LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to compile a portable emacs for Linux ? (https://www.linuxquestions.org/questions/linux-software-2/how-to-compile-a-portable-emacs-for-linux-4175426528/)

zcnnbb 09-10-2012 09:58 AM

How to compile a portable emacs for Linux ?
 
If you compile the emacs source code using default way
(that is "./configure && make && make install"),
once it has been compiled, the program path can no longer be changed.
(i.e. if you move the program and all its data to another directory, it won't run)

But I have specific need: I need to run emacs on multiple computers and the path is not a constant.
So how can I build a portable version of emacs?

For instance, I want to put the program and all its data in a folder named emacs, and this folder may have different path on different computers: /media/disk/emacs or /home/xxx/emacs or ...., and I want to make it run on those computers.

tronayne 09-10-2012 10:23 AM

The configure shell program has multiple options for setting the various path variables. If you execute configure --help (and maybe pipe it into more or redirect the output into a temporary file you'll see the options you can use.

For example, most configure programs include these:
Code:

...
Installation directories:
  --prefix=PREFIX        install architecture-independent files in PREFIX
  --exec-prefix=EPREFIX  install architecture-dependent files in EPREFIX
                          [PREFIX]
...
Fine tuning of the installation directories:
  --bindir=DIR          user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR      program executables [EPREFIX/libexec]
  --sysconfdir=DIR      read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR  modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR          object code libraries [EPREFIX/lib]
  --includedir=DIR      C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
...and a whole lot more options

Note that the default is to install in the /usr/local tree and you can override that by setting
Code:

configure --prefix=/usr
so that all the software installs in that tree.

It would be worth your time to scan through all the output of configure --help to see what options are available (most of them can, and usually should be, be left at the defaults).

Hope this helps some.

zcnnbb 09-10-2012 02:58 PM

You didn't understand my question.

tronayne 09-10-2012 04:20 PM

Perhaps not; however, if you want to build a portable version of emacs (that does not install in /usr/local -- which is not a bad place to install it in any event), you would need to determine where you want it to go then execute configure, make, and make install separately (not in one go) with appropriate arguments to configure.

"Portable" will only be portable on like distributions of Linux; i.e., you can't build emacs on a 32-bit box and expect it to run on a 64-bit (and vice versa) unless all the appropriate libraries are installed on that distribution. That's not exactly trivial.

So, what's wrong with /usr/local? The make install will create directories in /usr/local, such as bin, lib, etc. and install the editor there; all you'd need to do to is add /usr/local/bin to your /etc/login.defs file and, probably, /usr/local/lib to /etc/ld.so.conf (or LD_LIBRARY_PATH in /etc/profile). You'd have to do that if you choose to put it in some weird location in any event. You ought to be able to copy /usr/local from one machine to another without too much trouble. If you don't like /usr/local, configure the thing with some other prefix and be done with it.

Unless you are extremely familiar with whatever package management system your individual Linux boxes support the above may be your best bet; however, emacs is fairly common as standard equipment in most distributions and, if it's missing in a base install, it ought to be freely available from the distribution software depository; e.g., yum. Have you tried that?


All times are GMT -5. The time now is 11:40 AM.