1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
#!/usr/bin/make -f
SHELL+= -e
D-std := $(CURDIR)/debian/inn2
D-lfs := $(CURDIR)/debian/inn2-lfs
D = $(D-$*)
B = $(CURDIR)/build-$*
##############################################################################
# this code deals with building a second inn2-lfs package from the same
# source, but only on 32 bit architectures
# Ideally new future 32 bit architectures should not bother with inn2-lfs
# and just enable LFS by default.
include /usr/share/dpkg/architecture.mk
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),alpha arm hppa i386 mips mipsel powerpc s390 sparc))
# 32 bit LFS std package
# (these architectures used to have a non-LFS 32 bit std package)
FLAVORS := std
BUILD_DUMMY_INN2_LFS := 1
std_configure_flags = --enable-largefiles
lfs_configure_flags = --enable-largefiles
else ifeq ($(DEB_HOST_ARCH_BITS),64)
# 64 bit std package
FLAVORS := std
else
# 32 bit LFS std package
FLAVORS := std
std_configure_flags = --enable-largefiles
endif
std_dh_clean_opts = -pinn2 -pinn2-inews -p inn2-dev
lfs_dh_clean_opts = -pinn2-lfs
std_dh_movefiles_opts = -pinn2 -pinn2-inews -p inn2-dev
lfs_dh_movefiles_opts = -pinn2-lfs -pinn2-lfs-inews -p inn2-lfs-dev
ifeq ($(FLAVORS),std)
no_package := --no-package=inn2-lfs
endif
# the upstream source needs to be copied in the flavor-specific build dirs
src_files := $(shell find . -maxdepth 1 \
-not -name . -and -not -name debian -and -not -name .pc \
-and -not -name .git \
-and -not -name 'build-*' -and -not -name '.stamp-*')
##############################################################################
DPKG_EXPORT_BUILDFLAGS = 1
DEB_BUILD_MAINT_OPTIONS=hardening=+pie,+bindnow
-include /usr/share/dpkg/buildflags.mk
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
configure_flags += --build $(DEB_HOST_GNU_TYPE)
else
configure_flags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
clean:
rm -rf .stamp-* build-*
[ ! -f Makefile.global ] || $(MAKE) distclean
# delete packages which are not in control but are built anyway
rm -rf debian/inn2-lfs-dev/ debian/inn2-lfs-inews/
# delete generated files which have been changed by a patch to
# their source to prevent them from appearing in the diff
cd doc/man/ && rm -f control.ctl.5 inn.conf.5 nnrpd.8 send-uucp.8 sendinpaths.8
# delete the cloned debhelper configuration and logs
find debian -maxdepth 1 -name 'inn2-lfs*' -not -type d -print0 \
| xargs --no-run-if-empty -0 rm
dh_clean
configure: $(addprefix .stamp-configure-, $(FLAVORS))
.stamp-configure-%:
dh_testdir
mkdir -p $B
for dir in $(src_files); do cp -ldpR $$dir $B; done
cd $B && \
_PATH_PERL=/usr/bin/perl \
ac_cv_path__PATH_AWK=awk \
ac_cv_path__PATH_EGREP=egrep \
ac_cv_path__PATH_SED=sed \
ac_cv_path__PATH_SORT=sort \
ac_cv_path__PATH_UUX=uux \
ac_cv_path_GPGV=/usr/bin/gpgv \
PATH_GETFTP=wget \
LDFLAGS="-Wl,--as-needed $(LDFLAGS)" \
./configure \
--with-perl \
--with-openssl \
--enable-ipv6 \
--prefix=/usr/lib/news \
--libdir=/usr/lib/news \
--mandir=/usr/share/man \
--sysconfdir=/etc/news \
--includedir=/usr/include \
--with-db-dir=/var/lib/news \
--with-filter-dir=/etc/news/filter \
--with-log-dir=/var/log/news \
--with-run-dir=/run/news \
--with-spool-dir=/var/spool/news \
--with-tmp-dir=/var/spool/news/incoming/tmp \
--with-http-dir=/var/www/inn \
--with-libperl-dir=/usr/share/perl5 \
--with-berkeleydb=/usr \
--with-kerberos=/usr \
--with-sasl=/usr \
--with-sendmail=/usr/sbin/sendmail \
--with-zlib=/usr \
$($*_configure_flags) $(configure_flags)
touch $@
build: build-arch build-indep
build-arch: $(addprefix .stamp-build-, $(FLAVORS))
build-indep: $(addprefix .stamp-build-, $(FLAVORS))
.stamp-build-%: .stamp-configure-%
dh_testdir
cd $B && $(MAKE)
touch $@
install1-%: .stamp-build-%
dh_testdir
dh_testroot
dh_prep $($*_dh_clean_opts)
cd $B && $(MAKE) install DESTDIR=$D
sh -e debian/dh_cloneconf inn2 inn2-lfs
dh_movefiles $($*_dh_movefiles_opts) --sourcedir=$(subst $(CURDIR)/,,$D)
# move back to the main package these man pages
mv $D-dev/usr/share/man/man3/uwildmat.3 \
$D-dev/usr/share/man/man3/INN::Config.3pm \
$D/usr/share/man/man3/
# remove assorted crap and
# make sure we don't ship active, active.times, newsgroups in place!
cd $D/etc/news/filter && rm -f *.py *.tcl
rm -rf $D/usr/lib/news/bin/simpleftp $D/usr/share/man/man1/simpleftp.1\
$D/usr/lib/news/doc/ $D/usr/include/ $D/etc/news/motd.* \
$D/usr/lib/news/share/ \
$D/var/lib/news/* $D/run/news/ $D/var/www/
# compatibility symlink for nnrpd-ssl which was removed in 2.5.2-1
ln -s nnrpd $D/usr/lib/news/bin/nnrpd-ssl
install -m 755 extra/buildinnkeyring extra/ginpaths2 \
$D/usr/lib/news/bin/
mkdir $D/usr/lib/news/examples/
cp extra/active extra/newsgroups $D/usr/lib/news/examples/
mkdir $D/var/log/news/path
install2: $(addprefix install1-, $(FLAVORS))
dh_link
dh_installchangelogs ChangeLog
dh_installdocs
dh_installexamples
dh_installinit --noscripts --init-script=inn2
dh_installcron
dh_compress
dh_fixperms -Xusr/lib/news/bin/innbind
dh_strip
install3-%: install2
# these files may contain passwords
chown root:news $D-inews/etc/news/passwd.nntp $D/etc/news/incoming.conf $D/etc/news/innfeed.conf
chmod 640 $D-inews/etc/news/passwd.nntp $D/etc/news/incoming.conf $D/etc/news/innfeed.conf
perl -i -pe 's/^(pathhost:\s+).+/$${1}server.example.net/' \
$D-inews/etc/news/inn.conf
chmod -x $D/usr/lib/news/bin/control/*.pl $D/etc/news/*.local
chmod u+w,o+r $D/usr/lib/news/bin/innbind
chown news:uucp $D-inews/usr/lib/news/bin/rnews
chmod 4755 $D-inews/usr/lib/news/bin/rnews
chown -R news:news $D/var/spool/news/ $D/var/lib/news/ \
$D/var/log/news/
chmod -R g+w $D/var/spool/news/ $D/var/lib/news/ \
$D/var/log/news/
install4-std: install3-std
install4-lfs: install3-lfs
# lfs-specific: rename some files installed by debhelper
for file in /etc/cron.d/inn2; do \
mv $(D-lfs)$$file-lfs $(D-lfs)$$file; \
done
install5: $(addprefix install4-, $(FLAVORS))
dh_installdeb
dh_md5sums
dh_shlibdeps --exclude=/usr/lib/news/bin/auth/passwd/auth_krb5 -- \
-dSuggests $(D-std)/usr/lib/news/bin/auth/passwd/auth_krb5 \
$(D-lfs)/usr/lib/news/bin/auth/passwd/auth_krb5 \
-dDepends
dh_gencontrol $(no_package) -- \
-VPERLAPI=$$(perl -MConfig -e 'printf("perlapi-%s", $$Config{debian_abi} || $$Config{version})')
dh_builddeb $(no_package)
ifdef BUILD_DUMMY_INN2_LFS
rm -rf $(D-lfs) debian/inn2-lfs.*
cd debian && for s in preinst postinst postrm; do cp maint-dummy inn2-lfs.$$s; done
dh_installdocs -pinn2-lfs --link-doc=inn2
dh_installdeb -pinn2-lfs
dh_gencontrol -pinn2-lfs -- -cdebian/control-dummy
dh_builddeb -pinn2-lfs
endif
binary-arch: install5
binary-indep:
binary: binary-arch
get-orig-source:
cd $(dir $(firstword $(MAKEFILE_LIST)))../ && \
uscan --rename --force-download --destdir $(CURDIR)
.PHONY: clean configure build binary-arch binary install%
|