Files
haikuports/dev-libs/libxml2/libxml2-2.12.10.recipe
2025-05-27 15:06:43 +00:00

184 lines
4.8 KiB
Bash

SUMMARY="The XML C parser and toolkit of Gnome"
DESCRIPTION="Libxml2 is the XML C parser and toolkit developed for the Gnome \
project, but is usable outside of the Gnome platform as well.
XML itself is a metalanguage to design markup languages, i.e. text language \
where semantic and structure are added to the content using extra \"markup\" \
information enclosed between angle brackets. HTML is the most well-known \
markup language.
Though the library is written in C a variety of language bindings make it \
available in other environments."
HOMEPAGE="http://www.xmlsoft.org/"
COPYRIGHT="1998-2012 Daniel Veillard. All Rights Reserved."
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.gnome.org/sources/libxml2/2.12/libxml2-$portVersion.tar.xz"
CHECKSUM_SHA256="c3d8c0c34aa39098f66576fe51969db12a5100b956233dc56506f7a8679be995"
SOURCE_URI_2="https://www.w3.org/XML/Test/xmlts20130923.tar.gz"
CHECKSUM_SHA256_2="9b61db9f5dbffa545f4b8d78422167083a8568c59bd1129f94138f936cf6fc1f"
PATCHES="libxml2-$portVersion.patchset"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"
pythonModuleEnabled=false
if [ "$targetArchitecture" = x86_gcc2 ]; then
if [ -n "$secondaryArchSuffix" ]; then
pythonModuleEnabled=true
fi
else
if [ -z "$secondaryArchSuffix" ]; then
pythonModuleEnabled=true
fi
fi
PROVIDES="
libxml2$secondaryArchSuffix = $portVersion compat >= 2
lib:libxml2$secondaryArchSuffix = $portVersion compat >= 2
"
if [ -z "$secondaryArchSuffix" ]; then
PROVIDES="$PROVIDES
cmd:xmlcatalog = $portVersion compat >= 2
cmd:xmllint = $portVersion compat >= 2
"
fi
REQUIRES="
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
"
PROVIDES_devel="
libxml2${secondaryArchSuffix}_devel = $portVersion
cmd:xml2_config$secondaryArchSuffix = $portVersion compat >= 2
devel:libxml2$secondaryArchSuffix = $portVersion compat >= 2
"
REQUIRES_devel="
libxml2$secondaryArchSuffix == $portVersion base
devel:libiconv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
if $pythonModuleEnabled; then
SUMMARY_python="The python module for libxml2"
PROVIDES_python="
libxml2${secondaryArchSuffix}_python = $portVersion
"
if [ -n "$secondaryArchSuffix" ]; then
PROVIDES_python+="
libxml2_python = $portVersion
"
fi
REQUIRES_python="
libxml2$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
cmd:python3
"
fi
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libiconv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
if $pythonModuleEnabled; then
BUILD_REQUIRES="$BUILD_REQUIRES
cmd:python3
"
fi
BUILD_PREREQUIRES="
lib:libicudata$secondaryArchSuffix
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:sed
cmd:pkg_config$secondaryArchSuffix
"
PATCH()
{
# replace hard-coded references to the development documentation dir
sed -i "s,^devhelpdir = \(.*\),devhelpdir = ${developDocDir}," \
doc/devhelp/Makefile.am
}
BUILD()
{
withPython=
if $pythonModuleEnabled; then
# We symlink python's directories into our packaging directory and tell
# configure that it can find python there. This way the correct
# installation directory for the python module is determined.
pythonDir="$portPackageLinksDir/cmd~python3.10"
ln -s $pythonDir/bin $pythonDir/develop $pythonDir/lib $prefix
withPython="--with-python=$prefix"
else
withPython="--without-python"
fi
runConfigure ./configure LDFLAGS="-lnetwork" \
--disable-static \
--with-legacy \
$withPython
make $jobArgs
}
INSTALL()
{
if $pythonModuleEnabled; then
# Unfortunately we can't just remove the in symlinks we created in
# BUILD() and install normally, since then make detects that the
# Python.h is missing and tries to rebuild the module. So we leave
# things as is and use DESTDIR to install the everything in a subdir.
# Then we remove the symlinks and move everything where it belongs.
make DESTDIR=$prefix install
rm -f $prefix/bin $prefix/develop $prefix/lib
mv $prefix/$prefix/* $prefix
rm -r $prefix/packages
else
make install
fi
rm $libDir/libxml2.la
# prepare develop/lib
prepareInstalledDevelLibs libxml2
fixPkgconfig
fixDevelopLibDirReferences $binDir/xml2-config
# python package
if $pythonModuleEnabled; then
packageEntries python \
$prefix/lib/python*
fi
# devel package
packageEntries devel \
$binDir/xml2-config \
$dataDir \
$developDir \
$docDir \
$manDir/man1/xml2-config.1 \
$libDir/cmake
# Remove stuff we don't need in the secondary architecture base package.
if [ -n "$secondaryArchSuffix" ]; then
rm -rf $binDir
rm -rf $documentationDir
else
# left-over since all contents has been moved to other packages
rmdir $(dirname $docDir)
fi
}
TEST()
{
# link the conformance suite
ln -sf ../../sources-2/xmlconf
make check
}