mkpkgconfig 1.3 KB

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