/[meta-cvs]/meta-cvs/F-156CAB88D4EEE783E8C4B4146B5094E2
ViewVC logotype

Contents of /meta-cvs/F-156CAB88D4EEE783E8C4B4146B5094E2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (hide annotations)
Mon Mar 8 06:58:39 2004 UTC (10 years, 1 month ago) by kaz
Branch: MAIN
Changes since 1.18: +29 -3 lines
* code/install.sh: Generated mcvs-upgrade script cleans away
old Meta-CVS package and does garbage collection.
1 kaz 1.1 #!/bin/sh
2    
3 kaz 1.16 CLISP_LIB=$(clisp -q -norc -x '(progn (princ *lib-directory*) (values))')
4 kaz 1.7
5 kaz 1.5 LINKSET=unix-bindings-linking-set
6    
7 kaz 1.1 if [ $# != 1 ] ; then
8 kaz 1.5 echo
9     echo "Meta-CVS Installer"
10     echo
11     echo "Please specify the target prefix, as a full absolute path."
12     echo "For example, specifying /usr/local will place files under"
13     echo "/usr/local/bin and /usr/local/lib."
14     echo
15 kaz 1.1 exit 1
16     else
17 kaz 1.8 TARGET="$1"
18 kaz 1.1 fi
19    
20 kaz 1.12 space_check()
21 kaz 1.8 {
22     if [ $# -gt 1 ] ; then
23 kaz 1.9 echo "The path \"$*\" contains whitespace."
24 kaz 1.8 exit 1
25     fi
26     }
27    
28 kaz 1.12 dash_check()
29 kaz 1.10 {
30     case $1 in
31     -* )
32     echo "The path $1 looks like a command line option."
33     exit 1
34     ;;
35     esac
36     }
37    
38 kaz 1.8 space_check $TARGET
39 kaz 1.10 dash_check $TARGET
40 kaz 1.8
41     TARGET_LIB=$TARGET/lib/clisp/meta-cvs
42     TARGET_BIN=$TARGET/bin
43 kaz 1.5
44     if ! mkdir -p $TARGET_LIB ; then
45     echo "Unable to create $TARGET_LIB directory."
46     exit 1
47     fi
48    
49     if ! mkdir -p $TARGET_BIN ; then
50     echo "Unable to create $TARGET_BIN directory."
51     exit 1
52     fi
53    
54     if [ ! -e $LINKSET ] ; then
55 kaz 1.16 export CLISP_LINKKIT="${CLISP_LIB}linkkit"
56     sh "${CLISP_LIB}clisp-link" add-module-set unix-bindings \
57     "${CLISP_LIB}base" $LINKSET
58 kaz 1.5 fi
59    
60 kaz 1.15 LISPRUN=$LINKSET/lisp
61    
62     if [ -f $LISPRUN.run ] ; then
63     LISPRUN=$LISPRUN.run
64     LISPEXE=.run
65     elif [ -f $LISPRUN.exe ] ; then
66     LISPRUN=$LISPRUN.exe
67     LISPEXE=.exe
68     else
69     echo "linking set failed to build."
70     exit 1
71     fi
72    
73 kaz 1.17 if ! $LISPRUN -M $LINKSET/lispinit.mem -q -c mcvs ; then
74 kaz 1.3 echo "There were compilation errors."
75     exit 1
76     fi
77    
78 kaz 1.17 $LISPRUN -M $LINKSET/lispinit.mem -q -i mcvs -x '(ext:saveinitmem "mcvs.mem" :quiet t)'
79 kaz 1.5
80 kaz 1.8 if ! cp mcvs.mem $TARGET_LIB/lispinit.mem; then
81 kaz 1.9 echo "Unable to copy to $TARGET_LIB."
82 kaz 1.5 exit 1
83     fi
84 kaz 1.1
85 kaz 1.15 if ! cp $LISPRUN $TARGET_LIB; then
86 kaz 1.9 echo "Unable to copy to $TARGET_LIB."
87 kaz 1.1 exit 1
88     fi
89    
90 kaz 1.8 if ! cat > $TARGET_BIN/mcvs <<END
91 kaz 1.15 #!$TARGET_LIB/lisp$LISPEXE -M$TARGET_LIB/lispinit.mem
92 kaz 1.14 (meta-cvs:main)
93 kaz 1.1 END
94     then
95 kaz 1.9 echo "Could not create mcvs script in $TARGET."
96 kaz 1.1 exit 1
97     fi
98    
99 kaz 1.5 if ! chmod a+x "$TARGET_BIN/mcvs" ; then
100 kaz 1.9 echo "Could not set permissions of mcvs script in $TARGET."
101 kaz 1.1 exit 1
102     fi
103    
104 kaz 1.13 if ! cat > $TARGET_BIN/mcvs-upgrade <<END
105     #!/bin/sh
106     TARGET_LIB="$TARGET_LIB"
107     LISPRUN="\$TARGET_LIB/lisp.run -M \$TARGET_LIB/lispinit.mem"
108 kaz 1.19 LISPRUNNOMEM="\$TARGET_LIB/lisp.run"
109 kaz 1.13
110     if [ \$# != 1 ] ; then
111     echo
112     echo "Syntax:"
113     echo
114     echo " mcvs-upgrade <path-to-source>"
115     echo
116     echo "The path specifies the directory which holds unpacked Meta-CVS source,"
117     echo "the place where the file mcvs-main.lisp is located."
118     echo
119     echo "This upgrade mechanism is intended to make it possible to use a"
120     echo "newer version of Meta-CVS without having to obtain a complete binary"
121     echo "distribution that includes the Lisp executable, and without having"
122     echo "to install the Lisp development environment to build the sources."
123     echo
124     echo "Note that it's not possible to upgrade if the newer Meta-CVS sources"
125     echo "rely on new C functions being linked into the Lisp system; get a"
126     echo "new binary distribution, or set up CLISP and compile Meta-CVS from"
127     echo "the sources using its install.sh script"
128     echo
129     echo "Ignore the copious compiler warnings about objects and functions"
130     echo "being redefined; this is what we want."
131     echo
132     exit 1
133     fi
134    
135     SOURCE_PATH="\$1"
136    
137     if ! cd "\$SOURCE_PATH" ; then
138     echo "unable to change to \$SOURCE_PATH"
139     exit 1
140     fi
141    
142 kaz 1.19 #
143     # We first prepare a memory image that is scrubbed of Meta-CVS material.
144     # The "META-CVS" package is deleted, causing the global functions and
145     # and variables to become unreferenced. Garbage collection is invoked
146     # to clean them away. This way we start with a clean slate, so there
147     # are no warnings about redefinitions, and the new image doesn't contain
148     # garbage.
149     #
150    
151     if ! \$LISPRUN -q -x \
152     '(progn \
153     (when (find-package "META-CVS") \
154     (delete-package "META-CVS") \
155     (gc) \
156     (ext:saveinitmem "scrubbed.mem" :quiet t)))'
157     then
158     echo "unable to generate scrubbed memory image"
159     exit 1
160     fi
161    
162     if ! \$LISPRUNNOMEM -M scrubbed.mem -c mcvs ; then
163 kaz 1.13 echo "unable to compile"
164     exit 1
165     fi
166    
167 kaz 1.19 if ! \$LISPRUNNOMEM -M scrubbed.mem -q -i mcvs -x \
168     '(ext:saveinitmem "mcvs.mem" :quiet t)'
169     then
170     echo "unable to load Meta-CVS and generate new memory image"
171 kaz 1.13 exit 1
172     fi
173    
174     if ! cp mcvs.mem \$TARGET_LIB/lispinit.mem ; then
175     echo "unable to copy new Meta-CVS image to \$TARGET_LIB directory."
176     exit 1
177     fi
178 kaz 1.19
179     rm scrubbed.mem
180     rm mcvs.mem
181 kaz 1.13
182     echo
183     echo "It appears that Meta-CVS has been re-generated from the given sources."
184     echo
185    
186     END
187     then
188     echo "Could not create mcvs script in $TARGET."
189     exit 1
190     fi
191    
192     if ! chmod a+x "$TARGET_BIN/mcvs-upgrade" ; then
193     echo "Could not set permissions of mcvs script in $TARGET."
194     exit 1
195     fi
196    
197 kaz 1.1 exit 0

  ViewVC Help
Powered by ViewVC 1.1.5