upload tizen1.0 source
[external/libxml2.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # The versions of python currently supported
4 PYVERS=$(shell pyversions -s)
5 # The current default version of python
6 PYVER=$(shell pyversions -d)
7
8 CFLAGS = -Wall -g
9
10 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
11       CFLAGS += -O0
12 else
13       CFLAGS += -O2 -fno-strict-aliasing
14 endif
15
16 TARGETS := main #$(PYVERS) $(PYVERS:%=%-dbg)
17
18 WITH_UDEB := $(shell dpkg-vendor --derives-from Ubuntu && echo yes)
19
20 ifdef WITH_UDEB
21 $(if $(shell grep -q libxml2-udeb debian/control || echo yes),$(shell cat debian/control.udeb >> debian/control))
22 TARGETS += udeb
23 else
24 $(if $(shell grep -q libxml2-udeb debian/control && echo yes),$(shell sed -i /libxml2-udeb/,\$$d debian/control))
25 export DH_OPTIONS = -Nlibxml2-udeb
26 endif
27
28 CONFIGURE_FLAGS := --with-history CC="gcc -Wl,--as-needed" CFLAGS="$(CFLAGS)" --cache-file="$(CURDIR)/build/config.cache"
29
30 override_dh_auto_configure: $(TARGETS:%=configure-%)
31
32 configure-%:
33         dh_auto_configure --builddirectory=build/$* -- $(CONFIGURE_FLAGS)
34
35 configure-main: CONFIGURE_FLAGS += --without-python
36 #configure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
37 configure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
38
39 override_dh_auto_build: $(TARGETS:%=build-%)
40
41 build-%: BUILD_DIR=build/$*
42 build-%:
43         $(if $(filter $(BUILD_DIR),build/$*),,[ -d $(BUILD_DIR) ] || mv build/$*/python $(BUILD_DIR))
44         dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS)
45
46 #build-python%: BUILD_DIR=build/main/$*
47 #build-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)'
48 #build-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) LDFLAGS="-L$(CURDIR)/debian/tmp/usr/lib" CFLAGS="-Wall -g -O0"
49
50 override_dh_auto_clean:
51         rm -rf build debian/tmp-dbg
52
53         -test -r /usr/share/misc/config.sub && \
54         cp -f /usr/share/misc/config.sub config.sub
55         -test -r /usr/share/misc/config.guess && \
56         cp -f /usr/share/misc/config.guess config.guess
57
58 override_dh_auto_install: $(TARGETS:%=install-%)
59
60 install-main:
61         dh_auto_install --builddirectory=build/main
62         mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4
63
64         # Properly install documentation in /usr/share/doc/libxml2-doc
65         install -d debian/tmp/usr/share/doc/libxml2-doc/examples
66         install -m 644 \
67                 doc/*.html \
68                 doc/*.gif \
69                 doc/*.png \
70                 doc/libxml2-api.xml debian/tmp/usr/share/doc/libxml2-doc
71         install -m 644 \
72                 doc/examples/*.c \
73                 doc/examples/*.res \
74                 doc/examples/index.html \
75                 doc/examples/[tw]*.xml debian/tmp/usr/share/doc/libxml2-doc/examples
76         cp -a \
77                 doc/html \
78                 doc/tutorial debian/tmp/usr/share/doc/libxml2-doc
79
80 #install-python%-dbg:
81 #       $(MAKE) -C build/main/python$*-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES
82 #       prename 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$*/*-packages/*.so
83
84 #install-python%:
85 #       dh_auto_install --builddirectory=build/main/python$*
86
87 install-udeb:
88         dh_auto_install --builddirectory=build/udeb --destdir=debian/tmp-udeb
89
90 override_dh_installdocs:
91         dh_installdocs -A AUTHORS TODO README NEWS
92 #       dh_installdocs -ppython-libxml2 python/TODO
93
94 override_dh_compress:
95         dh_compress -Xexamples/ -Xtutorial/ -Xhtml/ -X.html
96
97 override_dh_installchangelogs:
98         dh_installchangelogs -plibxml2 ChangeLog
99         dh_installchangelogs -Nlibxml2 -XChangeLog
100
101 override_dh_install:
102         dh_install -Npython-libxml2-dbg -Nlibxml2-udeb
103 #       dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
104         dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
105         sed "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/libxml2.la > debian/libxml2-dev/usr/lib/libxml2.la
106
107 override_dh_strip:
108         dh_strip -a --dbg-package=libxml2-dbg #-Npython-libxml2 -Npython-libxml2-dbg
109 #       dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
110 #       $(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
111 #               cd $(CURDIR)/debian/python-libxml2/usr/lib/pyshared; \
112 #               if diff $(python)/libxml2mod.so $(PYVER)/libxml2mod.so > /dev/null 2>&1; then \
113 #                       rm -f $(python)/libxml2mod.so; \
114 #                       ln -s ../$(PYVER)/libxml2mod.so $(python)/libxml2mod.so; \
115 #               fi;)
116
117 override_dh_makeshlibs:
118         dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb )-V 'libxml2 (>= 2.7.4)' -- -c4
119
120 %:
121         dh $@