Subject: [alpine-aports] [PATCH] community/gsoap: make sure to define _GNU_SOURCE

From: alpine-mips-patches <[email-masked]>
Date: Sun, 30 Dec 2018 09:08:19 +0000

'strtod_l' is guarded by _GNU_SOURCE which gsoap fails to define on
musl and compilation reports warnings like this:

stdsoap2.c:16352:19: warning: implicit declaration of function 'strtod_l'; did you mean 'strtok_r'? [-Wimplicit-function-declaration]
       *p = (float)strtod_l(s, &r, SOAP_LOCALE(soap));
                   ^~~~~~~~
                   strtok_r

On most hard-float systems (x86_64 and mips*hf for sure) this code
will use some random garbage from the integer register.

...and update musl-fixes.patches to cover yet another attempt to
use glibc-style strerror_r() (triggered by _GNU_SOURCE).

The implicitly declared isatty() at soapcpp2_lex.c:1944 is ignored.
---
 community/gsoap/APKBUILD                      |  6 ++-
 community/gsoap/musl-fixes.patch              | 15 ++++++-
 .../gsoap/musl-needs-_GNU_SOURCE-too.patch    | 44 +++++++++++++++++++
 3 files changed, 61 insertions(+), 4 deletions(-)
 create mode 100644 community/gsoap/musl-needs-_GNU_SOURCE-too.patch

diff --git a/community/gsoap/APKBUILD b/community/gsoap/APKBUILD
index a988f427be..08d276af38 100644
--- a/community/gsoap/APKBUILD
+++ b/community/gsoap/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=gsoap
 pkgver=2.8.74
-pkgrel=0
+pkgrel=1
 arch="all"
 pkgdesc="Cross-platform C and C++ SDK for SOAP/XML Web services"
 license="GPL-2.0-or-later gSOAP-1.3b"
@@ -11,6 +11,7 @@ makedepends="autoconf automake bison flex openssl-dev libtool zlib-dev"
 subpackages="$pkgname-dev"
 source="https://downloads.sourceforge.net/project/gsoap2/gsoap-${pkgver%.*}/gsoap_$pkgver.zip
 	musl-fixes.patch
+	musl-needs-_GNU_SOURCE-too.patch
 	"
 builddir="$srcdir/$pkgname-${pkgver%.*}"
 
@@ -32,4 +33,5 @@ package() {
 }
 
 sha512sums="85284b88a94f07f433ffaeb9031c24d4c9c3eb82f8c590fa257cf9392fa0382cdcde5b3d5c7df903c6ddec41b876643b21ea24d18186b03db9dc8a4d6e8477ad  gsoap_2.8.74.zip
-cb276ffdd213f3626f212f304628d0e91974e493afd325bb324031d5e5ee2cb1de0f57d69da1608320f8e999984c64700fe9273ecdba97401366f662ac15d423  musl-fixes.patch"
+2b53a280b43d1ebee03760a69bba55ec214e9dfc1351808055df896d6985b55c2b112049e88a27ddfa322bb86b6aed889388349da2927f8fad698238143e952f  musl-fixes.patch
+663fb1572e0e6283bb9ef994b2e2a0f828d25a69454447d5a2b602aa396c8fe57c1b3c4098e5c26603e693931ac17d8dc5702c8ef6a00b8fec6a43ff9317a05c  musl-needs-_GNU_SOURCE-too.patch"
diff --git a/community/gsoap/musl-fixes.patch b/community/gsoap/musl-fixes.patch
index a2e583ea8d..7a8045cfe4 100644
--- a/community/gsoap/musl-fixes.patch
+++ b/community/gsoap/musl-fixes.patch
@@ -1,6 +1,17 @@
+--- a/gsoap/stdsoap2.c
++++ b/gsoap/stdsoap2.c
+@@ -22111,7 +22111,7 @@
+   {
+ #ifndef WIN32
+ # ifdef HAVE_STRERROR_R
+-#  if defined(_GNU_SOURCE) && !defined(__ANDROID__)
++#  if defined(_GNU_SOURCE) && !defined(__ANDROID__) && defined(__GLIBC__)
+     return strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* GNU-specific */
+ #  else
+     strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* XSI-compliant */
 --- a/gsoap/stdsoap2.cpp
 +++ b/gsoap/stdsoap2.cpp
-@@ -22400,7 +22400,7 @@
+@@ -22111,7 +22111,7 @@
    {
  #ifndef WIN32
  # ifdef HAVE_STRERROR_R
@@ -11,7 +22,7 @@
      strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* XSI-compliant */
 --- a/gsoap/stdsoap2.h
 +++ b/gsoap/stdsoap2.h
-@@ -1015,7 +1015,7 @@
+@@ -991,7 +991,7 @@
  # endif
  #elif defined(SOCKLEN_T)
  # define SOAP_SOCKLEN_T SOCKLEN_T
diff --git a/community/gsoap/musl-needs-_GNU_SOURCE-too.patch b/community/gsoap/musl-needs-_GNU_SOURCE-too.patch
new file mode 100644
index 0000000000..9b953b10f0
--- /dev/null
+++ b/community/gsoap/musl-needs-_GNU_SOURCE-too.patch
@@ -0,0 +1,44 @@
+--- a/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp
++++ b/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp
+@@ -58,7 +58,7 @@
+ # pragma convert(819)   /* EBCDIC to ASCII */
+ #endif
+ 
+-#if defined(__gnu_linux__) && !defined(_GNU_SOURCE)
++#if defined(__linux__) && !defined(_GNU_SOURCE)
+ # define _GNU_SOURCE 1
+ #endif
+ 
+--- a/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp
++++ b/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp
+@@ -58,7 +58,7 @@
+ # pragma convert(819)   /* EBCDIC to ASCII */
+ #endif
+ 
+-#if defined(__gnu_linux__) && !defined(_GNU_SOURCE)
++#if defined(__linux__) && !defined(_GNU_SOURCE)
+ # define _GNU_SOURCE 1
+ #endif
+ 
+--- a/gsoap/stdsoap2.c
++++ b/gsoap/stdsoap2.c
+@@ -58,7 +58,7 @@
+ # pragma convert(819)   /* EBCDIC to ASCII */
+ #endif
+ 
+-#if defined(__gnu_linux__) && !defined(_GNU_SOURCE)
++#if defined(__linux__) && !defined(_GNU_SOURCE)
+ # define _GNU_SOURCE 1
+ #endif
+ 
+--- a/gsoap/stdsoap2.cpp
++++ b/gsoap/stdsoap2.cpp
+@@ -58,7 +58,7 @@
+ # pragma convert(819)   /* EBCDIC to ASCII */
+ #endif
+ 
+-#if defined(__gnu_linux__) && !defined(_GNU_SOURCE)
++#if defined(__linux__) && !defined(_GNU_SOURCE)
+ # define _GNU_SOURCE 1
+ #endif
+ 
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---