| 1 |
rmayr |
2 |
#!/usr/bin/make -f |
| 2 |
|
|
# Sample debian/rules that uses debhelper. |
| 3 |
|
|
# GNU copyright 1997 to 1999 by Joey Hess. |
| 4 |
|
|
|
| 5 |
|
|
# Uncomment this to turn on verbose mode. |
| 6 |
|
|
#export DH_VERBOSE=1 |
| 7 |
|
|
|
| 8 |
|
|
export DH_OPTIONS |
| 9 |
harald-jenny-guest |
230 |
export CXXFLAGS = -fno-strict-aliasing |
| 10 |
|
|
export CFLAGS = -fno-strict-aliasing |
| 11 |
rmayr |
2 |
|
| 12 |
|
|
configure: configure-stamp |
| 13 |
|
|
configure-stamp: |
| 14 |
|
|
dh_testdir |
| 15 |
|
|
# Add here commands to configure the package. |
| 16 |
|
|
|
| 17 |
|
|
touch configure-stamp |
| 18 |
|
|
|
| 19 |
rmayr |
94 |
patch: |
| 20 |
rmayr |
2 |
dh_testdir |
| 21 |
rmayr |
94 |
dpatch apply-all |
| 22 |
rmayr |
2 |
|
| 23 |
rmayr |
94 |
unpatch: |
| 24 |
|
|
dpatch deapply-all |
| 25 |
rmayr |
2 |
|
| 26 |
|
|
build: build-stamp |
| 27 |
rmayr |
94 |
build-stamp: patch |
| 28 |
rmayr |
2 |
# create a dummy ipsec.secrets file before building the package so |
| 29 |
|
|
# that no RSA keys are created during the build process |
| 30 |
|
|
# (a package should not include a RSA key, it should produce the key |
| 31 |
|
|
# on demand, e.g. in the postinst script) |
| 32 |
|
|
touch $(CURDIR)/debian/ipsec.secrets |
| 33 |
|
|
$(MAKE) programs INC_USRLOCAL=/usr \ |
| 34 |
jaalto-guest |
364 |
FINALBINDIR=/usr/lib/ipsec \ |
| 35 |
rmayr |
2 |
FINALLIBEXECDIR=/usr/lib/ipsec \ |
| 36 |
|
|
PUBDIR=/usr/sbin \ |
| 37 |
|
|
MANTREE=/usr/share/man \ |
| 38 |
rmayr |
95 |
CONFDIR=$(CURDIR)/debian \ |
| 39 |
|
|
USE_LDAP=true USE_LIBCURL=true HAVE_THREADS=true \ |
| 40 |
|
|
USE_XAUTH=true USE_XAUTHPAM=true |
| 41 |
rmayr |
2 |
# remove the temporary file, it will be created during install |
| 42 |
|
|
rm -f $(CURDIR)/debian/ipsec.secrets |
| 43 |
|
|
|
| 44 |
|
|
# here we re-generate the upstream HTML documentation |
| 45 |
|
|
$(MAKE) -C doc/ index.html |
| 46 |
jaalto-guest |
364 |
|
| 47 |
rmayr |
2 |
touch build-stamp |
| 48 |
|
|
|
| 49 |
|
|
clean: unpatch |
| 50 |
|
|
dh_testdir |
| 51 |
|
|
dh_testroot |
| 52 |
|
|
rm -f build-stamp configure-stamp |
| 53 |
|
|
|
| 54 |
jaalto-guest |
364 |
[ ! -f Makefile ] || $(MAKE) clean |
| 55 |
|
|
|
| 56 |
rmayr |
2 |
# after a make clean, no binaries _should_ be left, but .... |
| 57 |
|
|
-find $(CURDIR) -name "*.o" | xargs --no-run-if-empty rm |
| 58 |
|
|
-find $(CURDIR)/lib/libcrypto -name "*.a" | xargs --no-run-if-empty rm |
| 59 |
|
|
|
| 60 |
|
|
rm -rf debian/openswan-modules-source-build/ |
| 61 |
|
|
|
| 62 |
rmayr |
93 |
# Really clean (#356716) |
| 63 |
|
|
# This is a hack: should be better implemented |
| 64 |
|
|
rm -f lib/libopenswan/libopenswan.a || true |
| 65 |
|
|
rm -f lib/libopenswan/liboswlog.a || true |
| 66 |
rmayr |
164 |
rm -rf OBJ.* || true |
| 67 |
|
|
rm -rf doc/manpage.d/*.html || true |
| 68 |
|
|
rm -f doc/index.html || true |
| 69 |
rmayr |
93 |
|
| 70 |
rmayr |
2 |
# just in case something went wrong |
| 71 |
|
|
rm -f $(CURDIR)/debian/ipsec.secrets |
| 72 |
jaalto-guest |
364 |
|
| 73 |
rmayr |
112 |
# and make sure that template are up-to-date |
| 74 |
|
|
debconf-updatepo |
| 75 |
rmayr |
2 |
|
| 76 |
|
|
dh_clean |
| 77 |
|
|
|
| 78 |
|
|
install-openswan: DH_OPTIONS=-a |
| 79 |
|
|
install-openswan: build |
| 80 |
|
|
dh_testdir |
| 81 |
|
|
dh_testroot |
| 82 |
jaalto-guest |
374 |
dh_prep |
| 83 |
rmayr |
2 |
dh_installdirs |
| 84 |
|
|
|
| 85 |
|
|
# Add here commands to install the package into debian/tmp. |
| 86 |
|
|
$(MAKE) install INC_USRLOCAL=/usr \ |
| 87 |
jaalto-guest |
364 |
FINALBINDIR=/usr/lib/ipsec \ |
| 88 |
rmayr |
2 |
FINALLIBEXECDIR=/usr/lib/ipsec \ |
| 89 |
|
|
PUBDIR=$(CURDIR)/debian/openswan/usr/sbin \ |
| 90 |
|
|
MANTREE=$(CURDIR)/debian/openswan/usr/share/man \ |
| 91 |
rmayr |
95 |
DESTDIR=$(CURDIR)/debian/openswan |
| 92 |
rmayr |
2 |
rm -rf $(CURDIR)/debian/openswan/usr/local |
| 93 |
|
|
install --mode=0600 $(CURDIR)/debian/ipsec.secrets.proto $(CURDIR)/debian/openswan/etc/ipsec.secrets |
| 94 |
|
|
|
| 95 |
|
|
rm -f $(CURDIR)/debian/openswan/etc/init.d/ipsec?* |
| 96 |
rmayr |
40 |
rm -f $(CURDIR)/debian/openswan/usr/lib/ipsec/_plutorun?* |
| 97 |
rmayr |
2 |
|
| 98 |
|
|
# this is handled by update-rc.d |
| 99 |
|
|
rm -rf $(CURDIR)/debian/openswan/etc/rc?.d |
| 100 |
harald-jenny-guest |
245 |
|
| 101 |
|
|
# delete var/lock/subsys and var/run to satisfy lintian |
| 102 |
|
|
rm -rf $(CURDIR)/debian/openswan/var/lock |
| 103 |
|
|
rm -rf $(CURDIR)/debian/openswan/var/run |
| 104 |
harald-jenny-guest |
262 |
|
| 105 |
harald-jenny-guest |
488 |
# remove the already installed docs |
| 106 |
|
|
rm -rf "$(CURDIR)/debian/openswan-doc/usr/share/doc" |
| 107 |
harald-jenny-guest |
486 |
|
| 108 |
|
|
# fix some manpage issues |
| 109 |
|
|
for oldname in `find $(CURDIR)/debian/openswan/usr/share/man -name "ipsec_ipsec*"`; \ |
| 110 |
harald-jenny-guest |
480 |
do \ |
| 111 |
harald-jenny-guest |
484 |
newname=`echo "$$oldname" | sed 's/ipsec_ipsec_/ipsec_/'`; \ |
| 112 |
|
|
if [ -f "$$newname" ]; then \ |
| 113 |
harald-jenny-guest |
485 |
rm -f "$$oldname"; \ |
| 114 |
harald-jenny-guest |
482 |
else \ |
| 115 |
harald-jenny-guest |
485 |
mv "$$oldname" "$$newname"; \ |
| 116 |
harald-jenny-guest |
480 |
fi; \ |
| 117 |
harald-jenny-guest |
479 |
done |
| 118 |
jaalto-guest |
364 |
|
| 119 |
harald-jenny-guest |
475 |
dh_installdocs -popenswan -n |
| 120 |
|
|
dh_installchangelogs CHANGES |
| 121 |
|
|
|
| 122 |
harald-jenny-guest |
476 |
# openswan-dbg depends on openswan so no need to ship doc twice |
| 123 |
|
|
rm -rf $(CURDIR)/debian/openswan-dbg/usr/share/doc/openswan-dbg |
| 124 |
|
|
|
| 125 |
rmayr |
2 |
# the logcheck ignore files |
| 126 |
|
|
install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.paranoid $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.paranoid/openswan |
| 127 |
|
|
install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.server $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.server/openswan |
| 128 |
|
|
install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.server $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.workstation/openswan |
| 129 |
|
|
install -D --mode=0600 $(CURDIR)/debian/logcheck.violations.ignore $(CURDIR)/debian/openswan/etc/logcheck/violations.ignore.d/openswan |
| 130 |
|
|
|
| 131 |
|
|
# set permissions on ipsec.secrets |
| 132 |
|
|
chmod 600 $(CURDIR)/debian/openswan/etc/ipsec.secrets |
| 133 |
|
|
chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.conf |
| 134 |
rmayr |
42 |
chmod 700 -R $(CURDIR)/debian/openswan/etc/ipsec.d/private/ |
| 135 |
|
|
# don't know why they come with +x set by default... |
| 136 |
|
|
chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.d/policies/* |
| 137 |
rmayr |
43 |
chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.d/examples/* |
| 138 |
rmayr |
2 |
|
| 139 |
|
|
# more lintian cleanups |
| 140 |
rmayr |
25 |
find $(CURDIR)/debian/openswan -name ".cvsignore" | xargs --no-run-if-empty rm -f |
| 141 |
rmayr |
126 |
find $(CURDIR)/debian/openswan -name ".gitignore" | xargs --no-run-if-empty rm -f |
| 142 |
harald-jenny-guest |
258 |
find $(CURDIR)/debian/openswan -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf |
| 143 |
rmayr |
2 |
|
| 144 |
jaalto-guest |
427 |
# Empty directory |
| 145 |
|
|
rmdir $(CURDIR)/debian/openswan/usr/bin |
| 146 |
|
|
|
| 147 |
harald-jenny-guest |
465 |
install-openswan-doc: DH_OPTIONS=-popenswan-doc |
| 148 |
harald-jenny-guest |
491 |
install-openswan-doc: build |
| 149 |
harald-jenny-guest |
465 |
dh_testdir |
| 150 |
|
|
dh_testroot |
| 151 |
|
|
|
| 152 |
|
|
dh_installdocs -popenswan-doc -n |
| 153 |
|
|
dh_installchangelogs CHANGES |
| 154 |
|
|
|
| 155 |
harald-jenny-guest |
486 |
# fix some doc issues |
| 156 |
harald-jenny-guest |
487 |
for oldname in `find $(CURDIR)/debian/openswan-doc/usr/share/doc -name "ipsec_ipsec*"`; \ |
| 157 |
harald-jenny-guest |
486 |
do \ |
| 158 |
|
|
newname=`echo "$$oldname" | sed 's/ipsec_ipsec_/ipsec_/'`; \ |
| 159 |
|
|
if [ -f "$$newname" ]; then \ |
| 160 |
|
|
rm -f "$$oldname"; \ |
| 161 |
|
|
else \ |
| 162 |
|
|
mv "$$oldname" "$$newname"; \ |
| 163 |
|
|
fi; \ |
| 164 |
|
|
done |
| 165 |
|
|
|
| 166 |
harald-jenny-guest |
476 |
# change the paths in the installed doc files (but only in regular |
| 167 |
|
|
# files, not in links to the outside of the build tree !) |
| 168 |
harald-jenny-guest |
477 |
( cd $(CURDIR)/debian/openswan-doc/; \ |
| 169 |
harald-jenny-guest |
476 |
for f in `grep "/usr/local/" --recursive --files-with-match *`; \ |
| 170 |
|
|
do \ |
| 171 |
|
|
if [ -f $$f -a ! -L $$f ]; then \ |
| 172 |
|
|
cp $$f $$f.old; \ |
| 173 |
|
|
sed 's/\/usr\/local\//\/usr\//' $$f.old > $$f; \ |
| 174 |
|
|
rm $$f.old; \ |
| 175 |
|
|
fi; \ |
| 176 |
|
|
done ) |
| 177 |
|
|
# but remove the doc/src dir, which just duplicates the HTML files |
| 178 |
harald-jenny-guest |
477 |
rm -rf $(CURDIR)/debian/openswan-doc/usr/share/doc/openswan-doc/doc/src |
| 179 |
harald-jenny-guest |
476 |
|
| 180 |
harald-jenny-guest |
465 |
# more lintian cleanups |
| 181 |
harald-jenny-guest |
472 |
find $(CURDIR)/debian/openswan-doc -name ".cvsignore" | xargs --no-run-if-empty rm -f |
| 182 |
harald-jenny-guest |
475 |
find $(CURDIR)/debian/openswan-doc -name ".gitignore" | xargs --no-run-if-empty rm -f |
| 183 |
harald-jenny-guest |
472 |
find $(CURDIR)/debian/openswan-doc -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf |
| 184 |
harald-jenny-guest |
465 |
|
| 185 |
harald-jenny-guest |
359 |
install-openswan-modules-source: DH_OPTIONS=-popenswan-modules-source |
| 186 |
rmayr |
2 |
install-openswan-modules-source: PKGDIR=$(CURDIR)/debian/openswan-modules-source |
| 187 |
|
|
install-openswan-modules-source: BUILDDIR=$(CURDIR)/debian/openswan-modules-source-build |
| 188 |
rmayr |
94 |
install-openswan-modules-source: patch |
| 189 |
rmayr |
2 |
dh_testdir |
| 190 |
|
|
dh_testroot |
| 191 |
|
|
dh_installdirs |
| 192 |
|
|
mkdir -p "$(BUILDDIR)/modules/openswan" |
| 193 |
|
|
mkdir -p "$(BUILDDIR)/modules/openswan/lib" |
| 194 |
|
|
mkdir -p "$(BUILDDIR)/modules/openswan/debian" |
| 195 |
rmayr |
44 |
mkdir -p "$(BUILDDIR)/modules/openswan/packaging" |
| 196 |
harald-jenny-guest |
331 |
cp -r CHANGES CREDITS Makefile Makefile.top Makefile.inc Makefile.ver linux/ \ |
| 197 |
rmayr |
2 |
"$(BUILDDIR)/modules/openswan" |
| 198 |
rmayr |
44 |
cp -r lib/libcrypto "$(BUILDDIR)/modules/openswan/lib/" |
| 199 |
rmayr |
150 |
cp -r packaging/makefiles packaging/linus packaging/utils packaging/defaults/ \ |
| 200 |
rmayr |
44 |
"$(BUILDDIR)/modules/openswan/packaging/" |
| 201 |
|
|
find "$(BUILDDIR)/modules/openswan/lib/" -name "*.o" | xargs --no-run-if-empty rm |
| 202 |
rmayr |
2 |
install --mode=644 debian/openswan-modules-source.kernel-config "$(BUILDDIR)/modules/openswan/config-all.h" |
| 203 |
|
|
install --mode=755 debian/openswan-modules-source.rules "$(BUILDDIR)/modules/openswan/debian/rules" |
| 204 |
|
|
install --mode=644 debian/openswan-modules-source.control.in "$(BUILDDIR)/modules/openswan/debian/control.in" |
| 205 |
|
|
install --mode=644 debian/changelog "$(BUILDDIR)/modules/openswan/debian/" |
| 206 |
harald-jenny-guest |
275 |
install --mode=644 debian/copyright "$(BUILDDIR)/modules/openswan/debian/" |
| 207 |
harald-jenny-guest |
331 |
install --mode=644 debian/NEWS "$(BUILDDIR)/modules/openswan/debian/" |
| 208 |
|
|
install --mode=644 debian/README.Debian "$(BUILDDIR)/modules/openswan/debian/" |
| 209 |
rmayr |
25 |
|
| 210 |
rmayr |
104 |
tar -C $(BUILDDIR) -c modules/ | bzip2 -9 > \ |
| 211 |
jaalto-guest |
364 |
"$(PKGDIR)/usr/src/openswan-modules.tar.bz2" |
| 212 |
|
|
|
| 213 |
rmayr |
2 |
dh_installdocs -popenswan-modules-source -n |
| 214 |
harald-jenny-guest |
330 |
dh_installchangelogs CHANGES |
| 215 |
rmayr |
2 |
|
| 216 |
|
|
# more lintian cleanups |
| 217 |
harald-jenny-guest |
472 |
find $(PKGDIR) -name ".cvsignore" | xargs --no-run-if-empty rm -f |
| 218 |
harald-jenny-guest |
492 |
find $(PKGDIR) -name ".gitignore" | xargs --no-run-if-empty rm -f |
| 219 |
harald-jenny-guest |
258 |
find $(PKGDIR) -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf |
| 220 |
rmayr |
2 |
|
| 221 |
harald-jenny-guest |
359 |
install-openswan-modules-dkms: DH_OPTIONS=-popenswan-modules-dkms |
| 222 |
harald-jenny-guest |
369 |
install-openswan-modules-dkms: VERSION:=$(shell dpkg-parsechangelog | grep '^Version:' | cut -d' ' -f2 | cut -d: -f2 | cut -d- -f1) |
| 223 |
harald-jenny-guest |
343 |
install-openswan-modules-dkms: patch |
| 224 |
|
|
dh_testdir |
| 225 |
|
|
dh_testroot |
| 226 |
harald-jenny-guest |
360 |
dh_installdirs |
| 227 |
|
|
mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" |
| 228 |
|
|
mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/debian" |
| 229 |
|
|
mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/packaging" |
| 230 |
harald-jenny-guest |
343 |
cp -r Makefile Makefile.top Makefile.inc Makefile.ver linux/ \ |
| 231 |
harald-jenny-guest |
361 |
"$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)" |
| 232 |
harald-jenny-guest |
360 |
cp -r lib/libcrypto "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" |
| 233 |
harald-jenny-guest |
343 |
cp -r packaging/makefiles packaging/linus packaging/utils packaging/defaults/ \ |
| 234 |
harald-jenny-guest |
360 |
"$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/packaging/" |
| 235 |
|
|
find "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" -name "*.o" | xargs --no-run-if-empty rm |
| 236 |
|
|
install --mode=644 debian/openswan-modules-source.kernel-config "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/config-all.h" |
| 237 |
|
|
sed -e "s/#VERSION#/$(VERSION)/g" debian/dkms.conf.in > "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/dkms.conf" |
| 238 |
harald-jenny-guest |
343 |
|
| 239 |
|
|
dh_installdocs -popenswan-modules-dkms -n |
| 240 |
|
|
dh_installchangelogs CHANGES |
| 241 |
|
|
|
| 242 |
|
|
# more lintian cleanups |
| 243 |
|
|
find $(CURDIR)/debian/openswan-modules-dkms -name ".cvsignore" | xargs --no-run-if-empty rm -f |
| 244 |
harald-jenny-guest |
492 |
find $(CURDIR)/debian/openswan-modules-dkms -name ".gitignore" | xargs --no-run-if-empty rm -f |
| 245 |
harald-jenny-guest |
343 |
find $(CURDIR)/debian/openswan-modules-dkms -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf |
| 246 |
|
|
|
| 247 |
jaalto-guest |
422 |
# Ensure +x for scrips |
| 248 |
|
|
find $(CURDIR)/debian/openswan-modules-dkms -type f -name "*.sh" -o -name "*.pl" | xargs --no-run-if-empty chmod 755 |
| 249 |
|
|
|
| 250 |
jaalto-guest |
434 |
# remove empty dir |
| 251 |
|
|
find $(CURDIR)/debian/openswan-modules-dkms -type d -name debian | xargs --no-run-if-empty rmdir |
| 252 |
|
|
|
| 253 |
jaalto-guest |
436 |
# These are not executable scripts, more like "shell source" files |
| 254 |
|
|
find $(CURDIR)/debian/openswan-modules-dkms -name sshenv -o -name setup | xargs --no-run-if-empty chmod 644 |
| 255 |
|
|
|
| 256 |
rmayr |
2 |
binary-common: |
| 257 |
|
|
dh_testdir |
| 258 |
|
|
dh_testroot |
| 259 |
|
|
dh_installdebconf |
| 260 |
harald-jenny-guest |
329 |
dh_link |
| 261 |
harald-jenny-guest |
322 |
dh_strip --dbg-package=openswan-dbg |
| 262 |
rmayr |
2 |
dh_compress |
| 263 |
|
|
dh_fixperms -X etc/ipsec.conf -X etc/ipsec.secrets -X etc/ipsec.d |
| 264 |
|
|
|
| 265 |
harald-jenny-guest |
199 |
dh_lintian |
| 266 |
rmayr |
2 |
dh_installdeb |
| 267 |
|
|
dh_shlibdeps |
| 268 |
|
|
dh_gencontrol |
| 269 |
|
|
dh_md5sums |
| 270 |
|
|
dh_builddeb |
| 271 |
|
|
|
| 272 |
|
|
# Build architecture-independent files here. |
| 273 |
harald-jenny-guest |
473 |
binary-indep: install-openswan-doc install-openswan-modules-source install-openswan-modules-dkms |
| 274 |
rmayr |
2 |
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common |
| 275 |
|
|
|
| 276 |
|
|
# Build architecture-dependent files here. |
| 277 |
harald-jenny-guest |
473 |
binary-arch: install-openswan |
| 278 |
rmayr |
2 |
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common |
| 279 |
|
|
|
| 280 |
|
|
binary: binary-indep binary-arch |
| 281 |
|
|
.PHONY: clean binary-indep binary-arch |