commit:     288ba058cbf295db82b4f62a600ef36bec37c008
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Sun Mar 10 22:09:20 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 14:22:44 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=288ba058

dev-libs/libf2c: add 20240130

Fix up a couple old patches to apply, and drop one that doesn't. There's
been a bit of development since 2009, after all.

Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/libf2c/Manifest                           |  1 +
 .../20240130-link-shared-libf2c-correctly.patch    | 13 +++++
 .../files/libf2c-20240130-fix-buildsystem.patch    | 66 ++++++++++++++++++++++
 dev-libs/libf2c/libf2c-20240130.ebuild             | 54 ++++++++++++++++++
 4 files changed, 134 insertions(+)

diff --git a/dev-libs/libf2c/Manifest b/dev-libs/libf2c/Manifest
index 860e613edbe5..982d923a5c3d 100644
--- a/dev-libs/libf2c/Manifest
+++ b/dev-libs/libf2c/Manifest
@@ -1 +1,2 @@
 DIST libf2c-20130927.zip 129082 BLAKE2B 
09f818bde8888b569858784c39e93a6a11b3103039f44c3f6a1246b29efb5f8ae6e45f787ed0c2216bea383a79b9554aff30e1fbb00668bbc872b4bc30d87ba8
 SHA512 
1a12093dec3c250f4775eebd06f1a9144fdb956ea3162202fb67569fdd956ac5591bc563a0726ca65ea10d465efaac1c1d8024d63bc4a4b5c88bf46242607c8a
+DIST libf2c-20240130.zip 130671 BLAKE2B 
3e8b989064e677d9725a703870b14531ea045b8ef167b11218687def75068c2b59997726acf4c3e5c0b20e024754f9207ffc9354b6feeb46414b59d99e7ec896
 SHA512 
596bd0017e0c4b61191200a0bc788777585049eb939c528625349404cc8d9bbd0957efecd79077c487fdff5fc7e435189574b2c495cafaa6006dd2585b13960a

diff --git a/dev-libs/libf2c/files/20240130-link-shared-libf2c-correctly.patch 
b/dev-libs/libf2c/files/20240130-link-shared-libf2c-correctly.patch
new file mode 100644
index 000000000000..9b58139b91a9
--- /dev/null
+++ b/dev-libs/libf2c/files/20240130-link-shared-libf2c-correctly.patch
@@ -0,0 +1,13 @@
+diff --git a/makefile.u b/makefile.u
+index a1cb700..6d5fb78 100644
+--- a/makefile.u
++++ b/makefile.u
+@@ -88,7 +88,7 @@ libf2c.a: $(OFILES)
+ ## arrange for $DYLD_LIBRARY_PATH to include the directory containing 
libf2c.so.
+ 
+ libf2c.so: $(OFILES)
+-      $(CC) $(LDFLAGS) -shared -o libf2c.so $(OFILES)
++      $(CC) $(LDFLAGS) -shared -Wl,-soname,libf2c.so.2 -o libf2c.so.2 -lm 
$(OFILES)
+ 
+ ### If your system lacks ranlib, you don't need it; see README.
+ 

diff --git a/dev-libs/libf2c/files/libf2c-20240130-fix-buildsystem.patch 
b/dev-libs/libf2c/files/libf2c-20240130-fix-buildsystem.patch
new file mode 100644
index 000000000000..1398c843507b
--- /dev/null
+++ b/dev-libs/libf2c/files/libf2c-20240130-fix-buildsystem.patch
@@ -0,0 +1,66 @@
+From c398f9cc0504c33de034e68a8d402a5ad301c19f Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Sun, 10 Mar 2024 17:54:11 -0400
+Subject: [PATCH] import libf2c-20130927-fix-buildsystem.patch and fix up
+
+---
+ makefile.u | 18 +++++++-----------
+ 1 file changed, 7 insertions(+), 11 deletions(-)
+
+diff --git a/makefile.u b/makefile.u
+index a271e5c..e8c8485 100644
+--- a/makefile.u
++++ b/makefile.u
+@@ -12,16 +12,12 @@
+ #     -fPIC
+ # to the CFLAGS = line below.
+ 
+-.SUFFIXES: .c .o
+-CC = cc
+ SHELL = /bin/sh
+-CFLAGS = -O
+ 
+ # compile, then strip unnecessary symbols
+ .c.o:
+-      $(CC) -c -DSkip_f2c_Undefs $(CFLAGS) $*.c
+-      ld -r -x -o $*.xxx $*.o
+-      mv $*.xxx $*.o
++      $(CC) -c $(CPPFLAGS) $(CFLAGS) -DSkip_f2c_Undefs $< -o $@
++
+ ## Under Solaris (and other systems that do not understand ld -x),
+ ## omit -x in the ld line above.
+ ## If your system does not have the ld command, comment out
+@@ -72,8 +68,8 @@ OFILES = $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \
+ all: f2c.h signal1.h sysdep1.h libf2c.a
+ 
+ libf2c.a: $(OFILES)
+-      ar r libf2c.a $?
+-      -ranlib libf2c.a
++      $(AR) r libf2c.a $?
++      $(RANLIB) libf2c.a
+ 
+ ## Shared-library variant: the following rule works on Linux
+ ## systems.  Details are system-dependent.  Under Linux, -fPIC
+@@ -126,7 +122,7 @@ fio.h: fio.h0 sysdep1.h
+ 
+ install: libf2c.a
+       cp libf2c.a $(LIBDIR)
+-      -ranlib $(LIBDIR)/libf2c.a
++      $(RANLIB) $(LIBDIR)/libf2c.a
+ 
+ clean:
+       rm -f libf2c.a *.o arith.h signal1.h sysdep1.h
+@@ -186,8 +182,8 @@ xwsne.o:   lio.h
+ xwsne.o:      fmt.h
+ 
+ arith.h: arithchk.c
+-      $(CC) $(CFLAGS) -DNO_FPINIT arithchk.c -lm ||\
+-       $(CC) -DNO_LONG_LONG $(CFLAGS) -DNO_FPINIT arithchk.c -lm
++      $(CC) $(CPPFLAGS) $(CFLAGS) -DNO_FPINIT arithchk.c -lm ||\
++       $(CC) -DNO_LONG_LONG $(CPPFLAGS) $(CFLAGS) -DNO_FPINIT arithchk.c -lm
+       ./a.out >arith.h
+       rm -f a.out arithchk.o
+ 
+-- 
+2.43.2
+

diff --git a/dev-libs/libf2c/libf2c-20240130.ebuild 
b/dev-libs/libf2c/libf2c-20240130.ebuild
new file mode 100644
index 000000000000..1d9da1eeca59
--- /dev/null
+++ b/dev-libs/libf2c/libf2c-20240130.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Library that converts FORTRAN to C source"
+HOMEPAGE="http://www.netlib.org/f2c/";
+SRC_URI="http://www.netlib.org/f2c/${PN}.zip -> ${P}.zip"
+
+LICENSE="HPND"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="static-libs"
+
+BDEPEND="app-arch/unzip"
+
+S="${WORKDIR}"
+
+PATCHES=(
+       "${FILESDIR}"/20051004-add-ofiles-dep.patch
+       "${FILESDIR}"/20240130-link-shared-libf2c-correctly.patch
+       "${FILESDIR}"/${PN}-20110801-main.patch
+       "${FILESDIR}"/${PN}-20110801-64bit-long.patch
+       "${FILESDIR}"/${PN}-20240130-fix-buildsystem.patch
+)
+
+src_configure() {
+       tc-export AR CC RANLIB
+}
+
+src_compile() {
+       if use static-libs; then
+               emake -f makefile.u all
+               # Clean up files so we can recompile
+               # with -fPIC for the shared lib
+               rm -v *.o || die "clean failed"
+       fi
+
+       append-cflags -fPIC
+       emake -f makefile.u libf2c.so
+}
+
+src_install() {
+       doheader f2c.h
+
+       dolib.so libf2c.so.2
+       dosym libf2c.so.2 /usr/$(get_libdir)/libf2c.so
+       use static-libs && dolib.a libf2c.a
+
+       einstalldocs
+       dodoc Notice
+}

Reply via email to