CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
- Added pkginfo to .gitignore
[pkgutils-cross.git] / pkgmk-cross
CommitLineData
04f9f193 1#!/bin/bash
f49ee185 2
04f9f193 3TOPDIR="$(cd $(dirname $(which $0)); pwd)"
04f9f193 4TMP_CONF="$(mktemp)"
f49ee185 5
c6f15699
JB
6PKGMK=$TOPDIR/pkgmk
7PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
04f9f193
JB
8PKGMK_ARGS=""
9PKGMK_OPTIMIZE=""
f49ee185 10
04f9f193 11while [ "$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
19done
20
21if [ ! -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
30fi
31
a04c645f 32if [ ! -x $PKGMK ]; then
77b59cfe 33 chmod +x $PKGMK
77b59cfe 34fi
04f9f193 35
a04c645f
TS
36$PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
37exit_code=$?
38
ab4e8070 39rm -f $TMP_CONF
f49ee185 40
a04c645f
TS
41# Pass along the exit code of pkgmk.
42exit $exit_code
43
f49ee185 44# End of file