From e21beab059d7f0f77ef38dc2a1d0145ee815225e Mon Sep 17 00:00:00 2001 From: hal9 Date: Fri, 25 Oct 2002 02:44:23 +0000 Subject: [PATCH] Port of make install, etc from main trunk. Needs testing! Add Slackware support, and other related changes. Update related docs. --- ChangeLog | 3 + GNUmakefile.in | 388 ++++++++++++++++++++++++++++++++++++++++++------- INSTALL | 150 +++++++++++++++++++ Makefile | 35 ++++- README | 81 +++-------- configure.in | 82 +++++++++-- mkinstalldirs | 40 +++++ 7 files changed, 656 insertions(+), 123 deletions(-) create mode 100644 INSTALL create mode 100644 mkinstalldirs diff --git a/ChangeLog b/ChangeLog index be94133e..8c788669 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ ChangeLog for Privoxy - Content cookie filter now part of default (Medium) profile - Add a demoronizer filter, which fixes MS's abuse of std charsets (common cases anyway). +- Rewrite make install target. Add uninstall and install-strip + targets. +- Add Slackware support to Makefile. *** Version 3.0 *** diff --git a/GNUmakefile.in b/GNUmakefile.in index 2e1c4926..ff4c61be 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -1,6 +1,6 @@ # Note: Makefile is built automatically from Makefile.in # -# $Id: GNUmakefile.in,v 1.104.2.18 2002/08/23 12:22:40 oes Exp $ +# $Id: GNUmakefile.in,v 1.104.2.19 2002/09/26 22:50:02 hal9 Exp $ # # Written by and Copyright (C) 2001 the SourceForge # Privoxy team. http://www.privoxy.org/ @@ -48,14 +48,34 @@ SNAPVERSION = $(RPM_VERSION)-$(shell date "+%Y%m%d") ############################################################################# -# Directories for "make install" +# "make install" directories and variables ############################################################################# -DEST = @prefix@ -CONFDEST = @prefix@@sysconfdir@ -SBIN_DEST = @prefix@@sbindir@ -MAN_DEST = @prefix@@mandir@ -DOK_WEB_USEM=doc/webserver/user-manual +prefix = @prefix@ +exec_prefix = @exec_prefix@ +CONF_BASE = @sysconfdir@ +SBIN_DEST = @sbindir@ +MAN_DIR = @mandir@ +MAN_DEST = $(MAN_DIR)/man1 +SHARE_DEST = @datadir@ +DOC_DEST = $(SHARE_DEST)/doc/privoxy +VAR_DEST = @localstatedir@ +LOGS_DEST = $(VAR_DEST)/log/privoxy +PIDS_DEST = $(VAR_DEST)/run + +# if $prefix = /usr/local then the default CONFDEST change from +# CONF_DEST = $(CONF_BASE) to CONF_DEST = $(CONF_BASE)/privoxy +# by the target rule CONF_DEST +# +# also if the $prefix is /usr/local and there is no +# $(SHARE_DEST)/doc, it checks for $prefix/doc and installs there +# instead in this situation +# +# finally if $prefix=/usr/local and VAR_DEST=$prefix/var it +# changes this to /var for storing the logs and pidfile + +# used in source dir only, the install goes to $share_dest/doc/privoxy +DOK_WEB = doc/webserver/ ############################################################################# # Build tools @@ -65,13 +85,31 @@ PROGRAM = privoxy@EXEEXT@ CC = @CC@ ECHO = echo GZIP_PROG = gzip -#INSTALL = cp -f +# Install usage should be compatible with install-sh. INSTALL = @INSTALL@ -INSTALL_P = -m 0750 -g @GROUP@ -o @USER@ -b -INSTALL_T = -m 0640 -g @GROUP@ -o @USER@ -b -INSTALL_D = -m 0750 -g @GROUP@ -o @USER@ -d +# Binaries +BIN_MODE = 0755 +# Support files, docs, etc. +RA_MODE = 0664 +# Directory +DIR_MODE = 0755 +# Files daemon writes to. +RWD_MODE = 0660 +INSTALL_P = -m $(BIN_MODE) +INSTALL_T = -m $(RA_MODE) +INSTALL_D = -m $(DIR_MODE) -d +INSTALL_R = -m $(RWD_MODE) + +# install options for superuser install +#INSTALL_S = -g @GROUP@ -o @USER@ +# id -u is not universal. FIXME: need to set from configure. Breaks on +# Solaris. +#ID = id -u + LD = @CC@ RM = rm -f +RMDIR = rmdir +MKDIR = ./mkinstalldirs STRIP_PROG = strip SED = sed GREP = grep @@ -81,6 +119,10 @@ RPMBUILD = rpmbuild MV = mv TAR = tar LN = ln +TOUCH = touch +KILL = kill +CHMOD = chmod +CHOWN = chown WDUMP = @WDUMP@ -dump JADECAT = @JADECAT@ JADEBIN = @JADEBIN@ @@ -119,16 +161,14 @@ RPM_BASE = @RPM_BASE@ ############################################################################# # We include these files in our distributions ############################################################################# +CONFIGS = config trust default.action standard.action user.action default.filter # take care that no CVS .cvsignore or other crappy files # are included here # and escape every '#' in the find. doh. -CONFIG_FILES = config trust \ - default.action \ - standard.action user.action \ - default.filter \ +CONFIG_FILES = $(CONFIGS) \ `find templates/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS"` -DOC_FILES = AUTHORS LICENSE README ChangeLog \ +DOC_FILES = AUTHORS LICENSE README ChangeLog INSTALL \ `find doc/text/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS"` \ `find doc/webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html"` \ `find doc/webserver/ -name "*.css"` \ @@ -217,8 +257,8 @@ all: $(PROGRAM) default.action ############################################################################# .PHONY: all inifiles redhat-dist redhat-upload solaris-dist suse-dist \ suse-upload win-dist tarball-dist dok redhat-dok webserver clean clobber tags \ -install conectiva-spec conectiva-dist conectiva-upload - +install conectiva-spec conectiva-dist conectiva-upload CONF_DEST LOG_DEST \ +PID_DEST check_doc install-strip uninstall GROUP_T ############################################################################# # Define this explicitly because Solaris is broken! @@ -683,10 +723,13 @@ groff2html: $(G2H_CMD) ./privoxy.1 | $(SED) -e 's@@@' > doc/webserver/man-page/privoxy-man-page.html -# readme page -dok-readme: +# readme page and INSTALL file +dok-readme: dok-release cd doc/source && $(DB)-notoc -V nochunks readme.sgml > tmp.html &&\ - $(WDUMP) tmp.html > ../../README && $(RM) -r tmp.html + $(WDUMP) tmp.html > ../../README ;\ + $(DB)-notoc -V nochunks install.sgml > tmp.html &&\ + $(WDUMP) tmp.html > ../../INSTALL ;\ + $(RM) tmp.* # index.sgml is used to create both the Home Page, and a local index # for documentation, etc. @@ -963,36 +1006,278 @@ distclean: clobber tags: $(SRCS) $(HDRS) etags $(SRCS) $(HDRS) -install: all - @$(ECHO) "***************************************************"; \ - $(ECHO) "*** ***"; \ - $(ECHO) "*** WARNING ***"; \ - $(ECHO) "*** ***"; \ - $(ECHO) "*** The install target is very broken and ***"; \ - $(ECHO) "*** should not be used. For the time being, ***"; \ - $(ECHO) "*** run from the build dir, install manually, ***"; \ - $(ECHO) "*** or use a binary package. Sorry. ***"; \ - $(ECHO) "*** ***"; \ - $(ECHO) "***************************************************"; \ - $(ECHO) "Type \"yes i am sure\" if you are sure that you"; \ - $(ECHO) -n "really want to proceed with the broken install: "; \ - read answer; \ - if [ "$$answer" != "yes i am sure" ]; then exit 1; fi - - # FIXME! +CONF_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(CONF_BASE)" = "$(prefix)/etc" ];then \ + $(ECHO) "$(CONF_BASE)/privoxy";\ + else\ + $(ECHO) "$(CONF_BASE)";\ + fi) + +LOG_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(LOGS_DEST)" = "$(prefix)/var/log/privoxy" ];then \ + $(ECHO) "/var/log/privoxy" ;\ + else\ + $(ECHO) "$(LOGS_DEST)";\ + fi) + +PID_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(PIDS_DEST)" = "$(prefix)/var/run" ];then \ + $(ECHO) "/var/run" ;\ + else\ + $(ECHO) "$(PIDS_DEST)";\ + fi) + +check_doc:=$(shell if [ ! -d "$(SHARE_DEST)/doc" ] && [ "$(prefix)" = "/usr/local" ] && [ -d "$(prefix)/doc" ];then \ + $(ECHO) "1";\ + else\ + $(ECHO) "0";\ + fi) + +# If USER is specified but no GROUP, assume there is a GROUP of same name. +GROUP_T:=$(shell if [ x$(GROUP) = x ] && [ x$(USER) != x ];then \ + $(ECHO) "$(USER)" ;\ + else\ + $(ECHO) "$(GROUP)";\ + fi) + +install-strip: + $(MAKE) install STRIP=-s + +# FIXME: Test USER and GROUP on Slack to make sure this works as +# intended. +# +# FIXME: id handling needs help, probably via configure, since 'id -u' is not +# universally reliable (eg Solaris). Group handling could be better. +# Perhaps the whole user/group validation should be done here. +PROGRAM_V = Privoxy $(VERSION) +install: CONF_DEST LOG_DEST PID_DEST check_doc GROUP_T + # Quick test for valid USER. + if [ -n "$(USER)" ]; then \ + id $(USER) >/dev/null || exit 1;\ + fi + # Test for valid group. + if [ -n "$(GROUP_T)" ] && [ -n "$(USER)" ] && ! groups $(USER) | $(GREP) "\<$(GROUP_T)\>" >/dev/null; then \ + $(ECHO) Group $(GROUP_T) for User $(USER) is invalid && exit 1 ;\ + fi + + $(ECHO) "Creating directories, and preparing $(PROGRAM_V) installation" + $(CHMOD) $(DIR_MODE) $(MKDIR) + $(MKDIR) $(SBIN_DEST) $(prefix) $(CONF_DEST) $(CONF_DEST)/templates $(SHARE_DEST) \ + $(LOG_DEST) $(PID_DEST) + # Install the executable binary, strip if invoked as install-strip + test -n "$(STRIP)" &&\ + $(ECHO) Installing $(PROGRAM) stripped executable to $(SBIN_DEST) ||\ + $(ECHO) Installing $(PROGRAM) executable to $(SBIN_DEST) + $(INSTALL) $(INSTALL_P) $(STRIP) $(PROGRAM) $(SBIN_DEST) + + # Install the DOCS and man page + -if [ $(check_doc) = 0 ]; then \ + DOC=$(DOC_DEST) ;\ + else \ + DOC=$(prefix)/doc/privoxy ;\ + fi;\ + $(MKDIR) $$DOC $$DOC/user-manual $$DOC/faq $$DOC/developer-manual \ + $$DOC/man-page $$DOC/images $(MAN_DEST) ;\ + if [ -d "$(DOK_WEB)" ]; then \ + $(ECHO) Installing FAQ, Manual, and other docs to $$DOC;\ + for i in user-manual developer-manual faq; do \ + for ii in $(DOK_WEB)/$$i/*html; do \ + $(INSTALL) $(INSTALL_T) $$ii $$DOC/$$i;\ + done ;\ + done ;\ + for i in $(DOK_WEB)/images/*jpg; do \ + $(INSTALL) $(INSTALL_T) $$i $$DOC/images;\ + done ;\ + $(INSTALL) $(INSTALL_T) $(DOK_WEB)/man-page/*html $$DOC/man-page;\ + $(INSTALL) $(INSTALL_T) $(DOK_WEB)/privoxy-index.html $$DOC/index.html;\ + $(INSTALL) $(INSTALL_T) AUTHORS $$DOC;\ + $(INSTALL) $(INSTALL_T) LICENSE $$DOC;\ + $(INSTALL) $(INSTALL_T) README $$DOC;\ + $(INSTALL) $(INSTALL_T) ChangeLog $$DOC;\ + $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $$DOC;\ + fi + # Not all platforms support gzipped man pages. + $(ECHO) Installing man page to $(MAN_DEST)/privoxy.1 + -$(INSTALL) $(INSTALL_T) privoxy.1 $(MAN_DEST)/privoxy.1 + + # Change the config file default directories according to the configured ones + $(ECHO) Rewriting config for this installation + if [ -f config.base ] ; then \ + $(CAT) config >config~ ;\ + $(MV) config.base config ;\ + fi + $(SED) 's+confdir .+confdir $(CONF_DEST)+' config | \ + $(SED) 's+logdir .+logdir $(LOG_DEST)+' >config.updated + $(MV) config config.base + $(MV) config.updated config + + # Install the config support files. Test for root install, and abort + # if there is no privoxy user, and no other user was enabled during + # configure. Later, install init script if appropriate. + $(ECHO) Installing templates to $(CONF_DEST)/templates + for i in `find templates -type f`; do \ + $(INSTALL) $(INSTALL_T) $$i $(CONF_DEST)/templates ;\ + done + + if [ "`id |sed 's/(.*//' |sed 's/.*=//'`" = "0" ] ;then\ + if [ x$(USER) = x ] || [ $(USER) = root ]; then \ + if [ "`id privoxy`" ]; then \ + $(ECHO) "Warning: Setting user and group to privoxy";\ + INSTALL_CONF="$(INSTALL_T) -g privoxy -o privoxy" ;\ + USER=privoxy ;\ + GROUP_T=privoxy ;\ + else \ + $(ECHO) "******************************************************************" ;\ + $(ECHO) " WARNING! WARNING! installing config files as root!" ;\ + $(ECHO) " It is strongly recommended to run $(PROGRAM) as non-root user," ;\ + $(ECHO) " and to install the config files as that user!" ;\ + $(ECHO) " Please read INSTALL, and create a privoxy user!" ;\ + $(ECHO) "*******************************************************************" ;\ + exit 1 ;\ + fi ;\ + else \ + $(ECHO) "Superuser install, installing config files as $(USER):$(GROUP_T)" ;\ + INSTALL_CONF="$(INSTALL_T) -o $(USER) -g $(GROUP_T)" ;\ + fi ;\ + else \ + if [ ! "`id $(USER)`" = "`id`" ] ;then \ + $(ECHO) "** WARNING ** current install user different from configured user!!" ;\ + $(ECHO) "Edit may fail." ;\ + fi ;\ + INSTALL_CONF="$(INSTALL_T)" ;\ + fi ;\ + $(ECHO) Installing configuration files to $(CONF_DEST);\ + for i in $(CONFIGS); do \ + if [ -s "$(CONF_DEST)/$$i" ] ; then \ + $(ECHO) Installing $$i as $$i.new ;\ + $(INSTALL) $(INSTALL_R) $$i $(CONF_DEST)/$$i.new || exit 1;\ + NEW=1;\ + else \ + if test "$$i" = "config" || test "$$i" = "default.filter"; then \ + $(INSTALL) $(INSTALL_R) $$i $(CONF_DEST) || exit 1;\ + else \ + $(INSTALL) $(INSTALL_R) $$INSTALL_CONF $$i $(CONF_DEST) || exit 1;\ + fi;\ + fi ;\ + done ;\ + if [ -n "$$NEW" ]; then \ + $(CHMOD) $(RWD_MODE) $(CONF_DEST)/*.new || exit 1 ;\ + $(ECHO) "Warning: Older config files are preserved. Check new versions for changes!" ;\ + fi ;\ + [ ! -f $(LOG_DEST)/logfile ] && $(ECHO) Creating logfiles in $(LOG_DEST) || \ + $(ECHO) Checking logfiles in $(LOG_DEST) ;\ + $(TOUCH) $(LOG_DEST)/logfile $(LOG_DEST)/jarfile || exit 1 ;\ + if [ x$$USER != x ]; then \ + $(CHOWN) $$USER:$$GROUP_T $(LOG_DEST)/logfile $(LOG_DEST)/jarfile || \ + $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\ + fi ;\ + $(CHMOD) $(RWD_MODE) $(LOG_DEST)/logfile $(LOG_DEST)/jarfile || exit 1 ;\ + if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \ + if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \ + $(SED) 's+%PROGRAM%+$(PROGRAM)+' slackware/rc.privoxy.orig | \ + $(SED) 's+%SBIN_DEST%+$(SBIN_DEST)+' | \ + $(SED) 's+%CONF_DEST%+$(CONF_DEST)+' | \ + $(SED) 's+%USER%+$$USER+' | \ + $(SED) 's+%GROUP%+$(GROUP_T)+' >slackware/rc.privoxy ;\ + $(INSTALL) $(INSTALL_P) slackware/rc.privoxy /etc/rc.d/ ;\ + $(ECHO) "Installing for Slackware." ;\ + $(ECHO) "Dont forget to add the rc.privoxy to rc.local if you want it started at every boot" ;\ + elif [ -f /etc/redhat-release ] && [ -d /etc/rc.d/init.d/ ] && [ -w /etc/rc.d/init.d/ ] ; then \ + $(ECHO) "Installing init script to /etc/rc.d/init.d/privoxy" ;\ + $(SED) 's,^PRIVOXY_BIN=.*,PRIVOXY_BIN="/usr/local/sbin/$(PROGRAM)",' privoxy.init |\ + $(SED) 's,^PRIVOXY_CONF=.*,PRIVOXY_CONF="$(CONF_DEST)/config",' |\ + $(SED) "s,^PRIVOXY_USER=.*,PRIVOXY_USER=$$USER," > init.tmp ;\ + $(INSTALL) $(INSTALL_P) init.tmp /etc/rc.d/init.d/privoxy && $(RM) init.tmp;\ + $(MKDIR) /etc/logrotate.d/ ;\ + $(ECHO) "Installing logrotate script to /etc/logrotate.d/" ;\ + $(INSTALL) $(INSTALL_P) privoxy.logrotate /etc/logrotate.d/privoxy ;\ + elif [ -d /etc/init.d ] && [ -w /etc/init.d ] ; then \ + $(ECHO) "Installing generic init script to /etc/init.d/privoxy" ;\ + $(ECHO) "Please check that the PATHs are correct, and edit if needed." ;\ + $(INSTALL) $(INSTALL_P) privoxy-generic.init /etc/init.d/privoxy ;\ + fi ;\ + else \ + $(ECHO) "No init script installed, install it manually if needed" ;\ + fi + # mmmmm, good. + @$(ECHO) "$(PROGRAM_V) installation succeeded!" + @$(ECHO) "The Privoxy configuration files have been installed in $(CONF_DEST)" + +# rmdir is used as a precaution since it will not remove non-empty +# directories. RH init script creates lock file and pid file. +uninstall: CONF_DEST LOG_DEST PID_DEST check_doc + $(ECHO) Starting Privoxy uninstallation + # KILL privoxy if running + -if [ -f /etc/redhat-release ] && [ -d /etc/rc.d/init.d/ ] && [ -w /etc/rc.d/init.d/ ] ; then \ + /etc/rc.d/init.d/privoxy stop >/dev/null 2>/dev/null ;\ + chkconfig --del $(PROGRAM) 2>/dev/null;\ + fi + -@ test -f $(PID_DEST)/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\ + $(KILL) `$(CAT) $(PID_DEST)/privoxy.pid` + -@ test -f /var/run/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\ + $(KILL) `$(CAT) /var/run/privoxy.pid ` + + # Program binary + $(ECHO) Removing $(PROGRAM) binary + $(RM) $(SBIN_DEST)/$(PROGRAM) $(SBIN_DEST)/$(PROGRAM)~ + + # config files and dir, and maybe old install backups + $(ECHO) Removing $(PROGRAM) config files + for i in $(CONFIGS); do \ + $(RM) $(CONF_DEST)/$$i $(CONF_DEST)/$$i~ $(CONF_DEST)/$$i.new ;\ + done + $(RM) -r $(CONF_DEST)/templates + + # man page and docs + $(ECHO) Removing $(PROGRAM) docs + -$(RM) $(MAN_DEST)/privoxy.1* + -$(RM) -r $(DOC_DEST) || $(RM) -r $(prefix)/doc/privoxy + + # Log and jarfile and pidfile + $(ECHO) Removing $(PROGRAM) logs + -$(RM) $(LOG_DEST)/logfile $(PID_DEST)/privoxy.pid $(LOG_DEST)/jarfile + + # Final clean up of unused directories. Special handling of CONF and LOG + # destinations. + $(ECHO) Removing $(PROGRAM) directories + for i in $(LOG_DEST) $(CONF_DEST); do \ + if test -d $$i; then \ + $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\ + fi;\ + done + if [ ! "$(prefix)" = "/usr/local" ] ;then \ + for i in $(MAN_DEST) $(MAN_DIR) $(SHARE_DEST)/doc $(SHARE_DEST) $(SBIN_DEST); do \ + if test -d $$i; then \ + $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\ + fi;\ + done;\ + if test $(LOG_DEST) != /var/log/privoxy && test -d $(prefix)/var/log; then \ + $(RMDIR) $(prefix)/var/log || $(ECHO) "$(prefix)/var/log is not empty, not removed";\ + fi ;\ + if test $(PID_DEST) != /var/run && test -d $(prefix)/var/run; then \ + $(RMDIR) $(prefix)/var/run || $(ECHO) "$(prefix)/var/run is not empty, not removed";\ + fi ;\ + if test $(prefix)/var != /var && test -d $(prefix)/var; then \ + $(RMDIR) $(prefix)/var || $(ECHO) "$(prefix)/var is not empty, not removed" ;\ + fi ;\ + if test $(prefix) != / && test $(prefix) != /usr && test -d $(prefix); then \ + $(ECHO) Removing installation directory $(prefix) ;\ + $(RMDIR) $(prefix) || $(ECHO) "$(prefix) is not empty, not removed" ;\ + fi;\ + fi + + # init scripts and logrotate + if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \ + $(ECHO) Removing $(PROGRAM) init script ;\ + if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \ + $(RM) /etc/rc.d/rc.privoxy ;\ + elif [ -f /etc/redhat-release ] && [ -d /etc/rc.d/init.d/ ] && [ -w /etc/rc.d/init.d/ ] ; then \ + $(RM) /etc/rc.d/init.d/privoxy /etc/logrotate.d/privoxy;\ + elif [ -d /etc/init.d ] && [ -w /etc/init.d ] ; then \ + $(RM) /etc/init.d/privoxy ;\ + else \ + $(ECHO) "Unable to remove privoxy init script, not installed or permission denied" ;\ + fi ;\ + fi + $(ECHO) Privoxy uninstalled, bye - $(STRIP_PROG) $(PROGRAM) - $(INSTALL) $(INSTALL_D) $(SBIN_DEST) - $(INSTALL) $(INSTALL_D) $(DEST)/user-manual - $(INSTALL) $(INSTALL_D) $(CONFDEST)/templates - $(INSTALL) $(INSTALL_D) $(DEST)/$(DOK_WEB_USEM) - $(INSTALL) $(INSTALL_P) $(PROGRAM) $(SBIN_DEST) - if [ -d "$(DOK_WEB_USEM)" ]; then $(INSTALL) $(INSTALL_T) $(DOK_WEB_USEM)/[a-z]* $(DEST)/$(DOK_WEB_USEM); fi - $(INSTALL) $(INSTALL_T) templates/[a-z]* $(CONFDEST)/templates - $(INSTALL) $(INSTALL_T) config default.action default.filter trust $(CONFDEST) - # FIXME $(ECHO) privoxy.logrotate privoxy.monthly privoxy.weekly - # FIXME: Need new manual! $(GZIP_PROG) -c privoxy.1 > $(MAN_DEST)/privoxy.1.gz - $(INSTALL) $(INSTALL_P) privoxy.init /etc/init.d/privoxy coffee: @perl -e 'print pack "C*", (31,139,8,8,153,63,226,60,2,3,99,111,102,102,101,101,0,109,143,205,13,192,32,8,133,\ @@ -1008,6 +1293,9 @@ coffee: ## end: # $Log: GNUmakefile.in,v $ +# Revision 1.104.2.19 2002/09/26 22:50:02 hal9 +# New user-manual examples in config-file are getting wrapped. Add warning. +# # Revision 1.104.2.18 2002/08/23 12:22:40 oes # Added warning to broken install target # diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..2fb54085 --- /dev/null +++ b/INSTALL @@ -0,0 +1,150 @@ +/********************************************************************* + * + * File : $Source: /cvsroot/ijbswa/current/doc/source/install.sgml,v $ + * + * Purpose : INSTALL file to help with installing from source. + * + * Copyright : Written by and Copyright (C) 2001,2002 the SourceForge + * Privoxy team. http://www.privoxy.org/ + * + * Based on the Internet Junkbuster originally written + * by and Copyright (C) 1997 Anonymous Coders and + * Junkbusters Corporation. http://www.junkbusters.com + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will + * be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * The GNU General Public License should be included with + * this file. If not, you can view it at + * http://www.gnu.org/copyleft/gpl.html + * or write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *********************************************************************/ + + +------------------------------------------------------------------------------- + +To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C +compiler like gcc are required. + +When building from a source tarball (either release version or nightly CVS +tarball), first unpack the source: + + tar xzvf privoxy-0.0.0-beta-src* [.tgz or .tar.gz] + cd privoxy-0.0.0-beta + +For retrieving the current CVS sources, you'll need CVS installed. Note that +sources from CVS are development quality, and may not be stable, or well +tested. To download CVS source: + + cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login + cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current + cd current + +This will create a directory named current/, which will contain the source +tree. + +You can also check out any Privoxy "branch", just exchange the current name +with the wanted branch name (Example: v_3_0_branch for the 3.0 cvs tree). + +It is also strongly recommended to not run Privoxy as root, and instead it is +suggested to create a "privoxy" user and group for this purpose. See your local +documentation for the correct command line to do this. + +/etc/passwd might then look like: + + privoxy:*:7777:7777:privoxy proxy:/no/home:/no/shell + +And then /etc/group, like: + + privoxy:*:7777: + +Some binary packages may do this for you. + +Then, to build from either unpacked tarball or CVS source: + + autoheader + autoconf + ./configure # (--help to see options) + make # (the make from gnu, gmake for *BSD) + su + make -n install # (to see where all the files will go) + make -s install # (to really install, -s to silence output) + +If you have GNU make, you can have the first four steps automatically done for +you by just typing: + + make + +in the freshly downloaded or unpacked source directory. + +WARNING: If installing as root, the install will fail unless another user is +specified. configure accepts --with-user and --with-group options for setting +user and group ownership of the configuration files (which need to be writable +by the daemon). The specified user must already exist. Or if there is already a +privoxy user on the system, and no user was specified during configure, make +install then will use the privoxy user. When starting Privoxy, it should be run +as this same user that owns the configuration and log files. + +Alternately, you can specify user and group on the make command line, but be +sure both already exist: + + make -s install USER=privoxy GROUP=privoxy + +If no group is specified, the install will assume a group exists with the same +name as the specified user. + +The default installation path for make install is /usr/local. This may of +course be customized with the various ./configure path options. If you are +doing a root install to anywhere else besides /usr/local, be sure to set the +appropriate paths with the correct configure options (./configure --help). + +If you do install to /usr/local, the install will use sysconfdir=$prefix/etc/ +privoxy by default. All other destinations, and the direct usage of +--sysconfdir flag behave like normal, i.e. will not add the extra privoxy +directory. This is for a safer install, as there may already exist another +program that uses a file with the "config" name, and thus makes /usr/local/etc +cleaner. + +If installing to /usr/local, the docs will go by default to $prefix/share/doc. +But if this directory doesn't exist, it will then try $prefix/doc and install +there before creating a new $prefix/share/doc just for Privoxy. + +Again, if the installs goes to /usr/local, the localstatedir (ie: var/) will +default to /var instead of $prefix/var so the logs will go to /var/log/privoxy +/, and the pid file will be created in /var/run/privoxy.pid. + +make install will attempt to set the correct values in config (main +configuration file). You may want to check this to make sure all values are +correct. If appropriate, an init script will be installed, but it is up to the +user to determine how and where to start Privoxy. The init script should be +checked for correct paths and values, if anything other than a default install +is done. + +If install finds previous versions of any configuration files, these will not +be overwritten, and the new ones will be installed with a "new" extension. You +will then need to manually update the installed configuration files as needed. +All template files will be overwritten. If you have customized, local +templates, you should save these first. If a previous version of Privoxy is +already running, you will have to restart it manually. + +For more detailed instructions on how to build Redhat and SuSE RPMs, Windows +self-extracting installers, building on platforms with special requirements +etc, please consult the developer manual. + +For binary RPM installation, and other platforms, see the User Manual as well. + +The simplest command line to start Privoxy is $path/privoxy --user=privoxy +$path/etc/privoxy/config. See privoxy --usage, or the man page, for other +options, and configuration. + diff --git a/Makefile b/Makefile index 14d71823..6038323a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 2002/04/11 12:51:34 oes Exp $ +# $Id: Makefile,v 1.5.2.1 2002/08/05 17:46:13 oes Exp $ # # Written by and Copyright (C) 2001 the SourceForge # Privoxy team. http://www.privoxy.org/ @@ -26,6 +26,9 @@ # Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # $Log: Makefile,v $ +# Revision 1.5.2.1 2002/08/05 17:46:13 oes +# Change make to gmake to fix auto-build on Solaris +# # Revision 1.5 2002/04/11 12:51:34 oes # Bugfix # @@ -45,13 +48,28 @@ ############################################################################# +GNU_MAKE_CMD = gmake +MAKE_CMD = make + error: @if [ -f GNUmakefile ]; then \ echo "***"; \ echo "*** You are not using the GNU version of Make - maybe it's called gmake"; \ - echo "*** or it's in a different directory?"; \ + echo "*** or it's in a different PATH? Please read INSTALL." ; \ echo "***"; \ exit 1; \ + elif test -n "$(HOST_ARCH)" && test -z "$(MAKE_VERSION)" ; then \ + echo "***"; \ + echo "*** You are not using GNU Make on Solaris, please make sure you do" ; \ + echo "*** and re-run 'make' "; \ + echo "***"; \ + exit 1 ; \ + elif test -n "$(MACHINE_ARCH)" && test -z "$(MAKE_VERSION)" ; then \ + echo "***"; \ + echo "*** You are not using GNU Make on FreeBSD, please make sure you do" ; \ + echo "*** and re-run 'make' "; \ + echo "***"; \ + exit 1 ; \ else \ echo "***"; \ echo "*** To build this program, you must run"; \ @@ -59,8 +77,17 @@ error: echo "***"; \ echo -n "*** Shall I do this for you now? (y/n) "; \ read answer; \ - if [ $$answer = "y" ]; then \ - autoheader && autoconf && ./configure && gmake; \ + if [ "$$answer" = "y" ]; then \ + autoheader && autoconf && ./configure || exit 1; \ + if $(GNU_MAKE_CMD) -v |grep GNU >/dev/null 2>/dev/null; then \ + $(GNU_MAKE_CMD) ;\ + elif $(MAKE_CMD) -v |grep GNU >/dev/null 2>/dev/null; then \ + $(MAKE_CMD) ;\ + else \ + echo "Neither 'make' nor 'gmake' are GNU compatible!" ; \ + echo "Please read INSTALL." ; \ + exit 1 ; \ + fi ;\ fi; \ fi diff --git a/README b/README index 61f35394..83bcd742 100644 --- a/README +++ b/README @@ -31,11 +31,20 @@ * *********************************************************************/ -This README is included with Privoxy 3.0.0. See http://www.privoxy.org/ for -more information. The current code level is stable. ------------------------------------------------------------------------------- + ********************************************************** + + NOTE: This is a pre-release version of Privoxy from the "stable" CVS branch. + It is being readied for the next stable release -- 3.0.1 which could happen + "soon". While this tree is in a transition state, the version will be + intentionally stamped as "0.0.0" so as to make it clear that this code is not + yet ready for release. If you try this code, and find problems which seem to + be bugs, please report it to the developers list. + + ********************************************************** + Privoxy is a web proxy with advanced filtering capabilities for protecting privacy, filtering web page content, managing cookies, controlling access, and removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a @@ -67,56 +76,8 @@ change your browser if upgrading!!! And maybe firewall, etc. 2. INSTALL -To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C -compiler like gcc are required. - -When building from a source tarball (either release version or nightly CVS -tarball), first unpack the source: - - tar xzvf privoxy-3.0.0-src* [.tgz or .tar.gz] - cd privoxy-3.0.0 - -For retrieving the current CVS sources, you'll need CVS installed. Note that -sources from CVS are development quality, and may not be stable, or well -tested. To download CVS source: - - cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login - cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current - cd current - -This will create a directory named current/, which will contain the source -tree. - -Then, in either case, to build from unpacked tarball or CVS source: - - autoheader - autoconf - ./configure # (--help to see options) - make # (the make from gnu, gmake for *BSD) - su - make -n install # (to see where all the files will go) - make install # (to really install) - -+-----------------------------------------------------------------------------+ -| Warning | -|-----------------------------------------------------------------------------| -|The "make install" target is temporary quite broken! It is recommended to use| -|a binary package, or do a source build, and manually install the components. | -|Sorry. | -+-----------------------------------------------------------------------------+ - -If you have gnu make, you can have the first four steps automatically done for -you by just typing: - - make - -in the freshly downloaded or unpacked source directory. - -For more detailed instructions on how to build Redhat and SuSE RPMs, Windows -self-extracting installers, building on platforms with special requirements -etc, please consult the developer manual. - -For binary RPM installation, and other platforms, see the user-manual as well. +See the INSTALL file in this directory, for installing from source, and the +User Manual, for other installation types. ------------------------------------------------------------------------------- @@ -159,16 +120,22 @@ with FTP or other protocols for the simple reason it does not work. The actions list can be configured via the web interface accessed via http:// p.p/, as well other options. +All configuration files are subject to unannounced changes during the +development process. + ------------------------------------------------------------------------------- 5. DOCUMENTATION -There should be documentation in the 'doc' subdirectory. In particular, see the -User Manual there, the FAQ, and those interested in Privoxy development, should -look at developer-manual. +There should be documentation in the 'doc' subdirectory, but it is not +completed at this point. In particular, see the User Manual there, the FAQ, and +those interested in Privoxy development, should look at developer-manual. -The source and configuration files are all well commented. The main -configuration files are: 'config', 'default.action', and 'default.filter'. +The most up to date source of information on the current development version, +may still be either comments in the source code, or the included configuration +files. The source and configuration files are all well commented. The main +configuration files are: 'config', 'default.action', and 'default.filter' in +the toplevel source directory. Included documentation may vary according to platform and packager. All documentation is posted on http://www.privoxy.org, in case you don't have it, diff --git a/configure.in b/configure.in index 29794b19..368d1ba3 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl $Id: configure.in,v 1.68.2.5 2002/08/25 23:37:00 hal9 Exp $ +dnl $Id: configure.in,v 1.68.2.6 2002/09/25 15:35:15 oes Exp $ dnl dnl Written by and Copyright (C) 2001, 2002 the SourceForge dnl Privoxy team. http://www.privoxy.org/ @@ -28,6 +28,9 @@ dnl or write to the Free Software Foundation, Inc., 59 dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl dnl $Log: configure.in,v $ +dnl Revision 1.68.2.6 2002/09/25 15:35:15 oes +dnl Marking as non-release +dnl dnl Revision 1.68.2.5 2002/08/25 23:37:00 hal9 dnl Getting ready for 3.0 release. dnl @@ -387,14 +390,14 @@ dnl ================================================================= dnl AutoConf Initialization dnl ================================================================= -AC_REVISION($Revision: 1.68.2.5 $) +AC_REVISION($Revision: 1.68.2.6 $) AC_INIT(jcc.c) if test ! -f config.h.in; then echo "You need to run autoheader first. " echo -n "Shall I do this for you now? (y/n) " read answer - if test $answer != "y"; then + if test "$answer" != "y"; then exit 1 else autoheader @@ -464,8 +467,13 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_PROG_AWK AC_CHECK_PROG(GDB,gdb,yes,no) +AC_PATH_PROG(BGROUPS,groups,no,/bin:/usr/bin:/usr/local/bin) +AC_PATH_PROG(ID,id,no,/bin:/usr/bin:/usr/local/bin) +AC_SUBST(ID) +AC_SUBST(BGROUPS) dnl ================================================================= dnl debug, gcc and gdb support @@ -500,35 +508,82 @@ AC_ARG_WITH(debug, ] ) +dnl ================================================================= +dnl Check for user and group validity +dnl ================================================================= + +$ID privoxy >/dev/null 2>/dev/null +if test $? -ne 0 ; then + AC_MSG_WARN(There is no user 'privoxy' on this system) +fi +AC_MSG_CHECKING([for user]) AC_ARG_WITH(user, - [ --with-user=privoxy Set user under which privoxy run], + [ --with-user=privoxy Set user under which privoxy will run], [ if test "x$withval" != "xyes"; then - USER=$with_user; + if test $ID = no ; then + AC_MSG_ERROR(There is no 'id' program on this system) + else + AC_MSG_RESULT($with_user) + $ID $with_user 2>/dev/null >/dev/null + if test $? -eq 0 ; then + USER=$with_user; + else + AC_MSG_ERROR(There is no user '$with_user' on this system) + fi + fi else AC_MSG_ERROR(We need a user if you give me this parameter) fi ], [ - USER=privoxy; + if test $ID = no ; then + AC_MSG_ERROR(There is no 'id' programm on this system) + else + AC_MSG_RESULT(none specified) + USER=$with_user + fi ] ) AC_SUBST(USER) +AC_MSG_CHECKING([for group]) AC_ARG_WITH(group, [ --with-group=privoxy Set group for privoxy], - [ + [ if test "x$withval" != "xyes"; then - GROUP=$with_group; + if test $BGROUPS = no ; then + AC_MSG_ERROR(There is no 'groups' program on this system) else + AC_MSG_RESULT($with_group) + $BGROUPS $USER >/dev/null + if test $? -eq 0 ; then + # FIXME: this fails if valid group, but not first group + # listed. + if test "$with_group" != "`$BGROUPS $USER | sed 's/.*: //' 2>/dev/null |$AWK '{print $1}'`" ; then + AC_MSG_ERROR(The given value '$withval' does not match group entry) + else + GROUP=$with_group; + fi + else + AC_MSG_ERROR(There is no group entry for user '$USER') + fi + fi + else AC_MSG_ERROR(We need a group if you give me this parameter) fi ], [ - GROUP=privoxy; + if test $BGROUPS = no ; then + AC_MSG_ERROR(There is no 'groups' programm on this system) + else + AC_MSG_RESULT(none specified) + GROUP=$with_group; + fi ] ) AC_SUBST(GROUP) + dnl ================================================================= dnl additional gcc flags dnl ================================================================= @@ -607,7 +662,7 @@ dnl Checking which text html browser we have avaliable if test $dodk != no; then AC_CHECK_PROGS(WDUMP,w3m lynx links,false) if test "$WDUMP" = false; then - AC_MSG_ERROR(You need some kind of text browser to continue \(w3m, lynx and links are supported\)) + AC_MSG_WARN(You need some kind of text browser to build documentation \(w3m, lynx and links are supported\)) fi if test $DB2HTML = false; then dnl We need to clean the variable, otherwise AC_CHECK_PROGS @@ -650,7 +705,9 @@ JADECAT="" if test $dodk = yes; then if test $DKPREFIX = none; then for i in /usr/share/sgml/docbook/dsssl-stylesheets /usr/share/sgml/docbkdsl /usr/share/sgml/docbook-dsssl; do - echo -n "checking for $i/html/docbook.dsl..." +dnl echo -n does not fly with /bin/sh. +dnl echo -n "checking for $i/html/docbook.dsl..." + AC_MSG_CHECKING([for $i]) if test -f $i/html/docbook.dsl; then echo "yes" DKPREFIX=$i @@ -661,7 +718,8 @@ if test $dodk = yes; then done # where are the catalogs? for i in /usr/share/sgml/CATALOG.docbk30 /usr/share/sgml/CATALOG.docbk31; do - echo -n "checking for $i..." +dnl echo -n "checking for $i..." + AC_MSG_CHECKING([for $i]) if test -f $i; then echo "yes" JADECAT="$JADECAT -c $i" diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100644 index 00000000..2b45406c --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.3 2002/10/12 05:25:18 hal9 Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here -- 2.49.0