ncurses 6.2 - patch 20210522
[ncurses.git] / test / package / debian / rules
1 #!/usr/bin/make -f
2 # Made with the aid of dh_make, by Craig Small
3 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4 # Some lines taken from debmake, by Cristoph Lameter.
5
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
8
9 # packages
10 NCURSES_PKG = ncurses-examples
11 NCURSEST_PKG = ncursest-examples
12
13 PACKAGES.indep = # ncurses-examples-docs
14 PACKAGES.arch  = $(NCURSES_PKG) $(NCURSEST_PKG)
15
16 # These are used for cross-compiling and for saving the configure script
17 # from having to guess our platform (since we know it already)
18 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
19 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
20
21 CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
22 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
23 LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
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         CFLAGS="$(CFLAGS)" \
38         CPPFLAGS="$(CPPFLAGS)" \
39         LDFLAGS="$(LDFLAGS)" ../../configure \
40                 --host=$(DEB_HOST_GNU_TYPE) \
41                 --build=$(DEB_BUILD_GNU_TYPE) \
42                 --prefix=/usr \
43                 --disable-rpath-hack
44
45 .PHONY: all config build install binary clean config-indep config-arch \
46     build-indep build-arch install-indep install-arch binary-indep \
47     binary-arch
48
49 all: build
50
51 config: config-indep config-arch
52 build: build-indep build-arch
53 install: install-indep install-arch
54 binary: binary-indep binary-arch
55 clean:
56         dh_testdir
57         dh_testroot
58         dh_clean $(verbose)
59         rm -rf t
60
61 config-indep: $(PACKAGES.indep:%=config-%-stamp)
62 config-arch: $(PACKAGES.arch:%=config-%-stamp)
63
64 build-indep: $(PACKAGES.indep:%=build-%-stamp)
65 build-arch: $(PACKAGES.arch:%=build-%-stamp)
66
67 install-indep: $(PACKAGES.indep:%=install-%-stamp)
68 install-arch: $(PACKAGES.arch:%=install-%-stamp)
69
70 config-$(NCURSES_PKG)-stamp:
71         dh_testdir
72
73         rm -rf t/ncurses6
74         mkdir -p t/ncurses6
75
76         cd t/ncurses6; $(configure) \
77                 --bindir=\$${prefix}/bin/$(NCURSES_PKG) \
78                 --datadir=\$${prefix}/share/$(NCURSES_PKG) \
79                 --with-screen=ncursesw6
80
81         touch $@
82
83 config-$(NCURSEST_PKG)-stamp:
84         dh_testdir
85
86         rm -rf t/ncursest6
87         mkdir -p t/ncursest6
88
89         cd t/ncursest6; $(configure) \
90                 --bindir=\$${prefix}/bin/$(NCURSEST_PKG) \
91                 --datadir=\$${prefix}/share/$(NCURSEST_PKG) \
92                 --with-screen=ncursestw6
93
94         touch $@
95
96 build-$(NCURSES_PKG)-stamp: config-$(NCURSES_PKG)-stamp
97         dh_testdir
98
99         $(MAKE) -C t/ncurses6
100
101         touch $@
102
103 build-$(NCURSEST_PKG)-stamp: config-$(NCURSEST_PKG)-stamp
104         dh_testdir
105
106         $(MAKE) -C t/ncursest6
107
108         touch $@
109
110 install-$(NCURSES_PKG)-stamp: build-$(NCURSES_PKG)-stamp
111         dh_testdir
112         dh_testroot
113         dh_installdirs $(verbose)
114         dh_prep        $(verbose) -p$(NCURSES_PKG)
115
116         $(MAKE) -C t/ncurses6 install DESTDIR=$(CURDIR)/debian/$(NCURSES_PKG)
117
118         touch $@
119
120 install-$(NCURSEST_PKG)-stamp: build-$(NCURSEST_PKG)-stamp
121         dh_testdir
122         dh_testroot
123         dh_installdirs $(verbose)
124         dh_prep        $(verbose) -p$(NCURSEST_PKG)
125
126         $(MAKE) -C t/ncursest6 install 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_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
155         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
156         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
157         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
158         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
159         dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
160         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
161         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
162         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
163         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
164 endif