Actually Build Squid 6
In order to get Squid 6 on Ubuntu 22.04 LTS we will use the original version from Debian Unstable Repository. Run script 03_build_squid.sh
to do the compilation.
#!/bin/bash
if [[ $EUID -eq 0 ]]; then
echo "This script must NOT be run as root" 1>&2
exit 1
fi
# drop squid build folder
rm -R build/squid
# we will be working in a subfolder make it
mkdir -p build/squid
# set squid version
source squid.ver
# copy the patches to working directory
# cp control.patch build/squid/
cp BoolOps.cc.patch build/squid/
# decend into working directory
pushd build/squid
# get squid from debian experimental
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_PKG}.dsc
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_VER}.orig.tar.xz
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_VER}.orig.tar.xz.asc
wget http://http.debian.net/debian/pool/main/s/squid/squid_${SQUID_PKG}.debian.tar.xz
# unpack the source package
dpkg-source -x squid_${SQUID_PKG}.dsc
# patch the opts
# patch squid-${SQUID_VER}/debian/control < control.patch
patch squid-${SQUID_VER}/src/acl/BoolOps.cc < BoolOps.cc.patch
# build the package
cd squid-${SQUID_VER} && dpkg-buildpackage -rfakeroot -b -us -uc
# and revert
popd
squid.ver
file is just to easier manage Squid versions in script.
control.patch
is small patch file that allows sources of squid package from Debian 12 to be built on Ubuntu 22.04.
--- control.old 2022-10-12 10:24:13.396181441 +0000
+++ control 2022-10-12 10:24:35.228069617 +0000
@@ -13,7 +13,7 @@
# The compiler dependencies are relevant for backporting.
, g++ (>= 4.9) <!cross> | clang (>= 3.7) <!cross>
, gcc (>= 4.9) <!cross> | clang (>= 3.7) <!cross>
- , debhelper-compat (= 13)
+ , debhelper-compat (= 12)
, lsb-release
, dh-apparmor
, libcppunit-dev
BoolOps.cc.patch
is a patch file that changes some minor c++ code to allow compiling using gcc version present in Ubuntu 22.04.
--- BoolOps.cc 2023-07-06 05:15:40.000000000 +0000
+++ BoolOps.cc.new 2023-07-11 16:12:35.904802697 +0000
@@ -17,7 +17,7 @@
Acl::NotNode::NotNode(ACL *acl)
{
assert(acl);
- Must(strlen(acl->name) <= sizeof(name)-2);
+ //Must(strlen(acl->name) <= sizeof(name)-2);
name[0] = '!';
name[1] = '\0';
xstrncpy(&name[1], acl->name, sizeof(name)-1); // -1 for '!'
After build is successful, run script 04_install_squid.sh
to install Squid.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# set squid version
source squid.ver
# decend into working directory
pushd build/squid
# install squid packages
sudo apt-get install squid-langpack
dpkg --install squid-common_${SQUID_PKG}_all.deb
dpkg --install squid-openssl_${SQUID_PKG}_amd64.deb
dpkg --install squidclient_${SQUID_PKG}_amd64.deb
# and revert
popd
# verify the installed squid binary
systemctl stop squid && systemctl start squid && systemctl status squid && /usr/sbin/squid -v