commit:     913e7f40b307960aa2e3e3cc20fb562d159d3bff
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Tue Apr 28 19:56:18 2020 +0000
Commit:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Tue Apr 28 19:56:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=913e7f40

sci-libs/saclib: patched toolchain

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>

 sci-libs/saclib/files/makefile.patch   | 150 +++++++++++++++++++++++++++++++++
 sci-libs/saclib/saclib-2.2.7-r2.ebuild |  79 +++++++++++++++++
 2 files changed, 229 insertions(+)

diff --git a/sci-libs/saclib/files/makefile.patch 
b/sci-libs/saclib/files/makefile.patch
new file mode 100644
index 0000000..bc49d0b
--- /dev/null
+++ b/sci-libs/saclib/files/makefile.patch
@@ -0,0 +1,150 @@
+diff -ur a/bin/mklib b/bin/mklib
+--- a/bin/mklib        2018-01-30 22:09:32.000000000 +0100
++++ b/bin/mklib        2020-04-28 21:03:24.823472623 +0200
+@@ -2,31 +2,17 @@
+ 
+ # USAGE:
+ #   mklib <std|deb|opt|all>
+-#
+-# FUNCTION
+-#   Creates ".a" files in "$saclib/lib/" depending on the argument:
+-#   - 'std' causes a standard library to be built. The library file will have
+-#     the name "saclib.a" and the corresponding object files are in
+-#     "saclib/lib/obj".   
+-#   - 'deb' switches on the '-g' option of the compiler which includes 
+-#     debugging information in the object files. The library file will have
+-#     the name "saclibd.a" and the corresponding object files are in
+-#     "saclib/lib/objd".  
+-#   - 'opt' switches on the '-O' option which produces optimized code. The
+-#     library file will have the name "saclibo.a" and the corresponding object
+-#     files are in "saclib/lib/objo".
+-#   - 'all' builds all three types of libraries.
+ 
+-if [ $# -lt 1 ] 
++if [ $# -lt 1 ]
+ then
+   echo "USAGE:"
+   echo "  mklib <deb|opt|all>"
+   exit
+ fi
+ 
+-if [ $1 = "clean" ] 
++if [ $1 = "clean" ]
+ then
+-  ### remove .o and .a and makefiles
++  ### remove .o and .so and makefiles
+   echo "Removing object files, libraries and makefiles ..."
+   pushd >/dev/null $saclib/lib/objo
+   'rm' -f *
+@@ -35,7 +21,7 @@
+   'rm' -f *
+   popd >/dev/null
+   pushd >/dev/null $saclib/lib/
+-  'rm' -f *.a
++  'rm' -f *.so
+   popd >/dev/null
+   ### do sysdep cleanup
+   echo "Removing system-dependent files ..."
+@@ -57,12 +43,6 @@
+   exit
+ fi
+ 
+-
+-if [ ! -n "${CC+1}" ] 
+-then
+-  CC=cc
+-fi
+-
+ echo "Compiling with" $CC
+ 
+ if [ $1 = "std" ]
+@@ -70,15 +50,15 @@
+   echo "This option no longer exists!"
+ elif [ $1 = "deb" ]; then
+   pushd >/dev/null  $saclib/lib/objd
+-  make  CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
++  make  CC=$CC "SACFLAG=-fPIC ${CFLAGS} -DNO_SACLIB_MACROS" EXTENSION=d
+   popd >/dev/null
+ elif [ $1 = "opt" ]; then
+   pushd >/dev/null  $saclib/lib/objo
+-  make  CC=$CC "SACFLAG=" EXTENSION=o
++  make  CC=$CC "SACFLAG=-fPIC ${CFLAGS}" EXTENSION=o
+   popd >/dev/null
+ elif [ $1 = "all" ]; then
+   pushd >/dev/null  $saclib/lib/objd
+-  make  CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
++  make  CC=$CC "SACFLAG=-fPIC ${CFLAGS} -DNO_SACLIB_MACROS" EXTENSION=d
+   popd >/dev/null
+   pushd >/dev/null  $saclib/lib/objo
+   make  CC=$CC "SACFLAG=" EXTENSION=o
+diff -ur a/bin/mkmake b/bin/mkmake
+--- a/bin/mkmake       2018-01-30 22:09:32.000000000 +0100
++++ b/bin/mkmake       2020-04-28 21:29:02.709088176 +0200
+@@ -25,20 +25,16 @@
+ #       E.g. if <flag> is -g and <character> is d, the library will be
+ #   compiled with the debug option set and the library name will be
+ #   "saclibg.a".
+-# 
++#
+ # REMARK
+ #   This file should not be modified. Modify 'mkmake' instead and then use it
+-#   to create the new makefile. 
++#   to create the new makefile.
+ 
+ # Macros
+ 
+ SRCDIR   = ${saclib}/src
+-TARGET   = ${saclib}/lib/saclib${EXTENSION}.a
+-CFLAGS   = -I${saclib}/include -c ${SACFLAG}
+-AFLAGS   = -I${saclib}/include -P
+-AS       = as
+-AR       = ar
+-RANLIB   = ranlib
++TARGET   = ${saclib}/lib/${FULLLIBNAME}
++CFLAGS   = -I${saclib}/include ${SACFLAG} -fPIC
+ 
+ # Object files
+ 
+@@ -81,21 +77,13 @@
+ #
+ 
+ cat >> $MAKEFILE <<\EOF
+- 
++
+ 
+ # Target dependencies
+ 
+-new: ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4}
++$(TARGET): ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4}
+       rm -f ${TARGET}
+-      ${AR} cq ${TARGET} ${OBJS1}
+-      ${AR} cq ${TARGET} ${OBJS2a}
+-      ${AR} cq ${TARGET} ${OBJS2b}
+-      ${AR} cq ${TARGET} ${OBJS3}
+-      ${AR} cq ${TARGET} ${OBJS4}
+-#       Use "ar ts" if your system does not have "ranlib".
+-#     ${AR} ts ${TARGET}
+-#       Use "ranlib" if your system's "ar" does not have the option "s".
+-      ${RANLIB} ${TARGET}
++      $(CC) ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4} -fPIC -shared 
${CFLAGS} -o $@ ${LDFLAGS} -Wl,-soname,${FULLLIBNAME}
+       @echo "Created '${TARGET}'."
+ 
+ EOF
+@@ -113,7 +101,7 @@
+ 
+ 
+ 'ls' *.[c] 2> /dev/null |\
+-awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${CC} ${CFLAGS} 
${SRCDIR}/%s\n",$1,$0,$0}' >>$MAKEFILE
++awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${CC} ${CFLAGS} -c 
${SRCDIR}/%s\n",$1,$0,$0}' >>$MAKEFILE
+ 
+ 'ls' *.[s] 2> /dev/null |\
+ awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${AS} ${AFLAGS} ${SRCDIR}/%s -o 
%s.o\n",$1,$0,$0,$1}' >>$MAKEFILE
+@@ -123,7 +111,7 @@
+ 
+ #
+ ## Done
+-# 
++#
+ 
+ 'cp' $MAKEFILE $saclib/lib/objd
+ popd >/dev/null

diff --git a/sci-libs/saclib/saclib-2.2.7-r2.ebuild 
b/sci-libs/saclib/saclib-2.2.7-r2.ebuild
new file mode 100644
index 0000000..631d69b
--- /dev/null
+++ b/sci-libs/saclib/saclib-2.2.7-r2.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+inherit toolchain-funcs
+
+MYP="${PN}${PV}"
+
+MAJOR=$(ver_cut 1)
+MINOR=$(ver_cut 2)
+REVISION=$(ver_cut 3)
+LIBNAME="lib${PN}.so"
+MAJLIBNAME="${LIBNAME}.${MAJOR}"
+MINMAJLIBNAME="${MAJLIBNAME}.${MINOR}"
+FULLLIBNAME="${MINMAJLIBNAME}.${REVISION}"
+
+DESCRIPTION="Reference implementations of algorithms and forms the basis of 
QEPCAD"
+HOMEPAGE="https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html";
+SRC_URI="https://www.usna.edu/Users/cs/wcbrown/qepcad/INSTALL/${MYP}.tar.gz";
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="debug"
+
+RDEPEND=""
+DEPEND=""
+BDEPEND="
+       app-shells/bash
+       app-shells/tcsh
+"
+
+S="${WORKDIR}/${MYP}"
+
+PATCHES=( "${FILESDIR}/makefile.patch" )
+
+DOCS=( doc/saclib.pdf doc/saclocal.dvi doc/desc.doc )
+
+src_prepare() {
+       export saclib="${S}"
+       export FULLLIBNAME
+       export CC=$(tc-getCC)
+       default
+}
+
+src_configure() {
+       cd "${saclib}/bin" || die
+       ./sconf || die
+       ./mkproto || die
+       ./mkmake || die
+}
+
+src_compile() {
+       cd "${saclib}/bin" || die
+       if use debug ; then
+               ./mklib deb || die
+               cd ../lib/objd || die
+       else
+               ./mklib opt || die
+               cd ../lib/objo || die
+       fi
+
+       cd .. || die
+       ln -s "${FULLLIBNAME}" "${MINMAJLIBNAME}" || die
+       ln -s "${MINMAJLIBNAME}" "${MAJLIBNAME}" || die
+       ln -s "${MAJLIBNAME}" "${LIBNAME}" || die
+}
+
+src_install() {
+       einstalldocs
+       dolib.so "lib/${FULLLIBNAME}"
+       dolib.so "lib/${MINMAJLIBNAME}"
+       dolib.so "lib/${MAJLIBNAME}"
+       dolib.so "lib/${LIBNAME}"
+       insinto /usr/include/saclib
+       doins -r include/.
+}

Reply via email to