在Ubuntu 14.04上构建Emacs 24.5的deb软件包

在Ubuntu 14.04中,通过apt-get install命令可以安装的emacs24版本是24.3,有点老旧。
目前看来,并没有24.5版本的ppa,因此我自己尝试进行了编译。
为了方便管理,我还制作了deb包。
由于遇到了一些问题,所以我写了一篇文章记录下来。

如果有更好的方法,请告诉我,因为我是deb包的初学者。

下载源代码。

由于Wily(15.10)的版本变为24.5,因此需要下载该源代码。
还需要下载一个名为emacsen-common的软件包,因为需要更新。

wget https://launchpad.net/ubuntu/+archive/primary/+files/emacs24_24.5%2B1.orig.tar.bz2
wget https://launchpad.net/ubuntu/+archive/primary/+files/emacs24_24.5%2B1-1ubuntu2.debian.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+files/emacsen-common_2.0.8.tar.xz

融化

我们将分别解压缩它们。

tar xf emacsen-common_2.0.8.tar.xz
tar xf emacs24_24.5+1.orig.tar.bz2
mv emacs24-24.5+1.orig emacs24-24.5+1
cd emacs24-24.5+1
tar xf ../emacs24_24.5+1-1ubuntu4.debian.tar.xz
cd ..

打补丁

在我的环境中,当我尝试安装libgnutls28-dev所需的构建时,它与其他软件包发生了冲突,因此我放宽了条件。

而且,需要对debian/patch-to-new的脚本进行修改(参考网址:http://git.willhughes.name/emacs/blob/master/debian/patch-to-news)。

在Shell上执行以下命令将应用该补丁。

patch -p0 << "EOS"
diff -ur emacs24-24.5+1_org/debian/control emacs24-24.5+1/debian/control
--- emacs24-24.5+1_org/debian/control   2015-10-29 23:00:59.000000000 +0900
+++ emacs24-24.5+1/debian/control   2015-12-28 08:45:35.874903978 +0900
@@ -9,7 +9,7 @@
  libgpm-dev [linux-any], libdbus-1-dev,
  autoconf, automake, autotools-dev, dpkg-dev (>> 1.10.0), quilt (>= 0.42),
  debhelper (>= 9), libxaw7-dev, sharutils, imagemagick, libgtk-3-dev,
- libgnutls28-dev, libxml2-dev, libselinux1-dev [linux-any], libmagick++-dev,
+ libgnutls-dev, libxml2-dev, libselinux1-dev [linux-any], libmagick++-dev,
  libgconf2-dev, libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
  libacl1-dev,
  zlib1g-dev
diff -ur emacs24-24.5+1_org/debian/control.in emacs24-24.5+1/debian/control.in
--- emacs24-24.5+1_org/debian/control.in    2015-09-18 02:58:21.000000000 +0900
+++ emacs24-24.5+1/debian/control.in    2015-12-28 08:46:00.182903255 +0900
@@ -9,7 +9,7 @@
  libgpm-dev [linux-any], libdbus-1-dev,
  autoconf, automake, autotools-dev, dpkg-dev (>> 1.10.0), quilt (>= 0.42),
  debhelper (>= 9), libxaw7-dev, sharutils, imagemagick, libgtk-3-dev,
- libgnutls28-dev, libxml2-dev, libselinux1-dev [linux-any], libmagick++-dev,
+ libgnutls-dev, libxml2-dev, libselinux1-dev [linux-any], libmagick++-dev,
  libgconf2-dev, libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
  libacl1-dev,
  zlib1g-dev
diff -ur emacs24-24.5+1_org/debian/patch-to-news emacs24-24.5+1/debian/patch-to-news
--- emacs24-24.5+1_org/debian/patch-to-news 2015-09-18 02:58:21.000000000 +0900
+++ emacs24-24.5+1/debian/patch-to-news 2015-12-28 08:45:25.778904278 +0900
@@ -4,6 +4,12 @@

 patch="$1"

+if [ ! -f "$patch" -a -f "patches/$patch" ]; then
+    patch="patches/$patch"
+elif [ ! -f "$patch" -a -f "debian/patches/$patch" ]; then
+    patch="debian/patches/$patch"
+fi
+
 sed '
   # delete everything after the first line starting with "--- " (the diff)
   /^--- [^ ]/,$d' < "$patch" \
EOS

安装构建所需的软件包

安装构建所需的软件包。
如果缺少,debuild会在构建过程中提醒您。

sudo apt-get install build-essential \
                     devscripts \
                     libacl1-dev \
                     libcurl4-gnutls-dev \
                     libgconf2-dev \
                     libghc-gconf-dev \
                     libgif-dev \
                     libgnutls-dev \
                     libgpm-dev \
                     libjpeg-dev \
                     liblockfile-dev \
                     libm17n-dev \
                     libmagick++-dev \
                     libmagickcore-dev \
                     libncurses5-dev \
                     libotf-dev \
                     libpng12-dev \
                     librsvg2-dev \
                     libselinux1-dev \
                     libtiff4-dev \
                     libx11-dev \
                     libxft-dev \
                     libxml2-dev \
                     sharutils \
                     xaw3dg-dev

构建

为了缩短构建时间,我们将进行并行构建。

cd emacs24-24.5+1
debuild -us -uc -j`nproc`

emacsen-common的部分也一样。这边即使不进行并行构建也会很快完成。

cd ../main
debuild -us -uc

安装

我会安装已经准备好的deb软件包。

cd ..
sudo dpkg -i emacsen-common_2.0.8_all.deb
sudo dpkg -i emacs24-el_24.5+1-1ubuntu4_all.deb \
             emacs24-bin-common_24.5+1-1ubuntu4_amd64.deb \
             emacs24-common_24.5+1-1ubuntu4_all.deb \
             emacs24_24.5+1-1ubuntu4_amd64.deb

结束了。

广告
将在 10 秒后关闭
bannerAds