ff1d051e7b20ed748e6ae1159abe50b9a98249ef
[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 DEBVERS := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 \
30                 | cut -d- -f1)
31 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
32 URL      = http://shibboleth.internet2.edu/downloads/shibboleth/cppsp
33
34 # Download the upstream source and do the repackaging that we have to do for
35 # DFSG reasons.  Depends on wget.
36 get-orig-source:
37         wget $(URL)/$(VERSION)/shibboleth-sp-$(VERSION).tar.gz
38         tar xfz shibboleth-sp-$(VERSION).tar.gz
39         rm shibboleth-sp-$(VERSION).tar.gz
40         rm shibboleth-$(VERSION)/schemas/WS-Trust.xsd
41         mv shibboleth-$(VERSION) shibboleth-sp2_$(DEBVERS).orig
42         tar cf shibboleth-sp2_$(DEBVERS).orig.tar \
43             shibboleth-sp2_$(DEBVERS).orig
44         rm -r shibboleth-sp2_$(DEBVERS).orig
45         gzip -9 shibboleth-sp2_$(DEBVERS).orig.tar
46
47 configure: configure-stamp
48 configure-stamp:
49         dh_testdir
50         cp /usr/share/misc/config.guess config.guess
51         cp /usr/share/misc/config.sub config.sub
52         rm -f libtool.m4
53         libtoolize --force
54         autoreconf --force
55         rm -rf autom4te.cache
56         CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure --prefix=/usr \
57             --sysconfdir=/etc --libexecdir=/usr/lib/shibboleth \
58             --localstatedir=/var --enable-apache-22 \
59             --with-apxs2=/usr/bin/apxs2 --disable-dependency-tracking \
60             $(SYSTEM)
61         touch $@
62
63 build: build-arch build-indep
64 build-arch: build-stamp
65 build-indep:
66 build-stamp: configure-stamp
67         dh_testdir
68         $(MAKE)
69         touch $@
70
71 clean:
72         dh_testdir
73         dh_testroot
74         rm -f configure-stamp build-stamp install-stamp
75         [ ! -f Makefile ] || $(MAKE) distclean
76         find . -name Makefile.in -print0 | xargs -0r rm
77         dh_clean aclocal.m4 config.h config.h.in config.status configure \
78             config.guess config.sub libtool.m4 ltmain.sh shibsp/paths.h \
79             debian/libapache2-mod-shib2.shibd.init
80
81 install: install-stamp
82 install-stamp:
83         dh_testdir
84         dh_testroot
85         dh_clean -k
86         $(MAKE) NOKEYGEN=1 DESTDIR=$(CURDIR)/debian/tmp install
87         rm -r $(CURDIR)/debian/tmp/usr/share/doc/shibboleth*
88         rm -r $(CURDIR)/debian/tmp/var/run
89         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.dist
90         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.config
91         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-osx.plist
92         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-redhat
93         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-suse
94         chmod +x $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh
95         mv $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh \
96             $(CURDIR)/debian/tmp/usr/sbin/shib-keygen
97         mv $(CURDIR)/debian/tmp/etc/shibboleth/metagen.sh \
98             $(CURDIR)/debian/tmp/usr/bin/shib-metagen
99         mv $(CURDIR)/debian/tmp/etc/shibboleth/shibd-debian \
100             $(CURDIR)/debian/libapache2-mod-shib2.shibd.init
101         dh_installdirs -s -i
102         mv $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.so \
103             $(CURDIR)/debian/libapache2-mod-shib2/usr/lib/apache2/modules
104         rm $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.la
105         pod2man $(CURDIR)/debian/man-pages/mdquery.pod --section 1 \
106             --center 'Shibboleth' --release $(VERSION) \
107             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man1/mdquery.1
108         pod2man $(CURDIR)/debian/man-pages/resolvertest.pod --section 1 \
109             --center 'Shibboleth' --release $(VERSION) \
110             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man1/resolvertest.1
111         pod2man $(CURDIR)/debian/man-pages/shib-metagen.pod --section 1 \
112             --center 'Shibboleth' --release $(VERSION) \
113             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man1/shib-metagen.1
114         pod2man $(CURDIR)/debian/man-pages/shib-keygen.pod --section 8 \
115             --center 'Shibboleth' --release $(VERSION) \
116             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shib-keygen.8
117         pod2man $(CURDIR)/debian/man-pages/shibd.pod --section 8 \
118             --center 'Shibboleth' --release $(VERSION) \
119             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shibd.8
120         dh_install -s -i --fail-missing
121         touch $@
122
123 binary: binary-arch binary-indep
124 binary-arch: DH_OPTIONS=-a
125 binary-arch: install-stamp
126         dh_testdir
127         dh_testroot
128         dh_installchangelogs
129         dh_installdocs -A doc/NOTICE.txt
130         dh_installinit --name=shibd
131         dh_installlogcheck
132         dh_strip
133         dh_compress
134         dh_fixperms
135         DH_OPTIONS="" dh_makeshlibs -plibshibsp4
136         dh_installdeb
137         dh_shlibdeps
138         dh_gencontrol
139         dh_md5sums
140         dh_builddeb
141
142 binary-indep: DH_OPTIONS=-i
143 binary-indep: install-stamp
144         dh_testdir
145         dh_testroot
146         dh_installchangelogs
147         dh_installdocs -A doc/NOTICE.txt
148         dh_compress
149         dh_fixperms
150         dh_installdeb
151         dh_gencontrol
152         dh_md5sums
153         dh_builddeb
154
155 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
156 .PHONY: install