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 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
|
#!/usr/bin/make -f
# 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 by Ian Jackson.
# Copyright 1998-2001 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>
# modified for emacs20 by Rob Browning <rlb@defaultvalue.org>
# modified for emacs21 by Rob Browning <rlb@defaultvalue.org>
SHELL := /bin/bash
pwd := $(shell pwd)
# 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.
# At the moment, we try to make it so that a "debian/rules clean" will
# get you back to the same state you were in before "debian/rules
# build", but that's kinda tricky. Right now, we try to avoid diff
# bloat by keeping the original upstream .elc files in the source
# package, and only re-byte-compiling files once they've been
# transferred to debian/tmp-emacs. This has associated dangers since if we
# make any changes to the .el files that are needed during the build
# process, they won't show up. At some point we may need to revisit
# the build process and consider shipping the debian source package
# with matching .elc files, diff bloat or not. I think perhaps I'll
# ask Gerd what his opinion is...
#
# For now, be aware that the current approach means that we have to
# have special handling for the info-files, the lisp_precious files,
# and the leim files (leim doesn't have an accurate clean target.
# If appropriate, I should create one and send it back upstream rather
# than hacking it here).
# The version from the changelog (i.e. 20.5-1)
debian_ver := $(shell dpkg-parsechangelog | egrep '^Version:')
debian_ver := $(shell echo ${debian_ver} | perl -pe 's/Version:\s+//o')
# The Debian revision (i.e. the 1 from 20.5-1)
# Always everything after the last '-'
debian_rev := $(shell echo ${debian_ver} | perl -pe 's/.*-//o')
# This is the official upstream version (the one in the tarfile names).
nominal_ver := $(shell echo ${debian_ver} | perl -pe 's/-[^-]+$$//o')
# This must be the version that's actually used at runtime for things
# like load-path. It may not be the same as the upstream version
# (i.e. when you have upstream 20.5a, the functional version may still
# be 20.5), so we do this by hand.
runtime_ver := $(shell echo ${nominal_ver} | perl -pe 's/[a-z]+$$//o')
major_ver := $(shell echo ${runtime_ver} | perl -pe 's/\..*$$//o')
minor_ver := $(shell echo ${runtime_ver} | perl -pe 's/^[^.]*\.//o')
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
ifeq ($(DEB_HOST_GNU_SYSTEM), linux)
target := $(DEB_HOST_GNU_CPU)-debian-linux-gnu
else
target := $(DEB_HOST_GNU_TYPE)
endif
# Uncomment if strip is broken
# CFLAGS := -DDEBIAN -O2
# LDFLAGS :=
CFLAGS := -DDEBIAN -O2 -g
LDFLAGS := -g
local_lpath := /etc/emacs${major_ver}:/etc/emacs
local_lpath := ${local_lpath}:/usr/local/share/emacs/${runtime_ver}/site-lisp
local_lpath := ${local_lpath}:/usr/local/share/emacs/site-lisp
local_lpath := ${local_lpath}:/usr/share/emacs/${runtime_ver}/site-lisp
local_lpath := ${local_lpath}:/usr/share/emacs/site-lisp
# This shouldn't be needed as of 20.3
local_lpath := ${local_lpath}:/usr/share/emacs/${runtime_ver}/leim
# These files are created during the build and aren't handled in any
# "make clean", so we have to handle them manually...
leim_tits := $(shell find leim -name "*.tit" -printf "%f\n")
leim_trash := $(basename ${leim_tits})
leim_trash := $(addsuffix .el,${leim_trash}) $(addsuffix .elc,${leim_trash})
# Info files that are going to show up in the main dir.
main_dir_info_files := \
info \
emacs \
efaq \
cl \
dired-x \
ediff \
pcl-cvs \
speedbar \
ada-mode \
ccmode \
ebrowse \
idlwave \
gnus \
message \
mh-e \
emacs-mime \
sc \
autotype \
eshell \
eudc \
forms \
reftex \
widget \
woman \
viper \
vip
define build_cmd
${MAKE} CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
prefix=/usr \
sharedstatedir=/var/lib \
libexecdir=/usr/lib \
infodir=/usr/share/info \
manext=.1emacs${major_ver} \
locallisppath=${local_lpath}
endef
define checkdir
test -f debian/emacs.postinst
endef
check_vars:
@echo "pwd: ${pwd}"
@echo "debian_ver: ${debian_ver}"
@echo "debian_rev: ${debian_rev}"
@echo "nominal_ver: ${nominal_ver}"
@echo "runtime_ver: ${runtime_ver}"
@echo "major_ver: ${major_ver}"
@echo "minor_ver: ${minor_ver}"
.PHONY: check_vars
# Update the automatically generated files.
# Useful before a CVS commit.
debian-sync: $(patsubst %.in,%,$(wildcard debian/*.in))
debian/% : debian/%.in debian/changelog
perl -p -e "s/\@MAJOR_VERSION\@/${major_ver}/go;" \
-e "s/\@MINOR_VERSION\@/${minor_ver}/go;" \
-e "s/\@FULL_VERSION\@/${runtime_ver}/go;" \
-e "s/\@PACKAGE_VERSION\@/${debian_ver}/go;" \
-e "s/\@DEBIAN_REV\@/${deb_rev}/go;" \
-e "s/\@NOMINAL_VERSION\@/${nominal_ver}/go;" \
> $@ < $<
debian/stamp-setup: debian/control debian/copyright debian/menu
find debian/bin -type f | xargs chmod 775
touch debian/stamp-setup
debian/stamp-configure: debian/stamp-setup
${checkdir}
# --without-gif required until libgif is updated.
CFLAGS="${CFLAGS}" ./configure ${target} \
--prefix=/usr \
--sharedstatedir=/var/lib \
--libexecdir=/usr/lib \
--localstatedir=/var/lib \
--infodir=/usr/share/info \
--mandir=/usr/share/man \
--with-pop=yes \
--with-x=yes \
--with-x-toolkit=athena \
--without-gif
# Because paths-force is called in configure, but configure
# doesn't support --locallisppath
${build_cmd} epaths-force
touch debian/stamp-configure
build: debian/stamp-build
debian/stamp-build: debian/stamp-configure
${checkdir}
# Save all the upstream files that are going to get re-generated
# so we can restore them later and avoid diff-bloat.
test -e debian/upstream-files.tar || \
(find `ls | grep -v debian` -name "*.elc" | \
tar cpf debian/upstream-files.tar.tmp --files-from - \
info lisp/cus-load.el lisp/loaddefs.el && \
mv debian/upstream-files.tar.tmp debian/upstream-files.tar)
# rebuild *everything* -- including all the .elc files.
${build_cmd} bootstrap
# This may not be needed, but shouldn't hurt.
${build_cmd}
# rebuild the info pages (in case we've changed the .texi files)
cd info && rm -f `ls | grep -v COPYING | grep -v dir | grep -v CVS`
cd man && make
touch debian/stamp-build
build-install-tree: debian/stamp-build
rm -rf debian/tmp-emacs
install -d debian/tmp-emacs
PATH=${pwd}/debian/bin/info:${PATH} ${MAKE} install \
INSTALL_STRIP="-s" \
prefix=${pwd}/debian/tmp-emacs/usr \
sharedstatedir=${pwd}/debian/tmp-emacs/var/lib \
libexecdir=${pwd}/debian/tmp-emacs/usr/lib \
infodir=${pwd}/debian/tmp-emacs/usr/share/info/emacs-${major_ver} \
mandir=${pwd}/debian/tmp-emacs/usr/share/man \
manext=.1emacs${major_ver} \
locallisppath=${local_lpath}
# Kill /usr/local dir
rm -r debian/tmp-emacs/usr/local
(cd debian/tmp-emacs/usr/bin && \
ls | grep -v emacs-${runtime_ver}) > debian/tmp-alt-list
for file in `cat debian/tmp-alt-list | grep -v 'emacs$$'`; \
do \
mv debian/tmp-emacs/usr/bin/$$file \
debian/tmp-emacs/usr/bin/$$file.emacs${major_ver}; \
done
# /usr/bin files
rm debian/tmp-emacs/usr/bin/emacs
test -f debian/tmp-emacs/usr/bin/emacs-${runtime_ver}
cd debian/tmp-emacs/usr/bin/ && \
ln -s emacs-${runtime_ver} emacs${major_ver}
# manpages
perl -pi -e "s|man1/etags\\.1|man1/etags\\.1emacs${major_ver}|" \
debian/tmp-emacs/usr/share/man/man1/ctags.1${major_ver}
find debian/tmp-emacs/usr/share/man -type f | xargs gzip -9v
# lisp path directories
install -d debian/tmp-emacs/etc/emacs${major_ver}/site-start.d
install -d debian/tmp-emacs/usr/share/emacs${major_ver}/
# The version-specific site-lisp dir, say emacs/21.1/site-lisp, needs
# to be in share/emacs21 so that as we upgrade from 21.1 to 21.2, etc.,
#add-on package bits don't get left behind.
mv debian/tmp-emacs/usr/share/emacs/${runtime_ver}/site-lisp \
debian/tmp-emacs/usr/share/emacs${major_ver}
cd debian/tmp-emacs/usr/share/emacs/${runtime_ver} && \
ln -sf ../../emacs${major_ver}/site-lisp .
.PHONY: build-install-tree
binary-indep: checkroot build-install-tree
${checkdir}
rm -rf debian/tmp-pkg-el
# emacs${major_ver}-el files (move all the .el files that have
# a corresponding .elc file to the emacs${major_ver}-el package)
install -d debian/tmp-pkg-el
(cd debian/tmp-emacs && \
find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | \
tar cpf - --files-from -) | \
(cd debian/tmp-pkg-el && tar xpf -)
install -d debian/tmp-pkg-el/usr/share/doc/emacs${major_ver}-el
cp debian/changelog \
debian/tmp-pkg-el/usr/share/doc/emacs${major_ver}-el/changelog.Debian
# Now compress before adding copyright.
find debian/tmp-pkg-el/usr/share/doc/emacs${major_ver}-el -type f | \
xargs gzip -9v
cp debian/copyright \
debian/tmp-pkg-el/usr/share/doc/emacs${major_ver}-el
# Mangle permissions to conform.
chown -R root.root debian/tmp-pkg-el
find debian/tmp-pkg-el -type d | xargs chmod 755
find debian/tmp-pkg-el -not -type d -a -not -type l | \
xargs chmod 644
install -d --mode 755 debian/tmp-pkg-el/DEBIAN
# control scripts
install -m 755 debian/emacs-el.postinst \
debian/tmp-pkg-el/DEBIAN/postinst
install -m 755 debian/emacs-el.prerm \
debian/tmp-pkg-el/DEBIAN/prerm
chmod ug+x debian/fix-debian-scripts
debian/fix-debian-scripts \
${major_ver} ${minor_ver} ${runtime_ver} ${target} \
"`cat debian/tmp-alt-list | perl -pe 's/\n/ /'`" \
'${main_dir_info_files}' \
debian/tmp-pkg-el/DEBIAN/postinst \
debian/tmp-pkg-el/DEBIAN/prerm
dpkg-gencontrol -isp -pemacs${major_ver}-el -Pdebian/tmp-pkg-el
dpkg --build debian/tmp-pkg-el ..
binary-arch: checkroot build-install-tree
${checkdir}
rm -rf debian/tmp-pkg
mv debian/tmp-emacs debian/tmp-pkg
(cd debian/tmp-pkg && \
find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | xargs rm)
# This is a duplicate of the file in emacs21/site-lisp
rm debian/tmp-pkg/usr/share/emacs/site-lisp/subdirs.el
# /usr/share/doc/emacs${major_ver} directory
install -d debian/tmp-pkg/usr/share/doc/emacs${major_ver}
cp README BUGS debian/tmp-pkg/usr/share/doc/emacs${major_ver}
cp ChangeLog debian/tmp-pkg/usr/share/doc/emacs${major_ver}/changelog
cp debian/changelog \
debian/tmp-pkg/usr/share/doc/emacs${major_ver}/changelog.Debian
cp debian/README \
debian/tmp-pkg/usr/share/doc/emacs${major_ver}/README.Debian
cp debian/README.add-on-package-maintainers \
debian/tmp-pkg/usr/share/doc/emacs${major_ver}
find debian/tmp-pkg/usr/share/doc/emacs${major_ver} -type f | xargs gzip -9v
cp debian/copyright debian/tmp-pkg/usr/share/doc/emacs${major_ver}
(cd debian/tmp-pkg/usr/share/doc/emacs${major_ver} && \
ln -s ../../../share/emacs/${runtime_ver}/etc .)
# info files
# Mangle menu entries for subdir.
chmod 755 debian/mangle-info
$(foreach f, ${main_dir_info_files}, \
DEBIAN_INFO_PREFIX=emacs-${major_ver} \
debian/mangle-info \
debian/tmp-pkg/usr/share/info/emacs-${major_ver}/$f;)
# Get rid of unwanted dir file.
rm debian/tmp-pkg/usr/share/info/emacs-${major_ver}/dir
# compress
find debian/tmp-pkg/usr/share/info -type f | xargs gzip -9v
# menu items
install -d debian/tmp-pkg/usr/lib/menu
cp debian/menu debian/tmp-pkg/usr/lib/menu/emacs${major_ver}
cp debian/gnu-32x32.xpm \
debian/tmp-pkg/usr/share/emacs/${runtime_ver}/etc/gnu-32x32.xpm
# Mangle permissions to conform.
chown -R root.root debian/tmp-pkg
find debian/tmp-pkg -type d | xargs chmod 755
find debian/tmp-pkg -not -type d -a -not -type l | xargs chmod 644
find debian/tmp-pkg/usr/lib/emacs/${runtime_ver}/${target}/ \
-type f -not -name "*.el" | xargs chmod 755
chmod 755 debian/tmp-pkg/usr/bin/*
# control scripts
install -d debian/tmp-pkg/DEBIAN
install -m 755 debian/emacs.preinst debian/tmp-pkg/DEBIAN/preinst
install -m 755 debian/emacs.postinst debian/tmp-pkg/DEBIAN/postinst
install -m 755 debian/emacs.prerm debian/tmp-pkg/DEBIAN/prerm
install -m 755 debian/emacs.postrm debian/tmp-pkg/DEBIAN/postrm
chmod ug+x debian/fix-debian-scripts
debian/fix-debian-scripts \
${major_ver} ${minor_ver} ${runtime_ver} ${target} \
"`cat debian/tmp-alt-list | perl -pe 's/\n/ /'`" \
'${main_dir_info_files}' \
debian/tmp-pkg/DEBIAN/preinst \
debian/tmp-pkg/DEBIAN/postinst \
debian/tmp-pkg/DEBIAN/prerm \
debian/tmp-pkg/DEBIAN/postrm
dpkg-shlibdeps debian/tmp-pkg/usr/bin/* \
`find debian/tmp-pkg/usr/lib/emacs/${runtime_ver}/${target}/ \
-type f -perm +u=x`
# Set up movemail (after dpkg-shlibdeps to avoid fakeroot sgid problem).
chown root \
debian/tmp-pkg/usr/lib/emacs/${runtime_ver}/${target}/movemail
chgrp mail \
debian/tmp-pkg/usr/lib/emacs/${runtime_ver}/${target}/movemail
chmod g+s \
debian/tmp-pkg/usr/lib/emacs/${runtime_ver}/${target}/movemail
dpkg-gencontrol -isp -pemacs${major_ver} -Pdebian/tmp-pkg
dpkg --build debian/tmp-pkg ..
clean:
${checkdir}
# For some reason the leim distclean target doesn't clean, so we do one,
# then the other. Shouldn't hurt...
-${MAKE} clean
-${MAKE} distclean
# This has to come after because we need to restore the .elc files
# that got cleaned above.
if test -e debian/upstream-files.tar; \
then \
rm -rf info/*; \
find -name "*.elc" | xargs rm; \
tar xpf debian/upstream-files.tar && rm -f debian/upstream-files.tar; \
fi
rm -f debian/upstream-files.tar.tmp
rm -f debian/stamp-* debian/substvars
find -name '*~' | xargs --no-run-if-empty rm -f
-rm -rf \
debian/tmp-emacs \
debian/tmp-pkg \
debian/tmp-pkg-el \
debian/tmp-alt-list \
debian/files* \
config.log \
core \
man/Makefile
# Below here is fairly generic really
binary: binary-indep binary-arch
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
checkroot:
${checkdir}
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot
# Local variables:
# mode: makefile
# End:
|