Fixes #2128. Based on @infinity0's commit.
This commit is contained in:
parent
62da869eee
commit
9d001d207e
2 changed files with 22 additions and 22 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#? stdtmpl(subsChar='?') | standard
|
#? stdtmpl(subsChar='?') | standard
|
||||||
#proc generateBuildShellScript(c: ConfigData): string =
|
#proc generateBuildShellScript(c: ConfigData): string =
|
||||||
# result = "#! /bin/sh\n# Generated from niminst\n" &
|
# result = "#! /bin/sh\n# Generated from niminst\n" &
|
||||||
# "# Template is in tools/niminst/buildsh.tmpl\n" &
|
# "# Template is in tools/niminst/buildsh.tmpl\n" &
|
||||||
# "# To regenerate run ``niminst csource`` or ``koch csource``\n"
|
# "# To regenerate run ``niminst csource`` or ``koch csource``\n"
|
||||||
|
|
@ -29,8 +29,8 @@ done
|
||||||
|
|
||||||
CC="gcc"
|
CC="gcc"
|
||||||
LINKER="gcc"
|
LINKER="gcc"
|
||||||
COMP_FLAGS="?{c.ccompiler.flags}$extraBuildArgs"
|
COMP_FLAGS="${CPPFLAGS:-} ${CFLAGS:-} ?{c.ccompiler.flags}$extraBuildArgs"
|
||||||
LINK_FLAGS="?{c.linker.flags}"
|
LINK_FLAGS="${LDFLAGS:-} ?{c.linker.flags}"
|
||||||
PS4=""
|
PS4=""
|
||||||
# add(result, "# platform detection\n")
|
# add(result, "# platform detection\n")
|
||||||
ucpu=`uname -m`
|
ucpu=`uname -m`
|
||||||
|
|
@ -51,8 +51,8 @@ ucpu=`echo $ucpu | tr "[:upper:]" "[:lower:]"`
|
||||||
uos=`echo $uos | tr "[:upper:]" "[:lower:]"`
|
uos=`echo $uos | tr "[:upper:]" "[:lower:]"`
|
||||||
|
|
||||||
case $uos in
|
case $uos in
|
||||||
*linux* )
|
*linux* )
|
||||||
myos="linux"
|
myos="linux"
|
||||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||||
;;
|
;;
|
||||||
*dragonfly* )
|
*dragonfly* )
|
||||||
|
|
@ -66,14 +66,14 @@ case $uos in
|
||||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||||
;;
|
;;
|
||||||
*openbsd* )
|
*openbsd* )
|
||||||
myos="openbsd"
|
myos="openbsd"
|
||||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||||
;;
|
;;
|
||||||
*netbsd* )
|
*netbsd* )
|
||||||
myos="netbsd"
|
myos="netbsd"
|
||||||
LINK_FLAGS="$LINK_FLAGS -lm"
|
LINK_FLAGS="$LINK_FLAGS -lm"
|
||||||
;;
|
;;
|
||||||
*darwin* )
|
*darwin* )
|
||||||
myos="macosx"
|
myos="macosx"
|
||||||
CC="clang"
|
CC="clang"
|
||||||
LINKER="clang"
|
LINKER="clang"
|
||||||
|
|
@ -84,41 +84,41 @@ case $uos in
|
||||||
;;
|
;;
|
||||||
*aix* )
|
*aix* )
|
||||||
myos="aix"
|
myos="aix"
|
||||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
LINK_FLAGS="$LINK_FLAGS -ldl -lm"
|
||||||
;;
|
;;
|
||||||
*solaris* | *sun* )
|
*solaris* | *sun* )
|
||||||
myos="solaris"
|
myos="solaris"
|
||||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm -lsocket -lnsl"
|
LINK_FLAGS="$LINK_FLAGS -ldl -lm -lsocket -lnsl"
|
||||||
;;
|
;;
|
||||||
*haiku* )
|
*haiku* )
|
||||||
myos="haiku"
|
myos="haiku"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 2>&1 "Error: unknown operating system: $uos"
|
echo 2>&1 "Error: unknown operating system: $uos"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $ucpu in
|
case $ucpu in
|
||||||
*i386* | *i486* | *i586* | *i686* | *bepc* | *i86pc* )
|
*i386* | *i486* | *i586* | *i686* | *bepc* | *i86pc* )
|
||||||
mycpu="i386" ;;
|
mycpu="i386" ;;
|
||||||
*amd*64* | *x86-64* | *x86_64* )
|
*amd*64* | *x86-64* | *x86_64* )
|
||||||
mycpu="amd64" ;;
|
mycpu="amd64" ;;
|
||||||
*sparc*|*sun* )
|
*sparc*|*sun* )
|
||||||
mycpu="sparc" ;;
|
mycpu="sparc" ;;
|
||||||
*ppc64* )
|
*ppc64* )
|
||||||
if [ "$myos" = "linux" ] ; then
|
if [ "$myos" = "linux" ] ; then
|
||||||
COMP_FLAGS="$COMP_FLAGS -m64"
|
COMP_FLAGS="$COMP_FLAGS -m64"
|
||||||
LINK_FLAGS="$LINK_FLAGS -m64"
|
LINK_FLAGS="$LINK_FLAGS -m64"
|
||||||
fi
|
fi
|
||||||
mycpu="powerpc64" ;;
|
mycpu="powerpc64" ;;
|
||||||
*power*|*ppc* )
|
*power*|*ppc* )
|
||||||
mycpu="powerpc" ;;
|
mycpu="powerpc" ;;
|
||||||
*mips* )
|
*mips* )
|
||||||
mycpu="mips" ;;
|
mycpu="mips" ;;
|
||||||
*arm*|*armv6l* )
|
*arm*|*armv6l* )
|
||||||
mycpu="arm" ;;
|
mycpu="arm" ;;
|
||||||
*)
|
*)
|
||||||
echo 2>&1 "Error: unknown processor: $ucpu"
|
echo 2>&1 "Error: unknown processor: $ucpu"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
@ -128,7 +128,7 @@ esac
|
||||||
|
|
||||||
case $myos in
|
case $myos in
|
||||||
# for osA in 1..c.oses.len:
|
# for osA in 1..c.oses.len:
|
||||||
?{c.oses[osA-1]})
|
?{c.oses[osA-1]})
|
||||||
case $mycpu in
|
case $mycpu in
|
||||||
# for cpuA in 1..c.cpus.len:
|
# for cpuA in 1..c.cpus.len:
|
||||||
?{c.cpus[cpuA-1]})
|
?{c.cpus[cpuA-1]})
|
||||||
|
|
@ -149,7 +149,7 @@ case $myos in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
# end for
|
# end for
|
||||||
*)
|
*)
|
||||||
echo 2>&1 "Error: no C code generated for: [$myos: $mycpu]"
|
echo 2>&1 "Error: no C code generated for: [$myos: $mycpu]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#? stdtmpl(subsChar='?') | standard
|
#? stdtmpl(subsChar='?') | standard
|
||||||
#proc generateMakefile(c: ConfigData): string =
|
#proc generateMakefile(c: ConfigData): string =
|
||||||
# result = "# Generated from niminst\n" &
|
# result = "# Generated from niminst\n" &
|
||||||
# "# Template is in tools/niminst/makefile.tmpl\n" &
|
# "# Template is in tools/niminst/makefile.tmpl\n" &
|
||||||
# "# To regenerate run ``niminst csource`` or ``koch csource``\n"
|
# "# To regenerate run ``niminst csource`` or ``koch csource``\n"
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
LINKER = gcc
|
LINKER = gcc
|
||||||
COMP_FLAGS = ?{c.ccompiler.flags}
|
COMP_FLAGS = $(CPPFLAGS) $(CFLAGS) ?{c.ccompiler.flags}
|
||||||
LINK_FLAGS = ?{c.linker.flags}
|
LINK_FLAGS = $(LDFLAGS) ?{c.linker.flags}
|
||||||
binDir = ?{firstBinPath(c).toUnix}
|
binDir = ?{firstBinPath(c).toUnix}
|
||||||
|
|
||||||
koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"')
|
koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue