Okay, there are 3 reasons why I'm doing this.
[asterisk/asterisk.git] / build_tools / mkpkgconfig
1 #!/bin/bash
2 PPATH=$1
3 ## Make sure we were called from Makefile
4
5 if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
6   echo " ** Do not call this script directly"
7   exit
8 fi
9
10 ## Create a pkgconfig spec file for 3rd party modules (pkg-config asterisk --cflags)
11
12 if [ ! -d $PPATH ]; then
13   exit
14 fi
15
16 ## Clean out CFLAGS for the spec file.
17
18 LOCAL_CFLAGS=`echo $CFLAGS | sed -e 's/[[:space:]]*-pipe[[:space:]]*//g' | sed -e 's/-[Wmp][^[:space:]]*[[:space:]]*//g' | \
19   sed -e 's/-I\(include|\.\.\/include\) //g' | \
20   sed -e 's/-DINSTALL_PREFIX=[^[:space:]]* //g' | \
21   sed -e 's/-DASTERISK_VERSION=[^[:space:]]* //g' | \
22   sed -e 's/-DAST\(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR\)=[^[:space:]]* //g'`
23
24
25 cat <<EOF > $PPATH/asterisk.pc
26 install_prefix=$INSTALL_PREFIX
27 version_number=$ASTERISKVERSIONNUM
28 etcdir=$ASTETCDIR
29 libdir=$ASTLIBDIR
30 varlibdir=$ASTVARLIBDIR
31 varrundir=$ASTVARRUNDIR
32 spooldir=$ASTSPOOLDIR
33 logdir=$ASTLOGDIR
34 confpath=$ASTCONFPATH
35 moddir=$MODULES_DIR
36 agidir=$AGI_DIR
37
38 Name: asterisk
39 Description: Open Source PBX and telephony toolkit
40 Version: $ASTERISKVERSION
41 Libs: $LIBS
42 Cflags: $LOCAL_CFLAGS
43 EOF