mkpkgconfig 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. PPATH=$1
  3. ## Make sure we were called from Makefile
  4. if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
  5. echo " ** Do not call this script directly"
  6. exit
  7. fi
  8. ## Create a pkgconfig spec file for 3rd party modules (pkg-config asterisk --cflags)
  9. if [ ! -d $PPATH ]; then
  10. exit
  11. fi
  12. #Solaris (and some others) don't have sed -r. perl -p is equivalent
  13. if [[ `echo "xxx" | sed -r 's/x/y/g' 2>/dev/null | grep -c "yyy"` != 0 ]]; then
  14. EXTREGEX="sed -r -e"
  15. else
  16. EXTREGEX="perl -pe"
  17. fi
  18. ## Clean out CFLAGS for the spec file.
  19. LOCAL_CFLAGS=`echo $CFLAGS | ${EXTREGEX} 's/\s*-pipe\s*//g' | ${EXTREGEX} 's/-[Wmp]\S*\s*//g' | \
  20. ${EXTREGEX} 's/-I(include|\.\.\/include) //g' | \
  21. ${EXTREGEX} 's/-DINSTALL_PREFIX=\S* //g' | \
  22. ${EXTREGEX} 's/-DASTERISK_VERSION=\S* //g' | \
  23. ${EXTREGEX} 's/-DAST(ETCDIR|LIBDIR|VARLIBDIR|VARRUNDIR|SPOOLDIR|LOGDIR|CONFPATH|MODDIR|AGIDIR)=\S* //g'`
  24. cat <<EOF > $PPATH/asterisk.pc
  25. install_prefix=$INSTALL_PREFIX
  26. version_number=$ASTERISKVERSIONNUM
  27. etcdir=$ASTETCDIR
  28. libdir=$ASTLIBDIR
  29. varlibdir=$ASTVARLIBDIR
  30. varrundir=$ASTVARRUNDIR
  31. spooldir=$ASTSPOOLDIR
  32. logdir=$ASTLOGDIR
  33. confpath=$ASTCONFPATH
  34. moddir=$MODULES_DIR
  35. agidir=$AGI_DIR
  36. Name: asterisk
  37. Description: Open Source PBX and telephony toolkit
  38. Version: $ASTERISKVERSION
  39. Libs: $LIBS
  40. Cflags: $LOCAL_CFLAGS
  41. EOF