emacs-snapshot build for debian

The followings are how I build emacs-snapshot for debian by myself. My PC is debian unstable.

get tar ball

> git clone --depth 1 git://git.sv.gnu.org/emacs.git
(check if make works well.)
> ./autogen.sh
> ./configure
> make bootstrap
(make the tar ball.)
> make clean
> tar cjvf emacs-snapshot-20150126.tar.bz2 ./emacs

prepare for package build

> apt-get source emacs-snapshot
> cd emacs-snapshot-20140823
> uupdate -v 20150126 ../emacs-snapshot-20150126.tar.bz2

correct patches

The following patches are not applicable as 20140823. So I modified the files by myself.

  • 0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
  • 0003-Adjust-documentation-references-for-Debian.patch
  • 0009-Some-documentation-references-to-usr-local-have-been.patch

After I correct the files, I made patches as followings:

> git diff --no-prefix a/lisp/startup.el b/lisp/startup.el > 0002-Run-debian-startup-and-set-debian-emacs-flavor.patch
> git diff --no-prefix a/etc/NEWS b/etc/NEWS > 0003-Adjust-documentation-references-for-Debian.patch
> git diff --no-prefix a/doc/man/emacs.1.in b/doc/man/emacs.1.in > 0009-Some-documentation-references-to-usr-local-have-been.patch

For convenience, I show these patches below:

diff --git a/lisp/startup.el b/lisp/startup.el
index 999e53e..6247110 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -424,6 +424,10 @@ Warning Warning!!!  Pure space overflow    !!!Warning Warning
   :type 'directory
   :initialize 'custom-initialize-delay)
+(defconst debian-emacs-flavor 'emacs-snapshot
+  "A symbol representing the particular debian flavor of emacs running.
+Something like 'emacs20, 'xemacs20, etc.")
 (defun normal-top-level-add-subdirs-to-load-path ()
   "Add all subdirectories of `default-directory' to `load-path'.
 More precisely, this uses only the subdirectories whose names
@@ -1035,8 +1039,21 @@ please check its value")
     ;; be loaded from site-run-file and wants to test if -q was given
     ;; should check init-file-user instead, since that is already set.
     ;; See cus-edit.el for an example.
-    (if site-run-file
-	(load site-run-file t t))
+    ;; Original upstream startup
+    ;; (if site-run-file
+    ;;     (load site-run-file t t))
+    ;;
+    ;; Debian startup
+     (if site-run-file
+        (progn
+          ;; Load all the debian package snippets.
+          ;; It's in here because we want -q to kill it too.
+          (if (load "debian-startup" t t nil)
+              (debian-startup debian-emacs-flavor))
+          ;; Now the normal site file...
+          (load site-run-file t t)))
     ;; Sites should not disable this.  Only individuals should disable
     ;; the startup screen.

diff --git a/etc/NEWS b/etc/NEWS
index d5baed3..2ab8da4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -22,6 +22,11 @@ When you add a new item, use the appropriate mark if you are sure it applies,
 otherwise leave it unmarked.
+* Debian specific changes to Emacs
+Please see /usr/share/doc/emacs25-common/README.Debian.gz.
 * Installation Changes in Emacs 25.1

diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in
index 259acb9..26eb84d 100644
--- a/doc/man/emacs.1.in
+++ b/doc/man/emacs.1.in
@@ -554,24 +554,24 @@ distribution.
-/usr/local/share/info \(em files for the Info documentation browser.
+/usr/share/info \(em files for the Info documentation browser.
 The complete text of the Emacs reference manual is included in a
 convenient tree structured form.
 Also includes the Emacs Lisp Reference Manual, useful to anyone
 wishing to write programs in the Emacs Lisp extension language,
 and the Introduction to Programming in Emacs Lisp.
-/usr/local/share/emacs/$VERSION/lisp \(em Lisp source files and
+/usr/share/emacs/$VERSION/lisp \(em Lisp source files and
 compiled files that define most editing commands.
 Some are preloaded; others are autoloaded from this directory when
-/usr/local/libexec/emacs/$VERSION/$ARCH \(em various programs that are
+/usr/lib/emacs/$VERSION/$ARCH \(em various programs that are
 used with GNU Emacs.
-/usr/local/share/emacs/$VERSION/etc \(em various files of information.
+/usr/share/emacs/$VERSION/etc \(em various files of information.
-/usr/local/share/emacs/$VERSION/etc/DOC.* \(em contains the documentation
+/usr/share/emacs/$VERSION/etc/DOC.* \(em contains the documentation
 strings for the Lisp primitives and preloaded Lisp functions
 of GNU Emacs.
 They are stored here to reduce the size of Emacs proper.

I copied these patches to debian/patches in the emacs snapshot directory.

edit control file

The package libgnutls-dev is no longer available, thus I modified to libgnutls28-dev.

edit emacs-snapshot-bin-common.overrides.lintian and other lintian, postinst files

Accroding to Changelog, there is no longer grep-changelog, so I removed the lines of grep-changelog in the followings:

  • emacs-snapshot-bin-common.overrides.lintian
  • emacs-snapshot-bin-common.postinst
  • emacs-bin-common.overrides.lintian
  • emacs-bin-common.postinst

copy CONTRIBUTE to etc

copy CONTRIBUTE file to etc. Then

> dpkg-source --commit


> debuild

That’s it. Good luck.