summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-02-12 06:21:50 +0000
committerSam James <sam@gentoo.org>2025-02-12 06:29:55 +0000
commit84b9d64c5f3592acf05c6e728afec29b2440b1fd (patch)
treee790ae4a0b5a8a53c66d0c31cd5b639949fe14f8 /media-gfx
parentdev-libs/tre: enable py3.13 (diff)
downloadgentoo-84b9d64c5f3592acf05c6e728afec29b2440b1fd.tar.gz
gentoo-84b9d64c5f3592acf05c6e728afec29b2440b1fd.tar.bz2
gentoo-84b9d64c5f3592acf05c6e728afec29b2440b1fd.zip
media-gfx/sane-frontends: update EAPI 7 -> 8, fix Modern C issues
Use a hack to avoid needing gimp in BDEPEND for eautoreconf. Closes: https://bugs.gentoo.org/933615 Thanks-to: Stephane Bakhos <nuitari@nuitari.net> Signed-off-by: Stephane Bakhos <nuitari@nuitari.net> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-gfx')
-rw-r--r--media-gfx/sane-frontends/files/gimp-2.0.m4180
-rw-r--r--media-gfx/sane-frontends/files/sane-frontends-1.0.14-c99.patch51
-rw-r--r--media-gfx/sane-frontends/sane-frontends-1.0.14-r6.ebuild20
3 files changed, 247 insertions, 4 deletions
diff --git a/media-gfx/sane-frontends/files/gimp-2.0.m4 b/media-gfx/sane-frontends/files/gimp-2.0.m4
new file mode 100644
index 000000000000..695b9e5a6577
--- /dev/null
+++ b/media-gfx/sane-frontends/files/gimp-2.0.m4
@@ -0,0 +1,180 @@
+# Configure paths for GIMP-2.0
+# Manish Singh, Sven Neumann
+# Large parts shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_GIMP_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for GIMP, and define GIMP_CFLAGS and GIMP_LIBS
+dnl
+AC_DEFUN([AM_PATH_GIMP_2_0],
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+
+AC_ARG_ENABLE(gimptest, [ --disable-gimptest do not try to compile and run a test GIMP program],, enable_gimptest=yes)
+
+ pkg_name=gimp-2.0
+ pkg_config_args="$pkg_name gimpui-2.0"
+
+ no_gimp=""
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ if test x$PKG_CONFIG != xno ; then
+ if pkg-config --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_gimp=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_gimp=yes
+ fi
+
+ min_gimp_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GIMP - version >= $min_gimp_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GIMP found in PKG_CONFIG_PATH"
+ enable_gimptest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_gimp_version $pkg_config_args; then
+ :
+ else
+ no_gimp=yes
+ fi
+ fi
+
+ if test x"$no_gimp" = x ; then
+ GIMP_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GIMP_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ GIMP_CFLAGS_NOUI=`$PKG_CONFIG $pkg_name --cflags`
+ GIMP_LIBS_NOUI=`$PKG_CONFIG $pkg_name --libs`
+ GIMP_DATA_DIR=`$PKG_CONFIG $pkg_name --variable=gimpdatadir`
+ GIMP_PLUGIN_DIR=`$PKG_CONFIG $pkg_name --variable=gimplibdir`
+
+ gimp_pkg_major_version=`$PKG_CONFIG --modversion $pkg_name | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ gimp_pkg_minor_version=`$PKG_CONFIG --modversion $pkg_name | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ gimp_pkg_micro_version=`$PKG_CONFIG --modversion $pkg_name | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_gimptest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GIMP_CFLAGS"
+ LIBS="$GIMP_LIBS $LIBS"
+
+dnl
+dnl Now check if the installed GIMP is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent
+dnl
+ rm -f conf.gimptest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libgimp/gimp.h>
+
+GimpPlugInInfo PLUG_IN_INFO =
+{
+ NULL, /* init_proc */
+ NULL, /* quit_proc */
+ NULL, /* query_proc */
+ NULL /* run_proc */
+};
+
+int main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.gimptest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_gimp_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_gimp_version");
+ exit(1);
+ }
+
+ if (($gimp_pkg_major_version > major) ||
+ (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version > minor)) ||
+ (($gimp_pkg_major_version == major) && ($gimp_pkg_minor_version == minor) && ($gimp_pkg_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'pkg-config --modversion %s' returned %d.%d.%d, but the minimum version\n", "$pkg_name", $gimp_pkg_major_version, $gimp_pkg_minor_version, $gimp_pkg_micro_version);
+ printf("*** of GIMP required is %d.%d.%d. If pkg-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct the correct configuration files\n");
+ return 1;
+ }
+}
+
+],, no_gimp=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gimp" = x ; then
+ AC_MSG_RESULT(yes (version $gimp_pkg_major_version.$gimp_pkg_minor_version.$gimp_pkg_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.gimptest ; then
+ :
+ else
+ echo "*** Could not run GIMP test program, checking why..."
+ CFLAGS="$CFLAGS $GIMP_CFLAGS"
+ LIBS="$LIBS $GIMP_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <libgimp/gimp.h>
+
+GimpPlugInInfo PLUG_IN_INFO =
+{
+ NULL, /* init_proc */
+ NULL, /* quit_proc */
+ NULL, /* query_proc */
+ NULL /* run_proc */
+};
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GIMP or finding the wrong"
+ echo "*** version of GIMP. If it is not finding GIMP, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occurred. This usually means GIMP is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GIMP_CFLAGS=""
+ GIMP_LIBS=""
+ GIMP_CFLAGS_NOUI=""
+ GIMP_LIBS_NOUI=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GIMP_CFLAGS)
+ AC_SUBST(GIMP_LIBS)
+ AC_SUBST(GIMP_CFLAGS_NOUI)
+ AC_SUBST(GIMP_LIBS_NOUI)
+ AC_SUBST(GIMP_DATA_DIR)
+ AC_SUBST(GIMP_PLUGIN_DIR)
+ rm -f conf.gimptest
+])
diff --git a/media-gfx/sane-frontends/files/sane-frontends-1.0.14-c99.patch b/media-gfx/sane-frontends/files/sane-frontends-1.0.14-c99.patch
new file mode 100644
index 000000000000..c02528bab90a
--- /dev/null
+++ b/media-gfx/sane-frontends/files/sane-frontends-1.0.14-c99.patch
@@ -0,0 +1,51 @@
+https://bugs.gentoo.org/933615#c7
+Signed-off-by: Stephane Bakhos <nuitari@nuitari.net>
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -61,6 +61,7 @@
+ AC_TRY_RUN([
+ #include <gtk/gtk.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ int
+ main ()
+@@ -484,6 +485,7 @@
+ AC_TRY_RUN([
+ #include <sane/sane.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ int
+ main ()
+--- a/aclocal.m4 2024-09-17 00:41:08.100761458 -0400
++++ b/aclocal.m4 2024-09-17 00:56:44.718894896 -0400
+@@ -494,6 +494,7 @@
+ AC_TRY_RUN([
+ #include <sane/sane.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ int
+ main ()
+--- a/configure 2024-09-17 01:07:22.612760156 -0400
++++ b/configure 2024-09-17 01:07:39.628889934 -0400
+@@ -6818,6 +6818,7 @@
+
+ #include <sane/sane.h>
+ #include <stdio.h>
++#include <stdlib.h>
+
+ int
+ main ()
+--- a/configure.in 2024-09-17 01:18:19.480771874 -0400
++++ b/configure.in 2024-09-17 01:15:08.469314114 -0400
+@@ -75,7 +75,7 @@
+
+ dnl Checks for header files.
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS(os2.h fcntl.h unistd.h libc.h sys/time.h sys/types.h)
++AC_CHECK_HEADERS(os2.h fcntl.h unistd.h libc.h sys/time.h sys/types.h sys/socket.h)
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
diff --git a/media-gfx/sane-frontends/sane-frontends-1.0.14-r6.ebuild b/media-gfx/sane-frontends/sane-frontends-1.0.14-r6.ebuild
index 49b45b38c9ab..3a01f21423be 100644
--- a/media-gfx/sane-frontends/sane-frontends-1.0.14-r6.ebuild
+++ b/media-gfx/sane-frontends/sane-frontends-1.0.14-r6.ebuild
@@ -1,7 +1,9 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
+
+inherit autotools
DESCRIPTION="Scanner Access Now Easy"
HOMEPAGE="http://www.sane-project.org"
@@ -11,7 +13,6 @@ LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm64 ppc ppc64 sparc x86"
IUSE="gimp gtk"
-
REQUIRED_USE="gimp? ( gtk )"
DEPEND="
@@ -26,10 +27,21 @@ RDEPEND="${DEPEND}"
DOCS=( AUTHORS Changelog NEWS PROBLEMS README )
-PATCHES=( "${FILESDIR}/MissingCapsFlag.patch" )
+PATCHES=(
+ "${FILESDIR}/MissingCapsFlag.patch"
+ "${FILESDIR}/${PN}-1.0.14-c99.patch"
+)
S="${WORKDIR}"/"${PN}"-upstream-"${PV}"
+src_prepare() {
+ default
+
+ # Needed for C99 patch (acinclude hack to avoid BDEPEND on gimp)
+ cat "${FILESDIR}"/gimp-2.0.m4 >> acinclude.m4 || die
+ eautoreconf
+}
+
src_configure() {
local myeconfargs=(
--datadir=/usr/share/misc