f9392e079b063e6b1c11d1a24a05142b26b7366c
[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 \
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) DESTDIR=$(CURDIR)/debian/tmp install
87         rm -r $(CURDIR)/debian/tmp/usr/share/doc/shibboleth
88         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.dist
89         rm $(CURDIR)/debian/tmp/etc/shibboleth/*.config
90         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-osx.plist
91         rm $(CURDIR)/debian/tmp/etc/shibboleth/shibd-redhat
92         rm $(CURDIR)/debian/tmp/etc/shibboleth/sp-*.pem
93         chmod +x $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh
94         mv $(CURDIR)/debian/tmp/etc/shibboleth/keygen.sh \
95             $(CURDIR)/debian/tmp/usr/sbin/shib-keygen
96         mv $(CURDIR)/debian/tmp/etc/shibboleth/shibd-debian \
97             $(CURDIR)/debian/libapache2-mod-shib2.shibd.init
98         dh_installdirs -s -i
99         mv $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.so \
100             $(CURDIR)/debian/libapache2-mod-shib2/usr/lib/apache2/modules
101         rm $(CURDIR)/debian/tmp/usr/lib/shibboleth/mod_shib_22.la
102         pod2man $(CURDIR)/debian/man-pages/mdquery.pod --section 1 \
103             --center 'Shibboleth' --release 2.0 \
104             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man1/mdquery.1
105         pod2man $(CURDIR)/debian/man-pages/resolvertest.pod --section 1 \
106             --center 'Shibboleth' --release 2.0 \
107             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man1/resolvertest.1
108         pod2man $(CURDIR)/debian/man-pages/shib-keygen.pod --section 8 \
109             --center 'Shibboleth' --release 2.0 \
110             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shib-keygen.8
111         pod2man $(CURDIR)/debian/man-pages/shibd.pod --section 8 \
112             --center 'Shibboleth' --release 2.0 \
113             $(CURDIR)/debian/libapache2-mod-shib2/usr/share/man/man8/shibd.8
114         dh_install -s -i --fail-missing
115         touch $@
116
117 binary: binary-arch binary-indep
118 binary-arch: DH_OPTIONS=-a
119 binary-arch: install-stamp
120         dh_testdir
121         dh_testroot
122         dh_installchangelogs
123         dh_installdocs -A doc/NOTICE.txt
124         dh_installinit --name=shibd
125         dh_installlogcheck
126         dh_strip
127         dh_compress
128         dh_fixperms
129         DH_OPTIONS="" dh_makeshlibs -plibshibsp2
130         dh_installdeb
131         dh_shlibdeps
132         dh_gencontrol
133         dh_md5sums
134         dh_builddeb
135
136 binary-indep: DH_OPTIONS=-i
137 binary-indep: install-stamp
138         dh_testdir
139         dh_testroot
140         dh_installchangelogs
141         dh_installdocs -A doc/NOTICE.txt
142         dh_compress
143         dh_fixperms
144         dh_installdeb
145         dh_gencontrol
146         dh_md5sums
147         dh_builddeb
148
149 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
150 .PHONY: install