Commit | Line | Data |
---|---|---|
04f9f193 | 1 | #!/bin/bash |
f49ee185 | 2 | |
04f9f193 | 3 | TOPDIR="$(cd $(dirname $(which $0)); pwd)" |
04f9f193 | 4 | TMP_CONF="$(mktemp)" |
f49ee185 | 5 | |
c6f15699 JB |
6 | PKGMK=$TOPDIR/pkgmk |
7 | PKGMK_CONF=$TOPDIR/pkgmk-cross.conf | |
04f9f193 JB |
8 | PKGMK_ARGS="" |
9 | PKGMK_OPTIMIZE="" | |
f49ee185 | 10 | |
04f9f193 | 11 | while [ "$1" ]; do |
ab4e8070 JB |
12 | if [ "$1" != "-o" ]; then |
13 | PKGMK_ARGS="$PKGMK_ARGS $1" | |
14 | else | |
15 | shift | |
16 | PKGMK_OPTIMIZE="$1" | |
17 | fi | |
04f9f193 JB |
18 | shift |
19 | done | |
20 | ||
21 | if [ ! -z "$PKGMK_OPTIMIZE" ]; then | |
573c30b8 | 22 | _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')" |
04f9f193 JB |
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 | ||
77b59cfe JB |
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 | |
04f9f193 | 38 | |
ab4e8070 | 39 | rm -f $TMP_CONF |
f49ee185 JB |
40 | |
41 | # End of file |