File: rules

package info (click to toggle)
comedilib 0.11.0-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 8,388 kB
  • sloc: xml: 19,779; ansic: 14,719; sh: 4,583; cpp: 2,195; ruby: 1,658; perl: 700; makefile: 604; yacc: 439; lex: 86; python: 17
file content (235 lines) | stat: -rwxr-xr-x 7,144 bytes parent folder | download
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk

PYTHONS  := $(shell pyversions -vr)
PYTHONS3 := $(shell py3versions -vr)
#ruby_ver = 1.8
arch_name = $(subst linux-gnu,linux-,$(patsubst %linux-gnu,%linux,$(HOST)))
#ruby_libdir  = $(CURDIR)/debian/tmp/usr/lib/ruby/$(ruby_ver)
#ruby_archdir = $(CURDIR)/debian/tmp/usr/lib/ruby/$(ruby_ver)/$(arch_name)

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
	dh_testdir
	dh_autoreconf
	for pyvers in ${PYTHONS}; \
	do\
		mkdir -p pybuild/$$pyvers; \
		cp -Rl `ls . |grep -v pybuild|grep -v debian` pybuild/$$pyvers; \
		(cd pybuild/$$pyvers; \
		PYTHON="/usr/bin/python$$pyvers" ./configure \
			--host=$(DEB_HOST_GNU_TYPE) \
			--build=$(DEB_BUILD_GNU_TYPE) \
			--prefix=/usr \
			CFLAGS="$(CFLAGS)" \
			CPPFLAGS="$(CPPFLAGS)" \
			LDFLAGS="$(LDFLAGS)");\
	done
	for pyvers in ${PYTHONS3}; \
	do\
		mkdir -p pybuild/$$pyvers; \
		cp -Rl `ls . |grep -v pybuild|grep -v debian` pybuild/$$pyvers; \
		(cd pybuild/$$pyvers; \
		PYTHON="/usr/bin/python$$pyvers" ./configure \
			--host=$(DEB_HOST_GNU_TYPE) \
			--build=$(DEB_BUILD_GNU_TYPE) \
			--prefix=/usr \
			CFLAGS="$(CFLAGS)" \
			CPPFLAGS="$(CPPFLAGS)" \
			LDFLAGS="$(LDFLAGS)");\
	done
	./configure \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--datadir=\$${prefix}/share/doc/ \
		--sysconfdir=/etc \
		--disable-firmware \
		--localstatedir=/var \
		--disable-dependency-tracking \
		--disable-python-binding \
		--disable-ruby-binding \
		--with-pdf-backend=no\
		--with-gnu-ld \
		CFLAGS="$(CFLAGS) -fPIC" \
		CPPFLAGS="$(CPPFLAGS)" \
		LDFLAGS="$(LDFLAGS)"
	cd comedi-calibrate && CPPFLAGS="$(CPPFLAGS) -I $(CURDIR)/c++/include/ -I $(CURDIR)/include/" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/lib/.libs" \
		./configure --disable-comedilib-checking
	touch $@

build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
	dh_testdir
	$(MAKE)
	cd comedi-calibrate && $(MAKE)
	for pyvers in ${PYTHONS};\
	do\
		rm -rf pybuild/$$pyvers/lib;\
		(cd pybuild/$$pyvers;\
		ln -s ../../lib .);\
		(cd pybuild/$$pyvers/swig/python;\
		$(MAKE);\
		sed -i '1s/^/#!\/usr\/bin\/python\n/' comedi.py);\
	done
	for pyvers in ${PYTHONS3};\
	do\
		rm -rf pybuild/$$pyvers/lib;\
		(cd pybuild/$$pyvers;\
		ln -s ../../lib .);\
		(cd pybuild/$$pyvers/swig/python;\
		$(MAKE);\
		sed -i '1s/^/#!\/usr\/bin\/python3\n/' comedi.py);\
	done
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: configure-stamp
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f config.log
	rm -f *-stamp
	rm -rf pybuild
	rm -rf doc/doc_html/
	rm -rf doc/man/
	rm -f lib/calib_lex.c
	rm -f lib/calib_lex.h
	rm -f lib/calib_yacc.c
	rm -f lib/calib_yacc.h
	#rm -f doc/*.xml
	rm -f doc/calibration_funcref.xml
	rm -f doc/command_funcref.xml
	rm -f doc/deprecated_funcref.xml
	rm -f rm -f doc/dio_funcref.xml
	rm -f doc/drivers.xml
	rm -f doc/error_funcref.xml
	rm -f doc/extensions_funcref.xml
	rm -f doc/funcref.xml
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f comedi-calibrate/config.log
	rm -f doc/pdf/comedilib.pdf
	[ ! -f comedi-calibrate/Makefile ]] || cd comedi-calibrate && [ ! -f Makefile ] || $(MAKE) distclean
	find . -name Makefile -exec rm -f {} \;
	dh_autoreconf_clean
	#rm -f comedi-calibrate
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr \
		pkgdatadir=$(CURDIR)/debian/tmp/usr/share/doc/libcomedi0 \
		sysconfdir=$(CURDIR)/debian/tmp/etc \
		localstatedir=$(CURDIR)/debian/tmp/var
	cd comedi-calibrate && $(MAKE) install prefix=$(CURDIR)/debian/tmp/usr

	for pyvers in ${PYTHONS};\
	do\
		(cd pybuild/$$pyvers/swig/python;\
		$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install);\
	done
	mkdir -p $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/comedi
	for pyvers in ${PYTHONS3};\
	do\
		(cd pybuild/$$pyvers/swig/python;\
		$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install);\
		ABITAG=`python$$pyvers -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"`; \
		(cd $(CURDIR)/debian/tmp/usr/lib/; \
		 mv python$$pyvers/site-packages/comedi.py python3/dist-packages/comedi;\
		 if echo x$$ABITAG | grep -q "$(DEB_HOST_MULTIARCH)"; then \
		   mv python$$pyvers/site-packages/_comedi.so \
		      python3/dist-packages/comedi/_comedi.$$ABITAG.so;\
		 else \
		   mv python$$pyvers/site-packages/_comedi.so \
		      python3/dist-packages/comedi/_comedi.$$ABITAG-$(DEB_HOST_MULTIARCH).so;\
		 fi; \
		rm -rf python$$pyvers);\
	done
#		for f in `find debian/tmp/ -name '*.so' ! -name '*.cpython*.so'`; \
#		do mv $$f $${f%.so}.$$ABITAG.so;
#	$(foreach v,$(PYTHONS3),dh_auto_install --builddirectory=pybuild/$v \
#					   --destdir=debian/tmp/ $(nl) \
#					   ABITAG=`python$(v) -c "import sysconfig; \
#					   print(sysconfig.get_config_var('SOABI'))"`; \
#					   for f in `find debian/tmp/ -name '*.so' ! -name '*.cpython*.so'`; \
#					   do mv $$f $${f%.so}.$$ABITAG.so; done;)
	mkdir -p debian/tmp/lib/udev/rules.d
	cp debian/90-comedi.rules debian/tmp/lib/udev/rules.d/
	chmod 644 debian/tmp/usr/lib/python*/dist-packages/comedi.py
	mkdir -p debian/tmp/usr/share/doc/libcomedi-dev/demo
	cp -a demo debian/libcomedi-dev/usr/share/doc/libcomedi-dev
	rm -f debian/libcomedi-dev/usr/share/doc/libcomedi-dev/demo/Makefile*
	cp debian/Makefile.debian_demo debian/libcomedi-dev/usr/share/doc/libcomedi-dev/demo/Makefile
	cd debian/libcomedi-dev/usr/share/doc/libcomedi-dev/demo && make clean
	rm -rf debian/tmp/usr/local
	find debian/ -name _comedi.*a -exec rm -f {} \;

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	#
	# build libcomedi${major} package by moving files from comedilib-dev
	#
	dh_install --sourcedir=debian/tmp --list-missing

	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installcron
	dh_installinfo
	dh_installchangelogs ChangeLog
	dh_link
	dh_strip --no-automatic-dbgsym
	dh_compress --exclude=.c
	dh_python2 -X python3
	dh_python3
	for pyvers in ${PYTHONS3};\
	do\
		dh_python3 debian/python-comedilib/usr/lib/python$$pyvers;\
	done
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps -l $(CURDIR)/debian/tmp/usr/lib/
	dh_gencontrol
	dh_md5sums
	dh_builddeb

get-orig-source:
	set -e;\
	VERCAL=2;\
	VER=$(DEB_VERSION_UPSTREAM);\
	wget -q http://comedi.org/download/comedilib-$$VER.tar.gz -O comedilib_$$VER.orig.tar.gz;\
	wget -q http://comedi.org/download/comedi_calibrate-$$VERCAL.tar.gz\
	  -O comedilib_$$VER.orig-comedi-calibrate.tar.gz

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