--- /dev/null
+--- squidGuard-1.6.orig/Makefile.in 2020-01-09 18:36:44.000000000 +0000
++++ squidGuard-1.6/Makefile.in 2020-01-10 13:02:14.000000000 +0000
+@@ -43,7 +43,7 @@
+ # Dependencies for installing
+ #
+
+-install: install-build install-conf
++install: install-build
+
+ install-conf:
+ @echo Installing configuration file ;
+--- squidGuard-1.6.orig/src/Makefile.in 2020-01-03 12:05:39.000000000 +0000
++++ squidGuard-1.6/src/Makefile.in 2020-01-10 13:02:14.000000000 +0000
+@@ -110,6 +110,8 @@
+ mv -f y.tab.c y.tab.c.bison
+ mv -f y.tab.h y.tab.h.bison
+
++sg.y sg.l:
++
+ #
+ # Dependencies for installing
+ #
+@@ -122,8 +124,8 @@
+
+ install.bin:: squidGuard
+ @echo making $@ in `basename \`pwd\``
+- @$(MKDIR) $(bindir) $(logdir) $(cfgdir)
+- $(INSTALL_PROGRAM) squidGuard $(bindir)/squidGuard
++ @$(MKDIR) "$(DESTDIR)"/$(bindir) "$(DESTDIR)"/$(logdir) "$(DESTDIR)"/$(cfgdir)
++ $(INSTALL_PROGRAM) squidGuard "$(DESTDIR)"/$(bindir)/squidGuard
+
+ uninstall.bin::
+ @echo making $@ in `basename \`pwd\``
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools db-use user
+
+DESCRIPTION="Combined filter, redirector and access controller plugin for Squid"
+HOMEPAGE="http://www.squidguard.org"
+SRC_URI="mirror://debian/pool/main/s/squidguard/${PN}_${PV}.orig.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="ldap"
+
+RDEPEND="|| (
+ sys-libs/db:5.3
+ sys-libs/db:4.8
+ )
+ ldap? ( net-nds/openldap:0 )"
+
+DEPEND="${RDEPEND}
+ sys-devel/bison:0
+ sys-devel/flex:0"
+
+suitable_db_version() {
+ local tested_slots="5.3 4.8"
+ for ver in ${tested_slots}; do
+ if [[ -n $(db_findver sys-libs/db:${ver}) ]]; then
+ echo ${ver}
+ return 0
+ fi
+ done
+ die "No suitable BerkDB versions found, aborting"
+}
+
+pkg_setup() {
+ enewgroup squid
+ enewuser squid -1 -1 /var/cache/squid squid
+}
+
+src_prepare() {
+ eapply \
+ "${FILESDIR}/${P}-gentoo.patch"
+
+ # Link only with specific BerkDB versions
+ db_version="$(suitable_db_version)"
+ sed -i -e "/\$LIBS -ldb/s/-ldb/-l$(db_libname ${db_version})/" configure.ac || die
+
+ eapply_user
+ eautoreconf
+ # eautomake does not work because of borked source code of squidguard buildsystem
+ # only needed to create install-sh and other missing stuff
+ automake --no-force --add-missing --copy
+}
+
+src_configure() {
+ econf \
+ $(use_with ldap) \
+ --with-db-inc="$(db_includedir ${db_version})" \
+ --with-sg-config=/etc/squidGuard/squidGuard.conf \
+ --with-sg-logdir=/var/log/squidGuard
+}
+
+src_install() {
+ emake prefix="/usr" DESTDIR="${D}" install
+
+ keepdir /var/log/squidGuard
+ fowners squid:squid /var/log/squidGuard
+
+ insinto /etc/squidGuard/sample
+ doins "${FILESDIR}"/squidGuard.conf.*
+ insinto /etc/squidGuard/sample/db
+ doins "${FILESDIR}"/blockedsites
+
+ dodoc ANNOUNCE CHANGELOG README
+ docinto html
+ dodoc doc/*.html
+ docinto text
+ dodoc doc/*.txt
+}
+
+pkg_postinst() {
+ einfo "To enable squidGuard, add the following lines to /etc/squid/squid.conf:"
+ einfo " url_rewrite_program /usr/bin/squidGuard"
+ einfo " url_rewrite_children 10"
+ einfo ""
+ einfo "Remember to edit /etc/squidGuard/squidGuard.conf first!"
+ einfo "Examples can be found in /etc/squidGuard/sample/"
+}