1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# The versions of python currently supported
PYVERS=$(subst -dev,,$(subst python,,$(filter python%-dev,$(shell sed -n '/^Build-Depends/s/,//gp' debian/control))))
WORKAROUND_REMOVED_FILES=include/libxml/xmlversion.h libxml2.spec python/setup.py doc/xmlcatalog.1
WORKAROUND_MODIFIED_FILES=python/libxml2-py.c
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-stamp
build-stamp:
dh_testdir
# Workaround backups because of non-idempotent upstream:
for file in $(WORKAROUND_REMOVED_FILES) $(WORKAROUND_MODIFIED_FILES); do \
cp -f -a $${file} $${file}-tmp; \
done
# ./configure
CFLAGS="$(CFLAGS)" ./configure --prefix=/usr
echo "all:" > example/Makefile
echo "install:" >> example/Makefile
echo "distclean:" >> example/Makefile
echo " rm -rf .deps" >> example/Makefile
mv -f python/Makefile python/Makefile.bak
echo all: > python/Makefile
# Build libxml2
$(MAKE)
mv -f python/Makefile.bak python/Makefile
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp install*-stamp
rm -f debian/python*.examples debian/python*.install
-$(MAKE) distclean
-rm -f example/Makefile
rm COPYING && cp Copyright COPYING
# Restore workaround backups of removed and modified files
-for file in $(WORKAROUND_REMOVED_FILES) $(WORKAROUND_MODIFIED_FILES); do \
test -r $${file}-tmp && \
mv -f $${file}-tmp $${file}; \
done
-test -r /usr/share/misc/config.sub && \
cp -f /usr/share/misc/config.sub config.sub
-test -r /usr/share/misc/config.guess && \
cp -f /usr/share/misc/config.guess config.guess
dh_clean
install: install-stamp install-python-stamp
install-stamp: build-stamp
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
mv -f python/Makefile python/Makefile.bak
echo install: > python/Makefile
$(MAKE) DESTDIR=`pwd`/debian/tmp install
mv -f python/Makefile.bak python/Makefile
mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4
# Properly install documentation in /usr/share/doc/libxml2-doc
install -d debian/tmp/usr/share/doc/libxml2-doc/examples
install -m 644 \
doc/*.html \
doc/*.gif \
doc/*.png \
doc/libxml2-api.xml debian/tmp/usr/share/doc/libxml2-doc
install -m 644 \
doc/examples/*.c \
doc/examples/*.res \
doc/examples/index.html \
doc/examples/[tw]*.xml debian/tmp/usr/share/doc/libxml2-doc/examples
cp -a \
doc/html \
doc/tutorial debian/tmp/usr/share/doc/libxml2-doc
# Special workaround for svn-buildpackage:
# Restore workaround backups of modified files.
-for file in $(WORKAROUND_MODIFIED_FILES); do \
test -r $${file}-tmp && \
cat $${file}-tmp > $${file}; \
done
touch install-stamp
build-python%-stamp: build-stamp
cd python && $(MAKE) clean && $(MAKE) PYTHON=/usr/bin/python$* PYTHON_VERSION=$* PYTHON_INCLUDES=/usr/include/python$*
touch $@
install-python%-stamp: build-python%-stamp
rm build-python$*-stamp
cd python && $(MAKE) DESTDIR=`pwd`/../debian/tmp PYTHON=/usr/bin/python$* PYTHON_VERSION=$* PYTHON_INCLUDES=/usr/include/python$* install
sed s/PYVERS/$*/ debian/python-libxml2.install.in > debian/python$*-libxml2.install
cp debian/python-libxml2.examples.in debian/python$*-libxml2.examples
touch $@
install-python-stamp: $(PYVERS:%=install-python%-stamp)
touch $@
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installdocs -i -Nlibxml2-python2.3 -A AUTHORS TODO README
dh_installdocs -plibxml2-python2.3
dh_installchangelogs -i -Nlibxml2-python2.3 debian/no-upstream-changelog
dh_installchangelogs -plibxml2-python2.3
dh_install -i --sourcedir=debian/tmp
dh_python -i
dh_link -i
dh_strip -i
dh_compress -i -Xexamples/ -Xtutorial/ -Xhtml/ -X.html
dh_fixperms -i
dh_installdeb -i -Nlibxml2-python2.3
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installexamples -a
dh_installdocs -plibxml2 -Nlibxml2-dev -A AUTHORS TODO README
for python in $(PYVERS); do \
dh_installdocs -ppython$${python}-libxml2 python/TODO; \
for file in AUTHORS README README.Debian changelog.Debian.gz changelog.gz; do \
ln -sf ../libxml2/$${file} debian/python$${python}-libxml2/usr/share/doc/python$${python}-libxml2/$${file}; \
done; \
done
ln -sf libxml2 debian/libxml2-dev/usr/share/doc/libxml2-dev
ln -sf libxml2 debian/libxml2-utils/usr/share/doc/libxml2-utils
dh_installman -a
dh_installchangelogs -plibxml2 ChangeLog
dh_install -a --sourcedir=debian/tmp
dh_python -a
dh_link -a
dh_strip -a
dh_compress -a -Xexamples/
dh_fixperms -a
dh_makeshlibs -a -V 'libxml2 (>= 2.6.16)'
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
|