scsh-users
[Top] [All Lists]

Makefile and pre-compiled packages

To: scsh@zurich.ai.mit.edu
Subject: Makefile and pre-compiled packages
From: lmamane-scsh-list-2003-08-19@ad1810.com
Date: Sat, 19 Jul 2003 16:34:32 +0200
Mail-followup-to: scsh@zurich.ai.mit.edu, lmamane-scsh-list-2003-08-19@ad1810.com
Sender: Lionel Elie Mamane <master@tofu.mamane.lu>
The scsh top-level Makefile (as in 0.6.4) is heavily incompatible with
the following procedure:

 ./configure --prefix=/usr
 make
 make install prefix=temporary_directory
 tar c temporary_directory > package_file
 # send package_file around
 tar x < package_file

which is (at the principle level) what many packaging systems do. I
know that's how Debian does it, I'm nearly sure that's how
Redhat/Mandrake do it. (I have no experience with any thing else than
variants of the GNU, mainly GNU/Linux)

The core idea is to be able to prepare a package without installing it
on the local system, for example leaving another version on the local
system or leaving another package that uses the same files or ... For
this, it is essential that during the "install" phase, the prefix not
be hardcoded anywhere. The easiest way to achieve this is to do really
only the "copy" action in the install target of the Makefile.

I include here a patch that cleanly separates building stage
(hard-coding paths in various places) and install stage (only copying
files around).

I also don't understand what the inst-script step is good for, as the
file it generates gets immediately replaced by the "install-scsh"
target, so I removed the call to it. If it serves any purpose, add
"script" to the "enough" target, too.


P.S.: Humans (as opposed to spam bots) wishing to answer me are
      encouraged to write to the lionel address in the MYNAME(dot)lu
      domain, where MYNAME is replaced by my last  name, and (dot) by
      a dot. My family name is mamane. Family and last are synonymous
      in this context. Sorry for this complexification, but
      usenet-harvesting spam bots being what they are...


--- scsh-0.6.3/Makefile.in      Sat Jul 19 11:00:22 2003
+++ scsh-0.6.4/Makefile.in      Sat Jul 19 15:43:32 2003
@@ -165,7 +165,7 @@
 
 # The following is the first rule and therefore the "make" command's
 # default target.
-enough: $(VM) $(IMAGE) go $(LIBCIG) scsh $(LIBSCSH) $(LIBSCSHVM)
+enough: $(VM) $(IMAGE) go $(LIBCIG) scsh $(LIBSCSH) $(LIBSCSHVM) man
 
 # --------------------
 # External code to include in the VM
@@ -319,19 +319,19 @@
 
 ### Fake targets:  all clean install man dist
 
-install: enough dirs inst-script inst-vm inst-misc inst-man inst-inc   \
+install: enough dirs inst-vm inst-misc inst-man inst-inc       \
         install-scsh
 
 inst-vm: $(VM)
        $(INSTALL_PROGRAM) $(VM) $(LIB)
 
+man:
+       sed -e 's=LBIN=$(bindir)=g' -e 's=LLIB=$(LIB)=g' \
+           -e 's=LSCSH=$(RUNNABLE)=g' doc/scsh.man > $(MANPAGE)
+
 inst-man:
        if [ -d $(mandir) -a -w $(mandir) ]; then                          \
-               sed 's=LBIN=$(bindir)=g' doc/scsh.man |            \
-                       sed 's=LLIB=$(LIB)=g' |                            \
-                       sed 's=LSCSH=$(RUNNABLE)=g' >$(MANPAGE) &&         \
-               $(INSTALL_DATA) $(MANPAGE) $(mandir) &&                    \
-               $(RM) $(MANPAGE);                                          \
+               $(INSTALL_DATA) $(MANPAGE) $(mandir);                      \
        else                                                               \
                echo "$(mandir) not writable dir, not installing man page" \
                        >&2;                                               \
@@ -398,9 +398,8 @@
                do $(INSTALL_DATA) $$f $(DOCDIR)/scsh-paper/html/ ; \
        done
 
-
-inst-script:
-       script=$(bindir)/$(RUNNABLE) &&                                 \
+script:
+       script=$(RUNNABLE).script &&                                            
\
        echo '#!/bin/sh'        >$$script &&                            \
        echo                    >>$$script &&                           \
        echo 'lib=$(LIB)'       >>$$script &&                           \
@@ -408,6 +407,9 @@
                                >>$$script &&                           \
        chmod +x $$script
 
+inst-script:
+       $(INSTALL_PROGRAM) $(RUNNABLE).script $(bindir)/$(RUNNABLE)
+
 # Script to run scsh in this directory.
 go:
        echo '#!/bin/sh'        >$@ &&                                  \
@@ -879,7 +883,11 @@
         echo ",open $(opens)"; \
         echo "(dump-scsh \"$@\")"; \
         ) \
-       | ./$(VM) -o ./$(VM) -i $(IMAGE) -h 10000000
+       | ./$(VM) -o ./$(VM) -i $(IMAGE) -h 10000000 && \
+       (       echo ',translate =scheme48 $(LIB)';                     \
+               echo '(dump-scsh "scsh/scsh.image")';                   \
+               echo ',exit';                                           \
+       ) | ./$(VM) -i scsh/scsh.image
 
 # ,flush files => 0k
 # ,flush names => -= 17k
@@ -894,7 +902,11 @@
         echo ",open $(opens)"; \
         echo ",flush"; \
         echo "(dump-scsh \"$@\")";) \
-       | ./$(VM) -o ./$(VM) -i $(IMAGE) -h 10000000
+       | ./$(VM) -o ./$(VM) -i $(IMAGE) -h 10000000 && \
+       (       echo ',translate =scheme48 $(LIB)';                     \
+               echo '(dump-scsh "scsh/stripped-scsh.image")';          \
+               echo ',exit';                                           \
+       ) | ./$(VM) -i scsh/stripped-scsh.image
 
 install-scsh: scsh install-scsh-image install-stripped-scsh-image
        $(RM) $(bindir)/$(RUNNABLE)
@@ -906,16 +918,10 @@
            do $(INSTALL_DATA) $$f $(LIB)/scsh/; done
 
 install-scsh-image: $(VM) scsh/scsh.image
-       (       echo ',translate =scheme48 $(LIB)';                     \
-               echo '(dump-scsh "$(LIB)/scsh.image")';                 \
-               echo ',exit';                                           \
-       ) | ./$(VM) -i scsh/scsh.image  
+       $(INSTALL_DATA) scsh/scsh.image $(LIB)
 
 install-stripped-scsh-image: $(VM) scsh/stripped-scsh.image
-       (       echo ',translate =scheme48 $(LIB)';                     \
-               echo '(dump-scsh "$(LIB)/stripped-scsh.image")';        \
-               echo ',exit';                                           \
-       ) | ./$(VM) -i scsh/stripped-scsh.image
+       $(INSTALL_DATA) scsh/stripped-scsh.image $(LIB)
 
 clean-scsh:
        $(RM) scsh/*.o scsh/rx/*.o scsh/machine/*.o 

-- 
Lionel

<Prev in Thread] Current Thread [Next in Thread>