File: pcre-build.sh

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (55 lines) | stat: -rwxr-xr-x 2,233 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/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 "    This will configure and build PCRE as a static library."
  echo "  - Afterwards run the SWIG configure script 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 -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre-*.tar*"
test -f "$pcre_tarball" || bail "Could not find a single PCRE tarball. Found: $pcre_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:-make} -s || bail "Could not build PCRE"
echo "Installing PCRE locally to $pcre_install_dir..."
${MAKE:-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."