diff --git a/iKarith-libretro-fetch.sh b/iKarith-libretro-fetch.sh index 5070e85e..0fbf273a 100755 --- a/iKarith-libretro-fetch.sh +++ b/iKarith-libretro-fetch.sh @@ -11,38 +11,10 @@ else BASE_DIR="$WORKDIR/$BASE_DIR" fi -. $BASE_DIR/iKarith-libretro-config.sh - WORKDIR=$(pwd) -echo_cmd() { - echo "$@" - "$@" -} - - -# fetch_git -# Clones or pulls updates from a git repository into a local directory -# -# $1 The URI to fetch -# $2 The local directory to fetch to (relative) -# $3 Set to clone --recursive -# $4 Set to pull --recursive -fetch_git() { - fetch_dir="$WORKDIR/$2" - echo "=== Fetching $2 ===" - if [ -d "$fetch_dir/.git" ]; then - echo_cmd git -C "$fetch_dir" pull - if [ -n "$4" ]; then - echo_cmd git -C "$fetch_dir" submodule foreach git pull origin master - fi - else - echo_cmd git clone "$1" "$fetch_dir" - if [ -n "$3" ]; then - echo_cmd git -C "$fetch_dir" submodule update --init - fi - fi -} +. $BASE_DIR/iKarith-libretro-config.sh +. $BASE_DIR/iKarith-super/fetch-rules.sh # Keep three copies so we don't have to rebuild stuff all the time. diff --git a/iKarith-super/cpu.sh b/iKarith-super/cpu.sh new file mode 100644 index 00000000..cff59794 --- /dev/null +++ b/iKarith-super/cpu.sh @@ -0,0 +1,56 @@ +# vim: set ts=3 sw=3 noet ft=sh : bash + +# CPU identification +# +# All of these functions can be overridden by $1 for use in buildbots, etc. +# The rest are meant to replace test or [ in if statements. + + +# Use with $() syntax +host_cpu() { + echo ${1:-`uname -m`} +} + + + +cpu_isx86() { + case ${1:-`uname -m`} in + i386|i586|i686|x86_64) echo "true" ;; + *) [ "${PROCESSOR_ARCHITEW6432}" = "AMD64" ] && echo "true" ;; + esac +} + +cpu_isx86_64() { + [ ${1:-`uname -m`} = "x86_64" ] && return 0 + return 1 +} + +cpu_isarm() { + case ${1:-`uname -m`} in + armv*) return 0 ;; + esac + return 1 +} + +cpu_isarmv5() { + [ "${1:-`uname -m`}" = "armv5tel" ] && return 0 + return 1 +} + +# Consider using armv6* here? +cpu_isarmv6() { + case ${1:-`uname -m`} in + armv6l|armv6) return 0 ;; + esac + return 1 +} + +# Consider using armv7* here? +# armv7s is Apple A6 chip +cpu_isarmv7() { + case ${1:-`uname -m`} in + armv7l|armv7|armv7s) return 0 ;; + esac + return 1 +} + diff --git a/iKarith-super/fetch-rules.sh b/iKarith-super/fetch-rules.sh new file mode 100644 index 00000000..2358a5e9 --- /dev/null +++ b/iKarith-super/fetch-rules.sh @@ -0,0 +1,28 @@ +# vim: set ts=3 sw=3 noet ft=sh : bash + +# FIXME: This doesn't belong here, move it +echo_cmd() { + echo "$@" + "$@" +} + + +# fetch_git +# Clones or pulls updates from a git repository into a local directory +# +# $1 The URI to fetch +# $2 The local directory to fetch to (relative) +# $3 Set to clone --recursive +# $4 Set to pull --recursive +fetch_git() { + fetch_dir="$WORKDIR/$2" + echo "=== Fetching $2 ===" + if [ -d "$fetch_dir/.git" ]; then + echo_cmd git -C "$fetch_dir" pull + [ -n "$4" ]&& echo_cmd git -C "$fetch_dir" submodule foreach git pull origin master + else + echo_cmd git clone "$1" "$fetch_dir" + [ -n "$3" ]&& echo_cmd git -C "$fetch_dir" submodule update --init + fi +} +