e983d1e7386d45d2e004d3282148430a0996ffa4
[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         cp /usr/share/misc/config.guess config.guess
48         cp /usr/share/misc/config.sub config.sub
49         CFLAGS="$(CFLAGS)" ./configure --enable-apache-22 \
50             --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
51             --disable-dependency-tracking $(SYSTEM) $(DEBUG)
52         touch $@
53
54 build: build-arch build-indep
55 build-arch: build-stamp
56 build-indep:
57 build-stamp: configure-stamp
58         dh_testdir
59         $(MAKE)
60         touch $@
61
62 clean:
63         dh_testdir
64         dh_testroot
65         rm -f configure-stamp build-stamp install-stamp
66         [ ! -f Makefile ] || $(MAKE) distclean
67         dh_clean config.guess config.sub
68
69 install: install-stamp
70 install-stamp:
71         dh_testdir
72         dh_testroot
73         dh_clean -k
74         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
75         rm -r $(CURDIR)/debian/tmp/usr/share/doc/shibboleth
76         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.{dist,config}
77         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-redhat
78         chmod +x $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh
79         mv $(CURDIR)/debian/tmp/etc/shibboleth/shibd-debian $(CURDIR)/debian/libapache2-mod-shib2.shibd.init
80         dh_installdirs -s -i
81         mv $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.so $(CURDIR)/debian/libapache2-mod-shib2/usr/lib/apache2/modules
82         rm $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.la
83         pod2man  $(CURDIR)/debian/shibd.pod --section 8 --center 'Shibboleth' --release 2.0 \
84             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shibd.8
85         dh_install -s -i --fail-missing
86         touch $@
87
88 binary: binary-arch binary-indep
89 binary-arch: DH_OPTIONS=-a
90 binary-arch: install-stamp
91         dh_testdir
92         dh_testroot
93         dh_installchangelogs
94         dh_installdocs -A doc/NOTICE.txt doc/CREDITS.txt doc/README.txt doc/RELEASE.txt
95         dh_installinit --name=shibd
96         dh_strip
97         dh_compress
98         dh_fixperms
99         dh_makeshlibs
100         dh_installdeb
101         dh_shlibdeps
102         dh_gencontrol
103         dh_md5sums
104         dh_builddeb
105
106 binary-indep: DH_OPTIONS=-i
107 binary-indep: install-stamp
108         dh_testdir
109         dh_testroot
110         dh_installchangelogs
111         dh_installdocs -A doc/NOTICE.txt doc/CREDITS.txt doc/README.txt doc/RELEASE.txt
112         dh_compress
113         dh_fixperms
114         dh_installdeb
115         dh_gencontrol
116         dh_md5sums
117         dh_builddeb
118
119 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
120 .PHONY: install