134 lines
4.0 KiB
Bash
134 lines
4.0 KiB
Bash
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
|
|
|
pkgbase=libxml2
|
|
pkgname=('libxml2' 'libxml2-devel' 'libxml2-python')
|
|
pkgver=2.13.8
|
|
pkgrel=1
|
|
pkgdesc="XML parsing library, version 2"
|
|
arch=(i686 x86_64)
|
|
license=('spdx:MIT')
|
|
makedepends=('gcc' 'python-devel' 'libreadline-devel'
|
|
'liblzma-devel' 'zlib-devel' 'autotools')
|
|
url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/"
|
|
msys2_repository_url="https://gitlab.gnome.org/GNOME/libxml2"
|
|
msys2_references=(
|
|
"cpe: cpe:/a:xmlsoft:libxml2"
|
|
)
|
|
source=("https://download.gnome.org/sources/libxml2/${pkgver%.*}/${pkgbase}-${pkgver}.tar.xz"
|
|
https://www.w3.org/XML/Test/xmlts20130923.tar.gz
|
|
libxml2-2.9.8-python3-unicode-errors.patch)
|
|
sha256sums=('277294cb33119ab71b2bc81f2f445e9bc9435b893ad15bb2cd2b0e859a0ee84a'
|
|
'9b61db9f5dbffa545f4b8d78422167083a8568c59bd1129f94138f936cf6fc1f'
|
|
'0f5d465503b24271e11752262af89c58eb0b26b4901c3b021bd843e6e5d4e95a')
|
|
|
|
# Helper macros to help make tasks easier #
|
|
apply_patch_with_msg() {
|
|
for _patch in "$@"
|
|
do
|
|
msg2 "Applying $_patch"
|
|
patch -Nbp1 -i "${srcdir}/$_patch"
|
|
done
|
|
}
|
|
|
|
del_file_exists() {
|
|
for _fname in "$@"
|
|
do
|
|
if [ -f $_fname ] || [ -d $_fname ]; then
|
|
rm -rf $_fname
|
|
fi
|
|
done
|
|
}
|
|
# =========================================== #
|
|
|
|
|
|
prepare() {
|
|
cd ${srcdir}
|
|
del_file_exists ${pkgbase}-${pkgver}/xmlconf
|
|
mv xmlconf -t ${pkgbase}-${pkgver}
|
|
|
|
cd ${pkgbase}-${pkgver}
|
|
|
|
# From https://src.fedoraproject.org/rpms/libxml2/tree/main
|
|
apply_patch_with_msg \
|
|
libxml2-2.9.8-python3-unicode-errors.patch
|
|
|
|
autoreconf -vfi
|
|
}
|
|
|
|
build() {
|
|
export lt_cv_deplibs_check_method='pass_all'
|
|
|
|
cd ${pkgbase}-${pkgver}
|
|
export MSYSTEM=CYGWIN
|
|
./configure \
|
|
--prefix=/usr \
|
|
--sysconfdir=/etc \
|
|
--localstatedir=/var \
|
|
--build=${CHOST} \
|
|
--host=${CHOST} \
|
|
--target=${CHOST} \
|
|
--enable-ipv6 \
|
|
--with-history \
|
|
--with-iconv \
|
|
--without-icu \
|
|
--enable-shared \
|
|
--enable-static \
|
|
--with-python=/usr/bin/python
|
|
make
|
|
make DESTDIR=${srcdir}/dest install
|
|
|
|
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
|
|
mv ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase/lib/msys-}mod.dll ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase}mod.dll
|
|
sed -i -e "s:${pkgbase/lib/msys-}mod:${PN}mod:g" ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase}mod.la
|
|
}
|
|
|
|
check() {
|
|
cd ${pkgbase}-${pkgver}
|
|
make check
|
|
}
|
|
|
|
package_libxml2() {
|
|
depends=('coreutils' 'liblzma' 'libreadline' 'zlib')
|
|
groups=('libraries')
|
|
install=libxml2.install
|
|
|
|
mkdir -p ${pkgdir}/usr
|
|
cp -rf ${srcdir}/dest/usr/bin ${pkgdir}/usr/
|
|
rm -f ${pkgdir}/usr/bin/*-config
|
|
mkdir -p ${pkgdir}/usr/share
|
|
cp -rf ${srcdir}/dest/usr/share/man ${pkgdir}/usr/share/
|
|
install -Dm644 ${srcdir}/${pkgbase}-${pkgver}/Copyright "${pkgdir}/usr/share/licenses/${pkgbase}/Copyright"
|
|
}
|
|
|
|
package_libxml2-devel() {
|
|
pkgdesc="Libxml2 headers and libraries"
|
|
groups=('development')
|
|
options=('staticlibs')
|
|
depends=("libxml2=${pkgver}" 'libreadline-devel' 'liblzma-devel' 'zlib-devel')
|
|
|
|
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
|
|
mkdir -p ${pkgdir}/usr/{bin,share}
|
|
cp -f ${srcdir}/dest/usr/bin/*-config ${pkgdir}/usr/bin/
|
|
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
|
|
cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
|
|
rm -rf ${pkgdir}${PYTHON_SITELIB}
|
|
cp -rf ${srcdir}/dest/usr/share/aclocal ${pkgdir}/usr/share/
|
|
cp -rf ${srcdir}/dest/usr/share/doc ${pkgdir}/usr/share/
|
|
cp -rf ${srcdir}/dest/usr/share/gtk-doc ${pkgdir}/usr/share/
|
|
}
|
|
|
|
package_libxml2-python(){
|
|
pkgdesc="Libxml2 python modules"
|
|
depends=('libxml2')
|
|
groups=('python-modules')
|
|
options=('staticlibs')
|
|
|
|
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
|
|
mkdir -p ${pkgdir}/${PYTHON_SITELIB}
|
|
mkdir -p ${pkgdir}/usr/share/doc
|
|
cp -rf ${srcdir}/dest${PYTHON_SITELIB}/* ${pkgdir}${PYTHON_SITELIB}/
|
|
|
|
python -m compileall \
|
|
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${pkgdir}${PYTHON_SITELIB}/"
|
|
}
|