xsane: fix build, switch to lcms2

This commit is contained in:
Piraty 2025-07-31 23:01:13 +02:00
parent 4d0476fa28
commit ceabe52cbb
3 changed files with 1312 additions and 9 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
source: alpine
Fix -Wimplicit-function-declaration and -Wincompatible-pointer-type error with
gcc 14.
```
getopt.c: In function '_getopt_initialize':
getopt.c:354:54: error: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]
354 | sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
| ^~~~~~
getopt.c:359:31: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
359 | nonoption_flags_len = strlen (nonoption_flags);
| ^~~~~~
getopt.c:104:1: note: include '<string.h>' or provide a declaration of 'strlen'
103 | #include "getopt.h"
+++ |+#include <string.h>
```
```
xsane-save.c: In function 'open_socket':
xsane-save.c:7531:26: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
7531 | if (connect(fd_socket, &sin, sizeof(sin)))
| ^~~~
| |
| struct sockaddr_in *
In file included from /usr/include/fortify/sys/socket.h:23,
from xsane-save.c:36:
/usr/include/sys/socket.h:386:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in *'
386 | int connect (int, const struct sockaddr *, socklen_t);
| ^~~~~~~~~~~~~~~~~~~~~~~
```
```
xsane.c: In function 'xsane_device_dialog':
xsane.c:4949:5: error: implicit declaration of function 'bind_textdomain_codeset'; did you mean 'bindtextdomain__'? [-Wimplicit-function-declaration]
4949 | bind_textdomain_codeset(xsane.backend_translation, "UTF-8");
| ^~~~~~~~~~~~~~~~~~~~~~~
| bindtextdomain__
```
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -39,6 +39,8 @@
#endif
#include <stdio.h>
+#include <string.h> /* for strlen, strcmp */
+#include <unistd.h> /* for getpid */
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
--- a/src/xsane-save.c
+++ b/src/xsane-save.c
@@ -7528,7 +7536,7 @@
sin.sin_family = AF_INET;
memcpy(&sin.sin_addr, he->h_addr_list[0], he->h_length);
- if (connect(fd_socket, &sin, sizeof(sin)))
+ if (connect(fd_socket, (struct sockaddr *)&sin, sizeof(sin)))
{
DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", ntohs(sin.sin_port), strerror(errno));
return -1;
--- a/src/xsane.c
+++ b/src/xsane.c
@@ -50,6 +50,8 @@
/* ---------------------------------------------------------------------------------------------------------------------- */
+char *bind_textdomain_codeset(const char *, const char *);
+
struct option long_options[] =
{
{"help", no_argument, 0, 'h'},

View file

@ -1,21 +1,26 @@
# Template file for 'xsane'
pkgname=xsane
version=0.999
revision=6
revision=7
build_style="gnu-configure"
configure_args="--disable-gimp"
hostmakedepends="pkg-config sane-devel gettext"
makedepends="gtk+-devel lcms-devel sane-devel"
hostmakedepends="automake autoconf-archive pkg-config gettext"
makedepends="gtk+-devel lcms2-devel sane-devel"
depends="sane"
short_desc="GTK-based X11 frontend for SANE"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://www.xsane.org"
distfiles="${DEBIAN_SITE}/main/x/xsane/xsane_${version}.orig.tar.gz"
checksum=5782d23e67dc961c81eef13a87b17eb0144cae3d1ffc5cf7e0322da751482b4b
distfiles="https://gitlab.com/sane-project/frontend/xsane/-/archive/${version}/xsane-${version}.tar.gz"
post_patch() {
vsed -i -e 's/DATADIRNAME=.*/DATADIRNAME=share/' \
-e 's,/usr/local/include,/usr/include,' \
configure
checksum=05359707effe1547ff123bb34443a95a4c54bd4888b91a3556c69875b64989b6
pre_configure() {
autoreconf -vfi
# m4/gettext.m4 tests '_nl_msg_cat_cntr' and sets bogus DATADIRNAME so
# locale ends up in /usr/lib/locale
vsed -i -e 's/DATADIRNAME=lib/DATADIRNAME=share/' configure
vsed -i -e 's,/usr/local/include,/usr/include,' configure
# vsed -i '/^localedir =/s/libdir/datadir/' po/Makefile.in
}