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
|
#!/usr/bin/make -f
# debian/rules file - for Stalin
# Copyright 1994,1995 by Ian Jackson
# Copyright (C) 1998-2004,2006 by Rob Browning
SHELL := /bin/bash
quilt := QUILT_PATCHES=debian/patches quilt
upstream_archive := stalin_0.11.orig.tar.gz
upstream_archive_dir := stalin-0.11
srcname := $(shell dpkg-parsechangelog | grep Source:)
srcname := $(shell echo $(srcname) | perl -pe 's/^Source:\s+//o')
version := $(shell dpkg-parsechangelog | grep Version:)
version := $(shell echo $(version) | perl -pe 's/^Version:\s+//o')
upstream := $(shell echo $(version) | perl -pe 's/-[^-]*$$//o')
deb_rev := $(shell echo $(version) | perl -pe 's/.*-//o')
build_cpu := $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
ifeq ($(build_cpu),amd64)
cc_optimization := -O0
else
cc_optimization := -O2
endif
define patch
$(quilt) push -a
endef
define unpatch
# now unpatch
test -z "$$($(quilt) applied)" || $(quilt) pop -a
rm -f debian/stamp/patch
rm -rf .pc
endef
define checkdir
dpkg-parsechangelog > /dev/null
@if ! test -f stalin.sc; \
then \
echo; \
echo -n "The upstream source does not appear to be available."; \
echo " Please put the contents"; \
echo -n "of $(upstream_archive) into the"; \
echo " current directory."; \
echo; \
false; \
fi
endef
define cleanup_all
$(MAKE) clean
$(unpatch)
rm -rf debian/stamp debian/substvars
find -name '*~' -o -name core | xargs --no-run-if-empty rm -f
rm -rf debian/tmp debian/files*
rm -rf $(DEB_TRASH)
endef
define run_tests
rm -rf debian/tmp-test
mkdir debian/tmp-test
echo '(display "hello") (newline)' > debian/tmp-test/hello.scm
cd debian/tmp-test && $(CURDIR)/stalin -On hello.scm
test -x debian/tmp-test/hello
test $$(debian/tmp-test/hello) = "hello"
# These don't work on all debian platforms yet.
#cd benchmarks && ./compile-and-run-stalin-old-benchmarks
endef
DEB_TRASH += debian/tmp-test
.PHONY: check-diff
check-diff:
$(checkdir)
$(cleanup_all)
@test -r ../$(upstream_archive)
@rm -rf debian/tmp-diff && mkdir debian/tmp-diff
@cd debian/tmp-diff && tar xzpSf ../../../$(upstream_archive)
@cd debian/tmp-diff && mv $(upstream_archive_dir) orig
@mkdir debian/tmp-diff/new
@tar cpf - --exclude './debian' --exclude './.pc' . \
| (cd debian/tmp-diff/new && tar xpf -)
@echo
@echo "########################################"
@echo "### Diffs outside ./debian"
@cd debian/tmp-diff && diff -ruN \
-x stalin-arch-amd64.c \
-x stalin-arch-i386.c \
-x stalin-arch-ia64.c \
-x stalin-arch-sparc.c \
orig new
@echo "########################################"
@echo "### Empty file list differences"
@diff -u \
<(cd debian/tmp-diff/orig && find -size 0) \
<(cd debian/tmp-diff/new && find -size 0) \
> debian/tmp-diff/empty-files.diff || test $$? -eq 1
@cat debian/tmp-diff/empty-files.diff
@test ! -s debian/tmp-diff/empty-files.diff || false
@echo "########################################"
@rm -rf debian/tmp-diff
DEB_TRASH += debian/tmp-diff
check-auto-parse:
@echo " srcname:" $(srcname)
@echo " version:" $(version)
@echo " upstream:" $(upstream)
@echo " deb_rev:" $(deb_rev)
buildpackage:
${checkdir}
dpkg-buildpackage -D -us -uc -rfakeroot -i'\.git|\.pc'
.PHONY: buildpackage
debian/stamp/patch:
$(checkdir)
$(patch)
mkdir -p $(dir $@) && touch $@
build: debian/stamp/build
debian/stamp/build: debian/stamp/patch
$(checkdir)
CC_OPTIMIZATION=$(cc_optimization) ./build
./build-gl-fpi
$(run_tests)
mkdir -p $(dir $@) && touch $@
.PHONY: build
clean:
$(checkdir)
$(cleanup_all)
.PHONY: clean
binary-indep: checkroot build
$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package. If there were any they would be
# made here.
.PHONY: binary-indep
binary-arch: checkroot build
$(checkdir)
rm -rf debian/tmp
install -d debian/tmp
# Binaries
install -d debian/tmp/usr/bin
cp debian/stalin-script debian/tmp/usr/bin/stalin
# libs (some of these should be in share, but stalin doesn't make the
# distinction ATM)
install -d debian/tmp/usr/lib/stalin
cp -r include/* debian/tmp/usr/lib/stalin
install -s include/stalin debian/tmp/usr/lib/stalin/
# manpages
install -d debian/tmp/usr/share/man/man1
cp stalin.1 debian/tmp/usr/share/man/man1
find debian/tmp/usr/share/man -type f | xargs gzip -9v
# docs
install -d debian/tmp/usr/share/doc/$(srcname)
install README ANNOUNCEMENT debian/tmp/usr/share/doc/$(srcname)
install stalin.el debian/tmp/usr/share/doc/$(srcname)
cp debian/changelog debian/tmp/usr/share/doc/$(srcname)/changelog.Debian
cp -a benchmarks debian/tmp/usr/share/doc/$(srcname)
find debian/tmp/usr/share/doc/$(srcname) -type f | xargs gzip -9v
cp debian/copyright debian/tmp/usr/share/doc/$(srcname)
# Mangle permissions to conform.
chown -R root.root debian/tmp
find debian/tmp -type d | xargs chmod 755
find debian/tmp -not -type d -a -not -type l | xargs chmod 644
chmod 755 debian/tmp/usr/bin/*
chmod 755 debian/tmp/usr/lib/stalin/stalin
chmod 755 debian/tmp/usr/lib/stalin/stalin-architecture-name
# control scripts
install -d debian/tmp/DEBIAN
install debian/prerm debian/tmp/DEBIAN/
chmod 755 debian/prerm
# Final steps...
dpkg-shlibdeps debian/tmp/usr/lib/stalin/stalin
dpkg-gencontrol -pstalin -isp
dpkg --build debian/tmp ..
.PHONY: binary-arch
# Below here is fairly generic really
binary: binary-indep binary-arch
.PHONY: binary
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: checkroot
# Local variables:
# mode: makefile
# End:
|