summaryrefslogtreecommitdiffstats
path: root/dilos/libraries/pytde/debian/rules
blob: e07eb640e33bd2789fa0710b8c3da9321930cf4b (plain)
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
178
179
180
181
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_CONFIGURE_INCLUDEDIR := /usr/include
DEB_CONFIGURE_MANDIR := /usr/share/man
DEB_CONFIGURE_PREFIX := /usr
DEB_CONFIGURE_INFODIR := /usr/share/info

cdbs_configure_flags := --with-qt-dir=/usr/share/qt3 --disable-rpath --with-xinerama $(cdbs_kde_enable_final) $(cdbs_kde_enable_debug)

# The default gzip compressor has been changed in dpkg >= 1.17.0.
deb_default_compress = $(shell LANG=C dpkg-deb --version | head -n1 | \
                         sed -e "s|.*version ||" -e "s| .*||" | \
                         xargs -r dpkg --compare-versions 1.17.0 lt \
                         && echo xz || echo gzip)
ifeq ($(deb_default_compress),gzip)
DEB_DH_BUILDDEB_ARGS += -- -Z$(shell dpkg-deb --help | grep -q ":.* xz[,.]" \
                               && echo xz || echo bzip2)
endif

export DEB_HOST_ARCH  		?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_HOST_ARCH_CPU	?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
export DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DH_OPTIONS
export TQTDIR=/usr/share/tqt3
export QMAKESPEC=$(TQTDIR)/mkspecs/dilos-g++

CXXFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CXXFLAGS += -O0
else
	CXXFLAGS += -O2
endif

PYTHONS := $(shell py3versions -vd)
#DBG_PYTHONS := $(shell py3versions -vd)

GCCVER := $(shell gcc --version | sed -n '/^gcc (GCC)/s/.*(GCC) \(...\).*/\1/p')
ifneq (,$(filter $(GCCVER),4.2 4.3))
        SPLIT=20
else
        SPLIT=4
endif

.PRECIOUS: build-%/configure-stamp
# dbg-build-%/configure-stamp

configure: $(PYTHONS:%=build-%/configure-stamp)
# $(DBG_PYTHONS:%=dbg-build-%/configure-stamp)

build-%/configure-stamp:
	dh_testdir
	mkdir -p build-$*
	cd build-$* && python$* ../configure.py \
		-c -u -k /usr -o /usr/include -n /usr/lib/$(DEB_HOST_MULTIARCH) \
		-v /usr/share/sip-tqt/trinity -j $(SPLIT)
	touch $@

dbg-build-%/configure-stamp:
	dh_testdir
	mkdir -p dbg-build-$*
	cd dbg-build-$* && python$*-dbg ../configure.py \
		-c -u -k /usr -o /usr/include -n /usr/lib \
		-v /usr/share/sip-tqt/trinity -j $(SPLIT)
	touch $@

build build-arch: $(PYTHONS:%=build-%/build-stamp)
# $(DBG_PYTHONS:%=dbg-build-%/build-stamp)
build-indep:

build-%/build-stamp: build-%/configure-stamp
	dh_testdir
	$(MAKE) -C build-$*
	touch $@

dbg-build-%/build-stamp: dbg-build-%/configure-stamp
	dh_testdir
	$(MAKE) -C dbg-build-$*
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	rm -rf $(PYTHONS:%=build-%) $(DBG_PYTHONS:%=dbg-build-%)

#	remove autogenerated *mod.sip files and clean up sources
	for moddir in sip/*;\
	do\
		if [ -d $$moddir ]; then\
			rm -f $$moddir/` basename $${moddir}`mod.sip;\
		fi;\
	done
	dh_clean

install: install-indep install-arch

install-indep:
	dh_testdir
	dh_testroot
	dh_clean -k -i 
	dh_installdirs -i
	dh_install -i -X'\.diff$$' -X'\.in$$' -X'\.html$$'
	for version in ${PYTHONS};\
	do\
		pylib=$$(python$$version -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())');\
		mkdir -p debian/pytde-dev/$$pylib;\
		install -m 644 -o root -g root debian/pytdeconfig.py debian/pytde-dev/$$pylib/pytdeconfig.py;\
		install -m 644 -o root -g root build-$$version/pytdeconfig.py debian/pytde-dev/$$pylib/pytdeconfig_nd.py;\
	done
#	for version in ${DBG_PYTHONS};\
#	do\
#		pylib=$$(python$$version -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())');\
#		install -m 644 -o root -g root dbg-build-$$version/pytdeconfig.py debian/pytde-dev/$$pylib/pytdeconfig_d.py;\
#	done

install-arch:
	dh_testdir
	dh_testroot
	dh_clean -k -a 
	dh_installdirs -a
	set -e; \
	for version in ${PYTHONS};\
	do\
		$(MAKE) -C build-$$version install DESTDIR=$(CURDIR)/debian/tmp;\
	done

#	set -e; \
#	for version in ${DBG_PYTHONS}; do \
#		$(MAKE) -C dbg-build-$$version install DESTDIR=$(CURDIR)/debian/python3-pytde-dbg;\
#	done

	dh_install -a --sourcedir=$(CURDIR)/debian/tmp

	mkdir -p $(CURDIR)/debian/python3-pytde/usr/lib/$(DEB_HOST_MULTIARCH)
	ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/trinity/libkonsolepart.so $(CURDIR)/debian/python3-pytde/usr/lib/$(DEB_HOST_MULTIARCH)
#	for i in $$(find debian/python3-*-dbg -name '*.so'); do \
#	  b=$$(basename $$i .so); \
#	  mv $$i $$(dirname $$i)/$${b}_d.so; \
#	done
#	find debian/python3-*-dbg ! -type d \
#		! \( -name '*.so' -o -name '*config_d.py' \) | xargs rm -f
#	find debian/python3-*-dbg -depth -type d -empty -exec rmdir {} \;


# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs -A THANKS
	dh_installexamples
	dh_link
ifeq (,$(findstring -i, $(DH_OPTIONS)))
	DH_OPTIONS= dh_strip -ppython3-pytde #--dbg-package=python3-pytde-dbg
endif
	dh_compress -X.py -X.ui -X.dtd
	dh_fixperms
	dh_python3 --no-dbg-cleaning --shebang=/usr/bin/python3
	dh_installdeb
	dh_shlibdeps -l /usr/lib/$(DEB_HOST_MULTIARCH)
	dh_gencontrol
	dh_md5sums
	dh_builddeb $(DEB_DH_BUILDDEB_ARGS)

# Build architecture independant packages using the common target.
binary-indep: install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common

binary: binary-arch binary-indep
.PHONY: build build-arch clean binary-indep binary-arch binary install install-indep install-arch configure