mkpkgconfig 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  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