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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
|
SHELL := /bin/bash
pf := set -o pipefail
chop = $(wordlist 2,$(words $1),x $1)
rc := echo " $$?"
diesh = $(info $(call chop,$(1)))$(info exit: $(lastword $(1)))$(error ($2))
shout = $(if $(lastword $(1)),$(if $(subst 0,,$(lastword $(1))),$(call diesh,$(1),$(2)),$(call chop,$(1))),$(call diesh,$(1),$(2)))
export HOME := $(CURDIR)/debian/no-trespassing
expected_info := guile.info $(foreach n,1 2 3 4 5 6 7 8 9 10,guile.info-$(n))
deb_src_ver := $(shell dpkg-parsechangelog -S version; $(rc))
deb_src_ver := $(call shout,$(deb_src_ver),dpkg-parsechangelog failed)
deb_src_rev := $(shell $(pf); echo $(deb_src_ver) | sed -e 's/.*-//'; $(rc))
deb_src_rev := $(call shout,$(deb_src_rev),unable to get deb_src_rev)
deb_src_ver := $(shell $(pf); echo $(deb_src_ver) | sed -e 's/-[^-]*//'; $(rc))
deb_src_ver := $(call shout,$(deb_src_ver),unable to get deb_src_ver)
deb_src_src_rev := \
$(shell $(pf); echo $(deb_src_ver) | sed -re 's/.*\+([0-9]+).*/\1/'; $(rc))
deb_src_src_rev := $(call shout,$(deb_src_src_rev),unable to get deb_src_src_rev)
upstream_ver := $(shell $(pf); echo $(deb_src_ver) | sed -e 's/\+.*//'; $(rc))
upstream_ver := $(call shout,$(upstream_ver),unable to get upstream_ver)
deb_src_maj_ver := $(shell $(pf); echo $(upstream_ver) | cut -d. -f 1; $(rc))
deb_src_min_ver := $(shell $(pf); echo $(upstream_ver) | cut -d. -f 2; $(rc))
deb_src_mic_ver := $(shell $(pf); echo $(upstream_ver) | cut -d. -f 3; $(rc))
deb_src_maj_ver := $(call shout,$(deb_src_maj_ver),unable to get deb_src_maj_ver)
deb_src_min_ver := $(call shout,$(deb_src_min_ver),unable to get deb_src_min_ver)
deb_src_mic_ver := $(call shout,$(deb_src_mic_ver),unable to get deb_src_mic_ver)
deb_src_eff_ver := $(deb_src_maj_ver).$(deb_src_min_ver)
deb_pkg_basename := guile-$(deb_src_eff_ver)
deb_guile_bin_path := /usr/bin/guile-$(deb_src_eff_ver)
ifneq (ok,$(shell x='$(deb_src_min_ver)'; [ "$${\#x}" -lt 4 ] && echo ok;))
$(error ERROR: alternatives priority expects min version < 1000)
endif
deb_alt_priority := $(deb_src_maj_ver)$(shell echo $$(($(deb_src_min_ver) + 200)))
multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH; $(rc))
multiarch := $(call shout,$(multiarch),dpkg-architecture failed)
ifneq ($(multiarch),)
march = $(multiarch)/
else
march =
endif
export DEB_CFLAGS_MAINT_APPEND := \
-DPACKAGE_PACKAGER='"Debian"' \
-DPACKAGE_PACKAGER_VERSION='"$(upstream_ver)-deb+$(deb_src_src_rev)-$(deb_src_rev)"' \
-DPACKAGE_PACKAGER_BUG_REPORTS='"http://www.debian.org/Bugs/Reporting"'
export DEB_CFLAGS_MAINT_APPEND += -fno-stack-protector
define checkdir
dh_testdir debian/guile.postinst
endef
%:
dh $@ --parallel --with autoreconf
.PHONY: check-vars
check-vars:
@echo " upstream_ver:" $(upstream_ver)
@echo "deb_pkg_basename:" $(deb_pkg_basename)
@echo " deb_src_ver:" $(deb_src_ver)
@echo " deb_src_eff_ver:" $(deb_src_eff_ver)
@echo " deb_src_maj_ver:" $(deb_src_maj_ver)
@echo " deb_src_min_ver:" $(deb_src_min_ver)
@echo " deb_src_mic_ver:" $(deb_src_mic_ver)
@echo " deb_src_src_rev:" $(deb_src_src_rev)
@echo " deb_src_rev:" $(deb_src_rev)
@echo "deb_alt_priority:" $(deb_alt_priority)
debian/autogen.sed: debian/rules debian/changelog
echo "s|@UPSTREAM_VER@|$(upstream_ver)|g" > "$@.tmp"
echo "s|@DEB_SRC_VER@|$(deb_src_ver)|g" >> "$@.tmp"
echo "s|@DEB_SRC_MAJ_VER@|$(deb_src_maj_ver)|g" >> "$@.tmp"
echo "s|@DEB_SRC_MIN_VER@|$(deb_src_min_ver)|g" >> "$@.tmp"
echo "s|@DEB_SRC_MIC_VER@|$(deb_src_mic_ver)|g" >> "$@.tmp"
echo "s|@DEB_SRC_EFF_VER@|$(deb_src_eff_ver)|g" >> "$@.tmp"
echo "s|@DEB_PKG_BASENAME@|$(deb_pkg_basename)|g" >> "$@.tmp"
echo "s|@DEB_ALT_PRIORITY@|$(deb_alt_priority)|g" >> "$@.tmp"
echo "s|@MARCH@|$(march)|g" >> "$@.tmp"
mv "$@.tmp" "$@"
autogen_install_files := $(addprefix debian/, \
guile-$(deb_src_eff_ver).install \
guile-$(deb_src_eff_ver).links \
guile-$(deb_src_eff_ver).menu \
guile-$(deb_src_eff_ver).undocumented \
guile-$(deb_src_eff_ver)-dev.install \
guile-$(deb_src_eff_ver)-doc.README.Debian \
guile-$(deb_src_eff_ver)-doc.install \
guile-$(deb_src_eff_ver)-libs.install \
guile-$(deb_src_eff_ver)-libs.lintian-overrides)
autogen_installdeb_files := $(addprefix debian/, \
guile-$(deb_src_eff_ver).postinst \
guile-$(deb_src_eff_ver).prerm \
guile-$(deb_src_eff_ver)-dev.postinst \
guile-$(deb_src_eff_ver)-dev.prerm \
guile-$(deb_src_eff_ver)-doc.postinst \
guile-$(deb_src_eff_ver)-doc.prerm \
guile-$(deb_src_eff_ver)-libs.postinst \
guile-$(deb_src_eff_ver)-libs.prerm \
guile-$(deb_src_eff_ver)-libs.triggers)
debian/guile-$(deb_src_eff_ver).%: debian/guile.% debian/autogen.sed
sed -f debian/autogen.sed "$<" > "$@.tmp"
mv "$@.tmp" "$@"
debian/guile-$(deb_src_eff_ver)-dev.%: debian/guile-dev.% debian/autogen.sed
sed -f debian/autogen.sed "$<" > "$@.tmp"
mv "$@.tmp" "$@"
debian/guile-$(deb_src_eff_ver)-doc.%: debian/guile-doc.% debian/autogen.sed
sed -f debian/autogen.sed "$<" > "$@.tmp"
mv "$@.tmp" "$@"
debian/guile-$(deb_src_eff_ver)-libs.%: debian/guile-libs.% debian/autogen.sed
sed -f debian/autogen.sed "$<" > "$@.tmp"
mv "$@.tmp" "$@"
debian/guile-$(deb_src_eff_ver)-doc.postinst:
DEB_PKG_BASENAME="$(deb_pkg_basename)" \
DEB_INFO_SUBDIR="$(deb_pkg_basename)" \
DEB_ALT_PRIORITY="$(deb_alt_priority)" \
debian/guile-doc.postinst.gen $(addprefix doc/ref/,$(expected_info)) \
> "$@".tmp
mv "$@.tmp" "$@"
override_dh_testdir:
$(checkdir)
override_dh_autoreconf:
echo '$(upstream_ver)' > .version
cp -a .version .tarball-version
dh_autoreconf ./autogen.sh
override_dh_auto_configure:
dh_auto_configure -- --disable-error-on-warning --disable-rpath \
--program-suffix "-$(deb_src_eff_ver)"
override_dh_auto_clean:
if test -e Makefile; then make distclean; fi
override_dh_clean:
-$(MAKE) -C prebuilt clean
dh_clean $(autogen_install_files) $(autogen_installdeb_files) \
.tarball-version \
.version \
blarg-clean \
bootstrap/ice-9/ \
bootstrap/language/ \
bootstrap/srfi/ \
bootstrap/system/ \
debian/autogen.sed \
doc/r5rs/r5rs.info \
doc/ref/autoconf-macros.texi \
doc/ref/effective-version.texi \
doc/ref/guile.info \
doc/ref/guile.info-1 \
doc/ref/guile.info-10 \
doc/ref/guile.info-2 \
doc/ref/guile.info-3 \
doc/ref/guile.info-4 \
doc/ref/guile.info-5 \
doc/ref/guile.info-6 \
doc/ref/guile.info-7 \
doc/ref/guile.info-8 \
doc/ref/guile.info-9 \
doc/ref/stamp-vti \
doc/ref/version.texi \
filesys-test-link.tmp \
guile-procedures.txt \
libguile/c-tokenize.c \
libguile/cpp-E.c \
libguile/cpp-SIG.c \
libguile/vm-operations.h
override_dh_installinfo:
true
override_dh_auto_install: $(autogen_install_files)
make DESTDIR="$$(pwd)/debian/tmp" INSTALL='install -p' install
rm -f debian/tmp/usr/lib/$(march)libguile*.la
gdb_ext := \
debian/$(deb_pkg_basename)-libs/usr/lib/$(march)libguile-$(deb_src_eff_ver).so*-gdb.scm
gdb_ext_dir := debian/$(deb_pkg_basename)-dev/usr/share/gdb/auto-load
override_dh_install-arch: $(autogen_install_files)
cd debian/tmp/usr/bin && mv -i guile-$(deb_src_eff_ver) guile
dh_install -a
dh_missing -a --fail-missing \
-Xusr/lib/$(march)guile/$(deb_src_eff_ver)/extensions/guile-readline.a \
-Xusr/lib/$(march)guile/$(deb_src_eff_ver)/extensions/guile-readline.la
test -e $(gdb_ext)
mkdir -p $(gdb_ext_dir)
mv $(gdb_ext) $(gdb_ext_dir)
override_dh_install-indep: $(autogen_install_files)
test "$(sort $(expected_info))" = \
"$(sort $(shell cd debian/tmp/usr/share/info && ls guile.info*))"
dh_install -i
dh_missing -i --fail-missing \
-Xusr/bin/guile-$(deb_src_eff_ver) \
-Xusr/share/info/dir \
-Xusr/share/info/r5rs.info \
-Xusr/lib/$(march)guile/$(deb_src_eff_ver)/extensions/guile-readline.a \
-Xusr/lib/$(march)guile/$(deb_src_eff_ver)/extensions/guile-readline.la
test ! -e debian/guile-$(deb_src_eff_ver)-doc/usr/share/info/dir
override_dh_installdeb: $(autogen_installdeb_files)
dh_installdeb
|