PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Tools/pcre-build.sh

#
Shell | 55 lines | 47 code | 7 blank | 1 comment | 13 complexity | 5cef5c6907d6d2bb66904d7d59f01dea MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. #!/bin/sh
  2. pcre_subdir=pcre/pcre-swig-install
  3. pcre_install_dir=`pwd`/$pcre_subdir
  4. usage() {
  5. echo "Helper script to build PCRE as a static library from a tarball just for use during the"
  6. echo "SWIG build. It does not install PCRE for global use on your system."
  7. echo "Usage: pcre-build.sh [--help] [args]"
  8. echo " args - optional additional arguments passed on to the PCRE configure script (leave out"
  9. echo " unless you are an expert at configure)"
  10. echo " --help - Display this help information."
  11. echo "Instructions:"
  12. echo " - Download the latest PCRE source tarball from http://www.pcre.org and place in the"
  13. echo " directory that you will configure and build SWIG."
  14. echo " - Run this script in the same directory that you intend to configure and build SWIG in."
  15. echo " This will configure and build PCRE as a static library."
  16. echo " - Afterwards run the SWIG configure script which will then find and use the PCRE static"
  17. echo " libraries in the $pcre_subdir subdirectory."
  18. exit 0
  19. }
  20. bail() {
  21. echo $1 >&2
  22. exit 1
  23. }
  24. if test "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ; then
  25. usage
  26. fi
  27. if test -f "pcre-build.sh" ; then
  28. echo "Error: this script should not be run in the Tools directory" >&2
  29. echo ""
  30. usage
  31. fi
  32. echo "Looking for PCRE tarball..."
  33. rm -rf pcre
  34. pcre_tarball=`ls pcre-*.tar*`
  35. test -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre-*.tar*"
  36. test -f "$pcre_tarball" || bail "Could not find a single PCRE tarball. Found: $pcre_tarball"
  37. echo "Extracting tarball: $pcre_tarball"
  38. tar -xf $pcre_tarball || bail "Could not untar $pcre_tarball"
  39. pcre_dir=`echo $pcre_tarball | sed -e "s/\.tar.*//"`
  40. echo "Configuring PCRE in directory: pcre"
  41. mv $pcre_dir pcre || bail "Could not create pcre directory"
  42. cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
  43. echo "Building PCRE..."
  44. make -s || bail "Could not build PCRE"
  45. echo "Installing PCRE locally to $pcre_install_dir..."
  46. make -s install || bail "Could not install PCRE"
  47. echo ""
  48. echo "The SWIG configure script can now be run, whereupon PCRE will automatically be detected and used from $pcre_install_dir/bin/pcre-config."