CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
- Added pkginfo to .gitignore
[pkgutils-cross.git] / pkgmk-cross
index 8c75b0f1a1ddbdbef12245e2b2fa66f4cc28d747..888bf02dc705d1dba26cdad8748017867a0ba386 100755 (executable)
@@ -1,25 +1,25 @@
 #!/bin/bash
 
 TOPDIR="$(cd $(dirname $(which $0)); pwd)"
-echo "TOP: $TOPDIR"
 TMP_CONF="$(mktemp)"
 
-PKGMK=$TOPDIR/src/pkgmk
-PKGMK_CONF=$TOPDIR/src/pkgmk.conf
+PKGMK=$TOPDIR/pkgmk
+PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
 PKGMK_ARGS=""
 PKGMK_OPTIMIZE=""
 
 while [ "$1" ]; do
-  echo "arg: $1"
-  case $1 in
-    -o) PKGMK_OPTIMIZE="$2" ;;
-     *) PKGMK_ARGS="$PKGMK_ARGS $1" ;;
-  esac
+  if [ "$1" != "-o" ]; then
+    PKGMK_ARGS="$PKGMK_ARGS $1"
+  else
+    shift
+    PKGMK_OPTIMIZE="$1"
+  fi
   shift
 done
 
 if [ ! -z "$PKGMK_OPTIMIZE" ]; then
-       _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')"
+  _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')"
   if [ ! -z "$_cflags" ]; then
     sed '/_CFLAGS=/d' $PKGMK_CONF | sed "s|CFLAGS=.*|CFLAGS=\"$_cflags\"|" > $TMP_CONF
     PKGMK_CONF="$TMP_CONF"
@@ -29,8 +29,16 @@ if [ ! -z "$PKGMK_OPTIMIZE" ]; then
   fi
 fi
 
-echo "$PKGMK -cf $PKGMK_CONF $PKGMK_ARGS"
+if [ ! -x $PKGMK ]; then
+  chmod +x $PKGMK
+fi
+
+$PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
+exit_code=$?
+
+rm -f $TMP_CONF
 
-#rm -f $TMP_CONF
+# Pass along the exit code of pkgmk.
+exit $exit_code
 
 # End of file