Skip to content

Instantly share code, notes, and snippets.

@jasonblewis
Last active March 4, 2025 13:15
Show Gist options
  • Save jasonblewis/619a72eb77703b3036e512624c6673ce to your computer and use it in GitHub Desktop.
Save jasonblewis/619a72eb77703b3036e512624c6673ce to your computer and use it in GitHub Desktop.
build and install emacs snapshot from source on debian stable
#!/bin/bash
# build emacs snapshopt packages form source on debian jessie
# you need to add the the emacs snapshot source to /etc/apt/sources.list.d
# sudo echo deb-src [arch=amd64] http://emacs.secretsauce.net unstable main >> /etc/apt/sources.list.d/emacs-snapshot.list
# wget -q -O - http://emacs.secretsauce.net/key.gpg | sudo apt-key add -
# usage ./build-emacs-snapshot
# enter your sudo password when prompted
# enjoy emacs snapshot.
# to update, just re-run the script.
# Jason Lewis [email protected]
# 2017-03-01
# script url: https://gist.github.com/jasonblewis/619a72eb77703b3036e512624c6673ce
# see http://emacs.secretsauce.net/ for details about the debian packages
set -e
BUILDLOCATION=~/source/emacssnapshot
MAKEFLAGS=j$(getconf _NPROCESSORS_ONLN || echo 1)
latest() {
local file latest;
for file in "$@"
do
[[ $file -nt $latest ]] && latest=$file
done
}
echo doing aptitude update
sudo aptitude update
mkdir -p $BUILDLOCATION
cd $BUILDLOCATION
apt-get source emacs-snapshot
cd $(latest ./emacs*/)
echo 'doing sudo apt-get build-dep -y emacs-snapshot'
sudo apt-get build-dep -y emacs-snapshot
debuild -b -uc -us
cd $BUILDLOCATION
sudo dpkg -i $(latest ./emacs-snapshot_*.deb) $(latest ./emacs-snapshot-common*.deb) $(latest ./emacs-snapshot-bin-common*.deb) $(latest ./emacs-snapshot-el*.deb)
@metaperl
Copy link

metaperl commented Jul 9, 2017

For some reason, the latest() function computed value is not being used by cd. I added a -x to the invocation line and the cd command executes with no arguments, even though the argument is computed. Shell transcript follows:

schemelab@metta:/tmp$ ~/bin/build-emacs-snapshot
+ set -e
+ BUILDLOCATION=/tmp/emacs-snapshot
++ getconf _NPROCESSORS_ONLN
+ MAKEFLAGS=j4
+ echo doing aptitude update
doing aptitude update
+ sudo aptitude update
Hit http://security.debian.org stretch/updates InRelease
Hit http://emacs.secretsauce.net unstable InRelease
Hit https://packages.microsoft.com/repos/vscode stable InRelease
Ign http://cdn-fastly.deb.debian.org/debian stretch InRelease
Hit http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease
Hit https://deb.nodesource.com/node_7.x jessie InRelease
Hit http://cdn-fastly.deb.debian.org/debian stretch Release

+ mkdir -p /tmp/emacs-snapshot
+ cd /tmp/emacs-snapshot
+ apt-get source emacs-snapshot
Reading package lists... Done
Skipping already downloaded file 'emacs-snapshot_20170709+emacs-25.1-129395-ge15784fbbbd-1.dsc'
Skipping already downloaded file 'emacs-snapshot_20170709+emacs-25.1-129395-ge15784fbbbd.orig.tar.gz'
Skipping already downloaded file 'emacs-snapshot_20170709+emacs-25.1-129395-ge15784fbbbd-1.debian.tar.xz'
Need to get 0 B of source archives.
Skipping unpack of already unpacked source in emacs-snapshot-20170709+emacs-25.1-129395-ge15784fbbbd
++ latest ./emacs-snapshot-20170709+emacs-25.1-129395-ge15784fbbbd/
++ local file latest
++ for file in "$@"
++ [[ ./emacs-snapshot-20170709+emacs-25.1-129395-ge15784fbbbd/ -nt '' ]]
++ latest=./emacs-snapshot-20170709+emacs-25.1-129395-ge15784fbbbd/
+ cd
+ echo 'doing sudo apt-get build-dep -y emacs-snapshot'
doing sudo apt-get build-dep -y emacs-snapshot
+ sudo apt-get build-dep -y emacs-snapshot
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+ debuild -b -uc -us
debuild: fatal error at line 660:
cannot find readable debian/changelog anywhere!
Are you in the source code tree?
schemelab@metta:/tmp$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment