libxml2: build python module as well

This commit is contained in:
Ingo Weinhold
2013-08-10 01:31:59 +02:00
parent 099c1c8b34
commit f2c6d0edc0
3 changed files with 204 additions and 64 deletions

View File

@@ -4,11 +4,17 @@ LICENSE="MIT"
COPYRIGHT="1998-2003 Daniel Veillard. All Rights Reserved."
SRC_URI="ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz"
CHECKSUM_MD5="c62106f02ee00b6437f0fb9d370c1093"
REVISION="4"
REVISION="5"
ARCHITECTURES="x86_gcc2 x86"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
PATCHES="libxml2-2.8.0.patch"
PATCHES="libxml2-2.8.0.patchset"
# build the python module only for the primary architecture
pythonModuleEnabled=false
if [ -z "$secondaryArchSuffix" ]; then
pythonModuleEnabled=true
fi
PROVIDES="
libxml2$secondaryArchSuffix = $portVersion compat >= 2
@@ -28,6 +34,14 @@ REQUIRES="
BUILD_REQUIRES="
devel:libz$secondaryArchSuffix
"
if $pythonModuleEnabled; then
BUILD_REQUIRES="$BUILD_REQUIRES
python
"
# Note: We don't use "cmd:python" here to avoid issues with the
# python search path.
fi
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
cmd:aclocal
@@ -37,6 +51,7 @@ BUILD_PREREQUIRES="
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:make
cmd:sed
"
PATCH()
@@ -54,15 +69,39 @@ BUILD()
aclocal
autoconf
automake
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/python"
ln -s $pythonDir/bin $pythonDir/develop $pythonDir/lib $prefix
withPython="--with-python=$prefix"
fi
runConfigure ./configure LDFLAGS="-lnetwork" \
--with-html-dir=$docDir/html \
--with-html-subdir=""
--with-html-subdir="" \
$withPython
make $jobArgs
}
INSTALL()
{
make 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
# prepare develop/lib
prepareInstalledDevelLibs libxml2
@@ -70,6 +109,13 @@ INSTALL()
mv $libDir/xml2Conf.sh $developLibDir/
fixDevelopLibDirReferences $developLibDir/xml2Conf.sh $binDir/xml2-config
# python package
if $pythonModuleEnabled; then
packageEntries python \
$libDir/python* \
${docDir}_python*
fi
# devel package
packageEntries devel \
$binDir/xml2-config \
@@ -83,6 +129,9 @@ INSTALL()
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
}
@@ -91,6 +140,32 @@ TEST()
make tests
}
# ----- devel package ---------------------------------------------------------
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
"
# ----- python package -------------------------------------------------------
if $pythonModuleEnabled; then
SUMMARY_python="The python module for libxml2"
PROVIDES_python="
libxml2_python = $portVersion
"
REQUIRES_python="
libxml2 == $portVersion base
cmd:python
"
fi
# ----- DESCRIPTION -----------------------------------------------------------
DESCRIPTION="
Libxml2 is the XML C parser and toolkit developed for the Gnome project
(but usable outside of the Gnome platform), it is free software available
@@ -144,14 +219,3 @@ DESCRIPTION="
on but it would be far too early to make any conformance statement about
it at the moment.
"
# ----- devel package -------------------------------------------------------
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
"

View File

@@ -1,49 +0,0 @@
diff -ur libxml2-2.8.0.orig/configure.in libxml2-2.8.0/configure.in
--- libxml2-2.8.0.orig/configure.in 2012-05-23 10:33:55.027787264 +0200
+++ libxml2-2.8.0/configure.in 2013-04-26 13:50:43.429391872 +0200
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(entities.c)
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
diff -ur libxml2-2.8.0.orig/Makefile.am libxml2-2.8.0/Makefile.am
--- libxml2-2.8.0.orig/Makefile.am 2012-05-23 10:56:18.030932992 +0200
+++ libxml2-2.8.0/Makefile.am 2013-04-26 13:50:43.432537600 +0200
@@ -1208,8 +1208,8 @@
#
# Install the tests program sources as examples
#
-BASE_DIR=$(datadir)/doc
-DOC_MODULE=libxml2-$(VERSION)
+BASE_DIR=$(docdir)
+DOC_MODULE=
EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples
install-data-local:
diff -ur orig/libxml2-2.8.0/xml2-config.in libxml2-2.8.0/xml2-config.in
--- orig/libxml2-2.8.0/xml2-config.in 2009-07-30 17:24:35.050855936 +0200
+++ libxml2-2.8.0/xml2-config.in 2013-04-30 18:29:36.158072832 +0200
@@ -40,8 +40,8 @@
case "$1" in
--prefix=*)
prefix=$optarg
- includedir=$prefix/include
- libdir=$prefix/lib
+ includedir=$prefix/develop/headers
+ libdir=$prefix/develop/lib
;;
--prefix)
@@ -50,7 +50,7 @@
--exec-prefix=*)
exec_prefix=$optarg
- libdir=$exec_prefix/lib
+ libdir=$exec_prefix/develop/lib
;;
--exec-prefix)

View File

@@ -0,0 +1,125 @@
From 847ae3527f9a7c10bbb81a299c0779bdedaa078b Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Fri, 9 Aug 2013 03:04:24 +0200
Subject: applying patch libxml2-2.8.0.patch
diff --git a/Makefile.am b/Makefile.am
index f82cefa..c4464a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1208,8 +1208,8 @@ pkgconfig_DATA = libxml-2.0.pc
#
# Install the tests program sources as examples
#
-BASE_DIR=$(datadir)/doc
-DOC_MODULE=libxml2-$(VERSION)
+BASE_DIR=$(docdir)
+DOC_MODULE=
EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples
install-data-local:
diff --git a/configure.in b/configure.in
index 0fb4983..a5f86ca 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(entities.c)
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
diff --git a/xml2-config.in b/xml2-config.in
index 2989325..162d348 100644
--- a/xml2-config.in
+++ b/xml2-config.in
@@ -40,8 +40,8 @@ while test $# -gt 0; do
case "$1" in
--prefix=*)
prefix=$optarg
- includedir=$prefix/include
- libdir=$prefix/lib
+ includedir=$prefix/develop/headers
+ libdir=$prefix/develop/lib
;;
--prefix)
@@ -50,7 +50,7 @@ while test $# -gt 0; do
--exec-prefix=*)
exec_prefix=$optarg
- libdir=$exec_prefix/lib
+ libdir=$exec_prefix/develop/lib
;;
--exec-prefix)
--
1.7.10.2
From 6a3fd0a71df7e9f9207cc44dab2abd77822939fa Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Fri, 9 Aug 2013 20:15:20 +0200
Subject: configure.in: hack to find python directories on Haiku
configure should really just ask python-config instead of searching
the stuff itself.
diff --git a/configure.in b/configure.in
index a5f86ca..ade0cf8 100644
--- a/configure.in
+++ b/configure.in
@@ -766,11 +766,11 @@ if test "$with_python" != "no" ; then
fi
if test "$PYTHON_VERSION" != ""
then
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+ if test -r $with_python/develop/headers/python$PYTHON_VERSION/Python.h -a \
-d $with_python/lib/python$PYTHON_VERSION/site-packages
then
- PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
+ PYTHON_INCLUDES=$with_python/develop/headers/python$PYTHON_VERSION
+ PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
else
if test -r $prefix/include/python$PYTHON_VERSION/Python.h
then
--
1.7.10.2
From 76ec01677cdf7b754497320bca5587c423d0bf65 Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Fri, 9 Aug 2013 23:00:24 +0200
Subject: python[/tests]/Makefile.am: $(datadir)/doc -> $(docdir)
diff --git a/python/Makefile.am b/python/Makefile.am
index 68d2236..3bad10f 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -9,7 +9,7 @@ INCLUDES = \
-I$(top_builddir)/include \
-I$(top_builddir)/$(subdir)
-docsdir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
+docsdir = $(docdir)_python-$(LIBXML_VERSION)
# libxml2class.txt is generated
dist_docs_DATA = TODO
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 52c89fc..7549db9 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -1,4 +1,4 @@
-exampledir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples
+exampledir = $(docdir)_python-$(LIBXML_VERSION)/examples
dist_example_DATA = $(PYTESTS) $(XMLS)
PYTESTS= \
--
1.7.10.2