From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1318694-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 6E113158041
	for <garchives@archives.gentoo.org>; Mon,  6 Sep 2021 23:42:50 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 653D0E0929;
	Mon,  6 Sep 2021 23:42:49 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 076F3E0929
	for <gentoo-commits@lists.gentoo.org>; Mon,  6 Sep 2021 23:42:48 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id AEC4A33D3C2
	for <gentoo-commits@lists.gentoo.org>; Mon,  6 Sep 2021 23:42:47 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 18A7A35
	for <gentoo-commits@lists.gentoo.org>; Mon,  6 Sep 2021 23:42:46 +0000 (UTC)
From: "Alessandro Barbieri" <lssndrbarbieri@gmail.com>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Alessandro Barbieri" <lssndrbarbieri@gmail.com>
Message-ID: <1630971764.022dbdafac9085c90aac1fae080cba5accc70f13.Alessandro-Barbieri@gentoo>
Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-mathematics/chaco/files/, sci-mathematics/chaco/
X-VCS-Repository: repo/proj/guru
X-VCS-Files: sci-mathematics/chaco/chaco-2.2-r1.ebuild sci-mathematics/chaco/chaco-2.2.ebuild sci-mathematics/chaco/files/chaco-2.2-lib.patch sci-mathematics/chaco/files/chaco-2.2-respect-flags.patch sci-mathematics/chaco/files/chaco-2.2-shared.patch sci-mathematics/chaco/files/makefile.patch
X-VCS-Directories: sci-mathematics/chaco/ sci-mathematics/chaco/files/
X-VCS-Committer: Alessandro-Barbieri
X-VCS-Committer-Name: Alessandro Barbieri
X-VCS-Revision: 022dbdafac9085c90aac1fae080cba5accc70f13
X-VCS-Branch: dev
Date: Mon,  6 Sep 2021 23:42:46 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: bbad7aaf-e406-4b64-b487-92a6cf9f3d18
X-Archives-Hash: 46c3684bfe663d0e0510225febb67ec2

commit:     022dbdafac9085c90aac1fae080cba5accc70f13
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Mon Sep  6 04:43:06 2021 +0000
Commit:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Mon Sep  6 23:42:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=022dbdaf

sci-mathematics/chaco: mbdyn patch, build shared library

Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>

 .../{chaco-2.2.ebuild => chaco-2.2-r1.ebuild}      | 15 +++++--
 sci-mathematics/chaco/files/chaco-2.2-lib.patch    | 48 ++++++++++++++++++++++
 .../chaco/files/chaco-2.2-respect-flags.patch      | 32 +++++++++++++++
 sci-mathematics/chaco/files/chaco-2.2-shared.patch | 22 ++++++++++
 sci-mathematics/chaco/files/makefile.patch         | 26 ------------
 5 files changed, 114 insertions(+), 29 deletions(-)

diff --git a/sci-mathematics/chaco/chaco-2.2.ebuild b/sci-mathematics/chaco/chaco-2.2-r1.ebuild
similarity index 67%
rename from sci-mathematics/chaco/chaco-2.2.ebuild
rename to sci-mathematics/chaco/chaco-2.2-r1.ebuild
index f7d0a7d15..499b1253a 100644
--- a/sci-mathematics/chaco/chaco-2.2.ebuild
+++ b/sci-mathematics/chaco/chaco-2.2-r1.ebuild
@@ -8,12 +8,16 @@ inherit toolchain-funcs
 DESCRIPTION="Software for Partitioning Graphs"
 HOMEPAGE="https://www3.cs.stonybrook.edu/~algorith/implement/chaco/implement.shtml"
 SRC_URI="https://www3.cs.stonybrook.edu/~algorith/implement/${PN}/distrib/Chaco-${PV}.tar.gz"
+S="${WORKDIR}/Chaco-${PV}"
 
 LICENSE="LGPL-2.1"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
-PATCHES=( "${FILESDIR}/makefile.patch" )
-S="${WORKDIR}/Chaco-${PV}"
+PATCHES=(
+	"${FILESDIR}/${P}-lib.patch"
+	"${FILESDIR}/${P}-respect-flags.patch"
+	"${FILESDIR}/${P}-shared.patch"
+)
 
 src_compile() {
 	cd code || die
@@ -22,6 +26,11 @@ src_compile() {
 }
 
 src_install() {
-	dobin "exec/chaco"
 	dodoc -r doc/.
+	dodoc -r "code/matlab"
+	cd "exec" || die
+	dobin "chaco"
+	dolib.so "libchaco.so"
+	dodoc *.coords *.graph "User_Params"
+	newdoc README README_exec
 }

diff --git a/sci-mathematics/chaco/files/chaco-2.2-lib.patch b/sci-mathematics/chaco/files/chaco-2.2-lib.patch
new file mode 100644
index 000000000..3d05ced52
--- /dev/null
+++ b/sci-mathematics/chaco/files/chaco-2.2-lib.patch
@@ -0,0 +1,48 @@
+Patch provided by Walter Landry <wlandry at ucsd.edu>
+for use within MBDyn
+
+--- a/code/Makefile
++++ b/code/Makefile
+@@ -5,7 +5,9 @@
+ CFLAGS =	-O2
+ OFLAGS =	-O2
+ 
+-FILES.c=	main/user_params.c main/interface.c main/main.c \
++main_file=	 main/main.c
++
++libFILES.c=	main/user_params.c main/interface.c \
+ 		submain/balance.c submain/divide.c submain/submain.c \
+ 		input/input_assign.c \
+ 		input/check_input.c input/input.c input/input_geom.c \
+@@ -87,11 +89,20 @@
+ 		util/update.c  util/vecout.c util/vecran.c \
+                 util/vecscale.c 
+ 
++FILES.c=	$(libFILES.c) $(main_file)
++
+ FILES.o=	$(FILES.c:.c=.o) 
+ 
++libFILES.o=	$(libFILES.c:.c=.o)
++
++all: ${DEST} ${DEST_DIR}/libchaco.a
+ 
+ ${DEST}:	${FILES.o} Makefile
+ 		${CC} ${OFLAGS} ${FILES.o} -lm -o ${DEST}
++
++${DEST_DIR}/libchaco.a:	${libFILES.o} Makefile
++		ar r ${DEST_DIR}/libchaco.a ${libFILES.o}
++		ranlib ${DEST_DIR}/libchaco.a
+ 
+ lint:
+ 		lint ${IFLAG} ${FILES.c} -lm
+--- a/code/main/user_params.c
++++ b/code/main/user_params.c
+@@ -98,7 +98,7 @@
+ long      RANDOM_SEED = 7654321L;	/* Seed for random number generator */
+ int       NSQRTS = 1000;	/* # square roots to precompute if coarsening */
+ int       MAKE_VWGTS = FALSE;	/* Make vtx weights degrees+1? (TRUE/FALSE) */
+-int       FREE_GRAPH = TRUE;	/* Free input graph data? (TRUE/FALSE) */
++int       FREE_GRAPH = FALSE;	/* Free input graph data? (TRUE/FALSE) */
+ char     *PARAMS_FILENAME = "User_Params";	/* File of parameter changes */
+ 
+ 

diff --git a/sci-mathematics/chaco/files/chaco-2.2-respect-flags.patch b/sci-mathematics/chaco/files/chaco-2.2-respect-flags.patch
new file mode 100644
index 000000000..94d0be979
--- /dev/null
+++ b/sci-mathematics/chaco/files/chaco-2.2-respect-flags.patch
@@ -0,0 +1,32 @@
+--- a/code/Makefile
++++ b/code/Makefile
+@@ -1,8 +1,6 @@
+ DEST_DIR = 	../exec
+ DEST=		${DEST_DIR}/chaco
+-CC = 		gcc
+ IFLAG =		-Imain
+-CFLAGS =	-O2
+ OFLAGS =	-O2
+ 
+ main_file=	 main/main.c
+@@ -98,11 +96,11 @@
+ all: ${DEST} ${DEST_DIR}/libchaco.a
+ 
+ ${DEST}:	${FILES.o} Makefile
+-		${CC} ${OFLAGS} ${FILES.o} -lm -o ${DEST}
++		${CC} ${CFLAGS} ${LDFLAGS} -fPIE ${FILES.o} -lm -o ${DEST}
+ 
+ ${DEST_DIR}/libchaco.a:	${libFILES.o} Makefile
+-		ar r ${DEST_DIR}/libchaco.a ${libFILES.o}
+-		ranlib ${DEST_DIR}/libchaco.a
++		${AR} r ${DEST_DIR}/libchaco.a ${libFILES.o}
++		${RANLIB} ${DEST_DIR}/libchaco.a
+ 
+ lint:
+ 		lint ${IFLAG} ${FILES.c} -lm
+@@ -114,4 +112,4 @@
+ 		rm -f */*.o ${DEST_DIR}/core
+ 
+ .c.o:
+-		${CC} -c ${IFLAG} ${CFLAGS} -o $*.o $*.c
++		${CC} -c ${IFLAG} ${CFLAGS} -fPIC -o $*.o $*.c

diff --git a/sci-mathematics/chaco/files/chaco-2.2-shared.patch b/sci-mathematics/chaco/files/chaco-2.2-shared.patch
new file mode 100644
index 000000000..3102ca735
--- /dev/null
+++ b/sci-mathematics/chaco/files/chaco-2.2-shared.patch
@@ -0,0 +1,22 @@
+--- a/code/Makefile
++++ b/code/Makefile
+@@ -93,14 +93,13 @@
+ 
+ libFILES.o=	$(libFILES.c:.c=.o)
+ 
+-all: ${DEST} ${DEST_DIR}/libchaco.a
++all: ${DEST} ${DEST_DIR}/libchaco.so
+ 
+-${DEST}:	${FILES.o} Makefile
+-		${CC} ${CFLAGS} ${LDFLAGS} -fPIE ${FILES.o} -lm -o ${DEST}
++${DEST}:	${DEST_DIR}/libchaco.so Makefile
++		${CC} ${CFLAGS} ${LDFLAGS} -fPIE $(main_file) -lm -L${DEST_DIR} -lchaco -o ${DEST}
+ 
+-${DEST_DIR}/libchaco.a:	${libFILES.o} Makefile
+-		${AR} r ${DEST_DIR}/libchaco.a ${libFILES.o}
+-		${RANLIB} ${DEST_DIR}/libchaco.a
++${DEST_DIR}/libchaco.so:	${libFILES.o} Makefile
++	$(CC) $(CFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,libchaco.so -o ${DEST_DIR}/libchaco.so $(libFILES.o) -lm
+ 
+ lint:
+ 		lint ${IFLAG} ${FILES.c} -lm

diff --git a/sci-mathematics/chaco/files/makefile.patch b/sci-mathematics/chaco/files/makefile.patch
deleted file mode 100644
index 32ab4b84c..000000000
--- a/sci-mathematics/chaco/files/makefile.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/code/Makefile	2021-04-12 01:42:10.792372462 +0200
-+++ b/code/Makefile	2021-04-12 01:46:20.332391138 +0200
-@@ -1,8 +1,6 @@
- DEST_DIR = 	../exec
- DEST=		${DEST_DIR}/chaco
--CC = 		gcc
- IFLAG =		-Imain
--CFLAGS =	-O2
- OFLAGS =	-O2
- 
- FILES.c=	main/user_params.c main/interface.c main/main.c \
-@@ -91,7 +89,7 @@
- 
- 
- ${DEST}:	${FILES.o} Makefile
--		${CC} ${OFLAGS} ${FILES.o} -lm -o ${DEST}
-+		${CC} ${CFLAGS} -fPIE ${LDFLAGS} ${FILES.o} -lm -o ${DEST}
- 
- lint:
- 		lint ${IFLAG} ${FILES.c} -lm
-@@ -103,4 +101,4 @@
- 		rm -f */*.o ${DEST_DIR}/core
- 
- .c.o:
--		${CC} -c ${IFLAG} ${CFLAGS} -o $*.o $*.c
-+		${CC} -c ${IFLAG} ${CFLAGS} -fPIC -o $*.o $*.c