From d862a6edfafeff9af7ab902df6cb59d852c49615 Mon Sep 17 00:00:00 2001 From: Ian Silvester Date: Fri, 16 Mar 2012 18:12:04 +0000 Subject: [PATCH] Privoxy source code directory now selectable --- OS X Package Builder HOWTO.txt | 2 +- Packagemaker Instructions.txt | 2 +- build.sh | 6 +++--- common.sh | 28 ++++++++++++++++++++++++ constructPkgContent.sh | 39 ++++++++++++++++++---------------- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/OS X Package Builder HOWTO.txt b/OS X Package Builder HOWTO.txt index 676058f..7b96111 100644 --- a/OS X Package Builder HOWTO.txt +++ b/OS X Package Builder HOWTO.txt @@ -5,7 +5,7 @@ This document will guide you through the complete process necessary to create a ASSUMPTIONS -1. That the Privoxy CVS project has been exported from Sourceforge to a folder named 'dist', pinned at whichever release you intend to build (as per the instructions in the developer manual). +1. That the Privoxy CVS project is available in a folder parallel to the one containing this file. If building for release it should have been exported from Sourceforge to a folder named 'dist', pinned at whichever release you intend to build (as per the instructions in the developer manual), you might have simply checked out the head of the CVS project to a folder named 'current'. If you are using a folder name other than these two you will be prompted to enter it. 2. That you have Xcode installed, including the SDKs for each OS X version you intend your package(s) to support. 3. That your build machine runs Snow Leopard (OS X 10.6). It will likely work equally well on Leopard or Lion (or later), but PackageMaker is substantially different in Tiger and earlier versions of OS X (even the project file format is different). 4. All references to files and folders in this document should be assumed to be within the OSXBuildSystem folder unless stated otherwise. diff --git a/Packagemaker Instructions.txt b/Packagemaker Instructions.txt index 3999b4f..41e7ddd 100644 --- a/Packagemaker Instructions.txt +++ b/Packagemaker Instructions.txt @@ -34,7 +34,7 @@ Empty. Edit Interface Background is empty. -Copy and paste texts from file 'pkg texts' to the relevant entry box on the left (having selected the 'embedded' radio button on the right). The license can be a File reference to ../current/LICENSE. +Copy and paste texts from file 'pkg texts' to the relevant entry box on the left (having selected the 'embedded' radio button on the right). The license can be a File reference to the file LICENSE in the directory containing Privoxy's source code (likely ../current or ../dist). Pkg Content diff --git a/build.sh b/build.sh index 65dd23b..35f7b43 100755 --- a/build.sh +++ b/build.sh @@ -76,7 +76,7 @@ fi # echo "" echo "Notice: configuring the privoxy software." -cd ../current +cd ../${SOURCE_DIR} /usr/bin/autoheader /usr/bin/autoconf /usr/bin/env CFLAGS="${CFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" LDFLAGS="${LDFLAGS} ${SYSROOT} ${ARCH} ${MACOSX_VERSION}" ./configure ${OPTS} @@ -92,6 +92,6 @@ echo "Notice: building the privoxy software." # # modify config file # -/usr/bin/awk '{sub(/logfile.*logfile$/,"logfile logfile.log"); print}' ../current/config > ../current/config.tmp -/bin/mv ../current/config.tmp ../current/config +/usr/bin/awk '{sub(/logfile.*logfile$/,"logfile logfile.log"); print}' ../${SOURCE_DIR}/config > ../${SOURCE_DIR}/config.tmp +/bin/mv ../${SOURCE_DIR}/config.tmp ../${SOURCE_DIR}/config diff --git a/common.sh b/common.sh index 0131199..41385ea 100755 --- a/common.sh +++ b/common.sh @@ -147,3 +147,31 @@ case "${darwin_major_rel_num}" in ;; esac +# +# identify the directory containing Privoxy's source +# +cd .. +DIRS_FOUND=0 +SOURCE_DIR="" +if [ -d dist ]; then + DIRS_FOUND=1 +fi +if [ -d current ]; then + DIRS_FOUND=$(( DIRS_FOUND + 10 )) +fi +case "${DIRS_FOUND}" in + # only 'current' found + 10) + SOURCE_DIR="current" + ;; + # only 'dist' found + 1) + SOURCE_DIR="dist" + ;; + # either both or neither found + 11|0) + read -p 'Could not select the Privoxy source directory. Please supply the directory name: ' SOURCE_DIR + ;; +esac +cd OSXPackageBuilder +echo "Using ../${SOURCE_DIR} as location of Privoxy source" \ No newline at end of file diff --git a/constructPkgContent.sh b/constructPkgContent.sh index 295c15a..e9856b2 100755 --- a/constructPkgContent.sh +++ b/constructPkgContent.sh @@ -31,6 +31,9 @@ # changes ought to be passed back to the macsetup module. # +# Use the common script to locate the directory containing Privoxy's source ($SOURCEDIR) +. ./common.sh + # Remove existing 'pkg content' folder if found echo "" echo "Remove existing 'pkg content' folder if found" @@ -46,64 +49,64 @@ cp -vR pkg\ content\ skeleton pkg\ content echo "" echo "Replace the version number placeholders in the uninstallation script" echo "" -VERSION=`perl findversion.pl ../current/ChangeLog` +VERSION=`perl findversion.pl ../${SOURCE_DIR}/ChangeLog` sed "s/PRIVOXY_VERSION/${VERSION}/g" pkg\ content\ skeleton/Applications/Privoxy/uninstall.command > pkg\ content/Applications/Privoxy/uninstall.command -# Copy the compiled privoxy binary from the 'current' project +# Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory echo "" echo "" -echo "Copy the compiled privoxy binary from the 'current' project" +echo "Copy the compiled privoxy binary from the '${SOURCE_DIR}' directory" echo "" -cp -v ../current/privoxy pkg\ content/usr/local/sbin +cp -v ../${SOURCE_DIR}/privoxy pkg\ content/usr/local/sbin -# Copy the configuration hierarchy from the 'current' project +# Copy the configuration hierarchy from the '${SOURCE_DIR}' directory echo "" echo "" -echo "Copy most of the configuration hierarchy from the 'current' project" +echo "Copy most of the configuration hierarchy from the '${SOURCE_DIR}' directory" echo "" for i in default.action default.filter match-all.action trust user.action user.filter templates; do if [ "$i" = "templates" ]; then # for the templates subfolder copy all files therein - cp -vR ../current/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i + cp -vR ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i else # for all regular files just copy them across - cp -v ../current/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i + cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/etc/privoxy/vanilla/$i fi done # Enter the correct values for confdir and logdir into the config file echo "" echo "" -echo "Copy the config file from the 'current' project, modifying the confdir and logdir in passing" +echo "Copy the config file from the '${SOURCE_DIR}' directory, modifying the confdir and logdir in passing" echo "" -sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../current/config > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp +sed 's/confdir ./confdir \/usr\/local\/etc\/privoxy/g' ../${SOURCE_DIR}/config > pkg\ content/usr/local/etc/privoxy/vanilla/config_temp sed 's/logdir ./logdir \/var\/log\/privoxy/g' pkg\ content/usr/local/etc/privoxy/vanilla/config_temp > pkg\ content/usr/local/etc/privoxy/vanilla/config rm -f pkg\ content/usr/local/etc/privoxy/vanilla/config_temp -# Copy the documentation hierarchy from the 'current' project +# Copy the documentation hierarchy from the '${SOURCE_DIR}' directory echo "" echo "" -echo "Copy the documentation hierarchy from the 'current' project" +echo "Copy the documentation hierarchy from the '${SOURCE_DIR}' directory" echo "" # copy the required directory hierarchies for i in developer-manual faq images man-page team user-manual; do - cp -vR ../current/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i + cp -vR ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i done # copy the top-level files for i in announce.txt p_doc.css privoxy-index.html; do - cp -v ../current/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i + cp -v ../${SOURCE_DIR}/doc/webserver/$i pkg\ content/usr/local/share/doc/privoxy/$i done # copy the project's AUTHORS, ChangeLog, LICENSE and README files for i in AUTHORS ChangeLog LICENSE README; do - cp -v ../current/$i pkg\ content/usr/local/share/doc/privoxy/$i + cp -v ../${SOURCE_DIR}/$i pkg\ content/usr/local/share/doc/privoxy/$i done -# Copy the manpage from the 'current' project +# Copy the manpage from the '${SOURCE_DIR}' directory echo "" echo "" -echo "Copy the manpage from the 'current' project" +echo "Copy the manpage from the '${SOURCE_DIR}' directory" echo "" -cp -v ../current/privoxy.1 pkg\ content/usr/local/share/man/man1 +cp -v ../${SOURCE_DIR}/privoxy.1 pkg\ content/usr/local/share/man/man1 # Remove CVS administration files echo "" -- 2.39.2