Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!MCC.COM!herme From: herme@MCC.COM (Manuel Hermenegildo) Newsgroups: gnu.emacs Subject: Re: shared source question Message-ID: <8906071437.AA09737@darth.aca.mcc.com> Date: 7 Jun 89 14:37:32 GMT References: <8906070331.AA00262@atlantis> Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 71 We have been using a relatively simple method in order to deal with the problem of having one set of source files and executables for different machines in an NFS environment. This is a "low tech" solution that doesn't need any modification of the loader or kernel. We use it, for example, in a Prolog implementation that uses one set of source files but runs on many different machines (suns, vaxen, and multiprocessors -Sequent). I will describe the method specialized for emacs, but it is of general application. If you know of a better method let me know. If you want more info on this one, I will be happy to provide it. The first part of the trick is to avoid duplication of source files by using symbolic links: all versions of emacs can be kept under a common directory tree. The top directory in the tree (let's call it "emacs-dir") contains all the source files (".c" files), a global Makefile, the directories for the non-machine-specific files --e.g. lisp source directory--- and a directory called "objcode". In the objcode directory there are subdirectories for each machine that is supported (e.g. "sun3", "sun2", "balance", "bobcat", etc.). Each one of these directories contains >symbolic links< to all the source files in the "emacs-dir" directory and a specialized copy of the makefile. Running "make" in each subdirectory in "objcode" creates a machine-specific version of emacs without duplicating the source files. Thus, after running make on each "objcode" subdirectory there will be different machine-specific versions of emacs ....emacs-dir/objcode/sun3/emacs ....emacs-dir/objcode/sun2/emacs ....emacs-dir/objcode/balance/emacs ....emacs-dir/objcode/bobcat/emacs without having duplicated the source files and libraries. The second part of the trick is to select the right executable when the user types "emacs", depending on which machine he or she is running on. A simple way to do this is to define at login time (i.e. in the ".login" file) an environment variable called "hardware" which contains the type of hardware that the login shell is running on (the type of hardware can be determined automatically --I can post that also if someone is interested), and then add to the standard set of paths a path to the appropriate version of emacs set path= (....emacs-dir/objcode/$hardware $path) that way the correct version is selected every time when the user types "emacs". In general, rather than doing this specifically for emacs, we organize our "bin" files into subdirectories ~/bin/sun3 ~/bin/sun4 ~/bin/balance which contain links to the right executables for different packages and set the user path to be set path= (~/bin/$hardware $path) Based on having a correct value in the "$hardware" variable the creation of the subdirectories (such as "....emacs/objcode/sun4") and the links to the source files is also automated by using a special makefile at the top level, so that when you type "make" at the top level the corresponding "objcode" subdirectory for the machine you are running on is created (if it didn't exist before), the symbolic links made, and compilation is automatically started in that subdirectory. Creating the different versions then simply involves starting shells on the different machines and typing "make" at the "emacs-dir" level. Again, I will be happy to provide more info or hear of a better solution. Manuel Hermenegildo