Next: , Previous: , Up: Building SXEmacs and Object Allocation   [Contents][Index]


B.1 Building SXEmacs

This section explains the steps involved in building the SXEmacs executable. You do not have to know this material to build and install SXEmacs, since the makefiles do all these things automatically. This information is pertinent to SXEmacs maintenance.

The SXEmacs Internals Manual contains more information about this.

Compilation of the C source files in the src directory produces an executable file called temacs, also called a bare impure SXEmacs. It contains the SXEmacs Lisp interpreter and I/O routines, but not the editing commands.

Before SXEmacs is actually usable, a number of Lisp files need to be loaded. These define all the editing commands, plus most of the startup code and many very basic Lisp primitives. This is accomplished by loading the file loadup.el, which in turn loads all of the other standardly-loaded Lisp files.

It takes a substantial time to load the standard Lisp files. Luckily, you don’t have to do this each time you run SXEmacs; temacs can dynamically dump out an executable program called sxemacs that has these files preloaded. In fact, this is actually all what temacs can do and does.

The resulting file sxemacs starts more quickly because it does not need to load the files. This is the SXEmacs executable that is normally installed.

To create sxemacs, use the command ‘temacs -batch -l loadup dump’. The purpose of ‘-batch’ here is to tell temacs to run in non-interactive, command-line mode. temacs can only run in this fashion. Part of the code required to initialize frames and faces is in Lisp, and must be loaded before SXEmacs is able to create any frames. The argument ‘dump’ tells loadup.el to dump a new executable named sxemacs.

Note: The dumping process is highly system-specific, and some operating systems do not support dumping. On those systems, you must start SXEmacs with the ‘temacs -batch -l loadup run-temacs’ command each time you use it. This takes a substantial time, but since you need to start SXEmacs once a day at most—or once a week if you never log out—the extra time is not too severe a problem.

You are free to start SXEmacs directly from temacs if you want, even if there is already a dumped sxemacs. Normally you wouldn’t want to do that; but the Makefiles do this when you rebuild SXEmacs using ‘make all-elc’, which builds SXEmacs and simultaneously compiles any out-of-date Lisp files.

You need temacs in order to compile Lisp files. However, you also need the compiled Lisp files in order to dump out sxemacs. If both of these are missing or corrupted, you are out of luck unless you’re able to bootstrap sxemacs from temacs. Note that ‘make all-elc’ actually loads the alternative loadup file loadup-el.el, which works like loadup.el but disables the pure-copying process and forces SXEmacs to ignore any compiled Lisp files even if they exist.

You can specify additional files to preload by writing a library named site-load.el that loads them. You may need to increase the value of PURESIZE, in src/puresize.h, to make room for the additional files. You should not modify this file directly, however; instead, use the ‘--puresize’ configuration option. If you run out of pure space while dumping sxemacs, you will be told how much pure space you actually will need. However, the advantage of preloading additional files decreases as machines get faster. On modern machines, it is often not advisable, especially if the Lisp code is on a file system local to the machine running SXEmacs.

You can specify other Lisp expressions to execute just before dumping by putting them in a library named site-init.el. However, if they might alter the behavior that users expect from an ordinary unmodified SXEmacs, it is better to put them in default.el, so that users can override them if they wish. See Start-up Summary.

Before loadup.el dumps the new executable, it finds the documentation strings for primitive and preloaded functions (and variables) in the file where they are stored, by calling Snarf-documentation (see Accessing Documentation). These strings were moved out of the sxemacs executable to make it smaller. See Documentation Basics.

Function: dump-emacs to-file from-file

This function dumps the current state of SXEmacs into an executable file to-file. It takes symbols from from-file (this is normally the executable file temacs).

If you use this function in an SXEmacs that was already dumped, you must set command-line-processed to nil first for good results. See Command Line Arguments.

Function: run-emacs-from-temacs &rest args

This is the function that implements the run-temacs command-line argument. It is called from loadup.el as appropriate. You should most emphatically not call this yourself; it will reinitialize your SXEmacs process and you’ll be sorry.

Command: emacs-version &optional arg

This function returns a string describing the version of SXEmacs that is running. It is useful to include this string in bug reports.

When called interactively with a prefix argument, insert string at point. Don’t use this function in programs to choose actions according to the system configuration; look at system-configuration instead.

(emacs-version)
  ⇒ "SXEmacs: hroptatyr@sxemacs.org--sxemacs/sxemacs--hrop--22.1.2--patch-15,
                 built Fri Apr 29 18:44:05 2005 on marlin.math.tu-berlin.de"

Called interactively, the function prints the same information in the echo area.

Variable: emacs-build-time

The value of this variable is the time at which SXEmacs was built at the local site.

emacs-build-time
     ⇒ "Fri Apr 29 18:44:05 2005"
Variable: emacs-version

The value of this variable is the version of Emacs being run. It is a string, e.g. "hroptatyr@sxemacs.org--sxemacs/sxemacs--hrop--22.1.2--patch-15".

The following two variables should be used in favour of snarfing and parsing the output of emacs-version.

Variable: emacs-major-version

The major version number of Emacs, as an integer. For SXEmacs version 22.1.2, the value is 22.

Variable: emacs-minor-version

The minor version number of Emacs, as an integer. For SXEmacs version 22.1.2, the value is 1.

Note: These variables did not exist in early Emacs versions. If you intend to preserve backward compatibility to this great extent you should definitely consider to use a boundp condition.

Code to make certain features dependent on the version you are running can be derived from the following example:

(when (boundp 'emacs-major-version)
  (case emacs-major-version
     (21 (message "You are probably not using SXEmacs"))
     (22 (case emacs-minor-version
           (1 (message "SXEmacs 22.1.x"))
           (2 (message "SXEmacs 22.2.x"))
           (3 (message "SXEmacs 22.3.x"))
           (otherwise (message "Weird version."))))
     (otherwise (error "Your version of SXEmacs is too old."))))

Next: , Previous: , Up: Building SXEmacs and Object Allocation   [Contents][Index]