File: rules

package info (click to toggle)
hamlib 3.3-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,952 kB
  • sloc: ansic: 136,360; sh: 12,250; cpp: 944; perl: 877; makefile: 607; python: 148; awk: 58
file content (135 lines) | stat: -rwxr-xr-x 3,789 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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/default.mk

PYTHON2 := $(shell pyversions --requested --version debian/control)
PYTHON3 := $(shell py3versions --requested --version debian/control)
PY3DEFAULT := $(shell py3versions --default --version)

FLAVOURS := $(PYTHON2) $(PYTHON3)

ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
LIBUSB = --without-libusb
endif

%:
	dh $@ --with python2,python3,lua --buildsystem=autoconf

override_dh_auto_configure-arch:
	set -ex; for x in $(FLAVOURS); do \
		dh_auto_configure \
			--builddirectory=build-$$x \
			-- \
			PYTHON_VERSION=$$x \
			--with-perl-binding \
			--with-python-binding \
			--with-tcl-binding \
			--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH) \
			--with-lua-binding \
			$(LIBUSB) \
			; \
	done
	$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple configure H=

override_dh_auto_build-arch:
	set -ex; for x in $(FLAVOURS); do \
		dh_auto_build \
			--arch \
			--builddirectory=build-$$x \
			; \
	done
	$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple build H=

# Build the docs
override_dh_auto_configure-indep:
	dh_auto_configure --builddirectory=build-indep

override_dh_auto_build-indep:
	dh_auto_build --indep --builddirectory=build-indep/doc -- doc
	find build-indep/doc -type f -name "*.md5" -delete

override_dh_auto_test-arch:
	set -ex; for x in $(FLAVOURS); do \
		LC_ALL=C.UTF-8 \
		PYTHON=/usr/bin/python$$x \
		VERBOSE=1 \
		dh_auto_test --arch --builddirectory=build-$$x; \
	done

# skip
override_dh_auto_test-indep:

override_dh_auto_install-arch:
	set -ex; for x in $(PYTHON2); do \
		PYTHON=/usr/bin/python$$x \
		dh_auto_install \
		--arch \
		--builddirectory=build-$$x \
		--destdir=debian/tmp \
		-- \
		pyexecdir='$${pythondir}' \
		pythondir=/usr/lib/python$$x/dist-packages \
		; \
		done
	set -ex; for x in $(PYTHON3); do \
		PYTHON=/usr/bin/python$$x \
		dh_auto_install \
		--arch \
		--builddirectory=build-$$x \
		--destdir=debian/tmp \
		-- \
		pyexecdir='$${pythondir}' \
		pythondir=/usr/lib/python$$x/site-packages \
		; \
		so=`/usr/bin/python$$x -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"`; \
		mkdir -p $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages; \
		mv debian/tmp/usr/lib/python$$x/site-packages/_Hamlib.so \
		debian/tmp/usr/lib/python3/dist-packages/_Hamlib$$so; \
		mv debian/tmp/usr/lib/python$$x/site-packages/Hamlib.py \
		debian/tmp/usr/lib/python3/dist-packages; \
		done
	# Remove python unused files.
	find debian/tmp -name '*.py[co]' -print0 | xargs -0 rm -f
	find debian/tmp -name '*.la' -print0 | xargs -0 rm -f
	rm -f debian/tmp/usr/lib/python2.7/dist-packages/_Hamlib.a
	# Install lua files
	$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple install H=

override_dh_auto_install-indep:
	mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/hamlib
	cp -r $(CURDIR)/build-indep/doc/html \
		$(CURDIR)/debian/tmp/usr/share/doc/hamlib/

override_dh_install:
	dh_install
	# Remove duplicated lua test file.
	rm -f $(CURDIR)/debian/lua-hamlib2/usr/share/doc/lua-hamlib2/luatest.lua

ifneq ($(DEB_HOST_ARCH_OS), linux)
override_dh_makeshlibs:
	# ignore disappearing symbols on non-Linux architectures
	dh_makeshlibs -- -c0
endif

override_dh_auto_clean:
	dh_auto_clean
	# Remove python build dirs
	set -ex; for x in $(FLAVOURS); do \
		if [ -d "build-$$x" ]; then \
			rm -R build-$$x; \
		fi; \
		done
	# Remove indep build
	if [ -d "build-indep" ]; then \
		rm -R build-indep; \
	fi;
	# Remove changed upstream files which create problems
	# with dpkg-source.
	rm -f $(CURDIR)/doc/hamlib.info \
		$(CURDIR)/doc/stamp-vti \
		$(CURDIR)/doc/version.texi
	# Remove LUA dirs
	rm -rf $(CURDIR)/5.[2,3]-hamlib2
	# find . -name '*.py[co]' -print0 | xargs -0 rm -f