summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 8a90a507b2750f6658064156e595992543a4e45a (plain)
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
#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independant
# package.

LDFLAGS	:= -Wl,-z,defs
CFLAGS	:= -g -D_GNU_SOURCE -D_REENTRANT -fPIC

ifeq (,$(findstring noopt, ${DEB_BUILD_OPTIONS}))
CFLAGS += -O2
endif

DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  conf_args = --build $(DEB_BUILD_GNU_TYPE)
else
  conf_args = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

LC_COLLATE=C
export LC_COLLATE

QUILT_PATCH_DIR = debian/patches-applied
include /usr/share/quilt/quilt.make

BUILD_TREE=$(CURDIR)

d = $(CURDIR)/debian
dl = $(d)/local

build: configure build-stamp
build-stamp:
	dh_testdir

	# Compile everything else
	$(MAKE) -C $(BUILD_TREE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

	pod2man --section 8 --release="Debian GNU/Linux" $(dl)/pam_getenv >$(dl)/pam_getenv.8

	touch build-stamp

configure: patch configure-stamp
configure-stamp:
	cd $(BUILD_TREE) && \
	./configure $(conf_args) \
	--sysconfdir=/etc --prefix=/usr --enable-static --enable-shared \
	--libdir=/lib/$(DEB_HOST_GNU_TYPE) --enable-isadir=/lib/security \
	--sbindir=/sbin --disable-audit
	touch configure-stamp


clean: clean-patched unpatch

clean-patched:
	dh_testdir
	dh_testroot
	[ ! -f $(BUILD_TREE)/Makefile ] || $(MAKE) -C $(BUILD_TREE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) -C $(BUILD_TREE) DESTDIR=$(CURDIR)/debian/tmp install

# Build architecture-independent files here.
binary-indep: install
	dh_testdir -i
	dh_testroot -i
	dh_install -i
	dh_installman -i
	dh_installdocs -i
	dh_installdebconf -i
	dh_installchangelogs -i
	dh_compress -i -X.html
	dh_lintian -i
	dh_link -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install
	dh_testdir -a
	dh_testroot -a

	dh_install -a -Nlibpam-cracklib -X pam_cracklib
	dh_install -plibpam-cracklib
	sed -e"s,^/lib,/lib/$(DEB_HOST_GNU_TYPE)," $(d)/libpam0g-dev.links.in > $(d)/libpam0g-dev.links
	dh_link -a
	dh_installman -a
	rm -f $(d)/libpam-modules/usr/share/man/man5/pam.conf.5

	dh_installdebconf -a
	dh_installdocs -a $(BUILD_TREE)/README
	dh_installexamples -a

	dh_installcron -a

	dh_installchangelogs -a
	dh_lintian -a

	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	chgrp shadow $(d)/libpam-modules/sbin/unix_chkpwd
	chmod 02755 $(d)/libpam-modules/sbin/unix_chkpwd
	dh_makeshlibs -a -V "libpam0g (>= 1.1.0)"
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary patch unpatch install configure