Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 1 | #!/usr/bin/make -f |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | # $Id: rules,v 1.53 2024/04/08 15:31:32 tom Exp $ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 3 | |
| 4 | # Uncomment this to turn on verbose mode. |
| 5 | #export DH_VERBOSE=1 |
| 6 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 7 | SHELL = /bin/bash |
| 8 | DPKG_EXPORT_BUILDFLAGS = 1 |
| 9 | |
| 10 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 11 | |
| 12 | include /usr/share/dpkg/buildflags.mk |
| 13 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 14 | # packages |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 15 | PACKAGES.indep = ncurses6-doc ncurses6-doc-html |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 16 | PACKAGES.arch = ncurses6 ncursest6 |
| 17 | |
| 18 | # These are used for cross-compiling and for saving the configure script |
| 19 | # from having to guess our platform (since we know it already) |
| 20 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 21 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 22 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 23 | |
| 24 | CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion |
| 25 | CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic |
| 26 | |
| 27 | MY_ABI=6 |
| 28 | MY_DIR=/usr |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 29 | BINDIR=$(MY_DIR)/bin |
| 30 | LIBDIR=$(MY_DIR)/lib/$(DEB_HOST_MULTIARCH) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | MYDATA=/usr/local/ncurses/share/terminfo |
| 32 | NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI) |
| 33 | THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI) |
| 34 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 35 | CFLAGS += $(CC_NORMAL) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 36 | |
| 37 | ifneq ($(MY_DIR),/usr) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 38 | RPATH_ENV = RPATH_LIST=../lib:$(LIBDIR) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 39 | RPATH_OPT = --enable-rpath |
| 40 | else |
| 41 | RPATH_ENV = |
| 42 | RPATH_OPT = --disable-rpath --disable-rpath-hack |
| 43 | endif |
| 44 | |
| 45 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 46 | CFLAGS += -O0 |
| 47 | else |
| 48 | CFLAGS += -O2 |
| 49 | endif |
| 50 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 51 | INSTALL_PROGRAM += -s |
| 52 | endif |
| 53 | |
| 54 | verbose = # -v |
| 55 | |
| 56 | configure = \ |
| 57 | $(RPATH_ENV) \ |
| 58 | CFLAGS="$(CFLAGS)" \ |
| 59 | CPPFLAGS="$(CPPFLAGS)" \ |
| 60 | LDFLAGS="$(LDFLAGS)" ../../configure $(RPATH_OPT) \ |
| 61 | --host=$(DEB_HOST_GNU_TYPE) \ |
| 62 | --build=$(DEB_BUILD_GNU_TYPE) \ |
| 63 | --prefix=$(MY_DIR) \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 64 | --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 65 | --disable-echo \ |
| 66 | --disable-getcap \ |
| 67 | --disable-leaks \ |
| 68 | --disable-macros \ |
| 69 | --disable-overwrite \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 70 | --disable-relink \ |
| 71 | --disable-root-access \ |
| 72 | --disable-root-environ \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 73 | --disable-termcap \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | --enable-check-size \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 75 | --enable-hard-tabs \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 76 | --enable-opaque-curses \ |
| 77 | --enable-opaque-form \ |
| 78 | --enable-opaque-menu \ |
| 79 | --enable-opaque-panel \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 80 | --enable-pc-files \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 81 | --enable-stdnoreturn \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 82 | --enable-warnings \ |
| 83 | --enable-wgetch-events \ |
| 84 | --enable-widec \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 85 | --enable-xmc-glitch \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 86 | --program-suffix=$(MY_ABI) \ |
| 87 | --verbose \ |
| 88 | --with-abi-version=$(MY_ABI) \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 89 | --with-config-suffix=dev \ |
| 90 | --with-cxx-shared \ |
| 91 | --with-default-terminfo-dir=$(MYDATA) \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 92 | --with-develop \ |
| 93 | --with-extra-suffix=$(MY_ABI) \ |
| 94 | --with-shared \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 95 | --with-terminfo-dirs=$(MYDATA):/lib/terminfo:/usr/share/terminfo \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 96 | --with-termlib \ |
| 97 | --with-ticlib \ |
| 98 | --with-trace \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 99 | --with-versioned-syms \ |
| 100 | --with-xterm-kbs=DEL \ |
| 101 | --without-ada \ |
| 102 | --without-debug \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 103 | --with-manpage-aliases \ |
| 104 | --with-manpage-symlinks \ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 105 | --without-normal |
| 106 | |
| 107 | NCURSES6_DIR = $(CURDIR)/debian/ncurses6 |
| 108 | NCURSEST6_DIR = $(CURDIR)/debian/ncursest6 |
| 109 | |
| 110 | .PHONY: all config build install binary clean config-indep config-arch \ |
| 111 | build-indep build-arch install-indep install-arch binary-indep \ |
| 112 | binary-arch |
| 113 | |
| 114 | all: build |
| 115 | |
| 116 | config: config-indep config-arch |
| 117 | build: build-indep build-arch |
| 118 | install: install-indep install-arch |
| 119 | binary: binary-indep binary-arch |
| 120 | clean: |
| 121 | dh_testdir |
| 122 | dh_testroot |
| 123 | dh_clean $(verbose) |
| 124 | rm -rf t |
| 125 | |
| 126 | config-indep: $(PACKAGES.indep:%=config-%-stamp) |
| 127 | config-arch: $(PACKAGES.arch:%=config-%-stamp) |
| 128 | |
| 129 | build-indep: $(PACKAGES.indep:%=build-%-stamp) |
| 130 | build-arch: $(PACKAGES.arch:%=build-%-stamp) |
| 131 | |
| 132 | install-indep: $(PACKAGES.indep:%=install-%-stamp) |
| 133 | install-arch: $(PACKAGES.arch:%=install-%-stamp) |
| 134 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 135 | # make the doc-package installable by renaming everything to avoid clashing |
| 136 | patch-ncurses6-stamp: |
| 137 | dh_testdir |
| 138 | sed -i.bak \ |
| 139 | -e 's/-config\.1$$/dev-config.1/;t' \ |
| 140 | -e 's/\.3ncurses$$/.3ncurses6/' \ |
| 141 | -e 's/\.3curses$$/.3curses6/' \ |
| 142 | -e 's/\.3form$$/.3form6/' \ |
| 143 | -e 's/\.3menu$$/.3menu6/' \ |
| 144 | -e 's/\.3panel$$/.3panel6/' \ |
| 145 | -e 's/\.\([157]\)$$/6.\1/' \ |
| 146 | man/man_db.renames.in |
| 147 | diff -u man/man_db.renames.in.bak man/man_db.renames.in || true |
| 148 | touch $@ |
| 149 | |
| 150 | config-ncurses6-stamp: patch-ncurses6-stamp |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 151 | dh_testdir |
| 152 | rm -rf t/ncurses6 |
| 153 | mkdir -p t/ncurses6 |
| 154 | cd t/ncurses6; $(configure) |
| 155 | touch $@ |
| 156 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 157 | config-ncursest6-stamp: patch-ncurses6-stamp |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 158 | dh_testdir |
| 159 | rm -rf t/ncursest6 |
| 160 | mkdir -p t/ncursest6 |
| 161 | cd t/ncursest6; $(configure) \ |
| 162 | --enable-interop \ |
| 163 | --enable-sp-funcs \ |
| 164 | --program-suffix=t$(MY_ABI) \ |
| 165 | --with-pthread |
| 166 | touch $@ |
| 167 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 168 | config-ncurses6-doc-stamp \ |
| 169 | config-ncurses6-doc-html-stamp: config-ncurses6-stamp |
| 170 | touch $@ |
| 171 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 172 | build-ncurses6-stamp: config-ncurses6-stamp |
| 173 | dh_testdir |
| 174 | |
| 175 | $(MAKE) -C t/ncurses6 |
| 176 | |
| 177 | touch $@ |
| 178 | |
| 179 | build-ncursest6-stamp: config-ncursest6-stamp |
| 180 | dh_testdir |
| 181 | |
| 182 | $(MAKE) -C t/ncursest6 |
| 183 | |
| 184 | touch $@ |
| 185 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 186 | build-ncurses6-doc-stamp \ |
| 187 | build-ncurses6-doc-html-stamp: build-ncurses6-stamp |
| 188 | touch $@ |
| 189 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 190 | install-ncurses6-stamp: build-ncurses6-stamp |
| 191 | dh_testdir |
| 192 | dh_testroot |
| 193 | dh_installdirs $(verbose) |
| 194 | dh_prep $(verbose) -pncurses6 |
| 195 | |
| 196 | $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 197 | $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(LIBDIR) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 198 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 199 | mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(BINDIR)/ncurses$(MY_ABI) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 200 | |
| 201 | touch $@ |
| 202 | |
| 203 | install-ncursest6-stamp: build-ncursest6-stamp |
| 204 | dh_testdir |
| 205 | dh_testroot |
| 206 | dh_installdirs $(verbose) |
| 207 | dh_prep $(verbose) -pncursest6 |
| 208 | |
| 209 | $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 210 | $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(LIBDIR) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 211 | |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 212 | mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(BINDIR)/ncursest$(MY_ABI) |
| 213 | |
| 214 | touch $@ |
| 215 | |
| 216 | install-ncurses6-doc-stamp: build-ncurses6-stamp |
| 217 | dh_testdir |
| 218 | dh_testroot |
| 219 | dh_installdirs $(verbose) |
| 220 | dh_prep $(verbose) -pncurses6-doc |
| 221 | |
| 222 | $(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc |
| 223 | find $(NCURSES6_DIR)-doc -name 'ncursesw6-config.*' -print -delete |
| 224 | |
| 225 | cd $(NCURSES6_DIR)-doc/usr/share/man/man1 && ln -sf tset6.1.gz reset6.1.gz |
| 226 | |
| 227 | touch $@ |
| 228 | |
| 229 | HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/doc/ncurses6-doc-html |
| 230 | install-ncurses6-doc-html-stamp: build-ncurses6-stamp |
| 231 | dh_testdir |
| 232 | dh_testroot |
| 233 | dh_installdirs $(verbose) |
| 234 | dh_prep $(verbose) -pncurses6-doc-html |
| 235 | |
| 236 | cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{} |
| 237 | cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{} |
| 238 | find $(HTML_DESTDIR) -type d -empty -delete -print |
| 239 | find $(HTML_DESTDIR) -type d -empty -delete -print |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 240 | |
| 241 | touch $@ |
| 242 | |
| 243 | # Build architecture-independent files here. |
| 244 | binary-indep: install-indep |
| 245 | ifneq ($(PACKAGES.indep),) |
| 246 | rm -f $(PACKAGES.indep:%=install-%-stamp) |
| 247 | dh_testdir |
| 248 | dh_testroot |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 249 | dh_lintian $(verbose) $(PACKAGES.arch:%=-p%) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 250 | dh_installdocs $(verbose) $(PACKAGES.indep:%=-p%) |
| 251 | dh_installman $(verbose) $(PACKAGES.indep:%=-p%) |
| 252 | dh_installexamples $(verbose) $(PACKAGES.indep:%=-p%) |
| 253 | dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS |
| 254 | dh_compress $(verbose) $(PACKAGES.indep:%=-p%) |
| 255 | dh_fixperms $(verbose) $(PACKAGES.indep:%=-p%) |
| 256 | dh_installdeb $(verbose) $(PACKAGES.indep:%=-p%) |
| 257 | dh_gencontrol $(verbose) $(PACKAGES.indep:%=-p%) |
| 258 | dh_md5sums $(verbose) $(PACKAGES.indep:%=-p%) |
| 259 | dh_builddeb $(verbose) $(PACKAGES.indep:%=-p%) |
| 260 | endif |
| 261 | |
| 262 | # Build architecture-dependent files here. |
| 263 | binary-arch: install-arch |
| 264 | ifneq ($(PACKAGES.arch),) |
| 265 | rm -f $(PACKAGES.arch:%=install-%-stamp) |
| 266 | dh_testdir |
| 267 | dh_testroot |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 268 | |
| 269 | version=`set -x; awk 'BEGIN{major=minor=0} /^NCURSES_MAJOR/{major=$$3} /^NCURSES_MINOR/{minor=$$3} END{print major "." minor}' < dist.mk`; \ |
| 270 | sed -i \ |
| 271 | -e "s, usr/lib, usr/lib/$(DEB_HOST_MULTIARCH)," \ |
| 272 | -e "s,6\.1,$${version}," \ |
| 273 | debian/*.lintian-overrides |
| 274 | |
| 275 | dh_lintian $(verbose) $(PACKAGES.arch:%=-p%) |
| 276 | dh_installdocs $(verbose) $(PACKAGES.arch:%=-p%) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 277 | dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%) NEWS |
| 278 | dh_strip $(verbose) $(PACKAGES.arch:%=-p%) |
| 279 | dh_compress $(verbose) $(PACKAGES.arch:%=-p%) |
| 280 | dh_fixperms $(verbose) $(PACKAGES.arch:%=-p%) |
| 281 | dh_installdeb $(verbose) $(PACKAGES.arch:%=-p%) |
| 282 | dh_makeshlibs $(verbose) $(PACKAGES.arch:%=-p%) |
| 283 | dh_shlibdeps $(verbose) $(PACKAGES.arch:%=-p%) |
| 284 | dh_gencontrol $(verbose) $(PACKAGES.arch:%=-p%) |
| 285 | dh_md5sums $(verbose) $(PACKAGES.arch:%=-p%) |
| 286 | dh_builddeb $(verbose) $(PACKAGES.arch:%=-p%) |
| 287 | endif |