rules 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. #!/usr/bin/make -f
  2. # -*- makefile -*-
  3. # This file is licensed under the terms of the Gnu Public License.
  4. # With the one additional provision that Ian Jackson's name may not be
  5. # removed from the file.
  6. # Copyright 1994,1995 Ian Jackson
  7. # Copyright 2004-2005 Jérôme Marant <jerome@debian.org>
  8. # Copyright 1998-2012 Rob Browning <rlb@defaultvalue.org>
  9. # Originally copied from the GNU Hello Debian rules file (1.3).
  10. # Modified for emacs by Mark Eichin <eichin@kitten.gen.ma.us>.
  11. # Debhelper support added via one of Joey Hess' example files.
  12. # See the debian/changelog for further historical information.
  13. # Uncomment this to turn on verbose mode.
  14. #export DH_VERBOSE=1
  15. SHELL := /bin/bash
  16. quilt := QUILT_PATCHES=debian/patches quilt
  17. pf := set -o pipefail
  18. # This package uses debian/source/format 3.0 (quilt).
  19. # For now we assume that emacs' versioning scheme is always
  20. # MAJOR.MINORtinyrev where MAJOR and MINOR are integers and tinyrev is
  21. # an optional lowercase letter (or letters). We also assume that
  22. # upstream uses a numbering scheme that sorts in a "Debian friendly"
  23. # way. So far that's always been true. If it becomes false, some of
  24. # the values below will have to be set manually.
  25. # (You might imagine that a VPATH build would allow us to avoid having
  26. # to copy the entire source tree for each of the three builds, but it
  27. # turns out that without additional complexity, VPATH builds will
  28. # cause diff bloat. That's because the emacs build process doesn't
  29. # completely respect the .elc files; some are modified in srcdir, not
  30. # builddir.)
  31. # The official upstream version defined by AC_INIT in configure.in.
  32. upstream_ver := 24.2
  33. # This must be the version that's actually used at runtime for things
  34. # like load-path. It may not be the same as the upstream version
  35. # (i.e. when you have upstream 20.5a, the functional version may still
  36. # be 20.5), so sometimes we may have to do this by hand.
  37. runtime_ver := $(shell $(pf); echo $(upstream_ver) | perl -pe 's/[a-z]+$$//o')
  38. major_ver := $(shell $(pf); echo $(runtime_ver) | perl -pe 's/\..*$$//o')
  39. minor_ver := $(shell $(pf); echo $(runtime_ver) | perl -pe 's/^[^.]*\.//o')
  40. # The name of the Debian source package
  41. src_name := $(shell $(pf); dpkg-parsechangelog | egrep '^Source:')
  42. src_name := $(shell $(pf); echo $(src_name) | perl -pe 's/Source:\s+//o')
  43. # The version from the changelog (i.e. 20.5-1)
  44. debian_ver := $(shell $(pf); dpkg-parsechangelog | egrep '^Version:')
  45. debian_ver := $(shell $(pf); echo $(debian_ver) | perl -pe 's/Version:\s+//o')
  46. # The Debian revision (i.e. the 1 from 20.5-1)
  47. # Always everything after the last '-'
  48. debian_rev := $(shell $(pf); echo $(debian_ver) | perl -pe 's/.*-//o')
  49. # Might be 21.3, or it might be 21.3+1 if we've had to have more than
  50. # one re-release of the upstream source (rare, but it happens), or if
  51. # we have to split the package for DFSG purposes. Always everything
  52. # before the last '-'
  53. debsrc_ver := $(shell $(pf); echo $(debian_ver) | perl -pe 's/-[^-]+$$//o')
  54. # The flavor (i.e. emacs21) currently matches the source package name.
  55. flavor := $(src_name)
  56. info_subdir := emacs-$(major_ver)
  57. ######################################################################
  58. # Customizable variables
  59. bin_priority := 27
  60. # This might also be something like 2006-09-09 for snapshots.
  61. menu_ver := $(major_ver)
  62. ######################################################################
  63. # Should these be exported like this (as autotools-dev recommends for
  64. # the two vars below) or not?
  65. export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
  66. export DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
  67. # As recommended by /usr/share/doc/autotools-dev/README.Debian.gz.
  68. # Handle cross-compiling and don't make ./configure guess.
  69. export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  70. export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  71. # FOR AUTOCONF 2.52 AND NEWER ONLY
  72. ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  73. confflags += --build $(DEB_HOST_GNU_TYPE)
  74. else
  75. confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
  76. endif
  77. deb_host_multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  78. CFLAGS = `dpkg-buildflags --get CFLAGS`
  79. CFLAGS += -Wall
  80. LDFLAGS = `dpkg-buildflags --get LDFLAGS`
  81. CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
  82. ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  83. ifneq (,$(filter $(DEB_HOST_ARCH),ia64))
  84. # Fix a problem with newer versions of gcc on ia64.
  85. # See bugs #582439 and #679986.
  86. CFLAGS += -O1
  87. endif # eq ia64
  88. endif
  89. joblimit := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  90. ifeq (,$(joblimit))
  91. joblimit := 1
  92. endif
  93. target := $(DEB_HOST_GNU_TYPE)
  94. movemail_bin := usr/lib/emacs/$(runtime_ver)/$(target)/movemail
  95. # Info files that are going to show up in the main dir.
  96. main_dir_info_files := \
  97. efaq
  98. # Files that the build stage depends on (may also be listed in other vars).
  99. persistent_autogen_build_files := debian/control debian/copyright
  100. nonpersistent_autogen_build_files :=
  101. # These files must always exist, i.e. can't ever be cleaned.
  102. persistent_autogen_install_files :=
  103. nonpersistent_autogen_install_files := \
  104. debian/$(flavor)-bin-common.lintian-overrides \
  105. debian/$(flavor)-bin-common.postinst \
  106. debian/$(flavor)-bin-common.prerm \
  107. debian/$(flavor)-common.README.Debian \
  108. debian/$(flavor)-common.docs \
  109. debian/$(flavor)-common.lintian-overrides \
  110. debian/$(flavor)-common.postinst \
  111. debian/$(flavor)-common.prerm \
  112. debian/$(flavor)-nox.README.Debian \
  113. debian/$(flavor)-nox.lintian-overrides \
  114. debian/$(flavor)-nox.menu \
  115. debian/$(flavor)-nox.postinst \
  116. debian/$(flavor)-nox.prerm \
  117. debian/$(flavor)-lucid.README.Debian \
  118. debian/$(flavor)-lucid.desktop \
  119. debian/$(flavor)-lucid.lintian-overrides \
  120. debian/$(flavor)-lucid.menu \
  121. debian/$(flavor)-lucid.postinst \
  122. debian/$(flavor)-lucid.prerm \
  123. debian/$(flavor).README.Debian \
  124. debian/$(flavor).desktop \
  125. debian/$(flavor).menu \
  126. debian/$(flavor).lintian-overrides \
  127. debian/$(flavor).postinst \
  128. debian/$(flavor).prerm
  129. autogen_build_files := \
  130. $(nonpersistent_autogen_build_files) $(persistent_autogen_build_files)
  131. autogen_install_files := \
  132. $(nonpersistent_autogen_install_files) $(persistent_autogen_install_files)
  133. persistent_autogen_files := \
  134. $(persistent_autogen_build_files) $(persistent_autogen_install_files)
  135. nonpersistent_autogen_files := \
  136. $(nonpersistent_autogen_build_files) $(nonpersistent_autogen_install_files)
  137. # Build directories
  138. pkgdir_common := $(CURDIR)/debian/$(flavor)-common
  139. pkgdir_bin_common := $(CURDIR)/debian/$(flavor)-bin-common
  140. pkgdir_x := $(CURDIR)/debian/$(flavor)
  141. pkgdir_nox := $(CURDIR)/debian/$(flavor)-nox
  142. pkgdir_lucid := $(CURDIR)/debian/$(flavor)-lucid
  143. pkgdir_el := $(CURDIR)/debian/$(flavor)-el
  144. install_dir_x := $(CURDIR)/debian/install-x
  145. install_dir_nox := $(CURDIR)/debian/install-nox
  146. install_dir_lucid := $(CURDIR)/debian/install-lucid
  147. local_lpath := /etc/$(flavor):/etc/emacs
  148. local_lpath := $(local_lpath):/usr/local/share/emacs/$(runtime_ver)/site-lisp
  149. local_lpath := $(local_lpath):/usr/local/share/emacs/site-lisp
  150. local_lpath := $(local_lpath):/usr/share/emacs/$(runtime_ver)/site-lisp
  151. local_lpath := $(local_lpath):/usr/share/emacs/site-lisp
  152. # Installation local_lpath
  153. local_lpath_install \
  154. := $(pkgdir_common)/$(subst :,:$(pkgdir_common)/,$(local_lpath))
  155. define testdir
  156. dh_testdir debian/emacsVER.postinst
  157. endef
  158. # If we ever need to do the stripping outside of dh_strip, just add an
  159. # INSTALL_STRIP="-s" to the make vars below.
  160. define emacs_inst
  161. $(MAKE) -C debian/$(1) install \
  162. DESTDIR=$(2) \
  163. infodir=/usr/share/info/emacs-$(major_ver) \
  164. localstatedir=/var
  165. endef
  166. # If we ever need it, we can create a copy that doesn't assume ./debian/
  167. define deb_sub
  168. perl -p \
  169. -e "s|\@PKG_NAME\@|$(pkg_name)|go;" \
  170. -e "s|\@MAJOR_VERSION\@|$(major_ver)|go;" \
  171. -e "s|\@MINOR_VERSION\@|$(minor_ver)|go;" \
  172. -e "s|\@FULL_VERSION\@|$(runtime_ver)|go;" \
  173. -e "s|\@PACKAGE_VERSION\@|$(debian_ver)|go;" \
  174. -e "s|\@DEBIAN_REV\@|$(deb_rev)|go;" \
  175. -e "s|\@UPSTREAM_VERSION\@|$(upstream_ver)|go;" \
  176. -e "s|\@DEBSRC_VERSION\@|$(debsrc_ver)|go;" \
  177. -e "s|\@DEB_FLAVOR\@|$(flavor)|go;" \
  178. -e "s|\@MENU_VERSION\@|$(menu_ver)|go;" \
  179. -e "s|\@INFO_FILES\@|$(main_dir_info_files)|go;" \
  180. -e "s|\@INFO_SUBDIR\@|$(info_subdir)|go;" \
  181. -e "s|\@X_SUPPORT\@|$(xsupport)|go;" \
  182. -e "s|\@BIN_PRIORITY\@|$(bin_priority)|go;" \
  183. -e "s|\@MOVEMAIL_BIN\@|$(movemail_bin)|go;" \
  184. < $(1) > $(2)
  185. endef
  186. %:
  187. dh $@ --parallel
  188. check-vars:
  189. @echo "src_name: $(src_name)"
  190. @echo "upstream_ver: $(upstream_ver)"
  191. @echo "debian_ver: $(debian_ver)"
  192. @echo "debsrc_ver: $(debsrc_ver)"
  193. @echo "debian_rev: $(debian_rev)"
  194. @echo "runtime_ver: $(runtime_ver)"
  195. @echo "major_ver: $(major_ver)"
  196. @echo "minor_ver: $(minor_ver)"
  197. @echo "movemail_bin: $(movemail_bin)"
  198. debian-sync: $(persistent_autogen_files)
  199. # so dh pattern rule doesn't try to handle this target
  200. true
  201. debian/$(flavor).%: xsupport := "x"
  202. debian/$(flavor).%: pkg_name := $(flavor)
  203. debian/$(flavor)-nox.%: xsupport := "nox"
  204. debian/$(flavor)-nox.%: pkg_name := $(flavor)-nox
  205. debian/$(flavor)-lucid.%: xsupport := "lucid"
  206. debian/$(flavor)-lucid.%: pkg_name := $(flavor)-lucid
  207. debian/$(flavor)-common.%: pkg_name := $(flavor)-common
  208. debian/$(flavor)-bin-common.%: pkg_name := $(flavor)-bin-common
  209. debian/%: debian/%.in debian/changelog debian/rules
  210. $(call deb_sub,$<,$@)
  211. debian/$(flavor)-bin-common.%: debian/emacsVER-bin-common.% debian/changelog
  212. $(call deb_sub,$<,$@)
  213. debian/$(flavor)-common.%: debian/emacsVER-common.% debian/changelog
  214. $(call deb_sub,$<,$@)
  215. debian/$(flavor)-el.%: debian/emacsVER-el.% debian/changelog
  216. $(call deb_sub,$<,$@)
  217. debian/$(flavor).%: debian/emacsVER.% debian/changelog
  218. $(call deb_sub,$<,$@)
  219. debian/$(flavor)-nox.%: debian/emacsVER.% debian/changelog
  220. $(call deb_sub,$<,$@)
  221. debian/$(flavor)-lucid.%: debian/emacsVER.% debian/changelog
  222. $(call deb_sub,$<,$@)
  223. debian/$(flavor)-common.README.Debian: \
  224. debian/emacsVER-common.README debian/patches/*.patch debian/patches/series \
  225. debian/rules debian/patch-to-news
  226. cd debian && \
  227. csplit -s -f emacsVER-common.README. \
  228. emacsVER-common.README '/@@PATCH_LIST_HERE@@/'
  229. cp debian/emacsVER-common.README.00 debian/emacsVER-common.README.tmp
  230. for p in $$($(quilt) series); do \
  231. debian/patch-to-news debian/patches/$$p \
  232. >> debian/emacsVER-common.README.tmp; \
  233. echo >> debian/emacsVER-common.README.tmp; \
  234. done
  235. tail -n +2 \
  236. < debian/emacsVER-common.README.01 \
  237. >> debian/emacsVER-common.README.tmp
  238. mv debian/emacsVER-common.README.tmp $@
  239. debian/setup-stamp:
  240. $(testdir)
  241. ./autogen.sh
  242. mkdir -p $(dir $@) && touch $@
  243. # common configure flags
  244. confflags += --prefix=/usr
  245. confflags += --sharedstatedir=/var/lib
  246. confflags += --libexecdir=/usr/lib
  247. confflags += --localstatedir=/var/lib
  248. confflags += --infodir=/usr/share/info
  249. confflags += --mandir=/usr/share/man
  250. confflags += --with-pop=yes
  251. confflags += --enable-locallisppath=$(local_lpath)
  252. # multiarch compatibility
  253. confflags += --with-crt-dir=/usr/lib/$(deb_host_multiarch)
  254. # x configure flags
  255. confflags_x := $(confflags)
  256. confflags_x += --with-x=yes
  257. confflags_x += --with-x-toolkit=gtk
  258. # For those who prefer the old-style non-toolkit scrollbars, just
  259. # change the assignment below to --without-toolkit-scroll-bars. The
  260. # resulting emacsXY package will have the old scrollbars.
  261. confflags_x += --with-toolkit-scroll-bars
  262. # nox configure flags
  263. confflags_nox := $(confflags)
  264. confflags_nox += --with-x=no
  265. confflags_nox += --without-gconf
  266. # lucid configure flags
  267. confflags_lucid := $(confflags)
  268. confflags_lucid += --with-x=yes
  269. confflags_lucid += --with-x-toolkit=lucid
  270. confflags_lucid += --with-toolkit-scroll-bars
  271. confflags_lucid += --without-gconf
  272. define cfg_tree
  273. rm -rf $(1)
  274. mkdir $(1)
  275. cp -a $$(ls -A | egrep -v '^(\.git|\.pc|debian)$$') "$(1)"
  276. cd $(1) && CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" ./configure $(confflags) $(2)
  277. endef
  278. define build_cmd
  279. $(MAKE) -C $(1) -j $(joblimit) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
  280. # If we don't use bootstrap, we need to explicitly build info.
  281. $(MAKE) -C $(1) -j $(joblimit) CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" info
  282. # Make sure we chose liblockfile.
  283. ldd $(1)/lib-src/movemail | grep liblockfile
  284. endef
  285. override_dh_auto_configure: debian/setup-stamp
  286. # Can't use dh --with autotools_dev because it only works if
  287. # you haven't removed the config.sub and config.guess files
  288. # from the source tree.
  289. cp -a /usr/share/misc/config.guess .
  290. cp -a /usr/share/misc/config.sub .
  291. $(call cfg_tree,debian/build-x,$(confflags_x))
  292. $(call cfg_tree,debian/build-nox,$(confflags_nox))
  293. $(call cfg_tree,debian/build-lucid,$(confflags_lucid))
  294. override_dh_auto_build: $(autogen_build_files)
  295. $(call build_cmd,debian/build-x)
  296. $(call build_cmd,debian/build-nox)
  297. $(call build_cmd,debian/build-lucid)
  298. define install_common_binpkg_bits
  299. # args: (1) srcdir (2) pkgdir (3) pkgname (4) bin-suffix
  300. install -d $(2)/usr/bin/
  301. test -f $(1)/usr/bin/emacs-*
  302. cp -a $(1)/usr/bin/emacs-* $(2)/usr/bin/$(flavor)-$(4)
  303. dh_link -p$(3) usr/bin/$(flavor)-$(4) usr/bin/$(flavor)
  304. install -d $(2)/usr/share/emacs/$(runtime_ver)/etc
  305. cp -a $(1)/usr/share/emacs/$(runtime_ver)/etc/DOC-$(runtime_ver).1 \
  306. $(2)/usr/share/emacs/$(runtime_ver)/etc/
  307. install -d $(2)/usr/share/man/man1
  308. dh_link -p$(3) \
  309. usr/share/man/man1/emacs.$(flavor).1.gz \
  310. usr/share/man/man1/$(flavor).1.gz
  311. dh_link -p$(3) \
  312. usr/share/man/man1/emacs.$(flavor).1.gz \
  313. usr/share/man/man1/$(flavor)-$(4).1.gz
  314. endef
  315. override_dh_auto_install: $(autogen_install_files)
  316. rm -rf \
  317. $(install_dir_x) $(install_dir_nox) $(install_dir_lucid) \
  318. $(pkgdir_common)/* \
  319. $(pkgdir_bin_common)/* \
  320. $(pkgdir_x)/* \
  321. $(pkgdir_nox)/* \
  322. $(pkgdir_lucid)/* \
  323. $(pkgdir_el)/*
  324. $(call emacs_inst,build-x,$(install_dir_x))
  325. ##################################################
  326. # emacsXY-common
  327. ifneq (,$(findstring $(flavor)-common, $(shell dh_listpackages)))
  328. install -d $(pkgdir_common)
  329. cp -a $(install_dir_x)/* $(pkgdir_common)
  330. rm -r $(pkgdir_common)/usr/bin
  331. rm -r $(pkgdir_common)/usr/lib
  332. cd $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc \
  333. && test -f DOC-$(runtime_ver).*
  334. cd $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc \
  335. && rm DOC-$(runtime_ver).*
  336. # lisp path directories
  337. install -d $(pkgdir_common)/etc/$(flavor)/site-start.d
  338. install -d $(pkgdir_common)/usr/share/$(flavor)
  339. # The version-specific site-lisp dir, say emacs/21.1/site-lisp, needs
  340. # to be in share/FLAVOR so that as we upgrade from 21.1 to 21.2,
  341. # etc., add-on package bits don't get left behind.
  342. mv $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/site-lisp \
  343. $(pkgdir_common)/usr/share/$(flavor)
  344. dh_link -p$(flavor)-common usr/share/$(flavor)/site-lisp \
  345. usr/share/emacs/$(runtime_ver)/site-lisp
  346. # This is a duplicate of the file in FLAVOR/site-lisp
  347. rm $(pkgdir_common)/usr/share/emacs/site-lisp/subdirs.el
  348. cd $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/images/icons \
  349. && convert hicolor/16x16/apps/emacs.{png,xpm}
  350. cd $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/images/icons \
  351. && convert hicolor/32x32/apps/emacs.{png,xpm}
  352. # Fixup image files in unversioned directories (remove old
  353. # images, version unversioned images) and prepare for
  354. # update-alternatives.
  355. rm $(pkgdir_common)/usr/share/icons/hicolor/16x16/apps/emacs22.png
  356. rm $(pkgdir_common)/usr/share/icons/hicolor/24x24/apps/emacs22.png
  357. rm $(pkgdir_common)/usr/share/icons/hicolor/32x32/apps/emacs22.png
  358. rm $(pkgdir_common)/usr/share/icons/hicolor/48x48/apps/emacs22.png
  359. cd $(pkgdir_common)/usr/share/icons/hicolor \
  360. && mv scalable/apps/emacs.svg scalable/apps/${flavor}.svg \
  361. && mv 16x16/apps/emacs.png 16x16/apps/${flavor}.png \
  362. && mv 24x24/apps/emacs.png 24x24/apps/${flavor}.png \
  363. && mv 32x32/apps/emacs.png 32x32/apps/${flavor}.png \
  364. && mv 48x48/apps/emacs.png 48x48/apps/${flavor}.png \
  365. && mv 128x128/apps/emacs.png 128x128/apps/${flavor}.png
  366. cd $(pkgdir_common)/usr/share/icons/hicolor/scalable/mimetypes \
  367. && mv emacs-document.svg ${flavor}-document.svg
  368. # Remove redundant emacs.desktop file.
  369. rm $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/emacs.desktop
  370. rm $(pkgdir_common)/usr/share/applications/emacs.desktop
  371. # Mangle info files.
  372. chmod 755 debian/mangle-info
  373. for f in $(main_dir_info_files); \
  374. do \
  375. gunzip $(pkgdir_common)/usr/share/info/$(info_subdir)/$$f.gz; \
  376. DEBIAN_INFO_PREFIX=$(info_subdir) \
  377. debian/mangle-info \
  378. $(pkgdir_common)/usr/share/info/$(info_subdir)/$$f; \
  379. done
  380. gunzip $(pkgdir_common)/usr/share/man/man1/*.gz
  381. perl -pi -e "s|man1/etags\\.1|man1/etags\\.$(flavor)\\.1|" \
  382. $(pkgdir_common)/usr/share/man/man1/ctags.1
  383. cd $(pkgdir_common)/usr/share/man/man1/ && \
  384. for f in *.1; do mv $$f $$(basename $${f} .1).$(flavor).1; done
  385. # At least etc/COPYING is needed by M-x describe-copying.
  386. rm $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/COPYING
  387. rm $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/lisp/COPYING
  388. dh_link -p$(flavor)-common /usr/share/common-licenses/GPL-3 \
  389. usr/share/emacs/$(runtime_ver)/etc/COPYING
  390. dh_link -p$(flavor)-common /usr/share/common-licenses/GPL-3 \
  391. usr/share/emacs/$(runtime_ver)/lisp/COPYING
  392. # Install replacements for non-free files that can be reached
  393. # through C-h
  394. for f in THE-GNU-PROJECT; \
  395. do \
  396. sed \
  397. -e "s/@FILE@/$$f/g" \
  398. -e "s/@MAJOR_VERSION@/$(major_ver)/g" \
  399. $(CURDIR)/debian/missing-file.dfsg > \
  400. $(pkgdir_common)/usr/share/emacs/$(runtime_ver)/etc/$$f.dfsg ; \
  401. done
  402. $(pf); cd $(pkgdir_common) && \
  403. find -name "*.elc" | perl -pe 's/\.elc$$/\.el/o' | xargs rm -f
  404. $(pf); cd $(pkgdir_common) && \
  405. find -name "*.elc" | perl -pe 's/\.elc$$/\.el\.gz/o' | xargs rm -f
  406. # Remove extraneous info dir files. These may not exist if dpkg
  407. # is 1.5.4 or newer.
  408. rm -f $(pkgdir_common)/usr/share/info/emacs-$(major_ver)/dir
  409. rm -f $(pkgdir_common)/usr/share/info/emacs-$(major_ver)/dir.old
  410. # Remove the shared game score directory as a simple way to
  411. # avoid a conflict with other flavors of Emacs. Since
  412. # Debian's update-game-score binary isn't setuid, that
  413. # directory is never used.
  414. rm $(pkgdir_common)/var/games/emacs/tetris-scores
  415. rm $(pkgdir_common)/var/games/emacs/snake-scores
  416. rmdir $(pkgdir_common)/var/games/emacs/
  417. rmdir $(pkgdir_common)/var/games/
  418. rmdir $(pkgdir_common)/var/
  419. # Make sure /usr/local dir doesn't exist.
  420. rm -r $(pkgdir_common)/usr/local
  421. endif
  422. ##################################################
  423. # emacsXY-bin-common
  424. ifneq (,$(findstring $(flavor)-bin-common, $(shell dh_listpackages)))
  425. # Move common binaries to emacs-bin-common.
  426. install -d $(pkgdir_bin_common)/usr
  427. cp -a $(install_dir_x)/usr/bin $(pkgdir_bin_common)/usr
  428. cp -a $(install_dir_x)/usr/lib $(pkgdir_bin_common)/usr
  429. # Make sure there's just one.
  430. test -f $(pkgdir_bin_common)/usr/bin/emacs-*
  431. rm $(pkgdir_bin_common)/usr/bin/{emacs,emacs-*}
  432. # Set up movemail.
  433. chown root.mail $(pkgdir_bin_common)/$(movemail_bin)
  434. chmod g+s $(pkgdir_bin_common)/$(movemail_bin)
  435. # Set up alternatives.
  436. alternatives=`ls $(pkgdir_bin_common)/usr/bin | xargs` && \
  437. set -x && \
  438. for f in debian/$(flavor)-bin-common.*; \
  439. do \
  440. perl -pwi -e "s|\@ALTERNATIVES\@|$${alternatives}|go" $$f ; \
  441. done
  442. for f in `ls $(pkgdir_bin_common)/usr/bin`; \
  443. do \
  444. mv $(pkgdir_bin_common)/usr/bin/$$f \
  445. $(pkgdir_bin_common)/usr/bin/$$f.$(flavor) ; \
  446. done
  447. endif
  448. ##################################################
  449. # emacsXY
  450. ifneq (,$(findstring $(flavor), $(shell dh_listpackages)))
  451. $(call install_common_binpkg_bits,\
  452. $(install_dir_x),$(pkgdir_x),$(flavor),x)
  453. # install desktop entry
  454. install -d $(pkgdir_x)/usr/share/applications
  455. install -m 0644 \
  456. debian/$(flavor).desktop $(pkgdir_x)/usr/share/applications/
  457. endif
  458. ##################################################
  459. # emacsXY-nox
  460. ifneq (,$(findstring $(flavor)-nox, $(shell dh_listpackages)))
  461. $(call emacs_inst,build-nox,$(install_dir_nox))
  462. $(call install_common_binpkg_bits,\
  463. $(install_dir_nox),$(pkgdir_nox),$(flavor)-nox,nox)
  464. rm -rf $(install_dir_nox)
  465. endif
  466. ##################################################
  467. # emacsXY-lucid
  468. ifneq (,$(findstring $(flavor)-lucid, $(shell dh_listpackages)))
  469. $(call emacs_inst,build-lucid,$(install_dir_lucid))
  470. $(call install_common_binpkg_bits,\
  471. $(install_dir_lucid),$(pkgdir_lucid),$(flavor)-lucid,lucid)
  472. # install desktop entry
  473. install -d $(pkgdir_lucid)/usr/share/applications
  474. install -m 0644 \
  475. debian/$(flavor)-lucid.desktop \
  476. $(pkgdir_lucid)/usr/share/applications/
  477. rm -rf $(install_dir_lucid)
  478. endif
  479. ##################################################
  480. # emacsXY-el
  481. ifneq (,$(findstring $(flavor)-el, $(shell dh_listpackages)))
  482. $(pf); \
  483. (cd $(install_dir_x) && find -name "*.el" -o -name "*.el.gz" -print0 \
  484. | tar cpf - --null --files-from -) \
  485. | (cd $(pkgdir_el) && tar xpf -)
  486. endif
  487. ##################################################
  488. # final cleanup
  489. rm -rf $(install_dir_x)
  490. rm -rf $(install_dir_nox)
  491. rm -rf $(install_dir_lucid)
  492. override_dh_testdir:
  493. $(testdir)
  494. override_dh_fixperms:
  495. dh_fixperms -X$(movemail_bin)
  496. override_dh_clean: $(persistent_autogen_files)
  497. rm -rf \
  498. aclocal.m4 \
  499. build-aux/compile \
  500. build-aux/config.guess \
  501. build-aux/config.sub \
  502. build-aux/depcomp \
  503. build-aux/install-sh \
  504. build-aux/missing \
  505. config.guess \
  506. config.sub \
  507. configure \
  508. debian/*-stamp \
  509. debian/build-lucid \
  510. debian/build-nox \
  511. debian/build-x \
  512. debian/emacsVER-common.README.00 \
  513. debian/emacsVER-common.README.01 \
  514. debian/install-lucid \
  515. debian/install-nox \
  516. debian/install-x \
  517. lib/Makefile.in \
  518. src/config.in \
  519. src/stamp-h1
  520. rm -f $(nonpersistent_autogen_files)
  521. dh_clean