/[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.7.4.2 - (show annotations)
Tue Mar 31 03:02:22 2009 UTC (5 years ago) by agoncharov
Branch: unicode-utf16-branch
Changes since 1.7.4.1: +1 -1 lines
File MIME type: application/x-sh
Not that it matters anywhere, but it's silly to have a $$foo instead
of $foo and pick a wrong branch.
1 #!/bin/sh
2
3 LISP_VARIANT=
4 MOTIF_VARIANT=
5 TARGET_DIR=
6
7 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 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=x86_linux ;;
31 Darwin) case `uname -m` in
32 ppc) LISP_VARIANT=ppc_darwin ;;
33 i386) LISP_VARIANT=x86_darwin ;;
34 esac
35 ;;
36 FreeBSD|freebsd) LISP_VARIANT=x86_freebsd ;;
37 # 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 usage
52 fi
53
54 [ -d $1 ] && echo "Error: Directory $1 exists already!" && exit 2
55
56 TARGET="`echo $TARGET_DIR | sed 's:/*$::'`"
57
58 # Make sure the given variants exist
59 if [ ! -f src/lisp/Config.$LISP_VARIANT ]; then
60 echo "No such lisp-variant could be found: Config.$LISP_VARIANT"
61 exit 1
62 fi
63
64 # From the given variant, try to derive a motif variant
65 if [ "$MOTIF_VARIANT" = "" ]; then
66 case $LISP_VARIANT in
67 alpha_linux) MOTIF_VARIANT=alpha_linux ;;
68 alpha_osf1) MOTIF_VARIANT=alpha_osf1 ;;
69 x86_freebsd|FreeBSD*|freebsd*) MOTIF_VARIANT=FreeBSD ;;
70 NetBSD*) MOTIF_VARIANT=NetBSD ;;
71 OpenBSD*) MOTIF_VARIANT=OpenBSD ;;
72 *_darwin) MOTIF_VARIANT=Darwin ;;
73 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 x86_linux|linux*) MOTIF_VARIANT=x86 ;;
79 esac
80 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 fi
84
85 # Tell user what's we've configured
86 echo "Lisp = $LISP_VARIANT"
87 echo "Motif = $MOTIF_VARIANT"
88
89 # 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
95 (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
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 SETENV=src/tools/setenv-scripts
107
108 # Create sample setenv.lisp file
109 cat $SETENV/base-features.lisp > $TARGET/setenv.lisp
110
111 # Put in some platform specific items
112 case $LISP_VARIANT in
113 *linux*)
114 case $LISP_VARIANT in
115 *_gencgc*) gcname=":gencgc" ;;
116 *) gcname=":cgc" ;;
117 esac
118 sed "s;@@gcname@@;$gcname;" $SETENV/linux-features.lisp >> $TARGET/setenv.lisp
119 ;;
120 *OpenBSD*)
121 case $LISP_VARIANT in
122 *_gencgc*) gcname=":gencgc" ;;
123 *) gcname=":cgc" ;;
124 esac
125 sed "s;@@gcname@@;$gcname;" $SETENV/openbsd-features.lisp >> $TARGET/setenv.lisp
126 ;;
127 *FreeBSD*|*freebsd*)
128 gcname=":gencgc"
129 sed "s;@@gcname@@;$gcname;" $SETENV/freebsd-features.lisp >> $TARGET/setenv.lisp
130 ;;
131 *solaris*)
132 cat $SETENV/solaris-features.lisp >> $TARGET/setenv.lisp
133 ;;
134 *)
135 sed "s;@@LISP@@;$LISP_VARIANT;" $SETENV/unknown.lisp >> $TARGET/setenv.lisp
136 ;;
137 esac
138
139
140 # Do Motif setup
141 if [ "$MOTIF_VARIANT" != "" ]
142 then
143 ( 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 fi

  ViewVC Help
Powered by ViewVC 1.1.5