Building GNU Emacs for Ubuntu
Issues related to OS administration are outside the scope of my interests, so when it becomes necessary to solve one of these issues, I first try to find a brief howto, if nothing is found, I sit down for reading manuals that I safely forget after solving the problem. Therefore, for rarely resolved, but still occasionally arising problems, I write myself cheat sheets. This article is one of them. What it is to a greater extent: “quick'n'dirty creating a deb package” or “briefly on the assembly of emacs.deb” - I can’t judge, it will suit both one and the other. The assembly of GNU Emacs 24.0.92 from source codes in Ubuntu 11.10 is described below.
We start by preparing the place: and creating, in the absence of it, a GPG key that will sign the assembled package:
A series of questions will be asked, the answers to which are intuitive. There is only one subtle point when creating a key - specify the same name that you will use later when creating the package.
Install the packages necessary for assembling .deb:
Now you need to get the original GNU Emacs codes:
Note that the name of the directory for receiving the source codes -
Let us put the directory with the source codes in a state of readiness for assembly. Ready state is the presence of a script
we just install the necessary one:
Search for the necessary one (regular expressions can be used):
Let's look at the output of the command (
If you need support for some library (where “no” stands), deliver the necessary -dev packages to the system. The file
That's all.
Sources of information:
www.debian.org/doc/manuals/maint-guide/index.ru.html
www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html
We start by preparing the place: and creating, in the absence of it, a GPG key that will sign the assembled package:
mkdir ~/build
cd ~/build
gpg --gen-key
gpg -a --output ~/.gnupg/john_doe.gpg --export 'John Doe'
A series of questions will be asked, the answers to which are intuitive. There is only one subtle point when creating a key - specify the same name that you will use later when creating the package.
Install the packages necessary for assembling .deb:
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder
Now you need to get the original GNU Emacs codes:
bzr co --lightweight -v bzr://bzr.savannah.gnu.org/emacs/trunk emacs-24.0.92
Note that the name of the directory for receiving the source codes -
emacs-24.0.92
- must be chosen in accordance with the requirements for naming the directory that contains the source codes for the assembly .deb Package: packagename-packageversion
Lowercase. You can find out the version number of the program in the trunk by looking at the file README
here: http://bzr.savannah.gnu.org/lh/emacs/trunk/files .Let us put the directory with the source codes in a state of readiness for assembly. Ready state is the presence of a script
configure
. We start for its generation:
Now we need to make an archive copy of the existing directory and put it on the same level with it:
We begin debianization:
where we replace john.doe@gmail.com with our e-mail, answer the question:
Choose “single binary”.
As a result, a directory will be created (I write the names of files and directories always relative to the current directory), which contains the files that control the assembly of the package. We will proceed to their editing a little later, but for now we will find out what will need to be registered there as necessary packages for assembly. To do this, run:
If the system lacks something to build:cd emacs-24.0.92
./autogen.sh
tar -czvf ../emacs-24.0.92.tgz ../emacs-24.0.92/
dh_make -p emacs -e john.doe@gmail.com -c gpl3 -f ../emacs-24.0.92.tgz
Type of package: single binary, indep binary, multiple binary, library, kernel module, kernel patch?
debian
dpkg-depcheck -d ./configure
checking for library containing tputs... no
configure: error: The required function `tputs' was not found in any library.
These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package.
we just install the necessary one:
sudo apt-get install libncurses5-dev
Search for the necessary one (regular expressions can be used):
apt-cache search .*libncurses.*dev
Let's look at the output of the command (
dpkg-depcheck -d ./configure
) at the very end of the long listing:
This will need to be added to the listed packages in the file in the “Build-Depends” line, separating the listed packages with a comma and a space. Look at the other fields in this file, edit them if necessary. Here is the contents of my file for comparison:
Detailed information on the contents of the file can be found here: http://www.debian.org/doc/manuals/maint-guide/dreq.ru.html#control .
Returning to the output of the command , look at what GNU Emacs will be built with, find the following lines:Packages needed:
libgtk-3-dev
debian/control
Source: emacs
Section: editors
Priority: extra
Maintainer: John Doe
Build-Depends: debhelper (>= 8.0.0), autotools-dev, libgtk-3-dev
Standards-Version: 3.9.2
Homepage: www.gnu.org/software/emacs
Package: emacs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: GNU Emacs is an extensible, customizable text editor.
debian/control
configure
What operating system and machine description files should Emacs use?
`s/gnu-linux.h' and `m/amdx86-64.h'
What compiler should emacs be built with? gcc -std=gnu99 -g -O2
Should Emacs use the GNU version of malloc? yes
(Using Doug Lea's new malloc from the GNU C Library.)
Should Emacs use a relocating allocator for buffers? no
Should Emacs use mmap(2) for buffer allocation? no
What window system should Emacs use? x11
What toolkit should Emacs use? GTK
Where do we find X Windows header files? Standard dirs
Where do we find X Windows libraries? Standard dirs
Does Emacs use -lXaw3d? no
Does Emacs use -lXpm? yes
Does Emacs use -ljpeg? yes
Does Emacs use -ltiff? yes
Does Emacs use a gif library? yes -lgif
Does Emacs use -lpng? yes
Does Emacs use -lrsvg-2? yes
Does Emacs use imagemagick? yes
Does Emacs use -lgpm? yes
Does Emacs use -ldbus? yes
Does Emacs use -lgconf? no
Does Emacs use GSettings? yes
Does Emacs use -lselinux? yes
Does Emacs use -lgnutls? yes
Does Emacs use -lxml2? yes
Does Emacs use -lfreetype? yes
Does Emacs use -lm17n-flt? yes
Does Emacs use -lotf? yes
Does Emacs use -lxft? yes
Does Emacs use toolkit scroll bars? yes
If you need support for some library (where “no” stands), deliver the necessary -dev packages to the system. The file
INSTALL
describes the options for the script configure
, using which you can configure GNU Emacs assembly in different ways. Keep in mind that now you are doing test runs configure
and doing dpkg-depcheck -d ./configure --without-png
, for example, you do not affect the .deb package created with compiled GNU Emacs. To pass the necessary parameters to the script configure
during the assembly of the .deb package, add the following lines to debian/rules
:
Note that the second line should and begins with a tab character (here the parser gobbled up everything and you cannot see the indent).
And now a few words about the content . For assembly, they all need to be run.override_dh_auto_configure:
dh_auto_configure -- --without-png
debian/
debian/{control, rules, copyright, changelog}
dh_make
. In principle, you can not edit anything else, but paying tribute to the work of people I propose to put the file in order debian/copyright
. Here is an example:
Now, everything is ready for assembly. There is one problem left - “make check”. built in such a way that there is a check target and it will be launched by the .deb build system. And since we merged the trunk, and not the prepared release, the tests may not pass. At least I have it now. To skip tests, you must set the environment variable . So, start the assembly:
no missing test team looks like this:
By default, GNU Emacs is going to support toolkit , parameterize configure to build eye-pleasing GUI version with support andFormat: dep.debian.net/deps/dep5
Upstream-Name: emacs
Source: savannah.gnu.org/bzr/?group=emacs
Maintainer: John Doe
Files: *
Copyright: Copyright (C) 2007 Free Software Foundation, Inc.
License: GPL-3.0+
Files: debian/*
Copyright: 2011 John Doe
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
Makefile
DEB_BUILD_OPTIONS="nocheck"
DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -rfakeroot
dpkg-buildpackage -rfakeroot
gtk3
Gtk3
Xft
(freetype fonts) is not required, just repeat the steps in the as is article and get a normal full GNU Emacs build. If you did everything correctly, then the package will be completed by asking for the secret phrase that was asked when generating the PGP key. After which, a level above the current directory, the assembled .deb package will appear, which can be installed on the system: dpkg -i ../emacs_24.0.92-1_amd64.deb
That's all.
Sources of information:
www.debian.org/doc/manuals/maint-guide/index.ru.html
www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html