commit:     269531ad4c0c31dee32ca78fb3e8832463a0fd08
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  7 07:54:19 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jun  7 07:54:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=269531ad

dev-libs/iniparser: bring back 3.1-r3: sys-block/ndctl depends on it

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 dev-libs/iniparser/Manifest                        |  1 +
 .../iniparser/files/iniparser-3.0-autotools.patch  | 38 ++++++++++++++++
 dev-libs/iniparser/files/iniparser-3.0b-cpp.patch  | 45 +++++++++++++++++++
 .../files/iniparser-4.0-out-of-bounds-read.patch   | 11 +++++
 dev-libs/iniparser/iniparser-3.1-r3.ebuild         | 50 ++++++++++++++++++++++
 5 files changed, 145 insertions(+)

diff --git a/dev-libs/iniparser/Manifest b/dev-libs/iniparser/Manifest
index 80cc71c57966..f061f9715a2a 100644
--- a/dev-libs/iniparser/Manifest
+++ b/dev-libs/iniparser/Manifest
@@ -1 +1,2 @@
+DIST iniparser-3.1.tar.gz 39097 BLAKE2B 
4ada36f5bb95476c06deffa7938a750bcdeb0bd5bb817b24274c1e1c588d9abbd23c3a58f3cb3b6f961912f3e12e74aadf224da4cd81863b874e4a84d11c1744
 SHA512 
8fd8324c5629fdc3e3eff00afb5f0832402ccc760c5b92db82aa29b340ec891419ca2c4fee3a4d4d67cf9bc51c76b095bc0c458e087c2b8e72ac36867c47ae86
 DIST iniparser-4.1.tar.gz 44732 BLAKE2B 
a3480dab512b41eb9635c733b76048ab089a311c2970aae5ce89d103ff6ab1923d5824a5fca3bf445ba213ecd9954018fdef2831fd98c1a43c9ae7d4fb1cb388
 SHA512 
a8125aaaead1f9dfde380fa1e45bae31ca2312be029f2c53b4072cb3b127d16578a95c7c0aee1e3dda5e7b8db7a865ba6dfe8a1d80eb673061b3babef744e968

diff --git a/dev-libs/iniparser/files/iniparser-3.0-autotools.patch 
b/dev-libs/iniparser/files/iniparser-3.0-autotools.patch
new file mode 100644
index 000000000000..361c96a7d4fb
--- /dev/null
+++ b/dev-libs/iniparser/files/iniparser-3.0-autotools.patch
@@ -0,0 +1,38 @@
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1,8 @@
++ACLOCAL_AMFLAGS = -I config
++
++lib_LTLIBRARIES = libiniparser.la
++
++libiniparser_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
++libiniparser_la_SOURCES = src/dictionary.c  src/iniparser.c
++
++include_HEADERS = src/dictionary.h  src/iniparser.h
+--- /dev/null
++++ b/configure.ac
+@@ -0,0 +1,24 @@
++AC_PREREQ([2.65])
++AC_INIT([iniparser], [3.0], [ndevi...@free.fr])
++
++AC_CONFIG_AUX_DIR(config)
++AC_CONFIG_MACRO_DIR(config)
++
++AM_INIT_AUTOMAKE([1.8 foreign])
++
++SHARED_VERSION_INFO="0"
++AC_SUBST(SHARED_VERSION_INFO)
++
++# Checks for programs.
++AC_PROG_CC
++AC_SYS_LARGEFILE
++
++LT_INIT
++# Checks for header files.
++AC_CHECK_HEADERS([ ctype.h stdio.h stdlib.h string.h ])
++
++# Checks for library functions.
++AC_CHECK_FUNCS([strcmp])
++
++AC_CONFIG_FILES([Makefile])
++AC_OUTPUT

diff --git a/dev-libs/iniparser/files/iniparser-3.0b-cpp.patch 
b/dev-libs/iniparser/files/iniparser-3.0b-cpp.patch
new file mode 100644
index 000000000000..b7cd17d2d226
--- /dev/null
+++ b/dev-libs/iniparser/files/iniparser-3.0b-cpp.patch
@@ -0,0 +1,45 @@
+--- a/src/dictionary.c
++++ b/src/dictionary.c
+@@ -32,6 +32,9 @@
+ /*---------------------------------------------------------------------------
+                             Private functions
+  ---------------------------------------------------------------------------*/
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Doubles the allocated size associated to a pointer */
+ /* 'size' is the current allocated size. */
+@@ -394,5 +397,10 @@
+     dictionary_del(d);
+     return 0 ;
+ }
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+ /* vim: set ts=4 et sw=4 tw=75 */
+--- a/src/iniparser.h
++++ b/src/iniparser.h
+@@ -49,6 +49,10 @@
+ int iniparser_getnsec(dictionary * d);
+ 
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /*-------------------------------------------------------------------------*/
+ /**
+   @brief    Get name for section n in a dictionary.
+@@ -304,4 +308,8 @@
+ /*--------------------------------------------------------------------------*/
+ void iniparser_freedict(dictionary * d);
+ 
++#ifdef __cplusplus
++}
++#endif
++
+ #endif

diff --git a/dev-libs/iniparser/files/iniparser-4.0-out-of-bounds-read.patch 
b/dev-libs/iniparser/files/iniparser-4.0-out-of-bounds-read.patch
new file mode 100644
index 000000000000..f6488810ac12
--- /dev/null
+++ b/dev-libs/iniparser/files/iniparser-4.0-out-of-bounds-read.patch
@@ -0,0 +1,11 @@
+--- a/src/iniparser.c
++++ b/src/iniparser.c
+@@ -663,7 +663,7 @@
+     while (fgets(line+last, ASCIILINESZ-last, in)!=NULL) {
+         lineno++ ;
+         len = (int)strlen(line)-1;
+-        if (len==0)
++        if (len<=0)
+             continue;
+         /* Safety check against buffer overflows */
+         if (line[len]!='\n') {

diff --git a/dev-libs/iniparser/iniparser-3.1-r3.ebuild 
b/dev-libs/iniparser/iniparser-3.1-r3.ebuild
new file mode 100644
index 000000000000..37dc4fdbbabb
--- /dev/null
+++ b/dev-libs/iniparser/iniparser-3.1-r3.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="A free stand-alone ini file parsing library"
+HOMEPAGE="http://ndevilla.free.fr/iniparser/";
+SRC_URI="http://ndevilla.free.fr/iniparser/${P}.tar.gz";
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv 
~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="doc examples"
+# the tests are rather examples than tests, no point in running them
+RESTRICT="test"
+
+BDEPEND="doc? ( app-doc/doxygen )"
+
+S="${WORKDIR}/${PN}"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-3.0b-cpp.patch
+       "${FILESDIR}"/${PN}-3.0-autotools.patch
+       "${FILESDIR}"/${PN}-4.0-out-of-bounds-read.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_install() {
+       if use doc; then
+               emake -C doc
+               HTML_DOCS=( html/. )
+       fi
+
+       default
+
+       if use examples; then
+               docinto examples
+               dodoc test/*.{c,ini,py}
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+
+       # No static archives
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to