version 0.7.2
This commit is contained in:
parent
2cd136cf7a
commit
ddaedab835
158 changed files with 34811 additions and 10001 deletions
97
tools/install.tmpl
Normal file
97
tools/install.tmpl
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#subsChar ?
|
||||
#proc GenerateInstallScript(c: TConfigData): string =
|
||||
# result = "#! /bin/sh\n# Generated by niminst\n"
|
||||
CC="gcc"
|
||||
LINKER="gcc"
|
||||
COMP_FLAGS="-w"
|
||||
LINK_FLAGS=""
|
||||
# add(result, "# platform detection\n")
|
||||
ucpu=`uname -m`
|
||||
uos=`uname`
|
||||
|
||||
# add(result, "# convert to lower case:\n")
|
||||
upcu=`echo $ucpu | tr "[:upper:]" "[:lower:]"`
|
||||
uos=`echo $uos | tr "[:upper:]" "[:lower:]"`
|
||||
|
||||
case $uos in
|
||||
*linux* )
|
||||
myos="linux"
|
||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||
;;
|
||||
*freebsd* )
|
||||
myos="freebsd"
|
||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||
;;
|
||||
*openbsd* )
|
||||
myos="openbsd"
|
||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||
;;
|
||||
*netbsd* )
|
||||
myos="netbsd"
|
||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||
;;
|
||||
*darwin* )
|
||||
myos="macosx"
|
||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||
;;
|
||||
*aix* )
|
||||
myos="aix"
|
||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||
;;
|
||||
*solaris* | *sun* )
|
||||
myos="solaris"
|
||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||
;;
|
||||
*)
|
||||
echo "Error: unknown operating system: $uos"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case $ucpu in
|
||||
*i386* | *i486* | *i586* | *i686* )
|
||||
mycpu="i386" ;;
|
||||
*amd*64* | *x86-64* | *x86_64* )
|
||||
mycpu="amd64" ;;
|
||||
*sparc*|*sun* )
|
||||
mycpu="sparc" ;;
|
||||
*power* )
|
||||
mycpu="powerpc" ;;
|
||||
*mips* )
|
||||
mycpu="mips" ;;
|
||||
*)
|
||||
echo "Error: unknown processor: $ucpu"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# add(result, "# write ``build/platdef.c`` file\n")
|
||||
cat >build/platdef.c <<EOF
|
||||
char* nimOS(void) { return "$myos"; }
|
||||
char* nimCPU(void) { return "$mycpu"; }
|
||||
EOF
|
||||
# add(result, "# call the compiler:\n")
|
||||
|
||||
case $myos in
|
||||
# for osA in 1..c.oses.len:
|
||||
?{c.oses[osA-1]})
|
||||
case $mycpu in
|
||||
# for cpuA in 1..c.cpus.len:
|
||||
?{c.cpus[cpuA-1]})
|
||||
# var linkCmd = "build/platdef.o"
|
||||
# for f in items(c.cfiles[osA][cpuA]):
|
||||
echo "$CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")}"
|
||||
$CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")} || exit 1
|
||||
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
||||
# end for
|
||||
$CC $COMP_FLAGS -Ibuild -c build/platdef.c -o build/platdef.o || exit 1
|
||||
echo "$LINKER $LINK_FLAGS -o ?{c.binPaths[0]}/?{toLower(c.name)} ?linkCmd"
|
||||
$LINKER $LINK_FLAGS -o ?{c.binPaths[0]}/?{toLower(c.name)} ?linkCmd || exit 1
|
||||
;;
|
||||
# end for
|
||||
esac
|
||||
;;
|
||||
# end for
|
||||
esac
|
||||
|
||||
echo "SUCCESS"
|
||||
Loading…
Add table
Add a link
Reference in a new issue