summaryrefslogtreecommitdiff
path: root/helper.sh
diff options
context:
space:
mode:
Diffstat (limited to 'helper.sh')
-rwxr-xr-xhelper.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/helper.sh b/helper.sh
new file mode 100755
index 000000000..bcde40c3f
--- /dev/null
+++ b/helper.sh
@@ -0,0 +1,37 @@
+#!/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_WORK=${PKG_BASE}/work/${PKG_NAME}
+export PKG_DEST=${PKG_BASE}/dest/${PKG_NAME}
+export PKG_STAT=${PKG_BASE}/stat/${PKG_NAME}
+export PKG_DATA=$(echo "${PKG_BASE}"/data/"${PKG_NAME}"?(_))
+export PKG_VRSN=$(cat "${PKG_DATA}/_metadata/version")-1
+export PKG_PACK=${PKG_BASE}/pack/${PKG_NAME}_${PKG_VRSN}_darwin-arm.deb
+
+if [[ ! -e ${PKG_DATA} ]]; then
+ echo "unknown package: ${PKG_NAME}" 1>&2
+ 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[@]}"
+}