An external PCRE library set can now be optionally compiled against and bundled with...
[OSXPackageBuilder.git] / build.sh
1 #!/bin/sh
2
3 # File        :  build.sh
4 #
5 # Purpose     :  Build the privoxy binary, documentation and config files
6 #                for the chosen target environment
7 #
8 # Copyright   :  Written by and Copyright (C) 2001-2012 the
9 #                Privoxy team. http://www.privoxy.org/
10 #
11 #                This program is free software; you can redistribute it
12 #                and/or modify it under the terms of the GNU General
13 #                Public License as published by the Free Software
14 #                Foundation; either version 2 of the License, or (at
15 #                your option) any later version.
16 #
17 #                This program is distributed in the hope that it will
18 #                be useful, but WITHOUT ANY WARRANTY; without even the
19 #                implied warranty of MERCHANTABILITY or FITNESS FOR A
20 #                PARTICULAR PURPOSE.  See the GNU General Public
21 #                License for more details.
22 #
23 #                The GNU General Public License should be included with
24 #                this file.  If not, you can view it at
25 #                http://www.gnu.org/copyleft/gpl.html
26 #                or write to the Free Software Foundation, Inc.,
27 #                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 #                USA
29 #
30 # Modification : If you modify this file please consider whether your 
31 #                changes ought to be passed back to the macsetup module.
32 #
33
34 #
35 # must provide target
36 #
37 if [ $# -eq 0 -o $# -gt 2 ]; then
38   echo "Usage: $0 lion | snowleopard64 | snowleopard | leopardupwards | leopard | tiger | panther  [-pcre]"
39   exit 1
40 fi
41
42 #
43 # load common settings
44 #
45 . ./common.sh $1
46
47 #
48 # must have Xcode
49 #
50 if [ -z ${XCODE_PATH} ]; then
51   echo "Error: this release of Mac OS X not supported."
52   exit 1
53 fi
54
55 #
56 # set configure options
57 #
58 OPTS=${OPTS}
59 if [ "$2" == "-pcre" ]; then
60         CFLAGS="${CFLAGS} -I/usr/local/include/"
61         LDFLAGS="${LDFLAGS} -L/usr/local/lib"
62 fi
63
64 #
65 # check if privoxy group and user exist?
66 #
67 if [ -z ${GNAME} -o -z ${UNAME} ]; then
68   echo ""
69   echo "Error: a privoxy group and user do not exist."
70   echo "A privoxy group and user must be created before continuing."
71   echo "Review the README file for instructions on creating a privoxy group and user."
72   exit 1
73 else
74   echo ""
75   echo "Notice: an existing privoxy group and user was found."
76 fi
77
78 #
79 # configure privoxy
80 #
81 echo ""
82 echo "Notice: configuring the privoxy software."
83 cd ../${SOURCE_DIR}
84 /usr/bin/autoheader
85 /usr/bin/autoconf
86 /usr/bin/env CFLAGS="${CFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" LDFLAGS="${LDFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" ./configure ${OPTS}
87
88 #
89 # clean, then make privoxy
90 #
91 echo ""
92 echo "Notice: building the privoxy software."
93 /usr/bin/make clean
94 /usr/bin/make
95
96 #
97 # modify config file
98 #
99 /usr/bin/awk '{sub(/logfile.*logfile$/,"logfile logfile.log"); print}' ../${SOURCE_DIR}/config > ../${SOURCE_DIR}/config.tmp
100 /bin/mv ../${SOURCE_DIR}/config.tmp ../${SOURCE_DIR}/config
101