changeset 130:140a5a5253f9

lib/argp-standalone: initial import, closes #1182
author David Demelier <markand@malikania.fr>
date Sun, 10 Mar 2019 18:45:44 +0100
parents f55c9ef41a9a
children adb183e19426
files lib/argp-standalone/argp-standalone.info lib/argp-standalone/argp-standalone.sh lib/argp-standalone/gnu89-inline.patch lib/argp-standalone/throw-in-funcdef.patch
diffstat 4 files changed, 170 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/argp-standalone.info	Sun Mar 10 18:45:44 2019 +0100
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PKGNAME=argp-standalone
+PKGVERSION=1.3
+PKGREVISION=1
+PKGLICENSE="GPLv2+"
+PKGSUMMARY="argument parsing extracted from glibc"
+PKGDOWNLOAD="http://www.lysator.liu.se/~nisse/misc/$PKGNAME-$PKGVERSION.tar.gz"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/argp-standalone.sh	Sun Mar 10 18:45:44 2019 +0100
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+: ${CHOST:=$(uname -m)-linux-musl}
+: ${CBUILD:=$(uname -m)-linux-musl}
+: ${CC:=gcc}
+: ${CFLAGS:=-O2}
+
+source ./argp-standalone.info
+
+set -ex
+
+rm -rf $PKGNAME-$PKGVERSION
+tar xvaf $PKGNAME-$PKGVERSION.tar.gz
+pushd $PKGNAME-$PKGVERSION
+
+# TODO: build as shared instead of static.
+patch -p1 < ../gnu89-inline.patch
+patch -p1 < ../throw-in-funcdef.patch
+autoreconf -if
+CC="$CC" \
+CFLAGS="$CFLAGS" \
+./configure \
+	--build=$CBUILD \
+	--host=$CHOST \
+	--prefix=/usr
+make
+install -D -m 0644 argp.h $DESTDIR/usr/include/argp.h
+install -D -m 0755 libargp.a $DESTDIR/usr/lib/libargp.a
+
+popd
+rm -rf $PKGNAME-$PKGVERSION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/gnu89-inline.patch	Sun Mar 10 18:45:44 2019 +0100
@@ -0,0 +1,22 @@
+diff --git a/configure.ac b/configure.ac
+index 4658839..09f0267 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -79,16 +79,10 @@ AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],
+ 
+ # Set these flags *last*, or else the test programs won't compile
+ if test x$GCC = xyes ; then
+-  # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core
+-  if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then
+-    true
+-  else
+-    CFLAGS="$CFLAGS -ggdb3"
+-  fi
+   CFLAGS="$CFLAGS -Wall -W \
+  -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
+  -Waggregate-return \
+- -Wpointer-arith -Wbad-function-cast -Wnested-externs"
++ -Wpointer-arith -Wbad-function-cast -Wnested-externs -fgnu89-inline"
+ fi
+ 
+ CPPFLAGS="$CPPFLAGS -I$srcdir"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/throw-in-funcdef.patch	Sun Mar 10 18:45:44 2019 +0100
@@ -0,0 +1,79 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+# 
+# T2 SDE: package/.../rng-tools/throw-in-funcdef.patch.argp-standalone
+# Copyright (C) 2006 The T2 SDE Project
+# 
+# More information can be found in the files COPYING and README.
+# 
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# --- T2-COPYRIGHT-NOTE-END ---
+
+
+No __THROW in function implementation.
+	--jsaw
+
+--- argp-standalone-1.4-test2/argp.h.orig	2006-01-06 02:29:59.000000000 +0100
++++ argp-standalone-1.4-test2/argp.h	2006-01-06 02:41:10.000000000 +0100
+@@ -560,17 +560,17 @@
+ # endif
+ 
+ # ifndef ARGP_EI
+-#  define ARGP_EI extern __inline__
++#  define ARGP_EI extern inline
+ # endif
+ 
+ ARGP_EI void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ ARGP_EI int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt)
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -582,7 +582,7 @@
+ }
+ 
+ ARGP_EI int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt)
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
+--- argp-standalone-1.4-test2/argp-parse.c.orig	2006-01-06 02:47:48.000000000 +0100
++++ argp-standalone-1.4-test2/argp-parse.c	2006-01-06 02:48:16.000000000 +0100
+@@ -1290,13 +1290,13 @@
+ /* Defined here, in case a user is not inlining the definitions in
+  * argp.h */
+ void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt) 
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -1310,7 +1310,7 @@
+ }
+ 
+ int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt) 
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }