Commit 7c53c93c authored by Alex Goncharov's avatar Alex Goncharov

1. Add .gitignore. 2. Rewrite tools/create-target.sh

parent 155ba1a1
contrib/asdf/asdf.*f
#!/bin/sh #!/bin/sh
LISP_VARIANT= quit() { echo "$@" >&2; exit 1; }
MOTIF_VARIANT=
TARGET_DIR=
usage() { usage() {
echo "Usage: `basename $0` target-dir [lisp-variant [motif-variant]]" echo "Usage: `basename $0` TARGET-DIR [LISP-VARIANT [MOTIF-VARIANT]]"
echo "" echo ""
echo "Creates a directory structure in TARGET-DIR for use in compiling" echo "Creates a directory structure in TARGET-DIR for use in building CMUCL."
echo "CMUCL. If the lisp-variant is not given, uname is used to select" echo "A simple logic is used to find the optional -VARIANT parameters."
echo "a version, if possible. If motif-variant is not given, one is"
echo "determined from the lisp-variant."
echo "" echo ""
# List possible values for lisp-variant and motif-variant # List possible values for lisp-variant and motif-variant
echo "Possible lisp-variants:" echo "Possible LISP-VARIANTs (don't trust what you see):"
( cd src/lisp/ ; ls -1 Config.* ) | sed 's;^Config[.];;g' | \ ( cd src/lisp/ && ls -1 Config.* ) | sed 's;^Config[.];;g' | pr -3at -o 8 || quit "Can't list lisp-variants"
pr -3at -o 8 echo "Possible MOTIF-VARIANTs (don't trust what you see):"
echo "Possible Motif-variants:" ( cd src/motif/server/ && ls -1 Config.* ) | sed 's;^Config[.];;g' | pr -3at -o 8 || quit "Can't list lisp-variants"
( cd src/motif/server/ ; ls -1 Config.* ) | sed 's;^Config[.];;g' | \ exit 2
pr -3at -o 8
exit 1
} }
if [ $# = 1 ]; then bld_dir=$1 lisp_variant=$2 motif_variant=$3
# Only target directory given. Try to deduce the lisp-variant exec 2>&1
TARGET_DIR="$1"
case `uname -s` in case $bld_dir in build-*) :;; *) usage;; esac
SunOS) uname_s=`uname -s`
case `uname -m` in uname_m=`uname -m 2>/dev/null`
i86pc) LISP_VARIANT=x86_solaris_sunc ;; [ -n "$lisp_variant" ] || {
sun*) LISP_VARIANT=sparc_gcc ;; case $uname_s in
esac Linux) lisp_variant=x86_linux ;;
;; FreeBSD) lisp_variant=x86_freebsd ;;
Linux) LISP_VARIANT=x86_linux ;; SunOS)
Darwin) case `uname -m` in case $uname_m in
ppc) LISP_VARIANT=ppc_darwin ;; i86pc) lisp_variant=x86_solaris_sunc ;;
i386) LISP_VARIANT=x86_darwin ;; sun*) lisp_variant=sparc_gcc ;;
esac
;;
Darwin)
case $uname_m in
ppc) lisp_variant=ppc_darwin ;;
i386) lisp_variant=x86_darwin ;;
esac esac
;; ;;
FreeBSD|freebsd) LISP_VARIANT=x86_freebsd ;; *) quit "Unsupported OS: $uname_s";;
# Please fill in some other common systems
*) echo "Sorry, please specify the desired Lisp variant."
exit 1 ;;
esac esac
elif [ $# = 2 ]; then }
# Target directory and lisp-variant given [ -n "$lisp_variant" ] || quit "Failed to determine lisp_variant"
TARGET_DIR="$1" [ -f src/lisp/Config.$lisp_variant ] || quit "Config.$lisp_variant not found"
LISP_VARIANT="$2"
elif [ $# = 3 ]; then case $lisp_variant in
# Target directory, lisp-variant, and motif variant given *linux*) lvshort=linux;;
TARGET_DIR="$1" *freebsd*) lvshort=freebsd;;
LISP_VARIANT="$2" *solaris*) lvshort=solaris;;
MOTIF_VARIANT="$3" *) lvshort=unknown;;
else esac
usage
fi
[ -d $1 ] && echo "Error: Directory $1 exists already!" && exit 2
TARGET="`echo $TARGET_DIR | sed 's:/*$::'`"
# Make sure the given variants exist
if [ ! -f src/lisp/Config.$LISP_VARIANT ]; then
echo "No such lisp-variant could be found: Config.$LISP_VARIANT"
exit 1
fi
# From the given variant, try to derive a motif variant # Beats me why we care about Motif today but let it be, other than on FreeBSD,
if [ "$MOTIF_VARIANT" = "" ]; then # where the config file is wrong anyway. (agoncharov, 2011-10-07)
case $LISP_VARIANT in case $uname_s in
alpha_linux) MOTIF_VARIANT=alpha_linux ;; FreeBSD) :;; # Free
alpha_osf1) MOTIF_VARIANT=alpha_osf1 ;; *) # Enjoy
x86_freebsd|FreeBSD*|freebsd*) MOTIF_VARIANT=FreeBSD ;; [ -n "$motif_variant" ] || {
NetBSD*) MOTIF_VARIANT=NetBSD ;; case $lisp_variant in
OpenBSD*) MOTIF_VARIANT=OpenBSD ;; NetBSD*) motif_variant=NetBSD ;;
*_darwin) MOTIF_VARIANT=Darwin ;; OpenBSD*) motif_variant=OpenBSD ;;
sun4_solaris_gcc|sparc_gcc) MOTIF_VARIANT=solaris ;; *_darwin) motif_variant=Darwin ;;
sun4_solaris_sunc|sparc_sunc|x86_solaris_sunc) MOTIF_VARIANT=solaris_sunc ;; sun4_solaris_gcc|sparc_gcc) motif_variant=solaris ;;
sun4c*) MOTIF_VARIANT=sun4c_411 ;; sun4_solaris_sunc|sparc_sunc|x86_solaris_sunc) motif_variant=solaris_sunc ;;
hp700*) MOTIF_VARIANT=hpux_cc ;; sun4c*) motif_variant=sun4c_411 ;;
pmax_mach) MOTIF_VARIANT=pmax_mach ;; hp700*) motif_variant=hpux_cc ;;
sgi*) MOTIF_VARIANT=irix ;; pmax_mach) motif_variant=pmax_mach ;;
x86_linux|linux*) MOTIF_VARIANT=x86 ;; sgi*) motif_variant=irix ;;
esac x86_linux|linux*) motif_variant=x86 ;;
elif [ ! -f src/motif/server/Config.$MOTIF_VARIANT ]; then esac
echo "No such motif-variant could be found: Config.$MOTIF_VARIANT" }
exit 1 [ -f src/motif/server/Config.$motif_variant ] || quit "No such motif-variant could be found: Config.$motif_variant"
fi ;;
esac
# Tell user what's we've configured # Tell user what's we've configured
echo "Lisp = $LISP_VARIANT" echo "bld_dir=$bld_dir lisp_variant=$lisp_variant ${motif_variant:+motif_variant=$motif_variant}"
echo "Motif = $MOTIF_VARIANT"
# Create a directory tree that mirrors the source directory tree # Create a directory tree that mirrors the source directory tree
find src -name 'CVS' -prune -o -type d -print \ [ -e "$bld_dir" ] && quit "delete this: `ls -ld $bld_dir`"
| sed "s:^src:$TARGET:g" | xargs mkdir mkdir -p "$bld_dir"
(cd src && find . -name .git -prune -o -type d -print) | (cd $bld_dir && xargs mkdir -p) ||
quit "Can't create target directories"
top_dir=$PWD
cd $bld_dir/lisp || quit "Can't cd $bld_dir/lisp"
# Link Makefile and Config files # Link Makefile and Config files
ln -s ../../src/lisp/GNUmakefile ../../src/lisp/Config.$lisp_variant ../../src/lisp/Config.*_common .
(cd $TARGET/lisp ln -s Config.$lisp_variant Config
ln -s ../../src/lisp/GNUmakefile ../../src/lisp/Config.$LISP_VARIANT ../../src/lisp/Config.*_common . [ -n "$motif_variant" ] && (
ln -s Config.$LISP_VARIANT Config cd motif/server || quit "Can't cd motif/server" # We will still continue in the outer shell
ln -s ../../../src/motif/server/GNUmakefile ./Makefile
ln -s ../../../src/motif/server/Config.$motif_variant ./Config
) )
# Create empty initial map file echo 'Map file for lisp version 0' > lisp.nm # Empty initial map file
echo 'Map file for lisp version 0' > $TARGET/lisp/lisp.nm echo '#error You need to run genesis (via build-world.sh) before compiling the startup code!' > internals.h
(
# Create dummy internals.h so we get warned to recompile setenv_dir=$top_dir/src/tools/setenv-scripts
echo '#error You need to run genesis (via build-world.sh) before compiling the startup code!' > $TARGET/lisp/internals.h cat $setenv_dir/base-features.lisp
case $lvshort in
SETENV=src/tools/setenv-scripts linux|freebsd) gcname=":gencgc"; sed "s;@@gcname@@;$gcname;" $setenv_dir/$lvshort-features.lisp >> setenv.lisp;;
solaris) cat $setenv_dir/solaris-features.lisp;;
# Create sample setenv.lisp file *) sed "s;@@LISP@@;$lisp_variant;" $setenv_dir/unknown.lisp;;
cat $SETENV/base-features.lisp > $TARGET/setenv.lisp esac
) > setenv.lisp || quit "Failed create setenv.lisp"
# Put in some platform specific items
case $LISP_VARIANT in
*linux*)
gcname=":gencgc"
sed "s;@@gcname@@;$gcname;" $SETENV/linux-features.lisp >> $TARGET/setenv.lisp
;;
*OpenBSD*)
case $LISP_VARIANT in
*_gencgc*) gcname=":gencgc" ;;
*) gcname=":cgc" ;;
esac
sed "s;@@gcname@@;$gcname;" $SETENV/openbsd-features.lisp >> $TARGET/setenv.lisp
;;
*FreeBSD*|*freebsd*)
gcname=":gencgc"
sed "s;@@gcname@@;$gcname;" $SETENV/freebsd-features.lisp >> $TARGET/setenv.lisp
;;
*solaris*)
cat $SETENV/solaris-features.lisp >> $TARGET/setenv.lisp
;;
*)
sed "s;@@LISP@@;$LISP_VARIANT;" $SETENV/unknown.lisp >> $TARGET/setenv.lisp
;;
esac
# Do Motif setup
if [ "$MOTIF_VARIANT" != "" ]
then
( cd $TARGET/motif/server ; ln -s ../../../src/motif/server/GNUmakefile ./Makefile )
( cd $TARGET/motif/server ; ln -s ../../../src/motif/server/Config.$MOTIF_VARIANT ./Config )
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment