/[cmucl]/src/tools/create-target.sh
ViewVC logotype

Contents of /src/tools/create-target.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations)
Fri Jan 9 14:42:51 2009 UTC (5 years, 3 months ago) by rtoy
Branch: MAIN
CVS Tags: snapshot-2009-01
Changes since 1.8: +4 -4 lines
File MIME type: application/x-sh
cd - doesn't work in /bin/sh, so we need to run that part in a
subshell.
1 toy 1.1 #!/bin/sh
2    
3 toy 1.2 LISP_VARIANT=
4     MOTIF_VARIANT=
5     TARGET_DIR=
6    
7 toy 1.3 usage() {
8     echo "Usage: `basename $0` target-dir [lisp-variant [motif-variant]]"
9     echo ""
10     echo "Creates a directory structure in TARGET-DIR for use in compiling"
11     echo "CMUCL. If the lisp-variant is not given, uname is used to select"
12     echo "a version, if possible. If motif-variant is not given, one is"
13     echo "determined from the lisp-variant."
14     echo ""
15     # List possible values for lisp-variant and motif-variant
16     echo "Possible lisp-variants:"
17     ( cd src/lisp/ ; ls -1 Config.* ) | sed 's;^Config[.];;g' | \
18     pr -3at -o 8
19     echo "Possible Motif-variants:"
20     ( cd src/motif/server/ ; ls -1 Config.* ) | sed 's;^Config[.];;g' | \
21     pr -3at -o 8
22     exit 1
23     }
24    
25 toy 1.2 if [ $# = 1 ]; then
26     # Only target directory given. Try to deduce the lisp-variant
27     TARGET_DIR="$1"
28     case `uname -s` in
29     SunOS) LISP_VARIANT=sun4_solaris_gcc ;;
30     Linux) LISP_VARIANT=linux_gencgc ;;
31 cshapiro 1.7 Darwin) case `uname -m` in
32     ppc) LISP_VARIANT=ppc_darwin ;;
33     i386) LISP_VARIANT=x86_darwin ;;
34     esac
35     ;;
36 agoncharov 1.8 FreeBSD|freebsd) LISP_VARIANT=x86_freebsd ;;
37 toy 1.2 # Please fill in some other common systems
38     *) echo "Sorry, please specify the desired Lisp variant."
39     exit 1 ;;
40     esac
41     elif [ $# = 2 ]; then
42     # Target directory and lisp-variant given
43     TARGET_DIR="$1"
44     LISP_VARIANT="$2"
45     elif [ $# = 3 ]; then
46     # Target directory, lisp-variant, and motif variant given
47     TARGET_DIR="$1"
48     LISP_VARIANT="$2"
49     MOTIF_VARIANT="$3"
50     else
51 toy 1.3 usage
52 toy 1.1 fi
53    
54 toy 1.2 [ -d $1 ] && echo "Error: Directory $1 exists already!" && exit 2
55 toy 1.1
56 toy 1.2 TARGET="`echo $TARGET_DIR | sed 's:/*$::'`"
57 toy 1.1
58     # Make sure the given variants exist
59 toy 1.2 if [ ! -f src/lisp/Config.$LISP_VARIANT ]; then
60     echo "No such lisp-variant could be found: Config.$LISP_VARIANT"
61 toy 1.1 exit 1
62     fi
63    
64     # From the given variant, try to derive a motif variant
65 toy 1.2 if [ "$MOTIF_VARIANT" = "" ]; then
66     case $LISP_VARIANT in
67     alpha_linux) MOTIF_VARIANT=alpha_linux ;;
68     alpha_osf1) MOTIF_VARIANT=alpha_osf1 ;;
69 agoncharov 1.8 FreeBSD*|freebsd*) MOTIF_VARIANT=FreeBSD ;;
70 toy 1.2 NetBSD*) MOTIF_VARIANT=NetBSD ;;
71     OpenBSD*) MOTIF_VARIANT=OpenBSD ;;
72 pmai 1.4 *_darwin) MOTIF_VARIANT=Darwin ;;
73 toy 1.2 sun4_solaris*) MOTIF_VARIANT=solaris ;;
74     sun4c*) MOTIF_VARIANT=sun4c_411 ;;
75     hp700*) MOTIF_VARIANT=hpux_cc ;;
76     pmax_mach) MOTIF_VARIANT=pmax_mach ;;
77     sgi*) MOTIF_VARIANT=irix ;;
78     linux*) MOTIF_VARIANT=x86 ;;
79 toy 1.1 esac
80 toy 1.2 elif [ ! -f src/motif/server/Config.$MOTIF_VARIANT ]; then
81     echo "No such motif-variant could be found: Config.$MOTIF_VARIANT"
82     exit 1
83 toy 1.1 fi
84    
85 toy 1.2 # Tell user what's we've configured
86     echo "Lisp = $LISP_VARIANT"
87     echo "Motif = $MOTIF_VARIANT"
88    
89 toy 1.1 # Create a directory tree that mirrors the source directory tree
90     find src -name 'CVS' -prune -o -type d -print \
91     | sed "s:^src:$TARGET:g" | xargs mkdir
92    
93     # Link Makefile and Config files
94 agoncharov 1.8
95 rtoy 1.9 (cd $TARGET/lisp
96     ln -s ../../src/lisp/GNUmakefile ../../src/lisp/Config.$LISP_VARIANT ../../src/lisp/Config.*_common .
97     ln -s Config.$LISP_VARIANT Config
98     )
99 toy 1.1
100     # Create empty initial map file
101     echo 'Map file for lisp version 0' > $TARGET/lisp/lisp.nm
102    
103     # Create dummy internals.h so we get warned to recompile
104     echo '#error You need to run genesis (via build-world.sh) before compiling the startup code!' > $TARGET/lisp/internals.h
105    
106 toy 1.2 SETENV=src/tools/setenv-scripts
107    
108 toy 1.1 # Create sample setenv.lisp file
109 toy 1.2 cat $SETENV/base-features.lisp > $TARGET/setenv.lisp
110 toy 1.1
111     # Put in some platform specific items
112 toy 1.2 case $LISP_VARIANT in
113 toy 1.1 *linux*)
114 toy 1.2 case $$LISP_VARIANT in
115 toy 1.1 *_gencgc*) gcname=":gencgc" ;;
116     *) gcname=":cgc" ;;
117     esac
118 toy 1.2 sed "s;@@gcname@@;$gcname;" $SETENV/linux-features.lisp >> $TARGET/setenv.lisp
119 toy 1.1 ;;
120     *OpenBSD*)
121 toy 1.2 case $LISP_VARIANT in
122 toy 1.1 *_gencgc*) gcname=":gencgc" ;;
123     *) gcname=":cgc" ;;
124     esac
125 toy 1.2 sed "s;@@gcname@@;$gcname;" $SETENV/openbsd-features.lisp >> $TARGET/setenv.lisp
126 toy 1.1 ;;
127 agoncharov 1.8 *FreeBSD*|*freebsd*)
128     gcname=":gencgc"
129     sed "s;@@gcname@@;$gcname;" $SETENV/freebsd-features.lisp >> $TARGET/setenv.lisp
130 rtoy 1.6 ;;
131 toy 1.1 *solaris*)
132 toy 1.2 cat $SETENV/solaris-features.lisp >> $TARGET/setenv.lisp
133 toy 1.1 ;;
134     *)
135 toy 1.2 sed "s;@@LISP@@;$LISP_VARIANT;" $SETENV/unknown.lisp >> $TARGET/setenv.lisp
136 toy 1.1 ;;
137     esac
138    
139    
140     # Do Motif setup
141 toy 1.2 if [ "$MOTIF_VARIANT" != "" ]
142 toy 1.1 then
143 toy 1.2 ( cd $TARGET/motif/server ; ln -s ../../../src/motif/server/GNUmakefile ./Makefile )
144     ( cd $TARGET/motif/server ; ln -s ../../../src/motif/server/Config.$MOTIF_VARIANT ./Config )
145 toy 1.1 fi

  ViewVC Help
Powered by ViewVC 1.1.5