From 8fe660e62b2e2858cd41d294e9ae418394d10092 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Sun, 27 Jul 2025 12:11:21 +0300
Subject: www-misc/hldig: several fixes

* update EAPI 7 -> 8
* add fixes for configure for gcc-14
* use relative symlinks

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 .../hldig-1.0.2-Fix-compile-tests-for-gcc-14.patch | 244 +++++++++++++++++++++
 www-misc/hldig/hldig-1.0.2-r1.ebuild               |  85 +++++++
 www-misc/hldig/hldig-1.0.2.ebuild                  |  81 -------
 3 files changed, 329 insertions(+), 81 deletions(-)
 create mode 100644 www-misc/hldig/files/hldig-1.0.2-Fix-compile-tests-for-gcc-14.patch
 create mode 100644 www-misc/hldig/hldig-1.0.2-r1.ebuild
 delete mode 100644 www-misc/hldig/hldig-1.0.2.ebuild

diff --git a/www-misc/hldig/files/hldig-1.0.2-Fix-compile-tests-for-gcc-14.patch b/www-misc/hldig/files/hldig-1.0.2-Fix-compile-tests-for-gcc-14.patch
new file mode 100644
index 00000000..f8d5a934
--- /dev/null
+++ b/www-misc/hldig/files/hldig-1.0.2-Fix-compile-tests-for-gcc-14.patch
@@ -0,0 +1,244 @@
+From 08acfff380b9c5e7449d1abeaea769aa5acafc4e Mon Sep 17 00:00:00 2001
+From: Alexander Golubev <fatzer2@gmail.com>
+Date: Sun, 27 Jul 2025 11:23:11 +0300
+Subject: [PATCH] Fix compile tests for gcc-14+
+
+Since gcc-14 -Wimplicit-function-declaration and -Wimplicit-int are
+treated as errors by default. This may cause some configuration-time
+tests to be false-negative unless fixed.
+---
+ db/acinclude.m4 | 78 ++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 55 insertions(+), 23 deletions(-)
+
+diff --git a/db/acinclude.m4 b/db/acinclude.m4
+index 4e3a5e33..166309f1 100644
+--- a/db/acinclude.m4
++++ b/db/acinclude.m4
+@@ -37,8 +37,9 @@ dnl we avoid answering lots of user questions, not to mention the bugs.
+ if test "$db_cv_mutex" = no; then
+ 
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <synch.h>
+-main(){
++int main(){
+ 	static lwp_mutex_t mi = SHAREDMUTEX;
+ 	static lwp_cond_t ci = SHAREDCV;
+ 	lwp_mutex_t mutex = mi;
+@@ -57,9 +58,10 @@ dnl Try with and without the -lthread library.
+ if test "$db_cv_mutex" = no; then
+ LIBS="-lthread $LIBS"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <thread.h>
+ #include <synch.h>
+-main(){
++int main(){
+ 	mutex_t mutex;
+ 	cond_t cond;
+ 	int type = USYNC_PROCESS;
+@@ -73,9 +75,10 @@ LIBS="$orig_libs"
+ fi
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <thread.h>
+ #include <synch.h>
+-main(){
++int main(){
+ 	mutex_t mutex;
+ 	cond_t cond;
+ 	int type = USYNC_PROCESS;
+@@ -92,8 +95,9 @@ dnl
+ dnl Try with and without the -lpthread library.
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <pthread.h>
+-main(){
++int main(){
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+ 	pthread_condattr_t condattr;
+@@ -116,8 +120,9 @@ fi
+ if test "$db_cv_mutex" = no; then
+ LIBS="-lpthread $LIBS"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <pthread.h>
+-main(){
++int main(){
+ 	pthread_cond_t cond;
+ 	pthread_mutex_t mutex;
+ 	pthread_condattr_t condattr;
+@@ -143,8 +148,9 @@ dnl msemaphore: HPPA only
+ dnl Try HPPA before general msem test, it needs special alignment.
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <sys/mman.h>
+-main(){
++int main(){
+ #if defined(__hppa)
+ 	typedef msemaphore tsl_t;
+ 	msemaphore x;
+@@ -161,9 +167,10 @@ fi
+ dnl msemaphore: OSF/1
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/mman.h>;
+-main(){
++int main(){
+ 	typedef msemaphore tsl_t;
+ 	msemaphore x;
+ 	msem_init(&x, 0);
+@@ -186,7 +193,8 @@ fi
+ dnl SCO: UnixWare has threads in libthread, but OpenServer doesn't.
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(__USLC__)
+ 	exit(0);
+ #endif
+@@ -233,7 +241,8 @@ fi
+ dnl Alpha/gcc: OSF/1
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(__alpha)
+ #if defined(__GNUC__)
+ exit(0);
+@@ -246,7 +255,8 @@ fi
+ dnl PaRisc/gcc: HP/UX
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(__hppa)
+ #if defined(__GNUC__)
+ exit(0);
+@@ -261,7 +271,8 @@ dnl The sparc/gcc code doesn't always work, specifically, I've seen assembler
+ dnl failures from the stbar instruction on SunOS 4.1.4/sun4c and gcc 2.7.2.2.
+ if test "$db_cv_mutex" = DOESNT_WORK; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(__sparc__)
+ #if defined(__GNUC__)
+ 	exit(0);
+@@ -274,7 +285,8 @@ fi
+ dnl 68K/gcc: SunOS
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if (defined(mc68020) || defined(sun3))
+ #if defined(__GNUC__)
+ 	exit(0);
+@@ -287,7 +299,8 @@ fi
+ dnl x86/gcc: FreeBSD, NetBSD, BSD/OS, Linux
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(i386)
+ #if defined(__GNUC__)
+ 	exit(0);
+@@ -300,7 +313,8 @@ fi
+ dnl: uts/cc: UTS
+ if test "$db_cv_mutex" = no; then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-main(){
++#include <stdlib.h>
++int main(){
+ #if defined(_UTS)
+ 	exit(0);
+ #endif
+@@ -533,7 +547,9 @@ AC_SUBST(u_int8_decl)
+ AC_CACHE_CHECK([for u_int8_t], db_cv_uint8, [dnl
+ AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
+ 	[db_cv_uint8=yes],
+-    AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){exit(sizeof(unsigned char) != 1);}]])],
++    AC_RUN_IFELSE([AC_LANG_SOURCE([[
++            #include <stdlib.h>
++            int main(){exit(sizeof(unsigned char) != 1);}]])],
+ 	    [db_cv_uint8="unsigned char"], [db_cv_uint8=no], [:]))])
+ if test "$db_cv_uint8" = no; then
+ 	AC_MSG_ERROR(No unsigned 8-bit integral type.)
+@@ -546,9 +562,13 @@ AC_SUBST(u_int16_decl)
+ AC_CACHE_CHECK([for u_int16_t], db_cv_uint16, [dnl
+ AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
+ 	[db_cv_uint16=yes],
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){exit(sizeof(unsigned short) != 2);}]])],
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++        #include <stdlib.h>
++        int main(){exit(sizeof(unsigned short) != 2);}]])],
+ 	[db_cv_uint16="unsigned short"],
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){exit(sizeof(unsigned int) != 2);}]])],
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++        #include <stdlib.h>
++        int main(){exit(sizeof(unsigned int) != 2);}]])],
+ 	[db_cv_uint16="unsigned int"], [db_cv_uint16=no], [:])))], [:])
+ if test "$db_cv_uint16" = no; then
+ 	AC_MSG_ERROR([No unsigned 16-bit integral type.])
+@@ -561,9 +581,13 @@ AC_SUBST(int16_decl)
+ AC_CACHE_CHECK([for int16_t], db_cv_int16, [dnl
+ AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
+ 	[db_cv_int16=yes],
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){exit(sizeof(short) != 2);}]])],
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++        #include <stdlib.h>
++        int main(){exit(sizeof(short) != 2);}]])],
+ 	[db_cv_int16="short"],
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[main(){exit(sizeof(int) != 2);}]])],
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++        #include <stdlib.h>
++        int main(){exit(sizeof(int) != 2);}]])],
+ 	[db_cv_int16="int"], [db_cv_int16=no], [:])))], [:])
+ if test "$db_cv_int16" = no; then
+ 	AC_MSG_ERROR([No signed 16-bit integral type.])
+@@ -576,9 +600,13 @@ AC_SUBST(u_int32_decl)
+ AC_CACHE_CHECK([for u_int32_t], db_cv_uint32, [dnl
+ AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
+ 	[db_cv_uint32=yes],
+-AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
++AC_TRY_RUN([
++    #include <stdlib.h>
++    int main(){exit(sizeof(unsigned int) != 4);}],
+ 	[db_cv_uint32="unsigned int"],
+-AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
++AC_TRY_RUN([
++    #include <stdlib.h>
++    int main(){exit(sizeof(unsigned long) != 4);}],
+ 	[db_cv_uint32="unsigned long"], [db_cv_uint32=no], [:])))], [:])
+ if test "$db_cv_uint32" = no; then
+ 	AC_MSG_ERROR([No unsigned 32-bit integral type.])
+@@ -591,9 +619,13 @@ AC_SUBST(int32_decl)
+ AC_CACHE_CHECK([for int32_t], db_cv_int32, [dnl
+ AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
+ 	[db_cv_int32=yes],
+-AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
++AC_TRY_RUN([
++    #include <stdlib.h>
++    int main(){exit(sizeof(int) != 4);}],
+ 	[db_cv_int32="int"],
+-AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
++AC_TRY_RUN([
++    #include <stdlib.h>
++    int main(){exit(sizeof(long) != 4);}],
+ 	[db_cv_int32="long"], [db_cv_int32=no], [:])))], [:])
+ if test "$db_cv_int32" = no; then
+ 	AC_MSG_ERROR([No signed 32-bit integral type.])
+-- 
+2.49.1
+
diff --git a/www-misc/hldig/hldig-1.0.2-r1.ebuild b/www-misc/hldig/hldig-1.0.2-r1.ebuild
new file mode 100644
index 00000000..0e8934a1
--- /dev/null
+++ b/www-misc/hldig/hldig-1.0.2-r1.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2025 Gentoo Authors
+# Copyright 2020-2025 The Trinity Desktop Project
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+inherit autotools flag-o-matic
+
+DESCRIPTION="HTTP/HTML indexing and searching system"
+HOMEPAGE="https://github.com/solbu/hldig"
+SRC_URI="https://github.com/solbu/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ppc ppc64 x86"
+IUSE="ssl"
+
+# Don't use Gentoo mirrors
+RESTRICT="mirror"
+
+DEPEND="
+	app-arch/unzip
+	sys-libs/zlib
+	ssl? ( dev-libs/openssl:= )
+"
+RDEPEND="${DEPEND}
+	!www-misc/htdig
+"
+
+HTML_DOCS=( docs/. )
+
+PATCHES=(
+	"${FILESDIR}/${P}-Fix-compile-tests-for-gcc-14.patch"
+)
+
+src_prepare() {
+	default
+	sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.ac db/configure.ac || die
+	eautoreconf
+}
+
+src_configure() {
+	append-cxxflags "-std=c++11"
+	local myeconfargs=(
+		--disable-static
+		--with-config-dir="${EPREFIX}"/etc/${PN}
+		--with-default-config-file="${EPREFIX}"/etc/${PN}/${PN}.conf
+		--with-database-dir="${EPREFIX}"/var/lib/${PN}/db
+		--with-cgi-bin-dir="${EPREFIX}"/var/www/localhost/cgi-bin
+		--with-search-dir="${EPREFIX}"/var/www/localhost/hldocs/${PN}
+		--with-image-dir="${EPREFIX}"/var/www/localhost/hldocs/${PN}
+		$(use_with ssl)
+	)
+	econf "${myeconfargs[@]}"
+}
+
+src_install () {
+	default
+	sed -i "s:${D}::g" \
+		"${ED}"/etc/${PN}/${PN}.conf \
+		"${ED}"/usr/bin/rundig \
+		|| die "sed failed (removing \${D} from installed files)"
+
+	keepdir "/var/lib/${PN}/db"
+
+	# Symlink hlsearch so it can be easily found.
+	dosym ../../var/www/localhost/cgi-bin/hlsearch /usr/bin/hlsearch
+
+	# Add symlinks for compatibility with applications using htdig
+	dosym ./hldb_dump /usr/bin/htdb_dump
+	dosym ./hldb_load /usr/bin/htdb_load
+	dosym ./hldb_stat /usr/bin/htdb_stat
+	dosym ./hldig /usr/bin/htdig
+	dosym ./hldump /usr/bin/htdump
+	dosym ./hlfuzzy /usr/bin/htfuzzy
+	dosym ./hlload /usr/bin/htload
+	dosym ./hlmerge /usr/bin/htmerge
+	dosym ./hlnotify /usr/bin/htnotify
+	dosym ./hlpurge /usr/bin/htpurge
+	dosym ./hlsearch /usr/bin/htsearch
+	dosym ./hlstat /usr/bin/htstat
+
+	# No static archives
+	find "${D}" -name '*.la' -delete || die
+}
diff --git a/www-misc/hldig/hldig-1.0.2.ebuild b/www-misc/hldig/hldig-1.0.2.ebuild
deleted file mode 100644
index 378ebc73..00000000
--- a/www-misc/hldig/hldig-1.0.2.ebuild
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Copyright 2020-2024 The Trinity Desktop Project
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-inherit autotools flag-o-matic
-
-DESCRIPTION="HTTP/HTML indexing and searching system"
-HOMEPAGE="https://github.com/solbu/hldig"
-SRC_URI="https://github.com/solbu/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ppc ppc64 x86"
-IUSE="ssl"
-
-# Don't use Gentoo mirrors
-RESTRICT="mirror"
-
-DEPEND="
-	app-arch/unzip
-	sys-libs/zlib
-	ssl? ( dev-libs/openssl:= )
-"
-RDEPEND="${DEPEND}
-	!www-misc/htdig
-"
-
-HTML_DOCS=( docs/. )
-
-src_prepare() {
-	default
-	sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.ac db/configure.ac || die
-	eautoreconf
-}
-
-src_configure() {
-	append-cxxflags "-std=c++11"
-	local myeconfargs=(
-		--disable-static
-		--with-config-dir="${EPREFIX}"/etc/${PN}
-		--with-default-config-file="${EPREFIX}"/etc/${PN}/${PN}.conf
-		--with-database-dir="${EPREFIX}"/var/lib/${PN}/db
-		--with-cgi-bin-dir="${EPREFIX}"/var/www/localhost/cgi-bin
-		--with-search-dir="${EPREFIX}"/var/www/localhost/hldocs/${PN}
-		--with-image-dir="${EPREFIX}"/var/www/localhost/hldocs/${PN}
-		$(use_with ssl)
-	)
-	econf "${myeconfargs[@]}"
-}
-
-src_install () {
-	default
-	sed -i "s:${D}::g" \
-		"${ED}"/etc/${PN}/${PN}.conf \
-		"${ED}"/usr/bin/rundig \
-		|| die "sed failed (removing \${D} from installed files)"
-
-	keepdir "/var/lib/${PN}/db"
-
-	# Symlink hlsearch so it can be easily found.
-	dosym ../../var/www/localhost/cgi-bin/hlsearch /usr/bin/hlsearch
-
-	# Add symlinks for compatibility with applications using htdig
-	dosym /usr/bin/hldb_dump /usr/bin/htdb_dump
-	dosym /usr/bin/hldb_load /usr/bin/htdb_load
-	dosym /usr/bin/hldb_stat /usr/bin/htdb_stat
-	dosym /usr/bin/hldig /usr/bin/htdig
-	dosym /usr/bin/hldump /usr/bin/htdump
-	dosym /usr/bin/hlfuzzy /usr/bin/htfuzzy
-	dosym /usr/bin/hlload /usr/bin/htload
-	dosym /usr/bin/hlmerge /usr/bin/htmerge
-	dosym /usr/bin/hlnotify /usr/bin/htnotify
-	dosym /usr/bin/hlpurge /usr/bin/htpurge
-	dosym /usr/bin/hlsearch /usr/bin/htsearch
-	dosym /usr/bin/hlstat /usr/bin/htstat
-
-	# No static archives
-	find "${D}" -name '*.la' -delete || die
-}
-- 
cgit v1.2.3

