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 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908
|
#!/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 1998-2005 Rob Browning <rlb@defaultvalue.org>
# Copyright 2004-2005 Jrme Marant <jerome@debian.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.
# TODO:
#
# Figure out what happened to fns-*.elc
# Should we set defaults for things like xsupport at the top here?
# Deal with build_binary_pkg and continue integration.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
SHELL := /bin/bash
quilt := QUILT_PATCHES=debian/patches quilt
deb_trash :=
# 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". With the original upstream source that's somewhat tricky
# because they ship the .elc files, but we need to re-build them when
# we patch the corresponding .el files. This is further complicated
# by the fact that any of these .el files may have macros, and if
# those are changed, then any other .el files that use those macros
# must also be recompiled. Over the years, we've tried various ways
# to handle this problem, originally by trying to keep track of which
# files need to be recompiled and only recompiling those, then later
# by just re-building all the .elc files with "make bootstrap". In
# either case, if you don't want to have diff bloat, you have to do
# something to keep track of the original .elc files so you can
# restore them during make clean.
# All of this was a lot of work, and was using quite a bit of
# unnecessary storage both in the .orig.tar.gz and during the package
# build. So in order to avoid this, and to dramatically simplify
# things, we now just remove the .elc files from the upstream
# distribution whenever we create the debian .orig.tar.gz file for a
# given upstream release. Since were always clobbering all of the
# .elc files during the package build anyway, this shouldn't be any
# great loss, and it also means that "debian/rules clean" now needs to
# be little more than a "make distclean" followed by a purge of all
# the remaining .elc files.
# NOTE -- emacs doesn't respect .elc files in VPATH build. They're
# modified in srcdir, not builddir. We don't worry about this because
# it shouldn't affect our builds ATM, but if we ever have more than
# one emacs configuration which could produce differing .elc files,
# we'll need to be careful. We'll probably have to build completely
# separate packages from completely separate source trees.
# In order to keep the autofiles up to date, but avoid any alterations
# outside of ./debian, we keep the changes made by running a new
# autoconf, etc. in patches/autofiles.diff. This patch can be
# automatically regenerated by running "debian/rules autofiles-sync",
# and this patch should always be maintained as the last one in the
# patch series.
# Note that we use quilt to handle the debian patches. One of the
# biggest differences between quilt and say dpatch is that you have to
# explicitly "quilt add" a file to a patch before you edit it. See
# "man quilt" for details..
# If the source tree ever ends up in an untenable "can't go forward,
# can't go back" state with respect to patching, you can always start
# over by just moving the current debian directory to a newly unpacked
# orig.tar.gz tree. Note that f you were in the process of editing a
# patch, you will lose those edits, but shouldn't lose anything else.
# This process just reverts all of the upstream files and abandons the
# volatile "what's been done to the current tree" state that quilt
# maintains in ./.pc. All of the actual patches are stored in
# debian/patches and should be unharmed.
######################################################################
# Important top-level targets:
#
# check-vars - displays how the version number has been parsed.
# buildpackage - build binary packages via dpkg-buildpackage w/suitable args
# prepare-release - prepare and check debs for upload.
# autofiles-sync - force a new autofiles.diff to be generated.
#
######################################################################
# The name of the Debian source package
src_name := $(shell dpkg-parsechangelog | egrep '^Source:')
src_name := $(shell echo $(src_name) | perl -pe 's/Source:\s+//o')
# 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')
# The official upstream version defined by emacs-version in lisp/version.el.
# The extraction method matches the code in the upstream configure.in.
nominal_ver := $(shell grep 'defconst[ ]*emacs-version' lisp/version.el \
| sed -e 's/^[^"]*"\([^"]*\)".*$$/\1/')
# 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 sometimes we may have to 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')
# version for the debian source, i.e. if the upstream is 21.3, this
# might be 21.3, or it might be 21.3+1 if we've had to have more than
# one re-release of the upstream source. Rare, but it happens...
# Always everything before the last '-'
debsrc_ver := $(shell echo $(debian_ver) | perl -pe 's/-[^-]+$$//o')
# upstream version - the actual upstream version, i.e. 21.4a, minus any +foo
upstream_ver := $(shell echo $(debsrc_ver) | perl -pe 's/\+[^+]+$$//o')
deb_orig_tgz := $(src_name)_$(debsrc_ver).orig.tar.gz
# name of the orig_tgz unpack directory
deb_orig_tgz_dir := emacs-$(runtime_ver)
######################################################################
# Customizable variables
# May differ from emacs version, i.e. 21.4 instead of 21.4a.
upstream_leim_ver := 21.4
# The flavor (i.e. emacs21) currently matches the source package name.
flavor := $(src_name)
bin_priority := 24
######################################################################
# Should these be exported like this (as autotools-dev recommends for
# the two vars below) or not?
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
# As recommended by /usr/share/doc/autotools-dev/README.Debian.gz.
# Handle cross-compiling and don't make ./configure guess.
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
LDFLAGS := -g
CFLAGS := -DDEBIAN -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else # not noopt
ifeq (m68k,$(DEB_HOST_ARCH))
# fix problem with newer versions of gcc on m68k
# -O2 causes a build failure (broken byte compiler)
CFLAGS += -O1
else # neq (m68k,$(DEB_HOST_ARCH))
CFLAGS += -O2
endif # neq (m68k,$(DEB_HOST_ARCH))
endif # not noopt
target := $(DEB_HOST_GNU_TYPE)
movemail_bin := usr/lib/emacs/$(runtime_ver)/$(target)/movemail
# These files may be modified in the *source* tree during the build.
# Wonder if we could patch emacs to copy/use these files to/from the
# build tree...
protected_files := config.sub config.guess lisp/loaddefs.el
# Info files that are going to show up in the main dir.
main_dir_info_files := \
dired-x \
efaq
# These files must always exist, i.e. can't ever be cleaned.
persistent_autogen_files := debian/control debian/copyright
nonpersistent_autogen_files := debian/$(flavor)-common.README.Debian
debpkgfiles := $(persistent_autogen_files) $(nonpersistent_autogen_files)
# Build directories
pkgdir_common := $(CURDIR)/debian/$(flavor)-common
pkgdir_bin_common := $(CURDIR)/debian/$(flavor)-bin-common
pkgdir_x := $(CURDIR)/debian/$(flavor)
pkgdir_nox := $(CURDIR)/debian/$(flavor)-nox
pkgdir_el := $(CURDIR)/debian/$(flavor)-el
local_lpath := /etc/$(flavor):/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
define checkroot
test root = "`whoami`"
endef
define checkdir
@if ! test -s debian/patches/autofiles.diff; \
then \
echo; \
echo "The Debian autofiles patch is not available."; \
echo "Please run this command:"; \
echo " debian/rules autofiles-sync"; \
echo; \
false; \
fi
dpkg-parsechangelog > /dev/null
dh_testdir debian/emacsVER.postinst
@if ! test -f src/emacs.c; \
then \
echo; \
echo -n "The upstream source does not appear to be available."; \
echo " Please put the contents"; \
echo -n "of $(deb_orig_tgz) into the"; \
echo " current directory."; \
echo; \
false; \
fi
endef
define build_cmd
$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
prefix=/usr \
sharedstatedir=/var/lib \
libexecdir=/usr/lib \
infodir=/usr/share/info \
manext=.1$(flavor) \
locallisppath=$(local_lpath)
endef
emacs_inst = (cd debian/$(1) && \
PATH=$(CURDIR)/debian/bin/info:$(PATH) $(MAKE) install \
debepkgdir=$(2) \
prefix=$(2)/usr \
sharedstatedir=$(2)/var/lib \
libexecdir=$(2)/usr/lib \
infodir=$(2)/usr/share/info/emacs-$(major_ver) \
mandir=$(2)/usr/share/man \
manext=.1$(flavor) \
locallisppath=$(local_lpath))
define patch
cd etc && uudecode $(CURDIR)/debian/replacement/yow.lines.uu
$(quilt) push -a
endef
define unpatch
test -z "$$($(quilt) applied)" || $(quilt) pop -a
rm -f etc/yow.lines
rm -f debian/stamp/patch
rm -rf .pc
endef
define cleanup_all
# distclean goes first so we clean using patched code
rm -f debian/stamp/setup
rm -f debian/stamp/{configure,configure-x,configure-nox}
rm -f debian/stamp/build
-$(MAKE) distclean
cd info && rm -f $$(ls | grep -v COPYING)
dh_clean
$(unpatch)
# now clean up bits in the source tree that the above didn't handle
find -name "*.elc" | xargs --no-run-if-empty rm
if [ -e debian/protected-files.tgz ]; then \
tar xzpf debian/protected-files.tgz; \
fi
rm -f debian/protected-files.tgz
# now clean up everything else (mostly ./debian related stuff)
find -name '*~' | xargs --no-run-if-empty rm -f
rm -f debian/substvars
rm -f $(nonpersistent_autogen_files)
rm -rf \
debian/build-x \
debian/build-nox \
debian/tmp-alt-list \
debian/files*
rm -rf debian/*.tmp
rm -rf $(deb_trash)
rm -rf .pc
test ! -e debian/stamp || rmdir debian/stamp
endef
define update_debian_autofiles_quilt
$(cleanup_all)
# Make sure autofiles.diff exists, otherwise patching will fail.
if ! test -e debian/patches/autofiles.diff; \
then \
touch debian/patches/autofiles.diff; \
fi;
$(patch)
test "$$($(quilt) top)" = autofiles.diff
$(quilt) pop
mkdir -p debian/tmp-autofiles/old
tar cpSf - --exclude ./debian --exclude ./.pc . \
| tar -C debian/tmp-autofiles/old -xpSf -
cp -a debian/tmp-autofiles/old debian/tmp-autofiles/new
# rm aclocal.m4 so it doesn't confuse newer autoconfs, but touch it
# so ./Makefile won't be upset if it's not recreated (b/c not needed).
cd debian/tmp-autofiles/new && rm -f aclocal.m4
cd debian/tmp-autofiles/new && touch aclocal.m4
cd debian/tmp-autofiles/new && aclocal
cd debian/tmp-autofiles/new && autoconf
cd debian/tmp-autofiles/new && rm -rf autom4te.cache
cd debian/tmp-autofiles && diff -ruN old new > new.diff; \
test $$? -eq 1
$(quilt) import -f -P autofiles.diff debian/tmp-autofiles/new.diff
$(quilt) header -r autofiles.diff < debian/autofiles-diff-header
$(patch)
$(cleanup_all)
endef
deb_trash += debian/tmp-autofiles
# If we ever need it, we can create a copy that doesn't assume ./debian/
define deb_sub
perl -p \
-e "s|\@PKG_NAME\@|$(pkg_name)|go;" \
-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;" \
-e "s|\@UPSTREAM_VERSION\@|$(upstream_ver)|go;" \
-e "s|\@UPSTREAM_LEIM_VERSION\@|$(upstream_leim_ver)|go;" \
-e "s|\@DEBSRC_VERSION\@|$(debsrc_ver)|go;" \
-e "s|\@DEB_FLAVOR\@|$(flavor)|go;" \
-e "s|\@INFOFILES\@|$(main_dir_info_files)|go;" \
-e "s|\@X_SUPPORT\@|$(xsupport)|go;" \
-e "s|\@BIN_PRIORITY\@|$(bin_priority)|go;" \
-e "s|\@MOVEMAIL_BIN\@|$(movemail_bin)|go;" \
< debian/$(1) > debian/$(2)
endef
check-vars:
@echo "upstream_ver: $(upstream_ver)"
@echo "debian_ver: $(debian_ver)"
@echo "debsrc_ver: $(debsrc_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
.PHONY: check-diff
check-diff: clean
$(checkdir)
test -r ../$(deb_orig_tgz)
rm -rf debian/tmp-diff && mkdir debian/tmp-diff
cd debian/tmp-diff && tar xzpSf ../../../$(deb_orig_tgz)
cd debian/tmp-diff && mv $(deb_orig_tgz_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 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
buildpackage:
$(checkdir)
dpkg-buildpackage -D -us -uc -rfakeroot -i'\.git|\.pc'
.PHONY: buildpackage
prepare-release:
$(checkdir)
# don't want to be root -- using fakeroot below.
# also, stacking fakeroots seems to cause trouble generating diff.
@test "`whoami`" != root || \
(echo "please run prepare-release as a normal user (not root)"; \
false)
# check for any uncommitted changes
@if test $$(cd debian && git-diff-files | wc -c) -ne 0; \
then \
read -p "Uncommitted changes. Continue? [y/n] "; \
if test "$${REPLY}" != y; \
then \
false; \
fi; \
fi
# TODO: make sure we actually installed the binary.
# TODO: run tests (use a check target?)
@read -p "Regenerate autofiles.diff? [y/n] "; \
if test "$${REPLY}" == y; \
then \
$(MAKE) -f debian/rules autofiles-sync; \
else \
true; \
fi
$(MAKE) -f debian/rules clean
$(MAKE) -f debian/rules buildpackage
test -f ../$(src_name)_$(debian_ver).diff.gz
@if [ $$(zgrep '^---' \
../$(src_name)_$(debian_ver).diff.gz \
| grep -v /debian/ | wc -c) -ne 0 ]; \
then \
echo "Diffs outside debian/ found, please fix and retry."; \
echo "This probably means either something wasn't cleaned"; \
echo "properly, or you need to do some work in debian/patches."; \
false; \
else \
echo "Everything looks OK. Ready for release."; \
echo "Don't forget to run debsign if needed."; \
fi
.PHONY: prepare-release
# we don't sync this automatically on clean because it's expensive and
# should only be done by a maintainer with time to deal with any mess
# it might create.
autofiles-sync:
$(update_debian_autofiles_quilt)
.PHONY: autofiles-sync
debian-sync: $(persistent_autogen_files)
.PHONY: force-debian-sync debian-sync
debian/$(flavor)-common.README.Debian: \
debian/emacsVER-common.README debian/patches/*.diff debian/patches/series
cd debian && \
csplit -s -f emacsVER-common.README. \
emacsVER-common.README '/@@PATCH_LIST_HERE@@/'
cp debian/emacsVER-common.README.00 debian/emacsVER-common.README.tmp
for p in $$($(quilt) series); do $(quilt) header $$p; done \
>> debian/emacsVER-common.README.tmp
tail -n +2 \
< debian/emacsVER-common.README.01 \
>> debian/emacsVER-common.README.tmp
mv debian/emacsVER-common.README.tmp $@
deb_trash += debian/emacsVER-common.README.tmp
deb_trash += debian/emacsVER-common.README.00
deb_trash += debian/emacsVER-common.README.01
debian/%: debian/%.in debian/changelog
$(call deb_sub,$(notdir $<),$(notdir $@))
debian/protected-files.tgz:
tar czpSf debian/protected-files.tgz.tmp $(protected_files)
mv debian/protected-files.tgz.tmp $@
debian/stamp/patch: debian/protected-files.tgz
$(checkdir)
$(patch)
# Work around quilt's use of patch -E.
# This will have to be changed if/when upstream changes aclocal.m4 use.
touch --reference configure.in aclocal.m4
mkdir -p $(dir $@) && touch $@
debian/stamp/setup: debian/stamp/patch
$(checkdir)
cp /usr/share/misc/config.sub .
cp /usr/share/misc/config.guess .
find debian/bin -type f | xargs chmod 775
mkdir -p $(dir $@) && touch $@
confflags += --prefix=/usr
confflags += --sharedstatedir=/var/lib
confflags += --libexecdir=/usr/lib
confflags += --localstatedir=/var/lib
confflags += --infodir=/usr/share/info
confflags += --mandir=/usr/share/man
confflags += --with-pop=yes
configure: debian/stamp/configure
.PHONY: configure
debian/stamp/configure: debian/stamp/configure-x debian/stamp/configure-nox
mkdir -p debian/stamp && touch $@
debian/stamp/configure-x: confflags += --with-x=yes
debian/stamp/configure-x: confflags += --with-x-toolkit=athena
debian/stamp/configure-x: BUILDDIR := debian/build-x
# For those who prefer the old-style non-toolkit scrollbars, just
# uncomment this line, and re-build. The resulting emacsXY package
# will have the old scrollbars.
#
#debian/stamp/configure-x: confflags += --without-toolkit-scroll-bars
debian/stamp/configure-nox: confflags += --with-x=no
debian/stamp/configure-nox: BUILDDIR := debian/build-nox
debian/stamp/configure-%: debian/stamp/setup
$(checkdir)
rm -rf $(BUILDDIR)
mkdir $(BUILDDIR)
cd $(BUILDDIR) && CFLAGS="$(CFLAGS)" ../../configure $(confflags)
# Because paths-force is called in configure, but configure
# doesn't support --locallisppath (do we still need this?)
(cd $(BUILDDIR) && $(build_cmd) epaths-force)
mkdir -p debian/stamp && touch $@
build: debian/stamp/build
.PHONY: build
debian/stamp/build: debian/stamp/configure
$(checkdir)
cd debian/build-x && $(build_cmd)
cd debian/build-nox && $(build_cmd)
# # rebuild the info pages (in case we've changed the .texi files)
# cd debian/build-nox/info && \
# rm -f `ls | grep -v COPYING | grep -v dir | grep -v CVS`
# cd debian/build-nox/man && make
mkdir -p debian/stamp && touch $@
define debinst_indep
dh_testdir -p$(1)
dh_testroot -p$(1)
dh_installchangelogs -p$(1)
dh_installdocs -p$(1)
dh_link -p$(1)
dh_strip -p$(1)
dh_compress -p$(1)
dh_fixperms -p$(1)
dh_installdeb -p$(1)
dh_shlibdeps -p$(1)
dh_gencontrol -p$(1)
dh_md5sums -p$(1)
dh_builddeb -p$(1)
endef
define debinst_bin
$(checkdir)
dh_testdir -p$(1)
dh_testroot -p$(1)
dh_installinfo -p$(1)
# handle http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337215
perl -wpi -e 's/\\Q//gmo; s/\\E//gmo' debian/$(1).postinst.debhelper
dh_installman -p$(1)
dh_installchangelogs -p$(1)
dh_installdocs -p$(1)
dh_installexamples -p$(1)
# dh_install -p$(1)
dh_installmenu -p$(1)
dh_link -p$(1)
dh_strip -p$(1)
dh_compress -p$(1)
dh_fixperms -p$(1) -X$(movemail_bin)
dh_installdeb -p$(1)
dh_shlibdeps -p$(1)
dh_gencontrol -p$(1)
dh_md5sums -p$(1)
dh_builddeb -p$(1)
endef
##################################################
# emacs
.PHONY: binary-dummy
binary-dummy: pkg_name := emacs
binary-dummy: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
$(call debinst_indep,$(pkg_name))
##################################################
# emacsXY-el
.PHONY: binary-el
binary-el: pkg_name := $(flavor)-el
binary-el: xsupport := x
binary-el: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
rm -rf $(pkgdir_el) $(pkgdir_el).tmp
$(call emacs_inst,build-x,$(pkgdir_el).tmp)
# $(flavor)-el files (move all the .el files that have
# a corresponding .elc file to the $(flavor)-el package)
install -d $(pkgdir_el)
(cd $(pkgdir_el).tmp && \
find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | \
tar cpf - --files-from -) | \
(cd $(pkgdir_el) && tar xpf -)
rm -rf $(pkgdir_el).tmp
$(call deb_sub,emacsVER-el.prerm,$(flavor)-el.prerm)
$(call debinst_indep,$(flavor)-el)
deb_trash += debian/$(flavor)-el.prerm
##################################################
# emacsXY-common
.PHONY: binary-common
binary-common: pkg_name := $(flavor)-common
binary-common: xsupport := x
binary-common: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
rm -rf $(pkgdir_common)
install -d $(pkgdir_common)
$(call emacs_inst,build-x,$(pkgdir_common))
rm -f debian/$(flavor)-common.links
# remove stuff that should only be in the binary packages
rm $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/DOC-$(runtime_ver).1
rm -r $(pkgdir_common)/usr/bin
rm -r $(pkgdir_common)/usr/lib
# make sure /usr/local dir doesn't exist in pkg.
rmdir $(pkgdir_common)/usr/local/share/emacs/site-lisp
rmdir $(pkgdir_common)/usr/local/share/emacs/$(runtime_ver)/site-lisp
rmdir $(pkgdir_common)/usr/local/share/emacs/$(runtime_ver)
rmdir $(pkgdir_common)/usr/local/share/emacs
rmdir $(pkgdir_common)/usr/local/share
rmdir $(pkgdir_common)/usr/local
# So any test pkgs I build from CVS will be OK -- emacs' build system
# accidentally installs CVS dirs in a few places.
rm -rf $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/leim/ja-dic/CVS
rm -rf $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/leim/quail/CVS
# manpages
install -m 0644 etc/emacsclient.1 \
$(pkgdir_common)/usr/share/man/man1/emacsclient.1$(flavor)
perl -pi -e "s|man1/etags\\.1|man1/etags\\.1$(flavor)|" \
$(pkgdir_common)/usr/share/man/man1/ctags.1$(flavor)
find $(pkgdir_common)/usr/share/man -type f | xargs gzip -9v
# lisp path directories
install -d $(pkgdir_common)/etc/$(flavor)/site-start.d
install -d $(pkgdir_common)/usr/share/$(flavor)/
# The version-specific site-lisp dir, say emacs/21.1/site-lisp, needs
# to be in share/$(flavor) so that as we upgrade from 21.1 to 21.2, etc.,
# add-on package bits don't get left behind.
mv $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/site-lisp \
$(pkgdir_common)/usr/share/$(flavor)
echo \
usr/share/$(flavor)/site-lisp \
usr/share/emacs/$(runtime_ver)/site-lisp \
>> debian/$(flavor)-common.links
cd $(pkgdir_common) && \
find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | xargs rm
# This is a duplicate of the file in $(flavor)/site-lisp
rm $(pkgdir_common)/usr/share/emacs/site-lisp/subdirs.el
install -d $(pkgdir_common)/usr/share/doc/$(flavor)-common
echo \
usr/share/emacs/$(runtime_ver)/etc \
usr/share/doc/$(flavor)-common/etc \
>> debian/$(flavor)-common.links
cp debian/gnu-32x32.xpm \
$(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/gnu-32x32.xpm
# info files
# Mangle menu entries for subdir.
chmod 755 debian/mangle-info
for f in $(main_dir_info_files); \
do \
DEBIAN_INFO_PREFIX=emacs-$(major_ver) \
debian/mangle-info \
$(pkgdir_common)/usr/share/info/emacs-$(major_ver)/$$f; \
done
# Install replacements for non-free files that can be reached
# through C-h
for f in DISTRIB THE-GNU-PROJECT ; do \
sed -e "s/@FILE@/$$f/g" \
-e "s/@MAJOR_VERSION@/$(major_ver)/g" \
$(CURDIR)/debian/missing-file.dfsg > \
$(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/$$f.dfsg ; \
done
$(call deb_sub,emacsVER-common.docs,$(flavor)-common.docs)
$(call deb_sub,emacsVER-common.postinst,$(flavor)-common.postinst)
$(call deb_sub,emacsVER-common.prerm,$(flavor)-common.prerm)
$(call debinst_indep,$(flavor)-common)
deb_trash += debian/$(flavor)-common.docs
deb_trash += debian/$(flavor)-common.links
deb_trash += debian/$(flavor)-common.postinst
deb_trash += debian/$(flavor)-common.prerm
define build_binary_pkg
rm -f debian/$(pkg_name).links
install -d debian/$(pkgdir)
install -d debian/$(pkgdir)/usr/bin/
mv debian/$(pkgdir).tmp/usr/bin/emacs-* \
debian/$(pkgdir)/usr/bin/emacs$(major_ver)-$(xsupport)
echo \
usr/bin/emacs$(major_ver)-$(xsupport) \
usr/bin/$(flavor) \
>> debian/$(pkg_name).links
install -d debian/$(pkgdir)/usr/share/emacs/$(runtime_ver)/etc/
mv \
debian/$(pkgdir).tmp/usr/share/emacs/$(runtime_ver)/etc/DOC-$(runtime_ver).1 \
debian/$(pkgdir)/usr/share/emacs/$(runtime_ver)/etc/
# move files to the build directory
install -d debian/$(pkgdir)/usr/lib/emacs/$(runtime_ver)/$(target)/
mv debian/$(pkgdir).tmp/usr/lib/emacs/$(runtime_ver)/$(target)/fns-*.el \
debian/$(pkgdir)/usr/lib/emacs/$(runtime_ver)/$(target)/
# rename fns-*.el and elc files
cd debian/$(pkgdir)/usr/lib/emacs/$(runtime_ver)/$(target)/ \
&& test `ls fns-*.el | wc -l` -eq 1 \
&& mv fns-*.el \
`echo fns-*.el | perl -pe 's/^fns-(.*)\.el$$/fns-$$1-$(xsupport).el/ or die;'`
# cd debian/$(pkgdir)/usr/lib/emacs/$(runtime_ver)/$(target)/ \
# && test `ls fns-*.elc | wc -l` -eq 1 \
# && mv fns-*.elc \
# `echo fns-*.elc | perl -pe 's/^fns-(.*)\.elc$$/fns-$$1-$(xsupport).elc/ or die;'`
rm -rf debian/$(pkgdir).tmp
# /usr/bin files
test -f debian/$(pkgdir)/usr/bin/emacs$(major_ver)-$(xsupport)
# Can this just be a symlink to the emacsXY-common's doc dir?
# /usr/share/doc/emacs$(major_ver) directory
install -d debian/$(pkgdir)/usr/share/doc/$(pkg_name)
$(call deb_sub,emacsVER.README,$(pkg_name).README.Debian)
$(call deb_sub,emacsVER.menu,$(pkg_name).menu)
$(call deb_sub,emacsVER.postinst,$(pkg_name).postinst)
$(call deb_sub,emacsVER.prerm,$(pkg_name).prerm)
$(call deb_sub,emacsVER.postrm,$(pkg_name).postrm)
# FIXME: this is wrong for -nox
$(call deb_sub,emacsVER.desktop,$(pkg_name).desktop)
if test "$(xsupport)" = x; \
then \
install -d debian/$(pkgdir)/usr/share/applications; \
install -m 0644 debian/emacs$(major_ver).desktop \
debian/$(pkgdir)/usr/share/applications; \
fi
$(call debinst_bin,$(pkg_name))
endef
# Would it be better if we were just explicit here?
define binpkg_trash
$(addprefix debian/$(1),.README.Debian .desktop .links .menu \
.postinst .prerm .postrm)
endef
deb_trash += $(call binpkg_trash,$(flavor))
deb_trash += $(call binpkg_trash,$(flavor)-nox)
##################################################
# emacsXY-nox
# We install, grab the bits we need, and then delete the tree
# to save diskspace. (Do we actually need to run install -- can we
# grab the files from the build tree instead?)
.PHONY: binary-nox
binary-nox: pkg_name := $(flavor)-nox
binary-nox: pkgdir := $(flavor)-nox
binary-nox: xsupport := nox
binary-nox: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
rm -rf debian/$(pkgdir) debian/$(pkgdir).tmp
$(call emacs_inst,build-nox,$(CURDIR)/debian/$(pkgdir).tmp)
$(build_binary_pkg)
##################################################
# emacsXY
# We install, grab the bits we need, and then delete the tree
# to save diskspace. (Do we actually need to run install -- can we
# grab the files from the build tree instead?)
.PHONY: binary-x
binary-x: pkg_name := $(flavor)
binary-x: pkgdir := $(flavor)
binary-x: xsupport := x
binary-x: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
rm -rf debian/$(pkgdir) debian/$(pkgdir).tmp
$(call emacs_inst,build-x,$(CURDIR)/debian/$(pkgdir).tmp)
$(build_binary_pkg)
##################################################
# emacsXY-bin-common
.PHONY: binary-bin-common
binary-bin-common: pkg_name := $(flavor)-bin-common
binary-bin-common: pkgdir := $(flavor)-bin-common
binary-bin-common: debian/stamp/build $(debpkgfiles)
$(checkroot)
$(checkdir)
dh_clean -k
rm -rf debian/$(pkgdir) debian/$(pkgdir).tmp
$(call emacs_inst,build-x,$(CURDIR)/debian/$(pkgdir).tmp)
install -d debian/$(pkgdir)
install -d debian/$(pkgdir)/usr
mv debian/$(pkgdir).tmp/usr/bin debian/$(pkgdir)/usr/
mv debian/$(pkgdir).tmp/usr/lib debian/$(pkgdir)/usr/
rm -rf debian/$(pkgdir).tmp
# remove stuff that should only be in the binary packages
# make sure it's only one file
test -f debian/$(pkgdir)/usr/bin/emacs-*
rm debian/$(pkgdir)/usr/bin/emacs-*
rm debian/$(pkgdir)/usr/bin/emacs
cd debian/$(pkgdir)/usr/lib/emacs/$(runtime_ver)/$(target)/ \
&& test `ls fns-*.el | wc -l | cut -d ' ' -f 1` -eq 1 \
&& rm fns-*.el
cd debian/$(pkgdir)/usr/bin && ls > ../../../tmp-alt-list
for file in `cat debian/tmp-alt-list | grep -v 'emacs$$'`; \
do \
mv debian/$(pkgdir)/usr/bin/$${file} \
debian/$(pkgdir)/usr/bin/$${file}.$(flavor); \
done
# /usr/share/doc/$(flavor) directory
install -d debian/$(pkgdir)/usr/share/doc/$(flavor)-bin-common/
$(call deb_sub,emacsVER.README,$(pkg_name).README.Debian)
$(call deb_sub,emacsVER-bin-common.postinst,$(pkg_name).postinst)
$(call deb_sub,emacsVER-bin-common.prerm,$(pkg_name).prerm)
$(call deb_sub,emacsVER-bin-common.postrm,$(pkg_name).postrm)
perl -pi -e 's/\n/ /gmo;' debian/tmp-alt-list
perl -w -p -i \
-e "s|\@ALTERNATIVES\@|`cat debian/tmp-alt-list`|go;" \
\
debian/$(pkg_name).postinst \
debian/$(pkg_name).prerm \
debian/$(pkg_name).postrm
# Set up movemail (after dpkg-shlibdeps to avoid fakeroot sgid problem)
chown root.mail debian/$(pkgdir)/$(movemail_bin)
chmod g+s debian/$(pkgdir)/$(movemail_bin)
$(call debinst_bin,$(pkg_name))
deb_trash += debian/$(flavor)-bin-common.README.Debian
deb_trash += debian/$(flavor)-bin-common.postinst
deb_trash += debian/$(flavor)-bin-common.prerm
deb_trash += debian/$(flavor)-bin-common.postrm
binary-indep: binary-dummy binary-el binary-common
binary-arch: binary-x binary-nox binary-bin-common
binary: binary-indep binary-arch
clean: debian-sync
$(checkdir)
$(cleanup_all)
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
.PHONY: binary binary-arch binary-indep clean
|