summaryrefslogtreecommitdiff
path: root/rules
blob: 908c7b5d80b32e8e1fee588d6e6692955836e588 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/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.

DH_COMPAT = 3
export DH_COMPAT

OS_CFLAGS	:= -g -D_GNU_SOURCE -D_REENTRANT -fPIC

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

LC_COLLATE=C
export LC_COLLATE

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

BUILD_TREE=Linux-PAM

pdoc=libpam-doc
d = $(shell pwd)/debian
dl = $(d)/local
i = install -p -m 0644
ie = install -p -m 0755

#version=${shell expr `pwd` : '.*-\([0-9.]*\)'}
#version_major=${shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*'}

build:   build-stamp
build-stamp: configure-stamp
	dh_testdir

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

	touch build-stamp

configure: configure-stamp

configure-stamp:
	touch $(BUILD_TREE)/configure
	cd $(BUILD_TREE) && \
	./configure --sysconfdir=/etc --prefix=/usr --enable-static-libpam \
	--mandir=/usr/share/man --infodir=/usr/share/info --libdir=/lib \
	--sbindir=/sbin --enable-docdir=/usr/share/doc/libpam-doc \
	--with-mailspool=/var/mail
	touch configure-stamp


clean:
	dh_testdir
	dh_testroot
	touch $(BUILD_TREE)/configure
	-$(MAKE) -C $(BUILD_TREE) distclean
	rm -f build-stamp configure-stamp
	rm -f Linux-PAM/bin/[a-z]*
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

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

	# Provided in libpam-cracklib
	rm -f $(CURDIR)/debian/libpam-modules/lib/security/pam_cracklib.so

# Build architecture-independent files here.
binary-indep: install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i

	mkdir -p debian/tmp/etc/pam.d
	mkdir -p debian/tmp/usr/share/pam
	$(i) $(dl)/pam.conf $(d)/tmp/etc
	-mkdir -p $(d)/tmp/usr/sbin $(d)/tmp/usr/share/man/man8
	$(ie) $(dl)/pam_getenv $(d)/tmp/usr/sbin
	pod2man --section 8 --release="Debian GNU/Linux" $(dl)/pam_getenv >$(d)/tmp/usr/share/man/man8/pam_getenv.8
	$(i) $(dl)/other $(d)/tmp/etc/pam.d
	$(i) $(dl)/common-* $(d)/tmp/usr/share/pam/

	dh_movefiles -i

	dh_installman -plibpam-runtime $(BUILD_TREE)/doc/man/*.[578]
	dh_installdocs -i
	dh_installchangelogs -i $(BUILD_TREE)/CHANGELOG
	dh_compress -i -X.html
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build module_check $(dh_mak_deps)
	dh_testdir -a
	dh_testroot -a
	dh_clean -a -k
	dh_installdirs -a

	$(MAKE) install -C $(BUILD_TREE) FAKEROOT=$(d)/tmp \
		DIRS="libpam libpam_misc modules libpamc"
	mkdir -p debian/tmp/etc/pam.d
	$(i) $(dl)/pam.conf $(d)/tmp/etc
	$(i) $(dl)/other $(d)/tmp/etc/pam.d
	$(ie) -D  $(BUILD_TREE)/modules/pam_tally/pam_tally $(d)/tmp/usr/sbin/pam_tally
	$(i) $(dl)/unix_chkpwd.8 $(d)/libpam-modules/usr/share/man/man8
	mkdir -p debian/tmp/usr/lib
	mv debian/tmp/lib/*.a debian/tmp/usr/lib
	dh_movefiles  -plibpam0g-dev -plibpam-cracklib -plibpam0g
	dh_movefiles -plibpam-modules `cd $(d)/tmp && ls lib/security/*.so`
	dh_link -A
	dh_installman -plibpam0g-dev $(BUILD_TREE)/doc/man/*.3
	for manpage in pam_end pam_close_session pam_get_item; do \
	rm debian/libpam0g-dev/usr/share/man/man3/$$manpage.3; done


	dh_installdocs -a $(BUILD_TREE)/README
	$(i) $(dl)/Debian-PAM-MiniPolicy $(d)/libpam0g/usr/share/doc/libpam0g
	dh_installexamples -a
	dh_installcron -a

	dh_installchangelogs -a $(BUILD_TREE)/CHANGELOG
	dh_strip -a
	dh_compress -a
	dh_fixperms -Xunix_chkpwd -a
	dh_makeshlibs -plibpam0g -V "libpam0g (>= 0.76)"
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

module_check:
	for module in `ls build-tree/Linux-PAM-*/modules/pam_*/pam_*.so`; \
	do \
		test=`ldd $$module | grep libpam.so.0`; \
		if [ "x$$test" = "x" ]; then \
			echo $$module is not linked to libpam; \
			exit 1; \
		fi; \
	done

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary