CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
added multi optimized CFLAGS support to pkgmk-cross
authorJose V Beneyto <sepen@crux.nu>
Wed, 24 Feb 2010 22:19:17 +0000 (23:19 +0100)
committerJose V Beneyto <sepen@crux.nu>
Wed, 24 Feb 2010 22:19:17 +0000 (23:19 +0100)
pkgmk-cross
src/pkgmk.conf

index 6db90be2195201e64dd67d45929f8049a8617d01..8c75b0f1a1ddbdbef12245e2b2fa66f4cc28d747 100755 (executable)
@@ -1,10 +1,36 @@
-#!/bin/sh
+#!/bin/bash
 
-TOPDIR="$(cd $(dirname $0); pwd)"
+TOPDIR="$(cd $(dirname $(which $0)); pwd)"
+echo "TOP: $TOPDIR"
+TMP_CONF="$(mktemp)"
 
 PKGMK=$TOPDIR/src/pkgmk
 PKGMK_CONF=$TOPDIR/src/pkgmk.conf
+PKGMK_ARGS=""
+PKGMK_OPTIMIZE=""
 
-$PKGMK -cf $PKGMK_CONF $@
+while [ "$1" ]; do
+  echo "arg: $1"
+  case $1 in
+    -o) PKGMK_OPTIMIZE="$2" ;;
+     *) PKGMK_ARGS="$PKGMK_ARGS $1" ;;
+  esac
+  shift
+done
+
+if [ ! -z "$PKGMK_OPTIMIZE" ]; then
+       _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"
+  else
+    echo "Error, invalid optimization: '$PKGMK_OPTIMIZE'"
+    exit 1
+  fi
+fi
+
+echo "$PKGMK -cf $PKGMK_CONF $PKGMK_ARGS"
+
+#rm -f $TMP_CONF
 
 # End of file
index e415169210c3d76591e9cc71137ba16855ee1165..a67a74d24f9bf98b990b25b18f4afd8a595c0593 100644 (file)
@@ -20,7 +20,12 @@ export LD="$CTARGET-ld"
 export STRIP="$CTARGET-strip"
 
 export CFLAGS="-O2 -pipe"
-export CXXFLAGS="-O2 -pipe"
+export CXXFLAGS="$CFLAGS"
+
+arm9tdmi_CFLAGS="-O2 -pipe -march=armv4 -mtune=arm9tdmi"
+armv5te_CFLAGS="-O2 -pipe -march=armv5te"
+strongarm_CFLAGS="-O2 -pipe -march=armv4 -mtune=strongarm"
+xscale_CFLAGS="-O2 -pipe -march=armv5te -mtune=xscale"
 
 STRIP_CMD="$STRIP"