commit:     d62dd665656426d5e0e21d55da493db14559c61f
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Thu Jan 16 14:36:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 10 09:24:00 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d62dd665

net-proxy/squidguard: update EAPI 7 -> 8, fix implicit defines in configure

Nothing defined HAVE_STDLIB_H, so configure test failed, so wrong version of
BerkleyDB was chosen, so compilation failed.
Also included extended patch of stdlib.h in configure from the bug tracker,
with all attribution.

Closes: https://bugs.gentoo.org/898084
Bug: https://bugs.gentoo.org/932312
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40160
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../squidguard/files/squidguard-1.6.0-C23.patch    |  37 ++++++++
 .../squidguard/files/squidguard-1.6.0-stdlib.patch |  40 +++++++-
 net-proxy/squidguard/squidguard-1.6.0-r2.ebuild    | 104 +++++++++++++++++++++
 3 files changed, 177 insertions(+), 4 deletions(-)

diff --git a/net-proxy/squidguard/files/squidguard-1.6.0-C23.patch 
b/net-proxy/squidguard/files/squidguard-1.6.0-C23.patch
new file mode 100644
index 000000000000..23121819391b
--- /dev/null
+++ b/net-proxy/squidguard/files/squidguard-1.6.0-C23.patch
@@ -0,0 +1,37 @@
+https://bugs.gentoo.org/898084
+https://bugs.gentoo.org/932312
+nothing defined HAVE_STDLIB_H to permit inclusion of stdlib.h,
+which caused failures to find correct version of db
+also fill the function definitions for C23
+--- a/configure.ac
++++ b/configure.ac
+@@ -5,6 +5,9 @@
+ AC_INIT(src/main.c.in)
+ AC_CONFIG_HEADER(src/config.h)
+ 
++AC_INCLUDES_DEFAULT
++AC_USE_SYSTEM_EXTENSIONS
++
+ dnl
+ dnl Checks for programs.
+ dnl
+--- a/src/sg.h.in
++++ b/src/sg.h.in
+@@ -360,7 +360,7 @@
+ void   sgEmergency __P(());
+ void   sgReloadConfig __P(());
+ void   sgHandlerSigHUP __P((int));
+-void   sgAlarm __P(());
++void   sgAlarm __P((int signal));
+ int    sgStrRcmp __P((char *, char *));
+ int    sgStrRncmp __P((char *, char *, int));
+ int    sgDomStrRncmp __P((char *, char *, int));
+@@ -431,7 +431,7 @@
+ int    sgRegExpMatch __P((struct sgRegExp *, char *));
+ char   *sgRegExpSubst __P((struct sgRegExp *, char *));
+ 
+-void   sgDbInit __P(());
++void   sgDbInit __P((struct sgDb *Db, char *file));
+ void   sgDbLoadTextFile __P((struct sgDb *, char *, int));
+ void   sgDbUpdate __P((struct sgDb *, char *, char *, size_t));
+ 

diff --git a/net-proxy/squidguard/files/squidguard-1.6.0-stdlib.patch 
b/net-proxy/squidguard/files/squidguard-1.6.0-stdlib.patch
index 51489b32de5e..f36a094edfe6 100644
--- a/net-proxy/squidguard/files/squidguard-1.6.0-stdlib.patch
+++ b/net-proxy/squidguard/files/squidguard-1.6.0-stdlib.patch
@@ -1,6 +1,18 @@
---- a/configure.ac     2022-12-15 10:33:13.845801113 +0300
-+++ b/configure.ac     2022-12-15 10:33:39.828949903 +0300
-@@ -342,6 +342,9 @@
+https://bugs.gentoo.org/919449
+patch by joergd <[email protected]>
+--- a/configure.ac     2019-02-02 18:00:40.000000000 +0100
++++ b/configure.ac     2025-01-13 12:13:48.087653985 +0100
+@@ -233,6 +233,9 @@
+     AC_DEFINE(HAVE_LIBLDAP, 1, [Define if LDAP support should be compiled])
+     AC_RUN_IFELSE([AC_LANG_SOURCE([[
+         #include <ldap.h>
++        #ifdef HAVE_STDLIB_H
++            #include <stdlib.h>
++        #endif
+         int main()
+         {
+            LDAP *p;
+@@ -342,6 +345,9 @@
  LIBS="$LIBS -ldb"
  AC_RUN_IFELSE([AC_LANG_SOURCE([[
      #include <db.h>
@@ -10,7 +22,27 @@
      int main() 
      {
          int major, minor, patch;
-@@ -377,6 +378,9 @@
+@@ -377,6 +383,9 @@
+ 
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+     #include <db.h>
++    #ifdef HAVE_STDLIB_H
++        #include <stdlib.h>
++    #endif
+     int main() 
+     {
+         int major, minor, patch;
+@@ -413,6 +422,9 @@
+ 
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+     #include <db.h>
++    #ifdef HAVE_STDLIB_H
++        #include <stdlib.h>
++    #endif
+     int main() 
+     {
+         int major, minor, patch;
+@@ -441,6 +453,9 @@
  
  AC_RUN_IFELSE([AC_LANG_SOURCE([[
      #include <db.h>

diff --git a/net-proxy/squidguard/squidguard-1.6.0-r2.ebuild 
b/net-proxy/squidguard/squidguard-1.6.0-r2.ebuild
new file mode 100644
index 000000000000..c922848a5b42
--- /dev/null
+++ b/net-proxy/squidguard/squidguard-1.6.0-r2.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools db-use
+
+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="
+       acct-group/squid
+       acct-user/squid
+       || (
+               sys-libs/db:5.3
+               sys-libs/db:4.8
+       )
+       ldap? ( net-nds/openldap:= )"
+
+DEPEND="${RDEPEND}"
+
+BDEPEND="
+       app-alternatives/yacc:0
+       app-alternatives/lex: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"
+}
+
+PATCHES=(
+       "${FILESDIR}/${P}-gentoo.patch"
+       "${FILESDIR}/${P}-gcc-10.patch"
+       "${FILESDIR}/${P}-stdlib.patch"
+       "${FILESDIR}/${P}-C23.patch"
+)
+
+src_prepare() {
+       default
+
+       # Link only with specific BerkDB versions
+       # Do not inject default paths for library searching
+       db_version="$(suitable_db_version)"
+       sed -i \
+               -e "/\$LIBS -ldb/s/-ldb/-l$(db_libname ${db_version})/" \
+               -e '/$LDFLAGS $db_lib $ldap_lib/d' \
+               configure.ac || die
+
+       eautoreconf
+
+       # Workaround for missing install-sh, bug #705374
+       local amver=$(best_version dev-build/automake)
+       amver=$(ver_cut 1-2 "${amver#dev-build/automake-}")
+       cp -p "${BROOT}/usr/share/automake-${amver}/install-sh" . || die
+}
+
+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/"
+}

Reply via email to