CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Merge remote-tracking branch 'upstream/master' into 3.1
[pkgutils-cross.git] / pkgmk-cross
1 #!/bin/bash
2
3 TOPDIR="$(cd $(dirname $(which $0)); pwd)"
4 TMP_CONF="$(mktemp)"
5
6 PKGMK=$TOPDIR/pkgmk
7 PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
8 PKGMK_ARGS=""
9 PKGMK_OPTIMIZE=""
10
11 while [ "$1" ]; do
12 if [ "$1" != "-o" ]; then
13 PKGMK_ARGS="$PKGMK_ARGS $1"
14 else
15 shift
16 PKGMK_OPTIMIZE="$1"
17 fi
18 shift
19 done
20
21 if [ ! -z "$PKGMK_OPTIMIZE" ]; then
22 _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')"
23 if [ ! -z "$_cflags" ]; then
24 sed '/_CFLAGS=/d' $PKGMK_CONF | sed "s|CFLAGS=.*|CFLAGS=\"$_cflags\"|" > $TMP_CONF
25 PKGMK_CONF="$TMP_CONF"
26 else
27 echo "Error, invalid optimization: '$PKGMK_OPTIMIZE'"
28 exit 1
29 fi
30 fi
31
32 if [ -x $PKGMK ]; then
33 $PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
34 else
35 chmod +x $PKGMK
36 $PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
37 fi
38
39 rm -f $TMP_CONF
40
41 # End of file