reddit / emacs

Compiling the latest Emacs *.deb files on stable Debian Linux from sid

idspispopd0 · 2022-11-13 15:08
This post details compiling and installing the *.deb files for Emacs 28.2 using the Debian maintainer's git repository intended for sid. Yes, emacswiki mentions 2 repositories from which one may install such newer Emacs versions, so this post is partly intended as an exercise of getting to know Debian's packaging tools. Note, it doesn't seem easily possible to compile Emacs 28.2 on Debian 9, so I had to upgrade one of my machines to Debian 10 for this to work. Edit: Thanks to spwhitton and starenka for suggesting the flags `dpkg-buildpackage -b` and `git clone --depth 1`, respectively. To compile and install the Emacs packages except for the info manual: mkdir -p ~/src/deb/ cd ~/src/deb/ git clone --depth 1 https://salsa.debian.org/rlb/deb-emacs.git cd deb-emacs/ sudo apt install packaging-dev # For quilt, etc. # Edit files to use gcc-10 and related packages instead of gcc-12: sed -i 's#gcc-12#gcc-10#' debian/control debian/rules sed -i 's#libgccjit-12-dev#libgccjit-10-dev#' debian/control # Find missing dependencies. dpkg-checkbuilddeps # Install missing dependencies; in my case, in alphabetical sorted order: sudo apt install \ libacl1-dev \ libgccjit-10-dev \ libgif-dev \ libgnutls28-dev \ libgpm-dev \ libjansson-dev \ liblockfile-dev \ libm17n-dev \ libmagick++-6.q16-dev \ libotf-dev \ librsvg2-dev \ libsystemd-dev \ libxaw7-dev \ sharutils \ xaw3dg-dev # Build the debs: dpkg-buildpackage -b -us -uc # Install packages generated in the above directory. The install # order is a bit wonky, so one has to run this twice: cd ../ sudo dpkg -i \ emacs_28.2+1-3_all.deb \ emacs-el_28.2+1-3_all.deb \ emacs-common_28.2+1-3_all.deb \ emacs-bin-common_28.2+1-3_amd64.deb \ emacs-gtk_28.2+1-3_amd64.deb To install the Emacs info manual from the source package https://packages.debian.org/source/sid/armel/emacs-non-dfsg: mkdir -p ~/src/deb/deb-emacs-non-dfsg cd ~/src/deb/deb-emacs-non-dfsg # Download the 3 files from the URL above and then unpack: tar -xf emacs-non-dfsg_28.2+1.orig.tar.xz cd emacs-non-dfsg-28.2+1.orig/ tar -xf ../emacs-non-dfsg_28.2+1-2.debian.tar.xz dpkg-checkbuilddeps # Needed to install texinfo. dpkg-buildpackage -us -uc sudo dpkg -i ../emacs-common-non-dfsg_28.2+1-2_all.deb I was not very familiar with Debian packaging and read https://www.debian.org/doc/manuals/maint-guide/ along the way so I'm happy to take notes and corrections to any of these steps. Happy hacking!
big_lentil · 2022-11-13 21:49
How long did it take?
idspispopd0 · 2022-11-15 01:20
Running all of the tests and compiling the graphical variants it took over an hour on my 4 cores. If I didn't need the graphical frontend, I wouldn't bother with the Debian packages; in contrast, compiling a minimal CLI variant from source `--with-gnutls` (for MELPA), `--without-x` and `--without-all` is <5 minutes: cd /tmp/ wget https://ftp.gnu.org/gnu/emacs/emacs-28.2.tar.xz tar -xf emacs-28.2.tar.xz cd emacs-28.2 ./configure --prefix=$HOME/.apps/emacs-28 --with-gnutls --without-x --without-all --with-mailutils time make -j # real 1m6.835s # user 3m11.345s # sys 0m9.119s time make -j install # real 0m8.982s # user 0m5.167s # sys 0m3.592s
starenka · 2022-11-15 18:47
why dont you install from unstable? anyway, you might want to clone w/ `--depth 1` to save bw & space
spwhitton · 2022-11-19 09:31
You don’t need to touch git-dpm if you additionally pass -b to dpkg-buildpackage. You might also like the athena/bullseye-backports branch of http://git.spwhitton.name/emacs which should be immediateoy buildable.
idspispopd0 · 2022-11-20 14:13
Thanks for the suggestion for `--depth 1`! I've updated the instructions. I'm not keen on using unstable because of the change from gcc-10 to gcc-12. Also these are my everyday machines where I prefer to avoid the risk of dependency conflicts from using unstable packages. Still, it would be interesting to read other people's experiences mixing unstable packages to build emacs.
idspispopd0 · 2022-11-20 14:16
Thanks for the tip for avoiding git-dpm! I've updated the instructions. Also thank you for the backports branch: I notice that it builds a single emacs-snapshot package which should be easier to work with.
starenka · 2022-11-20 14:19
nah, gotcha there. i just cherry pick pkgs via apt preferences from unstable (firefox). i wouldnt mix stable and unstable tho. frankly, i used your post to compile my 28 this week (testing still has 27). cheers!!!
spwhitton · 2022-11-23 05:27
Right!