Gentoo Archives: gentoo-commits

From: Alessandro Barbieri <lssndrbarbieri@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-libs/saclib/files/, sci-libs/saclib/
Date: Tue, 28 Apr 2020 19:56:54
Message-Id: 1588103806.913e7f40b307960aa2e3e3cc20fb562d159d3bff.Alessandro-Barbieri@gentoo
1 commit: 913e7f40b307960aa2e3e3cc20fb562d159d3bff
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Tue Apr 28 19:56:18 2020 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Tue Apr 28 19:56:46 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=913e7f40
7
8 sci-libs/saclib: patched toolchain
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
12
13 sci-libs/saclib/files/makefile.patch | 150 +++++++++++++++++++++++++++++++++
14 sci-libs/saclib/saclib-2.2.7-r2.ebuild | 79 +++++++++++++++++
15 2 files changed, 229 insertions(+)
16
17 diff --git a/sci-libs/saclib/files/makefile.patch b/sci-libs/saclib/files/makefile.patch
18 new file mode 100644
19 index 0000000..bc49d0b
20 --- /dev/null
21 +++ b/sci-libs/saclib/files/makefile.patch
22 @@ -0,0 +1,150 @@
23 +diff -ur a/bin/mklib b/bin/mklib
24 +--- a/bin/mklib 2018-01-30 22:09:32.000000000 +0100
25 ++++ b/bin/mklib 2020-04-28 21:03:24.823472623 +0200
26 +@@ -2,31 +2,17 @@
27 +
28 + # USAGE:
29 + # mklib <std|deb|opt|all>
30 +-#
31 +-# FUNCTION
32 +-# Creates ".a" files in "$saclib/lib/" depending on the argument:
33 +-# - 'std' causes a standard library to be built. The library file will have
34 +-# the name "saclib.a" and the corresponding object files are in
35 +-# "saclib/lib/obj".
36 +-# - 'deb' switches on the '-g' option of the compiler which includes
37 +-# debugging information in the object files. The library file will have
38 +-# the name "saclibd.a" and the corresponding object files are in
39 +-# "saclib/lib/objd".
40 +-# - 'opt' switches on the '-O' option which produces optimized code. The
41 +-# library file will have the name "saclibo.a" and the corresponding object
42 +-# files are in "saclib/lib/objo".
43 +-# - 'all' builds all three types of libraries.
44 +
45 +-if [ $# -lt 1 ]
46 ++if [ $# -lt 1 ]
47 + then
48 + echo "USAGE:"
49 + echo " mklib <deb|opt|all>"
50 + exit
51 + fi
52 +
53 +-if [ $1 = "clean" ]
54 ++if [ $1 = "clean" ]
55 + then
56 +- ### remove .o and .a and makefiles
57 ++ ### remove .o and .so and makefiles
58 + echo "Removing object files, libraries and makefiles ..."
59 + pushd >/dev/null $saclib/lib/objo
60 + 'rm' -f *
61 +@@ -35,7 +21,7 @@
62 + 'rm' -f *
63 + popd >/dev/null
64 + pushd >/dev/null $saclib/lib/
65 +- 'rm' -f *.a
66 ++ 'rm' -f *.so
67 + popd >/dev/null
68 + ### do sysdep cleanup
69 + echo "Removing system-dependent files ..."
70 +@@ -57,12 +43,6 @@
71 + exit
72 + fi
73 +
74 +-
75 +-if [ ! -n "${CC+1}" ]
76 +-then
77 +- CC=cc
78 +-fi
79 +-
80 + echo "Compiling with" $CC
81 +
82 + if [ $1 = "std" ]
83 +@@ -70,15 +50,15 @@
84 + echo "This option no longer exists!"
85 + elif [ $1 = "deb" ]; then
86 + pushd >/dev/null $saclib/lib/objd
87 +- make CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
88 ++ make CC=$CC "SACFLAG=-fPIC ${CFLAGS} -DNO_SACLIB_MACROS" EXTENSION=d
89 + popd >/dev/null
90 + elif [ $1 = "opt" ]; then
91 + pushd >/dev/null $saclib/lib/objo
92 +- make CC=$CC "SACFLAG=" EXTENSION=o
93 ++ make CC=$CC "SACFLAG=-fPIC ${CFLAGS}" EXTENSION=o
94 + popd >/dev/null
95 + elif [ $1 = "all" ]; then
96 + pushd >/dev/null $saclib/lib/objd
97 +- make CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
98 ++ make CC=$CC "SACFLAG=-fPIC ${CFLAGS} -DNO_SACLIB_MACROS" EXTENSION=d
99 + popd >/dev/null
100 + pushd >/dev/null $saclib/lib/objo
101 + make CC=$CC "SACFLAG=" EXTENSION=o
102 +diff -ur a/bin/mkmake b/bin/mkmake
103 +--- a/bin/mkmake 2018-01-30 22:09:32.000000000 +0100
104 ++++ b/bin/mkmake 2020-04-28 21:29:02.709088176 +0200
105 +@@ -25,20 +25,16 @@
106 + # E.g. if <flag> is -g and <character> is d, the library will be
107 + # compiled with the debug option set and the library name will be
108 + # "saclibg.a".
109 +-#
110 ++#
111 + # REMARK
112 + # This file should not be modified. Modify 'mkmake' instead and then use it
113 +-# to create the new makefile.
114 ++# to create the new makefile.
115 +
116 + # Macros
117 +
118 + SRCDIR = ${saclib}/src
119 +-TARGET = ${saclib}/lib/saclib${EXTENSION}.a
120 +-CFLAGS = -I${saclib}/include -c ${SACFLAG}
121 +-AFLAGS = -I${saclib}/include -P
122 +-AS = as
123 +-AR = ar
124 +-RANLIB = ranlib
125 ++TARGET = ${saclib}/lib/${FULLLIBNAME}
126 ++CFLAGS = -I${saclib}/include ${SACFLAG} -fPIC
127 +
128 + # Object files
129 +
130 +@@ -81,21 +77,13 @@
131 + #
132 +
133 + cat >> $MAKEFILE <<\EOF
134 +-
135 ++
136 +
137 + # Target dependencies
138 +
139 +-new: ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4}
140 ++$(TARGET): ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4}
141 + rm -f ${TARGET}
142 +- ${AR} cq ${TARGET} ${OBJS1}
143 +- ${AR} cq ${TARGET} ${OBJS2a}
144 +- ${AR} cq ${TARGET} ${OBJS2b}
145 +- ${AR} cq ${TARGET} ${OBJS3}
146 +- ${AR} cq ${TARGET} ${OBJS4}
147 +-# Use "ar ts" if your system does not have "ranlib".
148 +-# ${AR} ts ${TARGET}
149 +-# Use "ranlib" if your system's "ar" does not have the option "s".
150 +- ${RANLIB} ${TARGET}
151 ++ $(CC) ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4} -fPIC -shared ${CFLAGS} -o $@ ${LDFLAGS} -Wl,-soname,${FULLLIBNAME}
152 + @echo "Created '${TARGET}'."
153 +
154 + EOF
155 +@@ -113,7 +101,7 @@
156 +
157 +
158 + 'ls' *.[c] 2> /dev/null |\
159 +-awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${CC} ${CFLAGS} ${SRCDIR}/%s\n",$1,$0,$0}' >>$MAKEFILE
160 ++awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${CC} ${CFLAGS} -c ${SRCDIR}/%s\n",$1,$0,$0}' >>$MAKEFILE
161 +
162 + 'ls' *.[s] 2> /dev/null |\
163 + awk -F. '{printf "%s.o: ${SRCDIR}/%s\n\t${AS} ${AFLAGS} ${SRCDIR}/%s -o %s.o\n",$1,$0,$0,$1}' >>$MAKEFILE
164 +@@ -123,7 +111,7 @@
165 +
166 + #
167 + ## Done
168 +-#
169 ++#
170 +
171 + 'cp' $MAKEFILE $saclib/lib/objd
172 + popd >/dev/null
173
174 diff --git a/sci-libs/saclib/saclib-2.2.7-r2.ebuild b/sci-libs/saclib/saclib-2.2.7-r2.ebuild
175 new file mode 100644
176 index 0000000..631d69b
177 --- /dev/null
178 +++ b/sci-libs/saclib/saclib-2.2.7-r2.ebuild
179 @@ -0,0 +1,79 @@
180 +# Copyright 1999-2020 Gentoo Authors
181 +# Distributed under the terms of the GNU General Public License v2
182 +
183 +EAPI="7"
184 +
185 +inherit toolchain-funcs
186 +
187 +MYP="${PN}${PV}"
188 +
189 +MAJOR=$(ver_cut 1)
190 +MINOR=$(ver_cut 2)
191 +REVISION=$(ver_cut 3)
192 +LIBNAME="lib${PN}.so"
193 +MAJLIBNAME="${LIBNAME}.${MAJOR}"
194 +MINMAJLIBNAME="${MAJLIBNAME}.${MINOR}"
195 +FULLLIBNAME="${MINMAJLIBNAME}.${REVISION}"
196 +
197 +DESCRIPTION="Reference implementations of algorithms and forms the basis of QEPCAD"
198 +HOMEPAGE="https://www.usna.edu/Users/cs/wcbrown/qepcad/B/QEPCAD.html"
199 +SRC_URI="https://www.usna.edu/Users/cs/wcbrown/qepcad/INSTALL/${MYP}.tar.gz"
200 +
201 +LICENSE="MIT"
202 +SLOT="0"
203 +KEYWORDS="~amd64"
204 +
205 +IUSE="debug"
206 +
207 +RDEPEND=""
208 +DEPEND=""
209 +BDEPEND="
210 + app-shells/bash
211 + app-shells/tcsh
212 +"
213 +
214 +S="${WORKDIR}/${MYP}"
215 +
216 +PATCHES=( "${FILESDIR}/makefile.patch" )
217 +
218 +DOCS=( doc/saclib.pdf doc/saclocal.dvi doc/desc.doc )
219 +
220 +src_prepare() {
221 + export saclib="${S}"
222 + export FULLLIBNAME
223 + export CC=$(tc-getCC)
224 + default
225 +}
226 +
227 +src_configure() {
228 + cd "${saclib}/bin" || die
229 + ./sconf || die
230 + ./mkproto || die
231 + ./mkmake || die
232 +}
233 +
234 +src_compile() {
235 + cd "${saclib}/bin" || die
236 + if use debug ; then
237 + ./mklib deb || die
238 + cd ../lib/objd || die
239 + else
240 + ./mklib opt || die
241 + cd ../lib/objo || die
242 + fi
243 +
244 + cd .. || die
245 + ln -s "${FULLLIBNAME}" "${MINMAJLIBNAME}" || die
246 + ln -s "${MINMAJLIBNAME}" "${MAJLIBNAME}" || die
247 + ln -s "${MAJLIBNAME}" "${LIBNAME}" || die
248 +}
249 +
250 +src_install() {
251 + einstalldocs
252 + dolib.so "lib/${FULLLIBNAME}"
253 + dolib.so "lib/${MINMAJLIBNAME}"
254 + dolib.so "lib/${MAJLIBNAME}"
255 + dolib.so "lib/${LIBNAME}"
256 + insinto /usr/include/saclib
257 + doins -r include/.
258 +}