mkpkgconfig 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/\s*-pipe\s*//g' | ${EXTREGEX} 's/-[Wmp]\S*\s*//g' | \
  21. ${EXTREGEX} 's/-I(include|\.\.\/include) //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. 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