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