1#!/usr/bin/make -f
2# $Id: rules,v 1.11 2019/07/24 00:53:35 tom Exp $
3# Made with the aid of dh_make, by Craig Small
4# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
5# Some lines taken from debmake, by Cristoph Lameter.
6
7# Uncomment this to turn on verbose mode.
8#export DH_VERBOSE=1
9
10# These are used for cross-compiling and for saving the configure script
11# from having to guess our platform (since we know it already)
12DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14
15CPPFLAGS	:= $(shell dpkg-buildflags --get CPPFLAGS)
16CFLAGS		:= $(shell dpkg-buildflags --get CFLAGS)
17LDFLAGS		:= $(shell dpkg-buildflags --get LDFLAGS)
18
19TMP = $(CURDIR)/debian/tmp
20
21ACTUAL_PROG	= cdialog
22DEV_PACKAGE	= $(ACTUAL_PROG)-dev
23
24BINDIR		= /usr/bin
25LIBDIR		= /usr/lib
26LOCALE		= /usr/share/locale
27MANDIR		= /usr/share/man
28HEADER		= /usr/include
29
30ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
31        CFLAGS += -O0
32else
33        CFLAGS += -O2
34endif
35ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
36        INSTALL_PROGRAM += -s
37endif
38
39
40configure: configure-stamp
41configure-stamp:
42	dh_testdir
43
44	cp -v package/dialog.map package/${ACTUAL_PROG}.map
45
46	CPPFLAGS="$(CPPFLAGS)" \
47	CFLAGS="$(CFLAGS)" \
48	LDFLAGS="$(LDFLAGS)" \
49	./configure \
50		--host=$(DEB_HOST_GNU_TYPE) \
51		--build=$(DEB_BUILD_GNU_TYPE) \
52		--prefix=/usr \
53		--mandir=\$${prefix}/share/man \
54		--enable-nls \
55		--enable-header-subdir \
56		--enable-widec \
57		--with-shared \
58		--with-screen=ncursesw6 \
59		--with-package=${ACTUAL_PROG} \
60		--with-versioned-syms \
61		--disable-rpath-hack
62
63	touch configure-stamp
64
65build: build-stamp
66build-stamp: configure-stamp
67	dh_testdir
68
69	$(MAKE)
70
71	touch build-stamp
72
73clean:
74	dh_testdir
75	dh_testroot
76
77	[ ! -f makefile ] || $(MAKE) distclean
78
79	rm -f configure-stamp build-stamp install-stamp
80
81	dh_clean
82
83install: install-stamp
84install-stamp: build-stamp
85	dh_testdir
86	dh_testroot
87	dh_clean -k
88	dh_installdirs
89
90	$(MAKE) install-full DESTDIR=$(TMP)
91
92	dh_install -p${ACTUAL_PROG} $(BINDIR)/$(ACTUAL_PROG)
93	dh_install -p${ACTUAL_PROG} $(LIBDIR)
94	dh_install -p${ACTUAL_PROG} $(LOCALE)
95	dh_install -p${ACTUAL_PROG} $(MANDIR)/man1
96	dh_install -p${DEV_PACKAGE} $(BINDIR)/$(ACTUAL_PROG)-config
97	dh_install -p${DEV_PACKAGE} $(MANDIR)/man3
98	dh_install -p${DEV_PACKAGE} $(HEADER)
99
100	echo FIXME
101	for P in lib${ACTUAL_PROG}.so*; \
102	do \
103		[ -L "$$P" ] || continue; \
104		case "$$P" in \
105		*.so) \
106			echo "DEV: $$P"; \
107			dh_link -p${DEV_PACKAGE} $(LIBDIR)/`readlink $$P` $(LIBDIR)/$$P ; \
108			;; \
109		*) \
110			echo "BIN: $$P"; \
111			dh_link -p${ACTUAL_PROG} $(LIBDIR)/`readlink $$P` $(LIBDIR)/$$P ; \
112			;; \
113		esac; \
114	done
115
116	touch install-stamp
117
118# Build architecture-independent files here.
119binary-indep: build install
120# No binary-indep target.
121
122# Build architecture-dependent files here.
123binary-arch: build install
124	dh_testdir
125	dh_testroot
126	dh_installdocs
127	dh_installexamples
128	dh_installchangelogs CHANGES
129	dh_strip
130	dh_compress
131	dh_fixperms
132	dh_installdeb
133	dh_makeshlibs
134	dh_shlibdeps
135	dh_gencontrol
136	dh_md5sums
137	dh_builddeb
138
139binary: binary-indep binary-arch
140.PHONY: build clean binary-indep binary-arch binary install install-stamp
141