commit:     022dbdafac9085c90aac1fae080cba5accc70f13
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Mon Sep  6 04:43:06 2021 +0000
Commit:     Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
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

Reply via email to