Files
asterisk/build_tools/mkpkgconfig
T

52 lines
1.3 KiB
Bash
Raw Normal View History

2009-09-24 08:36:18 +00:00
#!/bin/sh
2011-08-25 15:30:46 +00:00
PPATH="$1"
GREP=${GREP:-grep}
2004-11-11 14:48:53 +00:00
## Make sure we were called from Makefile
if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
2004-11-11 14:48:53 +00:00
echo " ** Do not call this script directly"
exit
fi
## Create a pkgconfig spec file for 3rd party modules (pkg-config asterisk --cflags)
2011-08-25 15:30:46 +00:00
if [ ! -d "$PPATH" ]; then
2004-11-11 14:48:53 +00:00
exit
fi
2006-08-24 22:17:12 +00:00
#Solaris (and some others) don't have sed -r. perl -p is equivalent
2009-09-24 14:44:08 +00:00
if [ `echo "xxx" | sed -r 's/x/y/g' 2>/dev/null | ${GREP} -c "yyy"` != 0 ]; then
2006-08-24 22:17:12 +00:00
EXTREGEX="sed -r -e"
else
EXTREGEX="perl -pe"
fi
2004-11-11 14:48:53 +00:00
## Clean out CFLAGS for the spec file.
LOCAL_CFLAGS=`echo $CFLAGS | ${EXTREGEX} 's/-pipe\s*//g' | ${EXTREGEX} 's/-[Wmp]\S*\s*//g' | \
${EXTREGEX} 's/\s+-I(include|\.\.\/include)\s+/ /g' | \
2006-08-24 22:17:12 +00:00
${EXTREGEX} 's/-DINSTALL_PREFIX=\S* //g' | \
${EXTREGEX} 's/-DASTERISK_VERSION=\S* //g' | \
${EXTREGEX} 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g' | \
${EXTREGEX} 's/^\s|\s$//g'`
2004-11-11 14:48:53 +00:00
2011-08-25 15:30:46 +00:00
cat <<EOF > "$PPATH/asterisk.pc"
2004-11-11 14:48:53 +00:00
install_prefix=$INSTALL_PREFIX
version_number=$ASTERISKVERSIONNUM
cachedir=$ASTCACHEDIR
2004-11-11 14:48:53 +00:00
etcdir=$ASTETCDIR
libdir=$ASTLIBDIR
varlibdir=$ASTVARLIBDIR
varrundir=$ASTVARRUNDIR
spooldir=$ASTSPOOLDIR
logdir=$ASTLOGDIR
confpath=$ASTCONFPATH
moddir=$ASTMODDIR
2004-11-11 14:48:53 +00:00
agidir=$AGI_DIR
Name: asterisk
Description: Open Source PBX and telephony toolkit
Version: $ASTERISKVERSION
Libs: $LIBS
Cflags: $LOCAL_CFLAGS
EOF