Emacs was originally built on a Unix system and continues to run on the multitude of Unix variants out there. We're going to download the latest source and show you how to build Emacs from scratch. It's not really that hard and it has the salutary effect of keeping you up-to-date with future releases. 13.1.1 Where to Get Emacs?If you can't wait, the primary source for downloading Emacs is http://ftp.gnu.org/pub/gnu/emacs/. Alternatively, you can use CVS to nab the absolute latest build. But more on that in a minute. 13.1.1.1 Downloading Emacs from the WebYou can get Emacs from any one of many sites as long as your Internet connection is fast enough to transfer a 20 MB file easily. You must also have at least 120 MB of disk space free; this number will certainly grow in future Emacs releases. The Free Software Foundation maintains a definitive list of all mirror sites. The FSF is the principal sponsor of the GNU Project and it is housed at their site. If you want to look around a bit, http://www.gnu.org/ is the place to start. Or as mentioned earlier, you can just jump directly to the directly listing for Emacs at http://ftp.gnu.org/pub/gnu/emacs/. You should see a list similar to Figure 13-1. Figure 13-1. The emacs directory at gnu.orgLook for the latest version of Emacs (21.3 in Figure 13-1) and download it. 13.1.2 Where to Put Emacs?Regardless of where you go to get the source, where you put the files you download is really up to you. For our Unix-based systems, we downloaded everything into /usr/local/install. This is a fine place to start, but if you have a favorite download/development area, feel free to use that. In fact, you can even put everything in your home directory while you're building things. The only thing to remember is that the build process involves a lot of files that you won't need after everything's done. Make sure you put things somewhere that's easy to clean up when all is said and done. As for the final destination of the executable, that's also up to you. Most Unix systems (including Mac OS X) will do well to use the /usr/local hierarchy. That directory is both common and the default choice in the build scripts. If you're not on a machine that you have complete control over, though, you can certainly install Emacs into your home directory (or a subdirectory you keep for you own software). One quick note on using your home directory for the executable version of Emacs: it does make it easy to back up Emacs or transfer it to another machine if you upgrade your system (we know from experience!). However, it can limit who has access to Emacs. If another user works on the same machine and you both want to use Emacs, installing to a common directory (like /usr/local ) is definitely the way to go. 13.1.3 Uncompressing and UnpackingNow that you have the file, you need to do two things to it before you can actually build Emacs: uncompress and unpack. You can use the tar command to do both. Make sure you are in the directory where you downloaded the Emacs file. Type the following command (changing the n to the version number that matches the file you downloaded), and you will see a list of files. $ tar xvzf emacs-21.n.tar.gz x emacs-21.3, 0 bytes, 0 tape blocks x emacs-21.3/AUTHORS, 77854 bytes, 153 tape blocks x emacs-21.3/FTP, 8950 bytes, 18 tape blocks x emacs-21.3/INSTALL, 42841 bytes, 84 tape blocks x emacs-21.3/README, 4046 bytes, 8 tape blocks x emacs-21.3/BUGS, 1042 bytes, 3 tape blocks x emacs-21.3/move-if-change, 129 bytes, 1 tape blocks x emacs-21.3/ChangeLog, 161418 bytes, 316 tape blocks x emacs-21.3/Makefile.in, 25461 bytes, 50 tape blocks . . . This list of created files goes on for quite a while over 2500 files for Emacs 21.3. If you don't want to see the list, omit the v (verbose option) from the tar command. When this command completes, you have all of the files for Emacs. Now that any necessary preparations are out of the way, you can go through the steps to build and install Emacs itself. 13.1.4 Downloading Emacs from CVSAs we mentioned earlier, you can also use CVS to pull the source files. The big advantage with CVS is that you get the absolute latest version.
You'll see thousands of filenames flying by. If you have a slow network connection, this process could take a while. Hang in there, though you're on your way to building the absolute latest version of Emacs! 13.1.5 Building EmacsUnless you get a prebuilt version of Emacs that is right for your system, you will need to build and install the many executable components of Emacs from source code before you can use it. At this point, it doesn't matter how you got the source code (HTTP or CVS), you just need to compile it! Here is some information to get you started on this task. Your source code has a top-level directory with a name like emacs-21.3. In this directory, you will find files called INSTALL and README. Examine README first; it contains useful general information as well as last-minute release notes that may be important for you to read before proceeding. Then read INSTALL, which gives step-by-step instructions for building Emacs. Even if you aren't a Unix expert, you should be able to follow these instructions. (For convenience, we provide a procedure you can follow later in this section.) The FSF's standard installation procedure gets more comprehensive and bulletproof all the time. Still, the actual ease of building Emacs depends primarily on what combination of hardware and software you have. The FSF's installation script includes a program called configure that examines your system, figures out what hardware and software you are running, and configures Emacs accordingly. configure is likely to guess correctly if you have a popular combination (such as a Sun SPARC CPU and a recent release of Solaris). If this is true, you should be able to build Emacs without lots of tweaking or technical expertise. However, if you have an unusual setup a wildly obsolete computer or operating system version, an unusual hardware/software combination, or unconventional system configuration then you will have no choice but to tweak the software. That's beyond the scope of this book, but those README and INSTALL files that come with the source distribution are a great place to start when dealing with uncommon setups. Here's a procedure for building Emacs that you can use as a guide:
|