Introduce first class support for Android (#5772)
This commit is contained in:
parent
bbeadf184e
commit
c39e202976
15 changed files with 109 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#? stdtmpl(subsChar='?') | standard
|
||||
#? stdtmpl(subsChar='?') | standard
|
||||
#proc generateBuildShellScript(c: ConfigData): string =
|
||||
# result = "#! /bin/sh\n# Generated from niminst\n" &
|
||||
# "# Template is in tools/niminst/buildsh.tmpl\n" &
|
||||
|
|
@ -9,6 +9,18 @@ set -e
|
|||
while :
|
||||
do
|
||||
case "$1" in
|
||||
--os)
|
||||
optos=$2
|
||||
shift 2
|
||||
;;
|
||||
--cpu)
|
||||
optcpu=$2
|
||||
shift 2
|
||||
;;
|
||||
--osname)
|
||||
optosname=$2
|
||||
shift 2
|
||||
;;
|
||||
--extraBuildArgs)
|
||||
extraBuildArgs=" $2"
|
||||
shift 2
|
||||
|
|
@ -35,6 +47,7 @@ PS4=""
|
|||
# add(result, "# platform detection\n")
|
||||
ucpu=`uname -m`
|
||||
uos=`uname`
|
||||
uosname=`uname -o`
|
||||
# add(result, "# bin dir detection\n")
|
||||
binDir=?{firstBinPath(c).toUnix}
|
||||
|
||||
|
|
@ -46,9 +59,21 @@ if [ ! -d $binDir ]; then
|
|||
mkdir $binDir
|
||||
fi
|
||||
|
||||
# add(result, "# override OS, CPU and OS Name with command-line arguments\n")
|
||||
if [ -n "$optos" ]; then
|
||||
uos="$optos"
|
||||
fi
|
||||
if [ -n "$optcpu" ]; then
|
||||
ucpu="$optcpu"
|
||||
fi
|
||||
if [ -n "$optcpu" ]; then
|
||||
uosname="$optosname"
|
||||
fi
|
||||
|
||||
# add(result, "# convert to lower case:\n")
|
||||
ucpu=`echo $ucpu | tr "[:upper:]" "[:lower:]"`
|
||||
uos=`echo $uos | tr "[:upper:]" "[:lower:]"`
|
||||
uosname=`echo $uosname | tr "[:upper:]" "[:lower:]"`
|
||||
|
||||
case $uos in
|
||||
*linux* )
|
||||
|
|
@ -97,6 +122,11 @@ case $uos in
|
|||
*mingw* )
|
||||
myos="windows"
|
||||
;;
|
||||
*android* )
|
||||
myos="android"
|
||||
LINK_FLAGS="$LINK_FLAGS -ldl -lm -lrt"
|
||||
LINK_FLAGS="$LINK_FLAGS -landroid-glob"
|
||||
;;
|
||||
*)
|
||||
echo 2>&1 "Error: unknown operating system: $uos"
|
||||
exit 1
|
||||
|
|
@ -132,7 +162,7 @@ case $ucpu in
|
|||
exit 1
|
||||
esac
|
||||
;;
|
||||
*arm*|*armv6l* )
|
||||
*arm*|*armv6l*|*armv71* )
|
||||
mycpu="arm" ;;
|
||||
*aarch64* )
|
||||
mycpu="arm64" ;;
|
||||
|
|
@ -142,7 +172,17 @@ case $ucpu in
|
|||
;;
|
||||
esac
|
||||
|
||||
case $uosname in
|
||||
*android* )
|
||||
LINK_FLAGS="$LINK_FLAGS -landroid-glob"
|
||||
myosname="android"
|
||||
myos="android"
|
||||
;;
|
||||
esac
|
||||
|
||||
# add(result, "# call the compiler:\n")
|
||||
echo \# OS: $myos
|
||||
echo \# CPU: $mycpu
|
||||
|
||||
case $myos in
|
||||
# for osA in 1..c.oses.len:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue