Modifying newlisp to be able to handle variable ${PREFIX}

Started by sudowriter, April 05, 2009, 07:24:28 PM

Previous topic - Next topic

sudowriter

Hi,



Just like to say I just recently discovered newlisp and am very interested in playing with it!



The first thing I want to do is literally play with newlisp itself, to make it more amenable with my package manager (and other package managers). For that to happen, I have to find a way to deal with the hardcodred "/usr" prefix in the package, and modify the ./configure script to globally change the /usr item there.



It seems easy for me to do this by simply grep'ing for all "/usr" instances and replacing it with some PREFIX variable. However,

1) there are a lot of instances of /usr, and I'm not confident I will not break anything

2) I am not experienced in playng with make files to make it such that when I run my ./configure, all instances of /usr get replaced with the proper prefix.



I think the main idea should work out that for all lisp files, I should instead get them to include a central configuration directive where

(setq newlisp-prefix "/usr")

is written or something like that. Then my ./configure script should run some sed script that replaces that with the given configure option.



Anyways, my basic idea is

1) hardcoded paths = bad

2) flexibility = good



I am looking at newlisp-10.0.2 source package freshly downloaded :D



Does anyone have any ideas?

newdep

#1
Hello Sudowriter,



Yes your somehow right , the install will always goto (dir)/usr/share

where the install_home goes into $HOME/share..



If you realy need the NEWLISPDIR then this is a solution,



You could remove/replace all the "/usr" from the makefile

into i.e. "/export/programming/newlisp/".

If you do this you always need the .init.lsp in your $HOME.



And edit your .init.lsp and make sure the NEWLISPDIR

env-variable points to the right directory. This way your always

in sync with packages that use NEWLISPDIR.



put i.e. (env "NEWLISPDIR" "/export/programming/newlisp/")

in your $HOME/.init.lsp



But you dont need to do a "make install" You can simply a

copy the newlisp binary and .so to any dir you want after the "make".



I rearly use the NEWLISPDIR for personal use as I have my

own tree structure..
-- (define? (Cornflakes))

Lutz

#2
here is some additional info on how the make process works:



newLISP uses hand-written simple makefiles. The configure script is not the usual configure script normally found in open source packages. In newLISP configure only discovers the platform/OS and a similar build script calls the appropriate makefile_xxx from the main: Makefile script via a: build script similar to: config script.



This way a newLISP build and install can be driven by standard package managers and installers which use the sequence:



./configure

make

sudo make install



This will work in newLISP too, although strictly spealing the first step is redundant and only there to satisfy standard package installers.



For your purpose it should be enough to just change the file: Makefile. There is one other hardcoded instance in newlisp.c of /usr/share/newlisp used to define the environment variable NEWLISPDIR. You can leave this alone (do not touch it) and instead define the NEWLISPDIR environment variable in your OS environment to a different place. When newLISP starts and finds NEWLISPDIR already defined, then it will not use the hradcoded standard path for it.



To sum it up there are only 4 definitions to change around line 264 in Makefile:



datadir=$(DESTDIR)/usr/share

bindir=$(DESTDIR)/usr/bin

mandir=$(DESTDIR)/usr/share/man



GUISERVER = /usr/share/newlisp/guiserver



additionally you can define DESTDIR in your environment.

sudowriter

#3
I completely forgot about this, but I wrote a patch to the makefile to make it more *nix-like re:$PREFIX. I only happened to notice it after doing some spring cleaning of my hard drive. :D



I just took a casual look at the newlisp changes file and there's no prefix support so far, so I think it's fair game to have it checked. I've never submitted a patch for anything before.

Lutz

#4
$(prefix) in Makefile  is supported in the next development release 10.0.7.

TedWalther

#5
If you are interested in automating the build process without editing Makefiles, such as is provided by the autotools (autoconf, etc), try out this new patch, give it a whirl, it should do some nice things for you. (although the $prefix variable is not yet supported, lots of other good things are)



http://ted.affordableaffiliates.com/newlisp-configure.patch">http://ted.affordableaffiliates.com/new ... gure.patch">http://ted.affordableaffiliates.com/newlisp-configure.patch



Usage:



./configure
make -f makefile_configure
sudo make install


If you run into any problems, please email me the config.h and makefile_configure files, as well as pasting the error messages you got during  the compile.  Also the output of uname -a and dmesg would be helpful.



Should just work for you out of the box though.



Ted
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.