Updated stuff needed to build a debian package.
[freeradius.git] / debian / rules
1 #! /usr/bin/make -f
2 #
3 #       debian/rules file for freeradius
4 #
5
6 SHELL=/bin/bash
7
8 # Name.
9 package = freeradius
10 tmp     = $(shell pwd)/debian/tmp
11
12 define checkdir
13         test -f src/main/radiusd.c
14 endef
15
16 build:
17 # Builds the binary package.
18         $(checkdir)
19         ./configure --prefix=/ --exec_prefix='/usr' --infodir='$${exec_prefix}/share/info' --mandir='$${exec_prefix}/share/man' --with-datadir='$${exec_prefix}/share' --includedir='$$exec_prefix/include' --with-thread-pool --with-logdir='/var/log/radius'
20         make
21         touch build
22
23 # Architecture independant files.
24 binary-indep:   build
25         $(checkdir)
26
27 # Make a binary package (.deb file)
28 binary-arch:    build checkroot
29         -rm -rf $(tmp)
30         dh_installdirs
31         make install prefix=/ exec_prefix=/usr R=$(tmp)
32         for documented in man1/radlast.1 man5/acct_users.5 man8/builddbm.8; do \
33                 chmod 644 $(tmp)/usr/share/man/$${documented}; \
34                 gzip -9 $(tmp)/usr/share/man/$${documented}; \
35         done
36         dh_undocumented check-radiusd-config.1 checkrad.1 radiusd.1 radtest.1 radwatch.1 radwho.1 radzap.1
37         chmod 644 $(tmp)/usr/lib/*
38         #strip --strip-unneeded $(tmp)/usr/lib/*.{a,so.*}
39         dh_strip
40         #
41         install -g root -m 644 COPYRIGHT $(tmp)/usr/share/doc/freeradius/copyright
42         install -g root -m 644 CREDITS $(tmp)/usr/share/doc/freeradius/credits
43         rm $(tmp)/usr/sbin/rc.radiusd; install -g root -m 755 scripts/rc.radiusd $(tmp)/etc/init.d/radiusd
44         install -g root -m 755 scripts/radiusd.cron.daily $(tmp)/etc/cron.daily/radiusd
45         install -g root -m 755 scripts/radiusd.cron.monthly $(tmp)/etc/cron.monthly/radiusd
46         dh_installdeb
47         dh_installchangelogs
48         dh_makeshlibs
49         dh_shlibdeps
50         dh_compress
51         dh_fixperms
52         dh_gencontrol
53         dpkg --build $(tmp) ..
54         rm -rf $(tmp)
55
56 clean:  checkroot
57         [ -f Make.inc ] && make distclean || true
58         rm -f build debian/{files,substvars}
59         rm -rf $(tmp)
60
61 binary: binary-indep binary-arch
62
63 checkroot:
64         $(checkdir)
65         test root = "`whoami`"
66
67 .PHONY: binary binary-arch binary-indep clean checkroot