summaryrefslogtreecommitdiff
path: root/helper.sh
diff options
context:
space:
mode:
Diffstat (limited to 'helper.sh')
-rwxr-xr-xhelper.sh40
1 files changed, 15 insertions, 25 deletions
diff --git a/helper.sh b/helper.sh
index 2db729b70..d02ccd8a2 100755
--- a/helper.sh
+++ b/helper.sh
@@ -1,10 +1,17 @@
#!/bin/bash
-export PKG_ROOT=$(arm-apple-darwin-gcc -dumpspecs | grep '%{isysroot' | sed -e 's/.*%{isysroot\*:\([^}]*\)}.*/\1/; s/;:/\n/g' | sed -e 's/^-syslibroot //' | tail -n 1)
+export PKG_TARG=arm-apple-darwin
-export PKG_WORK=${PKG_BASE}/work/${PKG_NAME}
-export PKG_DEST=${PKG_BASE}/dest/${PKG_NAME}
-export PKG_STAT=${PKG_BASE}/stat/${PKG_NAME}
+export PKG_ROOT=$("${PKG_TARG}-gcc" -dumpspecs | grep '%{isysroot' | sed -e 's/.*%{isysroot\*:\([^}]*\)}.*/\1/; s/;:/\n/g' | sed -e 's/^-syslibroot //' | tail -n 1)
+export PKG_PFIX=$("${PKG_TARG}-gcc" -v 2>&1 | grep -- --prefix | sed -e 's/.*--prefix=\([^ ]*\).*/\1/')
+
+source "${PKG_BASE}/folders.sh"
+
+export PKG_DATA=$(PKG_DATA_ "${PKG_NAME}")
+export PKG_WORK=$(PKG_WORK_ "${PKG_NAME}")
+export PKG_DEST=$(PKG_DEST_ "${PKG_NAME}")
+
+export PKG_STAT=${PKG_BASE}/stat/${PKG_TARG}/${PKG_NAME}
export PKG_DATA=$(echo "${PKG_BASE}"/data/"${PKG_NAME}"?(_))
export PKG_VRSN=$(cat "${PKG_DATA}/_metadata/version")
export PKG_PRIO=$(cat "${PKG_DATA}/_metadata/priority")
@@ -15,24 +22,7 @@ if [[ ! -e ${PKG_DATA} ]]; then
exit 1
fi
-PKG_DEPS=("${PKG_DATA}"/_metadata/*.dep)
-
-function pkg_ {
- if [[ ${1:0:1} = / ]]; then
- echo "${PKG_DEST}$1"
- else
- echo $1
- fi
-}
-
-function pkg: {
- declare -a argv
- declare argc=$#
-
- for ((i=0; $i != $argc; ++i)); do
- argv[$i]=$(pkg_ $1)
- shift
- done
-
- "${argv[@]}"
-}
+declare -a PKG_DEPS
+for dep in "${PKG_DATA}"/_metadata/*.dep; do
+ PKG_DEPS[${#PKG_DEPS[@]}]=$(basename "${dep}" .dep)
+done