source: pkg/viola/main/pygtk/trunk/debian/rules @ 3860

Revision 3708, 5.2 KB checked in by alanbach-guest, 5 years ago (diff)
  • Sync'd with Debian 2.12.1-2
  • Property svn:executable set to *
Line 
1#!/usr/bin/make -f
2
3include /usr/share/cdbs/1/rules/simple-patchsys.mk
4include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
5-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
6
7CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
8
9DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11
12configure_flags += --prefix=/usr --enable-thread --build=$(DEB_BUILD_GNU_TYPE)
13
14ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
15        configure_flags += --host=$(DEB_HOST_GNU_TYPE)
16endif
17
18PYVERS := $(shell pyversions --requested --version debian/control)
19PYDEFAULTVER := $(shell pyversions --default --version)
20
21build-%/configure-stamp: apply-patches
22        dh_testdir
23        mkdir -p build-$*
24        cd build-$* && \
25                PYTHON=/usr/bin/python$* CFLAGS="$(CFLAGS)" \
26                        $(CURDIR)/configure $(configure_flags)
27        touch $@
28
29build-%/build-stamp: build-%/configure-stamp
30        dh_testdir
31        $(MAKE) -C build-$*
32        touch $@
33
34build: $(PYVERS:%=build-%/build-stamp)
35
36install-clean:
37        dh_testdir
38        dh_testroot
39        dh_clean -k
40
41install-%: build-%/build-stamp
42        dh_testdir
43        dh_testroot
44        $(MAKE) -C build-$* install DESTDIR=$(CURDIR)/debian/tmp
45        # move installed files to a per python runtime location to allow
46        # comparison of the resulting files across runtimes or shipping
47        # multiple versions
48        # pkg-config file (this is shipped twice because of varying pyexecdir)
49        mkdir debian/tmp/usr/lib/pkgconfig/python$*
50        mv debian/tmp/usr/lib/pkgconfig/*.pc debian/tmp/usr/lib/pkgconfig/python$*
51        # codegen helper, should be the same code whatever the build-time
52        # python runtime
53        mkdir debian/tmp/usr/share/pygtk/2.0/codegen/python$*
54        mv debian/tmp/usr/share/pygtk/2.0/codegen/*.py debian/tmp/usr/share/pygtk/2.0/codegen/python$*
55        # defs files, should be the same whatever the build-time python runtime
56        mkdir debian/tmp/usr/share/pygtk/2.0/defs/python$*
57        mv debian/tmp/usr/share/pygtk/2.0/defs/*.defs debian/tmp/usr/share/pygtk/2.0/defs/python$*
58        # headers, should be the same whatever the build-time python runtime
59        mkdir debian/tmp/usr/include/python$*
60        mv debian/tmp/usr/include/pygtk-2.0 debian/tmp/usr/include/python$*
61
62install: build install-clean $(PYVERS:%=install-%)
63        # check that all builds with various Python runtimes produced the same
64        # *.defs files and codegen (or fail)
65        for v in $(PYVERS); do \
66            echo "Comparing defs files for the default Python version ($(PYDEFAULTVER)) with defs files for Python $$v"; \
67            diff --brief --recursive debian/tmp/usr/share/pygtk/2.0/defs/python$(PYDEFAULTVER) debian/tmp/usr/share/pygtk/2.0/defs/python$$v; \
68            echo "Comparing codegen for the default Python version ($(PYDEFAULTVER)) with codegen for Python $$v"; \
69            diff --brief --recursive debian/tmp/usr/share/pygtk/2.0/codegen/python$(PYDEFAULTVER) debian/tmp/usr/share/pygtk/2.0/codegen/python$$v; \
70            echo "Comparing headers for the default Python version ($(PYDEFAULTVER)) with headers for Python $$v"; \
71            diff --brief --recursive debian/tmp/usr/include/python$(PYDEFAULTVER) debian/tmp/usr/include/python$$v; \
72        done
73        # since all Python runtimes produced the same files, only keep one set
74        echo "Cleaning up"
75        mv debian/tmp/usr/share/pygtk/2.0/defs/python$(PYDEFAULTVER)/*.defs debian/tmp/usr/share/pygtk/2.0/defs
76        mv debian/tmp/usr/share/pygtk/2.0/codegen/python$(PYDEFAULTVER)/*.py debian/tmp/usr/share/pygtk/2.0/codegen
77        mv debian/tmp/usr/include/python$(PYDEFAULTVER)/* debian/tmp/usr/include
78        for v in $(PYVERS); do \
79            rm --force --recursive debian/tmp/usr/share/pygtk/2.0/defs/python$$v; \
80            rm --force --recursive debian/tmp/usr/share/pygtk/2.0/codegen/python$$v; \
81            rm --force --recursive debian/tmp/usr/share/include/python$$v; \
82        done
83        # finally, install files from DESTDIR in the per-package dirs
84        dh_install
85        # install rtupdate script to handle Python default runtime change
86        install -d debian/python-gtk2-dev/usr/share/python/runtime.d
87        install debian/python-gtk2-dev.rtupdate debian/python-gtk2-dev/usr/share/python/runtime.d
88
89clean:: reverse-patches
90        dh_testdir
91        dh_testroot
92        rm -Rf debian/tmp-*
93        rm -Rf build-*
94        -test -f config.sub && \
95          test -r /usr/share/misc/config.sub && \
96          cp -f /usr/share/misc/config.sub config.sub
97        -test -f config.guess && \
98          test -r /usr/share/misc/config.guess && \
99          cp -f /usr/share/misc/config.guess config.guess
100        dh_clean codegen/*.pyc
101
102# Build architecture-independent files here.
103binary-indep: build install
104        dh_testdir
105        dh_testroot
106        dh_installdocs -i
107        dh_installexamples -i
108        find debian/python-gtk2-doc/usr/share/doc -name '*.py[co]' -delete
109        dh_installchangelogs ChangeLog -i
110        dh_link -i
111        dh_compress -i -X.py -X.glade
112        dh_fixperms -i
113        # More permission fixing
114        chmod 755 `grep -rl "^#\!.*python" debian/python-gtk2-dev/usr`
115        dh_pysupport -i /usr/share/pygtk/2.0/codegen/
116        dh_installdeb -i
117        dh_gencontrol -i
118        dh_md5sums -i
119        dh_builddeb -i
120
121# Build architecture-dependent files here.
122binary-arch: build install
123        dh_testdir
124        dh_testroot
125        dh_installdocs -s
126        dh_installexamples -s
127        dh_installchangelogs ChangeLog -s
128        dh_strip -s
129        dh_link -s
130        dh_compress -s -X.py -X.glade
131        dh_fixperms -s
132        dh_pysupport -s
133        dh_installdeb -s
134        dh_shlibdeps -s
135        dh_gencontrol -s
136        dh_md5sums -s
137        dh_builddeb -s
138
139binary: binary-arch binary-indep
140.PHONY: build clean binary-indep binary-arch binary install
Note: See TracBrowser for help on using the repository browser.