Files
haikuports/dev-libs/libxml2/libxml2-2.12.10.recipe
Oscar Lesta 0d9bf5dbff libxml2: fix name of the python bindings package.
(to explicitly tell which Python version it targets).

While at it, make use of dot in the python package name.

Related to #12949.
2025-10-05 16:27:02 -03:00

195 lines
5.2 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="2"
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
pythonVersion=3.10
pythonPackage=python${pythonVersion//.}
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
# Allows using dot in sub-package names (eg: "_python3.10" vs "_python310"):
eval "PACKAGE_NAME_$pythonPackage=\"${portName}_python$pythonVersion\""
eval "SUMMARY_$pythonPackage=\"The python module for libxml2\""
eval "PROVIDES_$pythonPackage=\"
${portName}_python$pythonVersion = $portVersion
\""
if [ -n "$secondaryArchSuffix" ]; then
eval "PROVIDES_${pythonPackage}+=\"
${portBaseName}_python$pythonVersion= $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
libxml2$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix
lib:libz$secondaryArchSuffix
cmd:python$pythonVersion
\""
eval "REPLACES_$pythonPackage=\"${portName}_python\""
fi
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libiconv$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
if $pythonModuleEnabled; then
BUILD_REQUIRES="$BUILD_REQUIRES
cmd:python$pythonVersion
"
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~python$pythonVersion"
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 $pythonPackage \
$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
}