generate-pc-config.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # Generate nss.pc and nss-config from nss.pc.in and nss-config.in
  3. # Ozan Caglayan, 2010
  4. LIBDIR="/usr/lib"
  5. PREFIX="/usr"
  6. EXEC_PREFIX="/usr"
  7. INCLUDEDIR="/usr/include/nss3"
  8. PKGCONFIG="dist/pkgconfig/nss.pc.in"
  9. NSSCONFIG="dist/pkgconfig/nss-config.in"
  10. NSS_VMAJOR=`cat nss/lib/nss/nss.h | grep "#define.*NSS_VMAJOR" | awk '{print $3}'`
  11. NSS_VMINOR=`cat nss/lib/nss/nss.h | grep "#define.*NSS_VMINOR" | awk '{print $3}'`
  12. NSS_VPATCH=`cat nss/lib/nss/nss.h | grep "#define.*NSS_VPATCH" | awk '{print $3}'`
  13. NSS_VERSION="$NSS_VMAJOR.$NSS_VMINOR.$NSS_VPATCH"
  14. NSPR_VERSION=`nspr-config --version`
  15. echo "NSS_VMAJOR: $NSS_VMAJOR"
  16. echo "NSS_VMINOR: $NSS_VMINOR"
  17. echo "NSS_VPATCH: $NSS_VPATCH"
  18. echo "NSS_VERSION: $NSS_VERSION"
  19. # Setup nss-config
  20. cat $NSSCONFIG | sed -e "s,@prefix@,$PREFIX,g" \
  21. -e "s,@MOD_MAJOR_VERSION@,$NSS_VMAJOR,g" \
  22. -e "s,@MOD_MINOR_VERSION@,$NSS_VMINOR,g" \
  23. -e "s,@MOD_PATCH_VERSION@,$NSS_VPATCH,g" \
  24. > dist/pkgconfig/nss-config
  25. # Set executable bit
  26. chmod 755 dist/pkgconfig/nss-config
  27. # Setup pkgconfig file
  28. cat $PKGCONFIG | sed -e "s,@libdir@,$LIBDIR,g" \
  29. -e "s,@prefix@,$PREFIX,g" \
  30. -e "s,@exec_prefix@,$EXEC_PREFIX,g" \
  31. -e "s,@includedir@,$INCLUDEDIR,g" \
  32. -e "s,@NSS_VERSION@,$NSS_VERSION,g" \
  33. -e "s,@NSPR_VERSION@,$NSPR_VERSION,g" \
  34. > dist/pkgconfig/nss.pc
  35. # Clear .in files
  36. rm -rf $PKGCONFIG $NSSCONFIG