mkpkgconfig 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. etcdir=$ASTETCDIR
  30. libdir=$ASTLIBDIR
  31. varlibdir=$ASTVARLIBDIR
  32. varrundir=$ASTVARRUNDIR
  33. spooldir=$ASTSPOOLDIR
  34. logdir=$ASTLOGDIR
  35. confpath=$ASTCONFPATH
  36. moddir=$ASTMODDIR
  37. agidir=$AGI_DIR
  38. Name: asterisk
  39. Description: Open Source PBX and telephony toolkit
  40. Version: $ASTERISKVERSION
  41. Libs: $LIBS
  42. Cflags: $LOCAL_CFLAGS
  43. EOF