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
|
#!/usr/bin/make -f
# -*- makefile -*-
# This file is licensed under the terms of the Gnu Public License.
# With the one additional provision that Ian Jackson's name may not be
# removed from the file.
# Copyright 1994,1995 Ian Jackson
# Copyright 2004-2005 Jrme Marant <jerome@debian.org>
# Copyright 1998-2018 Rob Browning <rlb@defaultvalue.org>
# Originally copied from the GNU Hello Debian rules file (1.3).
# Modified for emacs by Mark Eichin <eichin@kitten.gen.ma.us>.
# Debhelper support added via one of Joey Hess' example files.
# See the debian/changelog for further historical information.
include /usr/share/dpkg/pkg-info.mk
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
SHELL := /bin/bash
pf := set -o pipefail
# Emacs 28+ reads the version from org.el, which we don't have.
org_version := 9.5
# Must match emacs24{,-lucid,-nox} packages
bin_priority := 28
# For now we assume that emacs' versioning scheme is always
# MAJOR.MINORtinyrev where MAJOR and MINOR are integers and tinyrev is
# an optional lowercase letter (or letters). We also assume that
# upstream uses a numbering scheme that sorts in a "Debian friendly"
# way. So far that's always been true. If it becomes false, some of
# the values below will have to be set manually.
# From /usr/share/dpkg/pkg-info.mk
src_name := $(DEB_SOURCE)
debian_ver := $(DEB_VERSION)
major_ver := $(shell echo $(debian_ver) | sed 's/\..*//')
# Everything before the last '-' (21.3, 21.3a, 21.3+1, etc.)
debsrc_ver := $(shell echo $(debian_ver) | sed 's/-[^-]\+$$//')
# Everything before the last '-' minus epoch
deborig_ver := $(shell echo $(debsrc_ver) | sed 's/^[0-9]\+://')
# Everything before the last '+' (21.2, 21.3a, etc.) minus epoch
upstream_ver := $(shell echo $(deborig_ver) | sed 's/+[^+]\+$$//')
# 20.5, not 20.5a (used in load-path, etc.)
runtime_ver := $(shell echo $(upstream_ver) | sed 's/[^0-9]\+$$//')
# These files must always exist, i.e. can't ever be cleaned.
persistent_autogen_install_files := debian/copyright
transient_autogen_install_files := \
debian/emacs-common-non-dfsg.README.Debian \
debian/emacs-common-non-dfsg.lintian-overrides
autogen_install_files := \
$(persistent_autogen_install_files) $(transient_autogen_install_files)
autogen_installdeb_files := debian/emacs-common-non-dfsg.postinst
pkgdir_common := $(CURDIR)/debian/emacs-common-non-dfsg
etc_dir := /usr/share/emacs/$(runtime_ver)/etc
etc_files := DEVEL.HUMOR JOKES
deb_patches := $(addprefix debian/patches/,$(shell cat debian/patches/series))
%:
dh $@
# For now, assumes there are no "|" characters in the expansions.
debian/autogen.sed: debian/rules debian/changelog
echo 's|@MAJOR_VERSION@|$(major_ver)|g' >> '$@.tmp'
echo 's|@PACKAGE_VERSION@|$(debian_ver)|g' >> '$@.tmp'
echo 's|@UPSTREAM_VERSION@|$(upstream_ver)|g' >> '$@.tmp'
echo 's|@DEBSRC_VERSION@|$(debsrc_ver)|g' >> '$@.tmp'
echo 's|@DEBORIG_VERSION@|$(deborig_ver)|g' >> '$@.tmp'
mv '$@.tmp' '$@'
.PHONY: debian-sync
debian-sync: $(persistent_autogen_install_files)
# so dh pattern rule doesn't try to handle this target
true
debian/emacs-common-non-dfsg.README.Debian: \
debian/emacs-common-non-dfsg.README.Debian.in \
debian/patches/*.patch $(deb_patches) \
debian/rules debian/patch-to-news
perl -p \
-e 's|^\@DEBIAN_NEWS\@\n|`debian/patch-to-news $(deb_patches)`|e' \
debian/emacs-common-non-dfsg.README.Debian.in > "$@.tmp"
mv "$@.tmp" "$@"
debian/%: debian/%.in debian/autogen.sed
sed -f debian/autogen.sed "$<" > "$@.tmp"
mv "$@.tmp" "$@"
debian/emacs-common-non-dfsg.postinst:
shopt -s nullglob; \
DEB_ALT_PRIORITY='$(bin_priority)' \
DEB_INFO_SUBDIR=emacs \
debian/emacs-common-non-dfsg.postinst.gen \
info/*.info info/*.info-[0-9] info/*.info-[0-9][0-9] \
> '$@.tmp'
mv '$@.tmp' '$@'
doc/%/Makefile: doc/%/Makefile.in debian/rules
sed \
-e "s|@top_srcdir@|$(CURDIR)|g" \
-e "s|@SHELL@|/bin/bash|g" \
-e "s|@srcdir@|.|g" \
-e "s|@MAKEINFO@|makeinfo|g" \
-e "s|@MKDIR_P@|mkdir -p|g" \
-e "s|@INFO_OPTS@|--no-split|g" \
-e "s|@INFO_EXT@|.info|g" "$<" > "$@.tmp"
mv "$@.tmp" "$@"
doc/emacs/emacsver.texi: doc/emacs/emacsver.texi.in
sed -e 's|@version@|$(upstream_ver)|g' "$^" > "$@"
doc_makefiles := \
doc/emacs/Makefile \
doc/lispintro/Makefile \
doc/lispref/Makefile \
doc/misc/Makefile
override_dh_auto_configure: $(doc_makefiles) doc/emacs/emacsver.texi
# This target just supports parallel builds
.PHONY: debian/stamp/doc-%
debian/stamp/doc-%: $(doc_makefiles)
$(MAKE) -C $(dir $(patsubst debian/stamp/doc-%,%,$@))
# Only needed because parallel seems to be disabled in auto_build otherwise
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
parallel := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
parallel := 1
endif
override_dh_auto_build: $(doc_makefiles)
rm -rf info && install -d info
DEB_EMACS_BUILD_ORG_DOC_VERSION=$(org_version) \
$(MAKE) -j$(parallel) \
-f debian/rules $(foreach m,$(doc_makefiles),debian/stamp/doc-$(m))
override_dh_auto_install: ; true
pkg_infodir := $(pkgdir_common)/usr/share/info/emacs
override_dh_install: $(autogen_install_files)
install -d $(pkg_infodir)
test -e info/emacs.info
shopt -s nullglob; \
cp -a info/*.info info/*.info-[0-9] info/*.info-[0-9][0-9] \
$(pkg_infodir)
install -d $(pkgdir_common)/$(etc_dir)/schema
install --mode 0644 $(addprefix etc/,$(etc_files)) \
$(pkgdir_common)/$(etc_dir)
install --mode 0644 etc/schema/* \
$(pkgdir_common)/$(etc_dir)/schema
dh_install
override_dh_testdir:
dh_testdir \
debian/emacs-common-non-dfsg.README.Debian.in \
doc/emacs/emacs.texi
override_dh_clean: $(persistent_autogen_install_files)
rm -f \
doc/emacs/emacsver.texi \
doc/misc/modus-themes.texi \
doc/misc/org.texi
rm -rf \
debian/*.tmp \
doc/emacs/Makefile \
doc/lispintro/Makefile \
doc/lispref/Makefile \
doc/misc/Makefile \
info \
debian/stamp
rm -f \
$(autogen_installdeb_files) \
$(doc_makefiles) \
$(transient_autogen_install_files) \
debian/autogen.sed
dh_clean
override_dh_installdeb: $(autogen_installdeb_files)
dh_installdeb
|