Files
MINGW-packages/mingw-w64-python-lxml/PKGBUILD
2015-02-09 18:45:05 -02:00

132 lines
4.7 KiB
Bash

# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
_realname=lxml
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}" "${MINGW_PACKAGE_PREFIX}-python-${_realname}-docs")
pkgver=3.4.2
pkgrel=1
arch=('any')
license=('BSD' 'custom')
url="http://lxml.de/"
depends=("${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-python3")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
"${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-libxslt"
"${MINGW_PACKAGE_PREFIX}-python2-cssselect"
"${MINGW_PACKAGE_PREFIX}-python3-cssselect")
source=(http://pypi.python.org/packages/source/l/lxml/${_realname}-${pkgver}.tar.gz{,.asc}
mingw-python-fix.patch
use-distutils-get_platform.patch)
md5sums=('429e5e771c4be0798923c04cb9739b4e'
'SKIP'
'e07163fc1e02cab5fa6009af35d5f823'
'5268f79eb2a69b05da73d357ec8184b1')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i ${srcdir}/mingw-python-fix.patch
patch -p1 -i ${srcdir}/use-distutils-get_platform.patch
cd "${srcdir}"
cp -r ${_realname}-${pkgver} build-python2
cp -r ${_realname}-${pkgver} build-python3
}
build() {
# It seems to me that CFLAGS and LDFLAGS aren't getting
# converted to Windows versions when calling Python for
# some reason?
# Tried $(cygpath -m) to get -IC:/msys64/mingw32/
# but that gets mangled to -IC;C:msys64msys64mingw32
# PREFIX_WIN=$(cygpath -m $MINGW_PREFIX)
# CPPFLAGS="$CPPFLAGS -I${PREFIX_WIN}/include/libxml2"
# LDFLAGS="$LDFLAGS -L${PREFIX_WIN}/lib"
# This horrible version works; needs the right amount of \\ to
# escape the escapes. This stuff makes some of xslt-config
# redundant (xslt-config *should* return C:/ paths but doesn't)
PREFIX_WIN=$(cygpath -w $MINGW_PREFIX)
PREFIX_WIN=${PREFIX_WIN//\\/\\\\}
CPPFLAGS="$CPPFLAGS -I${PREFIX_WIN}\\\\include\\\\libxml2"
LDFLAGS="$LDFLAGS -L${PREFIX_WIN}\\\\lib"
# Build python 2 module
cd "${srcdir}"/build-python2
${MINGW_PREFIX}/bin/python2 setup.py build --with-xslt-config=${MINGW_PREFIX}/bin/xslt-config
# Build python 3 module
cd "${srcdir}"/build-python3
${MINGW_PREFIX}/bin/python3 setup.py build --with-xslt-config=${MINGW_PREFIX}/bin/xslt-config
}
package_python2-lxml() {
pkgdesc="Python2 binding for the libxml2 and libxslt libraries"
depends=("${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-libxslt")
optdepends=("${MINGW_PACKAGE_PREFIX}-python2-beautifulsoup3: support for parsing not well formed HTML"
"${MINGW_PACKAGE_PREFIX}-python-lxml-docs: offline docs")
cd "${srcdir}/build-python2"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSES.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python2-${_realname}/LICENSE
install -Dm644 doc/licenses/BSD.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python2-${_realname}/BSD.txt
install -Dm644 doc/licenses/elementtree.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python2-${_realname}/elementtree.txt
}
package_python3-lxml() {
pkgdesc="Python3 binding for the libxml2 and libxslt libraries"
depends=("${MINGW_PACKAGE_PREFIX}-python3" "${MINGW_PACKAGE_PREFIX}-libxslt")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-lxml-docs: offline docs")
cd "${srcdir}/build-python3"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSES.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python3-${_realname}/LICENSE
install -Dm644 doc/licenses/BSD.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python3-${_realname}/BSD.txt
install -Dm644 doc/licenses/elementtree.txt \
"${pkgdir}${MINGW_PREFIX}"/share/licenses/python3-${_realname}/elementtree.txt
}
package_python-lxml-docs() {
pkgdesc="Python binding for the libxml2 and libxslt libraries (docs)"
options=('docs')
cd ${_realname}-$pkgver
install -d "${pkgdir}${MINGW_PREFIX}"/share/doc/${_realname}
cp -r doc/html "${pkgdir}${MINGW_PREFIX}"/share/doc/${_realname}
}
package_mingw-w64-i686-python2-lxml() {
package_python2-lxml
}
package_mingw-w64-i686-python3-lxml() {
package_python3-lxml
}
package_mingw-w64-x86_64-python2-lxml() {
package_python2-lxml
}
package_mingw-w64-x86_64-python3-lxml() {
package_python3-lxml
}
package_mingw-w64-i686-python-lxml-docs() {
package_python-lxml-docs
}
package_mingw-w64-x86_64-python-lxml-docs() {
package_python-lxml-docs
}