Subject: [clisp-list] Clisp, rpm and added modules

From: Daniel Tourde <[email-masked]>
Date: Fri, 11 May 2001 12:43:04 +0200

Hi!

I am trying to generate an RPM for a RedHat 7.0 machine of an old
version of clisp (2000-03-06) WITH added functionnalities and I
encounter some problems that I hope someone can help me with.

I used an existing .spec file and I modified it according to my needs.
Basically the procedure is the well know
./configure
make
make install

%prep
%setup -q -n %{name}-2000-03-06 -a 1
%patch -p1

%build
./configure --prefix=%{_prefix} --fsstnd=redhat

cd src
./makemake  --prefix=%{_prefix} --with-readline --with-nogettext
--with-dynamic-ffi > Makefile
make config.lsp
make

%install
rm -rf %{buildroot}
mkdir %{buildroot}
cd src
make install_root=%{buildroot} install

The fact is some functions are added into the core of Clisp. I am not
the one wro wrote them, I know nothing about Clisp and I am just
following the instruction left by the guy before he got retired.

Basically here are the modifications:

%prep
%setup -q -n %{name}-2000-03-06 -a 1
%patch -p1

%build
./configure --prefix=%{_prefix} --fsstnd=redhat

cd src
./makemake  --prefix=%{_prefix} --with-readline --with-nogettext
--with-dynamic-ffi > Makefile
make config.lsp
make
cp lispinit.mem lispinit.mem.raw
cp lisp.run lisp.run.raw
cp ../ffi/* .

echo -e "echo \" \"\n/usr/lib/clisp/base+cfun/lisp.run -M
/usr/lib/clisp/base+cfun/lispinit.mem -i /usr/lib/clisp/ffi/psinit" >
clispcp
chmod 755 clispcp

./clisp-link create-module-set cfun lfun.c
cc -O -c cfun.c
cd cfun
ln -s ../cfun.o cfun.o

cd ..
ar r  libcfun.a cfun.o
cp libcfun.a /usr/lib
cp link.sh ./cfun
./base/lisp.run -M base/lispinit.mem -c lfun.lsp
./clisp-link add-module-set cfun base base+cfun
./base+cfun/lisp.run -M base+cfun/lispinit.mem -i lfun  -Efile
ISO-8859-1 -norc -x  "(load \"comstart\") (compile-file \"psinit-ffi\")
(compile-file \"psinit\") (compile-file \"net\") (compile-file
\"smail\") (bye)"

echo -e "echo \"
\"\n$RPM_BUILD_DIR/%{name}-2000-03-06/src/base+cfun/lisp.run -M
$RPM_BUILD_DIR/%{name}-2000-03-06/src/base+cfun/lispinit.mem -i
$RPM_BUILD_DIR/%{name}-2000-03-06/src/comstart -Efile ISO-8859-1 -norc
-x \"(saveinitmem) (exit)\" " > clbfni

./clbfni

%install
rm -rf %{buildroot}
mkdir %{buildroot}
cd src
make install_root=%{buildroot} install
cp -r ./base+cfun/ %{buildroot}/%{_libdir}/%{name}
cp -r clispcp %{buildroot}/usr/bin

cp libcfun.a       %{buildroot}/%{_libdir}

My former colleague never used the install procedure. He kept all the
files at his disposition, that was a choice of him. When I follow the
procedure until the install section, I obtain an image (cl) that works
perfectly.
When I run the install procedure, it seems that the memory core of clisp
is then modified and it stops to work:

The makefile for install-bin:

install-bin : lisp.run lispinit.mem clisp.c force
        if [ ! -d $(install_root)$(prefix) ] ; then mkdir
$(install_root)$(prefix) ; fi
        if [ ! -d $(install_root)$(exec_prefix) ] ; then mkdir
$(install_root)$(exec_prefix) ; fi
        if [ ! -d $(install_root)$(libdir) ] ; then mkdir
$(install_root)$(libdir) ; fi
        if [ ! -d $(install_root)$(lisplibdir) ] ; then mkdir
$(install_root)$(lisplibdir) ; fi
        if [ ! -d $(install_root)$(lisplibdir)/data ] ; then mkdir
$(install_root)$(lisplibdir)/data ; fi
        $(INSTALL_DATA) data/UnicodeData.txt
$(install_root)$(lisplibdir)/data/UnicodeData.txt
        if [ ! -d $(install_root)$(lisplibdir)/linkkit ] ; then mkdir
$(install_root)$(lisplibdir)/linkkit ; fi
        (cd $(install_root)$(lisplibdir) && rm -rf base full)
        mkdir $(install_root)$(lisplibdir)/base
        mkdir $(install_root)$(lisplibdir)/full
        for f in clisp-link linkkit/modules.d linkkit/modules.c
linkkit/clisp.h
base/* full/*; do cp -p $$f $(install_root)$(lisplibdir)/$$f; done
        if [ ! -d $(install_root)$(bindir) ] ; then mkdir
$(install_root)$(bindir) ; fi
        $(CC) $(CFLAGS) $(CLFLAGS) -DLISPLIBDIR='"$(lisplibdir)"'
-DLOCALEDIR='"$(localedir)"' clisp.c -o $(install_root)$(bindir)/clisp

This gives during the installation process:

...
;;  Loading file /usr/src/redhat/BUILD/clisp-2000-03-06/src/net.fas ...
;;  Loading of file /usr/src/redhat/BUILD/clisp-2000-03-06/src/net.fas
is finished.;;  Loading file
/usr/src/redhat/BUILD/clisp-2000-03-06/src/smail.fas ...
;;  Loading of file /usr/src/redhat/BUILD/clisp-2000-03-06/src/smail.fas
is finished.
;; Loading of file
/usr/src/redhat/BUILD/clisp-2000-03-06/src/comstart.lsp is finished.
861512 ;
524288
Bye.
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.53134
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd clisp-2000-03-06
+ rm -rf /var/tmp/clisp-2000.03.06-root
+ mkdir /var/tmp/clisp-2000.03.06-root
+ cd src
+ make install_root=/var/tmp/clisp-2000.03.06-root install
./lisp.run -m 750KW -B . -Efile ISO-8859-1 -norc -x "(load \"init.lsp\")
(sys::%saveinitmem) (exit)"
  i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo 
  I I I I I I I      8     8   8           8     8     o  8    8
  I  \ `+' /  I      8         8           8     8        8    8
   \  `-+-'  /       8         8           8      ooooo   8oooo
    `-__|__-'        8         8           8           8  8
        |            8     o   8           8     o     8  8
  ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999

;; Loading file defseq.fas ...
;; Loading of file defseq.fas is finished.
;; Loading file backquot.fas ...
;; Loading of file backquot.fas is finished.
;; Loading file defmacro.fas ...
;; Loading of file defmacro.fas is finished.
...

and it keeps going on like that with the same kind of procedures:

...
;; Loading file /usr/src/redhat/BUILD/clisp-2000-03-06/src/config.lsp
...
;; Loading of file /usr/src/redhat/BUILD/clisp-2000-03-06/src/config.lsp
is finished.
T
842532 ;
524288
Bye.
mv lispimag.mem interpreted.mem
./lisp.run -m 1000KW -M interpreted.mem -B . -Efile ISO-8859-1 -norc -q
-c init.lsp
Compiling file /usr/src/redhat/BUILD/clisp-2000-03-06/src/init.lsp ...

Compilation of file /usr/src/redhat/BUILD/clisp-2000-03-06/src/init.lsp
is finished.
0 errors, 0 warnings
./lisp.run -m 1000KW -M interpreted.mem -B . -Efile ISO-8859-1 -norc -q
-c defseq.lsp

Compiling file /usr/src/redhat/BUILD/clisp-2000-03-06/src/defseq.lsp ...

Compilation of file
/usr/src/redhat/BUILD/clisp-2000-03-06/src/defseq.lsp is finished.
...

...
The old definition will be lost

Compilation of file
/usr/src/redhat/BUILD/clisp-2000-03-06/src/macros1.lsp is finished.
0 errors, 0 warnings
./lisp.run -m 1000KW -M interpreted.mem -B . -Efile ISO-8859-1 -norc -q
-c macros2.lsp

Compiling file /usr/src/redhat/BUILD/clisp-2000-03-06/src/macros2.lsp
...
WARNING:
Redefining the COMMON LISP macro DEFLANGUAGE
...

and so on and so on
At the end of it, before I pack the files, I can read:

....
;; Loading file /usr/src/redhat/BUILD/clisp-2000-03-06/src/config.fas
...
;; Loading of file /usr/src/redhat/BUILD/clisp-2000-03-06/src/config.fas
is finished.
T
796288 ;
524288
Bye.
mv lispimag.mem lispinit.mem
if [ ! -d /var/tmp/clisp-2000.03.06-root/usr ] ; then mkdir
/var/tmp/clisp-2000.03.06-root/usr ; fi
...

I suppose that the final rpm does not contain the lispinit.mem and the
lisp.run file it is supposed to contain because during the make install,
things have happened.
Could someone help me to solve this to get installed what I am really
expecting to be installed. I am really sorry but as I said, I lack
experience in the domain. I don't really know what to do now.

I thank you in advance for any answer.

		Daniel

-- 
***********************************************************************
Daniel TOURDE                             E-mail : [email-masked]
                                                Tel : +46 8 55 50 43 44
   FOI, Swedish Defence Research Agency; Aeronautics Division - FFA
       Dept. of Wind Energy and Aviation Environmental Research
SE-172 90 Stockholm, Sweden                        Fax : +46 8 25 34 81
***********************************************************************

---

From: Sam Steingold <[email-masked]>
Date: 11 May 2001 10:09:07 -0400

I saw no error messages in you message.
What is your question?
(Sorry - I didn't get it)
-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
War doesn't determine who's right, just who's left.

---

From: Daniel Tourde <[email-masked]>
Date: Fri, 11 May 2001 16:06:56 +0200

Hi Sam,

> (Sorry - I didn't get it)

My problem is fairly simple. The make + add ons procedure produce
something I can use. After the make install it does not work anymore.
How am I supposed to get things working?

It seems that the make install phase modify the content of lispinit.mem
and lisp.run somehow (This is what I guess, I am not even sure). I just
want to install things, not to get them modified during the process...

So here is my problem and my question is fairly straightforward, how do
I do it?

			Daniel

---

From: Sam Steingold <[email-masked]>
Date: 11 May 2001 11:22:23 -0400

Hi Daniel,

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] Clisp, rpm and added modules"
> * Sent on Fri, 11 May 2001 16:06:56 +0200
> * Honorable Daniel Tourde <[email-masked]> writes:
>

this is strange.

make creates 2 "clisp linking sets"
(== pair of lisp.run and lispinit.mem)
 - "base" with the basic CL image and
 - "full" with all the modules you specified on the configure command
          line (--with-module=clx/new-clx &c).  

these two liking sets are installed in /usr/local/lib/clisp/base and
/usr/local/lib/clisp/full when you do "make install".
additionally, "make install" creates a driver executable "clisp" and
installs it as /usr/local/bin/clisp.  the driver execs the right image
with the right options.  Essentially it knows the installation defaults
and passes them to lisp.run.

Thus after "./configure --build build" you can call clisp as
$ ./build/lisp.run -B ./build -I ./build/lispinit.mem
and after "make install" you can just use
$ clisp

What does not work for you?

> It seems that the make install phase modify the content of
> lispinit.mem and lisp.run somehow (This is what I guess, I am not even
> sure). I just want to install things, not to get them modified during
> the process...

install does not modify anything.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
The only time you have too much fuel is when you're on fire.

---

From: Daniel Tourde <[email-masked]>
Date: Mon, 14 May 2001 09:29:15 +0200

Hi San,

>           line (--with-module=clx/new-clx &c).

I think this is the point. My retired colleague added his modifications
himself and I am almost convinced that he did not know or did not care
about the possibilities of ./configure and make regarding the
--with-module option

He just typed:
./makemake --with-readline --with-nogettext --with-dynamic-ffi >
Makefile

From the results of make, he added by himself (according to what I put
at the end of this email) the pieces of code he was interested in.
I am just following his notes. I wanted to automatize the procedure and
then to forget about it but it seems to be much more complicate than
what I thought originally. 

> install does not modify anything.

I know, that's the way it is supposed to be, so I don't really
understand. I suppose that the install procedure do not take into
account the following steps I must follow after the make procedure:

21. While still in src:
      clisp-link create-module-set cfun lfun.c
      cc -O -c cfun.c 
      cd cfun 
      ln -s ../cfun.o cfun.o
22. cd cfun
      Add the name cfun.o to the file_list in file ./cfun/link.sh. 
      It should look like this: file_list="$file_list"' lfun.o cfun.o'
23. Make sure f2c is installed and that there is an f2c.h in
/usr/include.
    Verify also that there is a library /usr/lib/libf2c.a
24. cd .. (=> Back to src)
25. Verify that the file clisp-link specifies the following libraries
for
    loading fortran and math functions (usually around lines 88, 262 and
467):
      /usr/lib/libcfun.a -lf2c -lm 
    If not, add them to the compile command
26. While still in src issue the commands
      ar r /usr/lib/libcfun.a cfun.o
      cp link.sh ./cfun
      base/lisp.run -M base/lispinit.mem -c lfun.lsp
      clisp-link add-module-set cfun base base+cfun
      base+cfun/lisp.run -M base+cfun/lispinit.mem -i lfun
    You will end up in Clisp.
27. While still in Clisp, type the Lisp commands, one at a time
      (load "comstart")
      (compile-file "psinit-ffi")
      (compile-file "psinit")
      (compile-file "net")
      (compile-file "smail")
      (bye)
28. Back in Unix, create a new core image (with all user functions
loaded) 
    by typing:
       clbfni (this will get you to Lisp), and while in Lisp:
       (saveinitmem)
       (exit)

This is the procedure I must follow between make and make install and I
wonder if it does not screw up somehow the result of the make install
coz it is not a very orthodox method to add new functionalities...

Maybe you have a better method, a more orthodox one to add
functionalities into the main core of Clisp. Something I am not aware
of, something that would make the make install procedure work for me
(that is to say, produce the right clisp and the right lisp.run and
lipinit.mem).

Thanks in advance for any help.