mkpkgconfig 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/-pipe\s*//g' | ${EXTREGEX} 's/-[Wmp]\S*\s*//g' | \
  20. ${EXTREGEX} 's/\s+-I(include|\.\.\/include)\s+/ /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. ${EXTREGEX} 's/^\s|\s$//g'`
  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=$ASTMODDIR
  36. agidir=$AGI_DIR
  37. Name: asterisk
  38. Description: Open Source PBX and telephony toolkit
  39. Version: $ASTERISKVERSION
  40. Libs: $LIBS
  41. Cflags: $LOCAL_CFLAGS
  42. EOF