I want to look at the GNU Emacs source code because I have some ideas I want to try and implement.
If you want to write patches for an open-source project, the first thing to do is to check out the latest version from the repository, make sure it compiles and runs. At this stage, you also want to make sure that all of the tests passes, so that you can start working on a verified assumption that you branched from a fully working commit.
So for short this post is a micro-tutorial on building GNU Emacs from source on a Debian-compatible (read: apt-based) system.
The first thing to do is to gather all the required build dependencies:
sudo apt-get build-dep emacs24
This alone will install all of the necessary building dependencies.
Next step is to check out the source code. You can find the url of the repository on the Savannah page:
git clone git clone -b master git://git.sv.gnu.org/emacs.git
At this page you might want to slow down a little and skim through the INSTALL file. It contains instructions for building.
At this point you’re al most ready for compilation. You have to run the auto-tools and generate the Makefile:
./autogen.sh ./autogen.sh git
And now you can generate a Makefile with all the features you want (you can look up some of the configure options in the INSTALL file, or run ./configure –help):
./configure --with-x-toolkit=gtk --with-cairo --with-modules
And now, finally, compile:
make -j9
On my machine (ThinkPad W530, quad-core i7 and 7200rpm rotational hard drive), it took about five minutes:
real 5m9.283s user 21m21.412s sys 0m48.284s
You will now find the newly built emacs binaries in the src/ directory.
Have fun!