What is wrong with my lfs file for Privoxy?

Hello,
I am still somewhat inexperienced with creating new packages. I would like to integrate PRIVOXY (https://www.privoxy.org) my IPFIRE firewall. To do this, I have successfully set up the build environment:

However, I am having some problems with the lfs file I created.
I get the following message when executing:

./make.sh downloadsrc

ERROR: Failed to download or verify some packages: privoxy [ FAIL ]
Check /home/xyz_user/ipfire-2.x/log_x86_64/_build.preparation.log for errors if applicable

The log file “_build.preparation.log” then shows:

Feb 24 09:34:50: Building privoxy make: Entering directory ‘/home/xyz_user/ipfire-2.x/lfs’
privoxy:76: *** missing separator. Stop.

What is wrong with my lfs file for Privoxy?

###############################################################################
#                                                                             #
# IPFire.org - A linux based firewall                                         #
# Copyright (C) 2023  IPFire Team  <info@ipfire.org>                          #
#                                                                             #
# 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 3 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.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

SUMMARY    = Privacy enhancing proxy

VER        = 4.1.0

THISAPP    = privoxy-$(VER)
DL_FILE    = privoxy-$(VER)-stable-src.tar.gz
DL_FROM    = https://www.privoxy.org/sf-download-mirror/Sources/$(VER)%20%28stable%29	
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(THISAPP)

PROG       = privoxy
PAK_VER    = 1

DEPS       = pcre zlib

SERVICES   = privoxy

###############################################################################
# Top-level Rules
###############################################################################

objects = $(DL_FILE)

$(DL_FILE) = $(DL_FROM)/$(DL_FILE)

$(DL_FILE)_BLAKE2 = a6467b905845285808b5f19386de3ea9bf389190a6bfc7a2b06378f4a49825ed9dbc50b8f2fe1ba0efbeb3fdf5f443b626280fddcdb861bcfb0e5d383a00d5b1

install : $(TARGET)

check : $(patsubst %,$(DIR_CHK)/%,$(objects))

download :$(patsubst %,$(DIR_DL)/%,$(objects))

b2 : $(subst %,%_BLAKE2,$(objects))

dist:
	@$(PAK)

###############################################################################
# Downloading, checking, b2sum
###############################################################################

$(patsubst %,$(DIR_CHK)/%,$(objects)) :
	@$(CHECK)

$(patsubst %,$(DIR_DL)/%,$(objects)) :
	@$(LOAD)

$(subst %,%_BLAKE2,$(objects)) :
	@$(B2SUM)

###############################################################################
# Installation Details
###############################################################################

$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
    @$(PREBUILD)
    @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
    groupadd -g 5555 privoxy  # GID 5555 ist ein Beispiel; passe an IPFire-Standards an (z. B. check /etc/group)
    useradd -u 5555 -g privoxy -s /bin/false -d /var/run/privoxy privoxy  # UID 5555; no shell, home in /var/run
    cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/etc --enable-compression --enable-zstd --enable-pcre-host-patterns --with-user=privoxy --with-group=privoxy
    cd $(DIR_APP) && make $(MAKETUNING)
    cd $(DIR_APP) && make install DESTDIR=$(DIR_DEST) USER=privoxy GROUP=privoxy
    @rm -rf $(DIR_APP)
    @mkdir -p $(DIR_DEST)/etc/init.d $(DIR_DEST)/var/run/privoxy $(DIR_DEST)/var/log/privoxy
    @cat << EOF > $(DIR_DEST)/etc/init.d/privoxy
#!/bin/sh
# Init-Skript für Privoxy
case "\$1" in
    start)
        mkdir -p /var/run/privoxy /var/log/privoxy
        chown privoxy:privoxy /var/run/privoxy /var/log/privoxy /etc/privoxy
        runuser -u privoxy -g privoxy -- /usr/sbin/privoxy --no-daemon /etc/privoxy/config &
        ;;
    stop) killall privoxy ;;
    restart) \$0 stop; \$0 start ;;
esac
EOF
    @chmod +x $(DIR_DEST)/etc/init.d/privoxy
    @if [ ! -f $(DIR_DEST)/etc/privoxy/config ]; then
        cat << EOF > $(DIR_DEST)/etc/privoxy/config
confdir /etc/privoxy
logdir /var/log/privoxy
listen-address 127.0.0.1:8118
toggle 1
enable-remote-toggle 0
enable-remote-http-toggle 0
enable-edit-actions 0
enforce-blocks 0
buffer-limit 4096
forwarded-connect-retries 0
accept-intercepted-requests 0
allow-cgi-request-crunching 0
split-large-forms 0
keep-alive-timeout 5
socket-timeout 300
EOF
    fi
    chown -R privoxy:privoxy $(DIR_DEST)/etc/privoxy $(DIR_DEST)/var/log/privoxy $(DIR_DEST)/var/run/privoxy

Best regards,
Rico

Hi,

“Build finished” in 1:02:03!? WOW! I’m envious… :wink:

‘privoxy’ should be no problem, its running here since a few years.

First, you’ll need to copy the ‘privoxy’ source tarball in the ‘cache’ directory of your build environment. That would be the easiest way.

The “missing seperator” often means that you need a leading tab (e.g.) in line 76 of your lfs file. I attached mine, just take a look. Please note: you’ll need ‘brotli’ for this version. If you’re interested, just drop me a note

lfs_privoxy.zip (1.8 KB)

.

HTH

Matthias

1 Like

Hi,

prior of writing my first answer, I should have read your lfs file first, I’ll just have to make up for that now.

Starting around line 92, your lfs file contains parts of the init skript and parts of the config file for privoxy. You can’t put these lines in a lfs file.

If you want to build ‘privoxy’ as a package, you should place various program components in specific directories of the build environment. E.g., this should be the privoxy ‘config’ for configs or language files and the ‘src/paks’-directory for install/uninstall and update skripts. Read my lfs file and you’ll get the idea. :wink:

HTH

Matthias

2 Likes

Hi,

I sorted my files - they’re here if you want to take a look…

HTH

Matthias

2 Likes

This is a bash error related to a syntax error in the lfs.

The lines should start at either column zero or if indented then the indent must be done via a tab and not by spaces.

I suspect that you have used spaces for the indent on one or more of the lines after the line starting $(TARGET) but you will need to check that all lines that are indented have been done via a tab(s) and not by spaces. These are not allowed in makefiles and the LFS files are makefiles.

EDIT:
I realised I could just check the lines in the lfs that you posted and all of those lines I showed above are using spaces instead of a tab for the indent.

If you look at this section

you will see that the @$(CHECK), @$(LOAD) and @$(B@SUM) lines are all indented with tabs and not spaces and that is how they should be.

2 Likes

Thank you both very much for your quick help. Matthias’ lfs (thanks for the files) works, unlike mine :wink:
I have customized ./configure to suit my needs and Privoxy is also compiling. I just need to adjust the paths and install files. I have also removed the blanks from my lfs, but the problem remains. I will use Matthias’ lfs as a basis. That saves time. I also need to familiarize myself with all the scripts and the script concept of IPFIRE. I wish Privoxy were already included as an add-on. It is very useful. I will continue working on it over the next few days.

:thinking: You can check whether there is an end-of-line character problem.

Regards

2 Likes

A brief interim report. I almost despaired. It is important to always run “sudo ./make.sh clean” after making changes to the lfs files. Always! I neglected to do this because I thought the other packages didn’t matter at first and were working fine. I initially built without brotli because I don’t need it at the moment. Further testing and adjustments are still pending.

Best regards,
Rico

Hi,

don’t bother - starting from scratch isn’t always necessary, it really depends. There are a few tricks you can use.
If it is a ‘harmless’ program component (e.g., nano), it may be sufficient to delete the respective log file in the log directory (e.g., ‘log_x86_64’) before the next run.
Then only this particular component will be recompiled during the next run - because its log file is missing… This helps if you want to know if perhaps there is an error in your lfs file.
In the case of ‘privoxy’, a temporary user group and a user are created during compilation so that the correct permissions are available and can be created from the outset.. This is a bit more complicated. So only if there are some bigger changes, it may be advisable to start from scratch using ./make.sh clean (jm2c).

HTH

Matthias (Deepl Translate helped me a bit…)

I understand. Thank you very much. One more question: The entry for the privoxy parent proxy comes to: /var/ipfire/proxy/advanced/acls/inklude.acl. ?

Hi,

I never used ‘include.acl’ for this, I patched ‘squid.cgi’ accordingly.

I added a ‘privoxy’ checkbox:

squid-cgi-privoxy

This was done with:

if ( -e "/usr/sbin/privoxy" ) {
	print "<td class='base'><a href='http://config.privoxy.org/show-status' target='_blank'><b>".$Lang::tr{'advproxy privoxy'}."</a></b><br />";
	print $Lang::tr{'advproxy enabled'}.":&nbsp;&nbsp;<input type='checkbox' name='ENABLE_PRIVOXY' ".$checked{'ENABLE_PRIVOXY'}{'on'}." /><br />";
	print "</td>";
} else {
	print "<td></td>";
}
```

And at last some code to add ‘privoxy’ to ‘squid.conf’:

	if ($proxysettings{'ENABLE_PRIVOXY'} eq 'on')
	{
		print FILE "cache_peer 127.0.0.1 parent 8118 0 name=privoxy no-query no-digest no-netdb-exchange default\n";
		print FILE "never_direct allow all\n";
	}

You can see all of my changes in my new ‘proxy.cgi’ and in the corresponding files here.

Matthias

1 Like

Elegant.

Merci =)

Rico