# Purpose : Build the privoxy binary, documentation and config files
# for the chosen target environment
#
-# Copyright : Written by and Copyright (C) 2001-2012 the
+# Copyright : Written by and Copyright (C) 2001-2021 the
# Privoxy team. http://www.privoxy.org/
#
# This program is free software; you can redistribute it
#
# must provide target
#
-if [ $# -eq 0 -o $# -gt 2 ]; then
- echo "Usage: $0 lion | snowleopardx64 | snowleopard | snowleopardi386 | leopardupwards | leopard | leopardi386 | leopardppc | tiger | tigeri386 | tigerppc | panther [-pcre]"
+if [ $# -eq 0 -o $# -gt 3 ]; then
+ echo "Usage: $0 current | curent-Xcode | lion | snowleopardx64 | snowleopard | snowleopardi386 | leopardupwards | leopard | leopardi386 | leopardppc | tiger | tigeri386 | tigerppc | panther [-pcre] [-https]"
exit 1
fi
#
. ./common.sh $1
+# Debugging
+#echo "${XCODE_PATH}"
+#echo ${SYSROOT}
+
#
# must have Xcode
#
if [ -z ${XCODE_PATH} ]; then
- echo "Error: Xcode is not found."
+ echo "Error: Commandline Tools for Xcode is not found."
exit 1
fi
#
-# set configure options; include the appropriate user/group as discerned by common.sh and set pcre to dynamic (libpcre) or static (bundled)
-#
-if [ "$2" == "-pcre" ]; then
- CFLAGS="${CFLAGS} -I/usr/local/include/"
- LDFLAGS="${LDFLAGS} -L/usr/local/lib"
- OPTS=${OPTS}
-else
+# set configure options based on the parameters passed at the command line
+
+for option in "$@"
+do
+ # set pcre library source to dynamic (libpcre - more up to date but requires the external library to exist for compiling) or static (bundled with privoxy - older version)
+ if [ "$option" == "-pcre" ]; then
+ CFLAGS="${CFLAGS} -I/usr/local/include/"
+ LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+ OPTS="${OPTS}"
+ fi
+
+ # enable HTTPS Inspection?
+ if [ "$option" == "-https" ]; then
+ CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@3/include/"
+ CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/openssl@3/include/"
+ LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@3/lib"
+ OPTS="${OPTS} --with-openssl"
+ fi
+done
+
+# if we didn't select external PCRE, set option to use the bundled one
+if [[ "${CFLAGS}" != *"-I/usr/local/include/"* ]]; then
OPTS="${OPTS} --disable-dynamic-pcre"
fi
#
echo ""
echo "Notice: configuring the privoxy software."
+# Debugging
+echo "${CFLAGS}"
+echo "${CPPFLAGS}"
+echo "${LDFLAGS}"
+echo "${OPTS}"
cd ../${SOURCE_DIR}
-/usr/bin/autoheader
-/usr/bin/autoconf
+autoheader
+autoconf
-/usr/bin/env CFLAGS="${CFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" LDFLAGS="${LDFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" ./configure ${OPTS}
+/usr/bin/env CFLAGS="-O2 -mdynamic-no-pic ${CFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" LDFLAGS="${LDFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" ./configure ${OPTS}
#
# clean, then make privoxy