Debian Codegraph @

test/package/debian/rules

raw
1 #!/usr/bin/make -f
2 # $Id: rules,v 1.15 2025/06/14 21:15:59 tom Exp $
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 SHELL = /bin/bash
8 DPKG_EXPORT_BUILDFLAGS = 1
9 export DEB_BUILD_MAINT_OPTIONS := hardening=+all qa=+bug reproducible=+all
10
11 include /usr/share/dpkg/buildflags.mk
12
13 # packages
14 NCURSES_PKG = ncurses-examples
15 NCURSEST_PKG = ncursest-examples
16
17 PACKAGES.indep = # ncurses-examples-docs
18 PACKAGES.arch = $(NCURSES_PKG) $(NCURSEST_PKG)
19
20 # These are used for cross-compiling and for saving the configure script
21 # from having to guess our platform (since we know it already)
22 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
23 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
24
25 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
26 CFLAGS += -O0
27 else
28 CFLAGS += -O2
29 endif
30 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
31 INSTALL_PROGRAM += -s
32 endif
33
34 verbose = # -v
35
36 configure = \
37 ../../configure \
38 --host=$(DEB_HOST_GNU_TYPE) \
39 --build=$(DEB_BUILD_GNU_TYPE) \
40 --prefix=/usr \
41 --disable-rpath-hack
42
43 .PHONY: all config build install binary clean config-indep config-arch \
44 build-indep build-arch install-indep install-arch binary-indep \
45 binary-arch
46
47 all: build
48
49 config: config-indep config-arch
50 build: build-indep build-arch
51 install: install-indep install-arch
52 binary: binary-indep binary-arch
53 clean:
54 dh_testdir
55 dh_testroot
56 dh_clean $(verbose)
57 rm -rf t
58
59 config-indep: $(PACKAGES.indep:%=config-%-stamp)
60 config-arch: $(PACKAGES.arch:%=config-%-stamp)
61
62 build-indep: $(PACKAGES.indep:%=build-%-stamp)
63 build-arch: $(PACKAGES.arch:%=build-%-stamp)
64
65 install-indep: $(PACKAGES.indep:%=install-%-stamp)
66 install-arch: $(PACKAGES.arch:%=install-%-stamp)
67
68 config-$(NCURSES_PKG)-stamp:
69 dh_testdir
70
71 rm -rf t/ncurses6
72 mkdir -p t/ncurses6
73
74 cd t/ncurses6; $(configure) \
75 --datadir=\$${datarootdir}/$(NCURSES_PKG) \
76 --with-screen=ncursesw6td
77
78 touch $@
79
80 config-$(NCURSEST_PKG)-stamp:
81 dh_testdir
82
83 rm -rf t/ncursest6
84 mkdir -p t/ncursest6
85
86 cd t/ncursest6; $(configure) \
87 --datadir=\$${datarootdir}/$(NCURSEST_PKG) \
88 --with-screen=ncursestw6td
89
90 touch $@
91
92 build-$(NCURSES_PKG)-stamp: config-$(NCURSES_PKG)-stamp
93 dh_testdir
94
95 $(MAKE) -C t/ncurses6
96
97 touch $@
98
99 build-$(NCURSEST_PKG)-stamp: config-$(NCURSEST_PKG)-stamp
100 dh_testdir
101
102 $(MAKE) -C t/ncursest6
103
104 touch $@
105
106 install-$(NCURSES_PKG)-stamp: build-$(NCURSES_PKG)-stamp
107 dh_testdir
108 dh_testroot
109 dh_installdirs $(verbose)
110 dh_prep $(verbose) -p$(NCURSES_PKG)
111
112 $(MAKE) -C t/ncurses6 install \
113 PACKAGE=$(NCURSES_PKG) \
114 DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG)
115
116 touch $@
117
118 install-$(NCURSEST_PKG)-stamp: build-$(NCURSEST_PKG)-stamp
119 dh_testdir
120 dh_testroot
121 dh_installdirs $(verbose)
122 dh_prep $(verbose) -p$(NCURSEST_PKG)
123
124 $(MAKE) -C t/ncursest6 install \
125 PACKAGE=$(NCURSEST_PKG) \
126 DESTDIR=$(CURDIR)/debian/$(NCURSEST_PKG)
127
128 touch $@
129
130 # Build architecture-independent files here.
131 binary-indep: install-indep
132 ifneq ($(PACKAGES.indep),)
133 rm -f $(PACKAGES.indep:%=install-%-stamp)
134 dh_testdir
135 dh_testroot
136 dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%)
137 dh_installman $(verbose) $(PACKAGES.indep:%=-p%)
138 dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%)
139 dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
140 dh_compress $(verbose) $(PACKAGES.indep:%=-p%)
141 dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%)
142 dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%)
143 dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%)
144 dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%)
145 dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%)
146 endif
147
148 # Build architecture-dependent files here.
149 binary-arch: install-arch
150 ifneq ($(PACKAGES.arch),)
151 rm -f $(PACKAGES.arch:%=install-%-stamp)
152 dh_testdir
153 dh_testroot
154 dh_lintian $(verbose) $(PACKAGES.arch:%=-p%)
155 dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%)
156 dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) NEWS
157 dh_strip $(verbose) $(PACKAGES.arch:%=-p%)
158 dh_compress $(verbose) $(PACKAGES.arch:%=-p%)
159 dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%)
160 dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%)
161 dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%)
162 dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%)
163 dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%)
164 dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%)
165 dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%)
166 endif