changeset 618:a9b53729d91b

lib/argp-standalone: build shared library (thanks to FreeBSD)
author David Demelier <markand@malikania.fr>
date Tue, 23 Jul 2019 20:20:00 +0200
parents 996230e6b946
children a4dd42f62111
files lib/argp-standalone/argp-standalone.sh lib/argp-standalone/gnu89-inline.patch lib/argp-standalone/patch-Makefile.am.patch lib/argp-standalone/patch-configure.ac.patch lib/argp-standalone/patch-gnu89-inline.patch lib/argp-standalone/patch-testsuite_Makefile.am.patch lib/argp-standalone/patch-throw-in-funcdef.patch lib/argp-standalone/throw-in-funcdef.patch
diffstat 8 files changed, 161 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/lib/argp-standalone/argp-standalone.sh	Tue Jul 23 20:14:00 2019 +0200
+++ b/lib/argp-standalone/argp-standalone.sh	Tue Jul 23 20:20:00 2019 +0200
@@ -29,20 +29,19 @@
 : ${LDFLAGS:=}
 : ${LIBS:=}
 
-if [ "$(uname -m)" = "x86_64" ]; then
-	CFLAGS="-fPIC $CFLAGS"
-fi
-
 build()
 {
 	rm -rf $PKGNAME-$PKGVERSION
 	tar xvf $PKGNAME-$PKGVERSION.tar.gz
 	cd $PKGNAME-$PKGVERSION
 
-	# TODO: build as shared instead of static.
-	patch -p1 < ../gnu89-inline.patch
-	patch -p1 < ../throw-in-funcdef.patch
-	autoreconf -if
+	# https://svnweb.freebsd.org/ports/head/devel/argp-standalone/files
+	patch -p0 < ../patch-configure.ac.patch
+	patch -p0 < ../patch-Makefile.am.patch
+	patch -p0 < ../patch-testsuite_Makefile.am.patch
+	patch -p1 < ../patch-gnu89-inline.patch
+	patch -p1 < ../patch-throw-in-funcdef.patch
+	autoreconf -vif
 	CC="$CC" \
 	CFLAGS="$CFLAGS" \
 	LDFLAGS="$LDFLAGS" \
@@ -52,8 +51,10 @@
 		--host=$CHOST \
 		--prefix=
 	make
-	install -D -m 0644 argp.h $DESTDIR/include/argp.h
-	install -D -m 0755 libargp.a $DESTDIR/lib/libargp.a
+	make install DESTDIR=$DESTDIR
+	install -Dm0644 argp.h $DESTDIR/include/argp.h
+	rm -f $DESTDIR/lib/libargp.la
+	rm -f $DESTDIR/lib/libargp.a
 
 	cd ..
 	rm -rf $PKGNAME-$PKGVERSION
--- a/lib/argp-standalone/gnu89-inline.patch	Tue Jul 23 20:14:00 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-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/patch-Makefile.am.patch	Tue Jul 23 20:20:00 2019 +0200
@@ -0,0 +1,28 @@
+--- Makefile.am.orig	2004-02-23 17:57:28 UTC
++++ Makefile.am
+@@ -21,20 +21,20 @@
+ AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = . testsuite
+ 
+-LIBOBJS = @LIBOBJS@
++LTLIBOBJS = @LTLIBOBJS@
+ 
+-noinst_LIBRARIES = libargp.a
++lib_LTLIBRARIES = libargp.la
+ noinst_PROGRAMS = argp-test
+ noinst_HEADERS = argp.h argp-fmtstream.h argp-namefrob.h # argp-comp.h
+ 
+ EXTRA_DIST = mempcpy.c strchrnul.c strndup.c Versions
+ 
+ # Leaves out argp-fs-xinl.c and argp-xinl.c 
+-libargp_a_SOURCES = argp-ba.c argp-eexst.c argp-fmtstream.c \
++libargp_la_SOURCES = argp-ba.c argp-eexst.c argp-fmtstream.c \
+ 		    argp-help.c argp-parse.c argp-pv.c \
+ 		    argp-pvh.c
+ 
+-libargp_a_LIBADD = $(LIBOBJS)
++libargp_la_LIBADD = $(LTLIBOBJS)
+ 
+-argp_test_LDADD = libargp.a
++argp_test_LDADD = libargp.la
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/patch-configure.ac.patch	Tue Jul 23 20:20:00 2019 +0200
@@ -0,0 +1,10 @@
+--- configure.ac.orig	2004-02-23 17:57:29 UTC
++++ configure.ac
+@@ -17,6 +17,7 @@ AC_PROG_CC
+ AC_PROG_MAKE_SET
+ AC_PROG_RANLIB
+ AM_PROG_CC_STDC
++AC_PROG_LIBTOOL
+ 
+ if test "x$am_cv_prog_cc_stdc" = xno ; then
+   AC_ERROR([the C compiler doesn't handle ANSI-C])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/patch-gnu89-inline.patch	Tue Jul 23 20:20:00 2019 +0200
@@ -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/patch-testsuite_Makefile.am.patch	Tue Jul 23 20:20:00 2019 +0200
@@ -0,0 +1,11 @@
+--- testsuite/Makefile.am.orig	2003-02-04 19:38:52 UTC
++++ testsuite/Makefile.am
+@@ -5,7 +5,7 @@ TS_ALL = $(TS_PROGS) $(TS_SH)
+ 
+ noinst_PROGRAMS = $(TS_PROGS) ex1 ex3 ex4
+ 
+-LDADD = ../libargp.a
++LDADD = ../.libs/libargp.a
+ 
+ EXTRA_DIST = $(TS_SH) run-tests
+ CLEANFILES = test.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/argp-standalone/patch-throw-in-funcdef.patch	Tue Jul 23 20:20:00 2019 +0200
@@ -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;
+ }
--- a/lib/argp-standalone/throw-in-funcdef.patch	Tue Jul 23 20:14:00 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-# --- 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;
- }