chiark / gitweb /
debugging for thing that crashed
[innduct.git] / debian / rules
1 #!/usr/bin/make -f
2 SHELL+= -e
3
4 QUILT_STAMPFN := .stamp-patched
5 include /usr/share/quilt/quilt.make
6
7 D-std := $(CURDIR)/debian/inn2
8 D-lfs := $(CURDIR)/debian/inn2-lfs
9 D = $(D-$*)
10 B = $(CURDIR)/build-$*
11
12 ##############################################################################
13 # this code deals with building a second inn2-lfs package from the same
14 # source, but only on 32 bit architectures
15 # Ideally new future 32 bit architectures should not bother with inn2-lfs
16 # and just enable LFS by default.
17
18 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
19 ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64 ia64 ppc64 s390x))
20 # 64 bit std package
21 FLAVORS := std
22 else ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),armel))
23 # 32 bit LFS std package
24 FLAVORS := std
25 std_configure_flags = --enable-largefiles
26 else
27 # 32 bit std package and 32 bit LFS lfs package
28 FLAVORS := std lfs
29 lfs_configure_flags = --enable-largefiles
30 endif
31
32 std_dh_clean_opts = -pinn2 -pinn2-inews -p inn2-dev
33 lfs_dh_clean_opts = -pinn2-lfs
34 std_dh_movefiles_opts = -pinn2 -pinn2-inews -p inn2-dev
35 lfs_dh_movefiles_opts = -pinn2-lfs -pinn2-lfs-inews -p inn2-lfs-dev
36
37 ifeq ($(FLAVORS),std)
38 no_package := --no-package=inn2-lfs
39 endif
40
41 # the upstream source needs to be copied in the flavor-specific build dirs
42 src_files := $(shell find . -maxdepth 1 \
43         -not -name . -and -not -name debian -and -not -name .pc \
44         -and -not -name 'build-*' -and -not -name '.stamp-*')
45
46 ##############################################################################
47 DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
48 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
49 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
50   configure_flags += --build $(DEB_HOST_GNU_TYPE)
51 else
52   configure_flags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
53 endif
54
55 clean: unpatch
56         rm -rf .stamp-* build-*
57         [ ! -f Makefile.global ] || $(MAKE) distclean
58         # delete packages which are not in control but are built anyway
59         rm -rf debian/inn2-lfs-dev/ debian/inn2-lfs-inews/
60         # delete the cloned debhelper configuration and logs
61         find debian -maxdepth 1 -name 'inn2-lfs*' -not -type d -print0 \
62                 | xargs --no-run-if-empty -0 rm
63         dh_clean
64
65 configure: $(addprefix .stamp-configure-, $(FLAVORS))
66 .stamp-configure-%: $(QUILT_STAMPFN)
67         dh_testdir
68         mkdir -p $B
69         for dir in $(src_files); do cp -ldpR $$dir $B; done
70         cd $B && \
71         _PATH_PERL=/usr/bin/perl \
72         ac_cv_path__PATH_AWK=awk \
73         ac_cv_path__PATH_EGREP=egrep \
74         ac_cv_path__PATH_SED=sed \
75         ac_cv_path__PATH_SORT=sort \
76         ac_cv_path__PATH_UUX=uux \
77         ac_cv_path_PATH_GPGV=/usr/bin/gpgv \
78         ac_cv_path_GETFTP=wget \
79         ac_cv_search_dbm_open=-ldb \
80         LDFLAGS="-Wl,--as-needed $(LDFLAGS)" \
81         ./configure \
82                 --with-perl \
83                 --enable-ipv6 \
84                 --prefix=/usr/lib/news \
85                 --mandir=/usr/share/man \
86                 --includedir=/usr/include/inn \
87                 --with-db-dir=/var/lib/news \
88                 --with-etc-dir=/etc/news \
89                 --with-filter-dir=/etc/news/filter \
90                 --with-lib-dir=/usr/lib/news \
91                 --with-log-dir=/var/log/news \
92                 --with-run-dir=/var/run/news \
93                 --with-spool-dir=/var/spool/news \
94                 --with-tmp-dir=/var/spool/news/incoming/tmp \
95                 --with-berkeleydb=/usr \
96                 --with-kerberos=/usr \
97                 --with-sendmail=/usr/sbin/sendmail \
98                 $($*_configure_flags) $(configure_flags)
99         cd $B && \
100         mkdir ssl/ ssl/nnrpd/ && \
101         cd ssl/ && \
102         ln -s ../Makefile.global ../include ../storage ../history . && \
103         cd nnrpd/ && ln -s ../../nnrpd/* .
104         touch $@
105
106 build: $(addprefix .stamp-build-, $(FLAVORS))
107 .stamp-build-%: .stamp-configure-%
108         dh_testdir
109         cd $B && $(MAKE)
110         cd $B/ssl/nnrpd/ && $(MAKE) \
111                 SSLLIB='-L/usr/lib -lssl -lcrypto -ldl' SSLINC='-DHAVE_SSL=1'
112         touch $@
113
114 install1-%: .stamp-build-%
115         dh_testdir
116         dh_testroot
117         dh_clean -k $($*_dh_clean_opts)
118
119         cd $B && $(MAKE) install DESTDIR=$D
120         sh -e extra/dh_cloneconf inn2 inn2-lfs
121
122         dh_movefiles $($*_dh_movefiles_opts) --sourcedir=$(subst $(CURDIR)/,,$D)
123
124 #       move back this one
125         mv $D-dev/usr/share/man/man3/uwildmat.3 $D/usr/share/man/man3/
126
127 #       remove assorted crap and
128 #       make sure we don't ship active, active.times, newsgroups in place!
129         cd $D/etc/news/filter && rm -f *.py *.tcl
130         rm -rf $D/usr/lib/news/bin/simpleftp $D/usr/share/man/man1/simpleftp.1\
131                 $D/usr/lib/news/doc/ $D/var/lib/news/* \
132                 $D/usr/include/
133
134         mv $D/usr/share/man/man1/startinnfeed.1 \
135            $D/usr/share/man/man8/startinnfeed.8
136
137         cp $B/ssl/nnrpd/nnrpd $D/usr/lib/news/bin/nnrpd-ssl
138         install -m 755 extra/buildinnkeyring extra/ginpaths2 \
139                 $D/usr/lib/news/bin/
140         install -m 755 contrib/showtoken.in $D/usr/lib/news/bin/showtoken
141         install -m 755 extra/bunbatch $D-inews/usr/lib/news/bin/rnews.libexec/
142
143         install -m 644 extra/send-uucp.cf extra/sasl.conf $D/etc/news/
144
145         mkdir $D/var/log/news/path
146
147 install2: $(addprefix install1-, $(FLAVORS))
148         dh_link
149         dh_installchangelogs NEWS
150         dh_installdocs
151         dh_installexamples
152         dh_installinit --noscripts --init-script=inn2
153         dh_installcron
154         dh_installlogcheck
155         dh_compress
156         dh_fixperms \
157             -Xusr/lib/news/bin/inndstart -Xusr/lib/news/bin/startinnfeed
158         # some files are not writeable when installed by make install
159         dh_strip
160
161 install3-%: install2
162         chown root:news $D-inews/etc/news/passwd.nntp
163         chmod 640 $D-inews/etc/news/passwd.nntp
164
165         chmod -x $D/usr/lib/news/bin/control/*.pl
166         chmod +rw \
167                 $D/usr/lib/news/bin/inndstart \
168                 $D/usr/lib/news/bin/startinnfeed
169
170         chown news:uucp $D-inews/usr/lib/news/bin/rnews
171         chmod 4755 $D-inews/usr/lib/news/bin/rnews
172
173         chown -R news:news $D/var/spool/news/ $D/var/lib/news/ \
174                 $D/var/run/news/ $D/var/log/news/
175         chmod -R g+w $D/var/spool/news/ $D/var/lib/news/ \
176                 $D/var/run/news/ $D/var/log/news/
177
178 install4-std: install3-std
179
180 # lfs-specific: rename some files installed by debhelper
181 install4-lfs: install3-lfs
182         for file in /etc/logcheck/ignore.d.server/inn2 /etc/logcheck/violations.ignore.d/inn2 /etc/cron.d/inn2; do \
183                 mv $(D-lfs)$$file-lfs $(D-lfs)$$file; \
184         done
185
186 install5: $(addprefix install4-, $(FLAVORS))
187         dh_installdeb
188         dh_md5sums
189         dh_shlibdeps
190         dh_gencontrol $(no_package) -- \
191             -VPERLAPI=$$(perl -MConfig -e 'print "perlapi-$$Config{version}"')
192         dh_builddeb $(no_package)
193
194 binary-arch: install5
195
196 binary: binary-arch
197
198 .PHONY: clean configure build binary-arch binary install%