Update build-depends and re-run libtool at build time
[shibboleth/sp.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 # This has to be exported to make some magic below work.
8 export DH_OPTIONS
9
10 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
11     DEBUG = --enable-debug
12 else
13     DEBUG =
14 endif
15
16 # These variable is used only by get-orig-source, which will normally only be
17 # run by maintainers.
18 VERSION = 2.0
19 DEBVERS = dfsg1
20 URL     = http://shibboleth.internet2.edu/downloads/shibboleth/cppsp
21
22 # Download the upstream source and do the repackaging that we have to do for
23 # DFSG reasons.  Depends on wget.
24 get-orig-source:
25         wget $(URL)/$(VERSION)/shibboleth-sp-$(VERSION).tar.gz
26         tar xfz shibboleth-sp-$(VERSION).tar.gz
27         rm shibboleth-sp-$(VERSION).tar.gz
28         rm shibboleth-$(VERSION)/schemas/WS-Trust.xsd
29         mv shibboleth-$(VERSION) shibboleth-sp_$(VERSION).$(DEBVERS).orig
30         tar cf shibboleth-sp2_$(VERSION).$(DEBVERS).orig.tar \
31             shibboleth-sp_$(VERSION).$(DEBVERS).orig
32         rm -r shibboleth-sp_$(VERSION).$(DEBVERS).orig
33         gzip -9 shibboleth-sp_$(VERSION).$(DEBVERS).orig.tar
34
35 # Tell Autoconf the correct system types.
36 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
37 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
38 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
39     SYSTEM = --build $(DEB_HOST_GNU_TYPE)
40 else
41     SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
42 endif
43
44 configure: configure-stamp
45 configure-stamp:
46         dh_testdir
47         rm -f libtool.m4
48         libtoolize --force
49         autoreconf --force
50         rm -rf autom4te.cache
51         cp /usr/share/misc/config.guess config.guess
52         cp /usr/share/misc/config.sub config.sub
53         CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure --prefix=/usr \
54             --sysconfdir=/etc --libexecdir=/usr/lib/shibboleth \
55             --localstatedir=/var --enable-apache-22 \
56             --with-apxs2=/usr/bin/apxs2 --disable-dependency-tracking
57         touch $@
58
59 build: build-arch build-indep
60 build-arch: build-stamp
61 build-indep:
62 build-stamp: configure-stamp
63         dh_testdir
64         $(MAKE)
65         touch $@
66
67 clean:
68         dh_testdir
69         dh_testroot
70         rm -f configure-stamp build-stamp install-stamp
71         [ ! -f Makefile ] || $(MAKE) distclean
72         dh_clean aclocal.m4 config.h config.h.in config.status configure \
73             config.guess config.sub libtool.m4 ltmain.sh
74
75 install: install-stamp
76 install-stamp:
77         dh_testdir
78         dh_testroot
79         dh_clean -k
80         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
81         rm -r $(CURDIR)/debian/tmp/usr/share/doc/shibboleth
82         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.{dist,config}
83         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-redhat
84         chmod +x $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh
85         mv $(CURDIR)/debian/tmp/etc/shibboleth/shibd-debian $(CURDIR)/debian/libapache2-mod-shib2.shibd.init
86         dh_installdirs -s -i
87         mv $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.so $(CURDIR)/debian/libapache2-mod-shib2/usr/lib/apache2/modules
88         rm $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.la
89         pod2man  $(CURDIR)/debian/shibd.pod --section 8 --center 'Shibboleth' --release 2.0 \
90             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shibd.8
91         dh_install -s -i --fail-missing
92         touch $@
93
94 binary: binary-arch binary-indep
95 binary-arch: DH_OPTIONS=-a
96 binary-arch: install-stamp
97         dh_testdir
98         dh_testroot
99         dh_installchangelogs
100         dh_installdocs -A doc/NOTICE.txt doc/CREDITS.txt doc/README.txt doc/RELEASE.txt
101         dh_installinit --name=shibd
102         dh_strip
103         dh_compress
104         dh_fixperms
105         dh_makeshlibs
106         dh_installdeb
107         dh_shlibdeps
108         dh_gencontrol
109         dh_md5sums
110         dh_builddeb
111
112 binary-indep: DH_OPTIONS=-i
113 binary-indep: install-stamp
114         dh_testdir
115         dh_testroot
116         dh_installchangelogs
117         dh_installdocs -A doc/NOTICE.txt doc/CREDITS.txt doc/README.txt doc/RELEASE.txt
118         dh_compress
119         dh_fixperms
120         dh_installdeb
121         dh_gencontrol
122         dh_md5sums
123         dh_builddeb
124
125 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
126 .PHONY: install