Add pcre-build.sh script for easier building of pcre and configuring with SWIG if PCRE not installed
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12238 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
eaada32f26
commit
db6bf51067
4 changed files with 93 additions and 7 deletions
3
README
3
README
|
|
@ -57,6 +57,9 @@ You must use GNU `make' to build SWIG.
|
|||
|
||||
http://www.gnu.org/software/make/
|
||||
|
||||
PCRE needs to be installed on your system to build SWIG. The configure
|
||||
script will provide instructions for obtaining PCRE if it cannot be found.
|
||||
|
||||
To build and install SWIG, simply type the following:
|
||||
|
||||
% ./configure
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ else
|
|||
if test x$zip = x; then
|
||||
zip=zip
|
||||
fi
|
||||
extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux CXXFLAGS=-O2 CFLAGS=-O2"
|
||||
extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux"
|
||||
else
|
||||
if test "$cygwin"; then
|
||||
echo "Building native Windows executable on Cygwin"
|
||||
|
|
@ -61,6 +61,13 @@ fi
|
|||
swigbasename=swig-$version
|
||||
swigwinbasename=swigwin-$version
|
||||
tarball=$swigbasename.tar.gz
|
||||
pcre_tarball=`ls pcre-*.tar.*`
|
||||
|
||||
if ! test -f "$pcre_tarball"; then
|
||||
echo "Could not find PCRE tarball. Please download a PCRE source tarball from http://www.pcre.org"
|
||||
echo "and place in the same directory as the SWIG tarball."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -f "$tarball"; then
|
||||
builddir=build-$version
|
||||
|
|
@ -78,8 +85,11 @@ if test -f "$tarball"; then
|
|||
mv $swigbasename $swigwinbasename
|
||||
tar -zxf ../$tarball
|
||||
cd $swigbasename
|
||||
(cd ../.. && cp $pcre_tarball $builddir/$swigbasename)
|
||||
echo Running: Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
|
||||
./Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
|
||||
echo Running: ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
|
||||
./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
|
||||
./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
|
||||
echo "Compiling (quietly)..."
|
||||
make > build.log
|
||||
echo "Simple check to see if swig.exe runs..."
|
||||
|
|
|
|||
53
Tools/pcre-build.sh
Executable file
53
Tools/pcre-build.sh
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
|
||||
pcre_subdir=pcre/pcre-swig-install
|
||||
pcre_install_dir=`pwd`/$pcre_subdir
|
||||
|
||||
usage() {
|
||||
echo "Helper script to build PCRE as a static library from a tarball just for use during the"
|
||||
echo "SWIG build. It does not install PCRE for global use on your system."
|
||||
echo "Usage: pcre-build.sh [--help] [args]"
|
||||
echo " args - optional additional arguments passed on to the PCRE configure script (leave out"
|
||||
echo " unless you are an expert at configure)"
|
||||
echo " --help - Display this help information."
|
||||
echo "Instructions:"
|
||||
echo " - Download the latest PCRE source tarball from http://www.pcre.org and place in the"
|
||||
echo " directory that you will configure and build SWIG."
|
||||
echo " - Run this script in the same directory that you intend to configure and build SWIG in."
|
||||
echo " - Afterwards run the SWIG configure scrip which will then find and use the PCRE static"
|
||||
echo " libraries in the $pcre_subdir subdirectory."
|
||||
exit 0
|
||||
}
|
||||
|
||||
bail() {
|
||||
echo $1 >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if test -f "pcre-build.sh" ; then
|
||||
echo "Error: this script should not be run in the Tools directory" >&2
|
||||
echo ""
|
||||
usage
|
||||
fi
|
||||
|
||||
echo "Looking for PCRE tarball..."
|
||||
rm -rf pcre
|
||||
pcre_tarball=`ls pcre-*.tar.*`
|
||||
test -f "$pcre_tarball" || bail "Could not find tarball"
|
||||
|
||||
echo "Extracting tarball: $pcre_tarball"
|
||||
tar -xf $pcre_tarball || bail "Could not untar $pcre_tarball"
|
||||
pcre_dir=`echo $pcre_tarball | sed -e "s/\.tar.*//"`
|
||||
echo "Configuring PCRE in directory: pcre"
|
||||
mv $pcre_dir pcre || bail "Could not create pcre directory"
|
||||
cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
|
||||
echo "Building PCRE..."
|
||||
make -s || bail "Could not build PCRE"
|
||||
echo "Installing PCRE locally to $pcre_install_dir..."
|
||||
make -s install || bail "Could not install PCRE"
|
||||
echo ""
|
||||
echo "The SWIG configure script can now be run, whereupon PCRE will automatically be detected and used from $pcre_install_dir/bin/pcre-config."
|
||||
30
configure.in
30
configure.in
|
|
@ -67,6 +67,19 @@ AC_ARG_WITH([pcre],
|
|||
|
||||
AC_MSG_CHECKING([whether to enable PCRE support])
|
||||
AC_MSG_RESULT([$with_pcre])
|
||||
|
||||
dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
|
||||
if test x"${with_pcre}" = xyes ; then
|
||||
AC_MSG_CHECKING([whether to use local PCRE])
|
||||
local_pcre_config=no
|
||||
if test -z $PCRE_CONFIG; then
|
||||
if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
|
||||
PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
|
||||
local_pcre_config=$PCRE_CONFIG
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$local_pcre_config])
|
||||
fi
|
||||
AS_IF([test "x$with_pcre" != xno],
|
||||
[AX_PATH_GENERIC([pcre],
|
||||
[], dnl Minimal version of PCRE we need -- accept any
|
||||
|
|
@ -75,11 +88,18 @@ AS_IF([test "x$with_pcre" != xno],
|
|||
LIBS="$LIBS $PCRE_LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
|
||||
],
|
||||
[AC_MSG_FAILURE(
|
||||
Can't find pcre-config script from PCRE (Perl Compatible Regular
|
||||
Expressions) library package. You need to either download PCRE from
|
||||
www.pcre.org and install it or use --without-pcre configure option to
|
||||
disable regular expressions support in SWIG.)
|
||||
[AC_MSG_FAILURE([
|
||||
Can't find pcre-config script from PCRE (Perl Compatible Regular Expressions)
|
||||
library package. This dependency is needed for configure to complete,
|
||||
Either:
|
||||
- Install the PCRE developer package on your system (preferred approach).
|
||||
- Download the PCRE source tarball, build and install on your system
|
||||
as you would for any package built from source distribution.
|
||||
- Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
|
||||
link against. Run 'Tools/pcre-build.sh --help' for instructions.
|
||||
(quite easy and does not require privileges to install PCRE on your system)
|
||||
- Use configure --without-pcre to disable regular expressions support in SWIG
|
||||
(not recommended).])
|
||||
])
|
||||
])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue