Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-electronics/ngspice/, sci-electronics/ngspice/files/
Date: Thu, 28 Dec 2017 13:26:42
Message-Id: 1514467578.5e3a68ac72fd7e3da395fc9a055295e18c091fea.marecki@gentoo
1 commit: 5e3a68ac72fd7e3da395fc9a055295e18c091fea
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 28 13:23:24 2017 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 28 13:26:18 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e3a68ac
7
8 sci-electronics/ngspice: support building shared libs and the Tcl module
9
10 Also a few dependency fixes + restrict tests again.
11
12 Submitted-by: Fabio Rossi <rossi.f <AT> inwind.it>
13 Closes: https://bugs.gentoo.org/632140
14 Package-Manager: Portage-2.3.13, Repoman-2.3.3
15
16 .../files/ngspice-27-blt_linkage_workaround.patch | 12 ++
17 .../ngspice-27-fix_parsing_tcl_commands.patch | 16 ++
18 sci-electronics/ngspice/metadata.xml | 3 +
19 sci-electronics/ngspice/ngspice-27-r1.ebuild | 189 +++++++++++++++++++++
20 4 files changed, 220 insertions(+)
21
22 diff --git a/sci-electronics/ngspice/files/ngspice-27-blt_linkage_workaround.patch b/sci-electronics/ngspice/files/ngspice-27-blt_linkage_workaround.patch
23 new file mode 100644
24 index 00000000000..53415c748d6
25 --- /dev/null
26 +++ b/sci-electronics/ngspice/files/ngspice-27-blt_linkage_workaround.patch
27 @@ -0,0 +1,12 @@
28 +--- a/configure.ac
29 ++++ b/configure.ac
30 +@@ -461,6 +461,9 @@
31 + AC_MSG_ERROR([Couldn't find BLT])
32 + fi
33 + rm -f conftest.tcl
34 ++
35 ++ AC_SEARCH_LIBS([Blt_GetVector], [BLT BLT24 BLT25],,
36 ++ [AC_MSG_ERROR([Couldnt find BLT library.])])
37 +
38 + AC_CHECK_LIB([pthread], [pthread_create])
39 +
40
41 diff --git a/sci-electronics/ngspice/files/ngspice-27-fix_parsing_tcl_commands.patch b/sci-electronics/ngspice/files/ngspice-27-fix_parsing_tcl_commands.patch
42 new file mode 100644
43 index 00000000000..bad336590df
44 --- /dev/null
45 +++ b/sci-electronics/ngspice/files/ngspice-27-fix_parsing_tcl_commands.patch
46 @@ -0,0 +1,16 @@
47 +--- a/src/tclspice.c
48 ++++ b/src/tclspice.c
49 +@@ -828,10 +828,9 @@
50 + int i;
51 + NG_IGNORE(clientData);
52 + save_interp();
53 +- /* Looks backwards through the first command and strips the :: part */
54 +- for (i = strlen(argv[0])-1; i > 0; i--)
55 +- if (argv[0][i] == *":")
56 +- argv[0] += i + 1;
57 ++ char *prefix = strstr(argv[0], "spice::");
58 ++ if (prefix)
59 ++ argv[0] = prefix + 7;
60 + return _run(argc, (char **)argv);
61 + }
62 +
63
64 diff --git a/sci-electronics/ngspice/metadata.xml b/sci-electronics/ngspice/metadata.xml
65 index 54267123c56..ed47ec5f170 100644
66 --- a/sci-electronics/ngspice/metadata.xml
67 +++ b/sci-electronics/ngspice/metadata.xml
68 @@ -9,6 +9,9 @@
69 Ngspice is a mixed-level/mixed-signal circuit simulator. Its code is based on
70 three open source software packages: Spice3f5, Cider1b1 and Xspice.
71 </longdescription>
72 + <use>
73 + <flag name="shared">Build ngspice as a shared library</flag>
74 + </use>
75 <upstream>
76 <remote-id type="sourceforge">ngspice</remote-id>
77 </upstream>
78
79 diff --git a/sci-electronics/ngspice/ngspice-27-r1.ebuild b/sci-electronics/ngspice/ngspice-27-r1.ebuild
80 new file mode 100644
81 index 00000000000..372ba4f94d7
82 --- /dev/null
83 +++ b/sci-electronics/ngspice/ngspice-27-r1.ebuild
84 @@ -0,0 +1,189 @@
85 +# Copyright 1999-2017 Gentoo Foundation
86 +# Distributed under the terms of the GNU General Public License v2
87 +
88 +EAPI=6
89 +
90 +inherit autotools multibuild toolchain-funcs
91 +
92 +DESCRIPTION="The Next Generation Spice (Electronic Circuit Simulator)"
93 +SRC_URI="mirror://sourceforge/ngspice/${P}.tar.gz
94 + doc? ( mirror://sourceforge/ngspice/${P}-manual.pdf )"
95 +HOMEPAGE="http://ngspice.sourceforge.net"
96 +LICENSE="BSD GPL-2"
97 +
98 +SLOT="0"
99 +IUSE="X debug doc examples fftw openmp readline shared tcl"
100 +KEYWORDS="~amd64 ~ppc ~sparc ~x86 ~x64-macos"
101 +
102 +# See bug #642460
103 +RESTRICT="test"
104 +
105 +DEPEND="sys-libs/ncurses:0=
106 + X? ( x11-libs/libXaw
107 + x11-libs/libXt
108 + x11-libs/libX11 )
109 + fftw? ( sci-libs/fftw:3.0 )
110 + readline? ( sys-libs/readline:0= )
111 + tcl? ( dev-lang/tcl:0
112 + dev-tcltk/blt )"
113 +RDEPEND="${DEPEND}
114 + X? ( sci-visualization/xgraph )"
115 +
116 +DOCS=(
117 + ANALYSES
118 + AUTHORS
119 + BUGS
120 + ChangeLog
121 + DEVICES
122 + NEWS
123 + README
124 + Stuarts_Poly_Notes
125 +)
126 +
127 +PATCHES=(
128 + "${FILESDIR}"/${P}-autoconf_fftw3.patch
129 + "${FILESDIR}"/${P}-blt_linkage_workaround.patch
130 + "${FILESDIR}"/${P}-fix_parsing_tcl_commands.patch
131 + "${FILESDIR}"/${P}-split_terminfo.patch
132 +)
133 +
134 +pkg_setup() {
135 + MULTIBUILD_VARIANTS=( "binaries" )
136 + use shared && MULTIBUILD_VARIANTS+=( "shared" )
137 + use tcl && MULTIBUILD_VARIANTS+=( "tcl" )
138 + use openmp && tc-check-openmp
139 +}
140 +
141 +src_prepare() {
142 + default
143 +
144 + if use tcl; then
145 + if use examples; then
146 + find examples/tclspice -type f -iname \*tcl |
147 + while read s
148 + do
149 + sed -i -e 's@../../../src/.libs/libspice.so@××××××××.so@g' \
150 + -e 's@package require BLT@package require Tk\npackage require BLT@g' \
151 + -e "s@spice::codemodel \(.*\)/\(.*\).cm@spice::codemodel /usr/$(get_libdir)/ngspice/\2.cm@g" \
152 + "${s}" || die "sed failed"
153 + done
154 + fi
155 + fi
156 +
157 + eautoreconf
158 +}
159 +
160 +src_configure() {
161 + multibuild_copy_sources
162 + multibuild_foreach_variant ngspice_configure
163 +}
164 +
165 +ngspice_configure() {
166 + pushd "${BUILD_DIR}"
167 +
168 + local myconf
169 + if use debug; then
170 + myconf="--enable-debug \
171 + --enable-ftedebug \
172 + --enable-cpdebug \
173 + --enable-sensdebug \
174 + --enable-asdebug \
175 + --enable-stepdebug \
176 + --enable-pzdebug"
177 + else
178 + myconf="--disable-debug \
179 + --disable-ftedebug \
180 + --disable-cpdebug \
181 + --disable-sensdebug \
182 + --disable-asdebug \
183 + --disable-stepdebug \
184 + --disable-pzdebug"
185 + fi
186 + # As of December 2017, these do not compile
187 + myconf="${myconf} \
188 + --disable-blktmsdebug \
189 + --disable-smltmsdebug"
190 +
191 + myconf="${myconf} \
192 + --enable-xspice \
193 + --enable-cider \
194 + --enable-ndev \
195 + --disable-xgraph \
196 + --disable-dependency-tracking \
197 + --disable-rpath \
198 + $(use_enable openmp) \
199 + $(use_with fftw fftw3) \
200 + $(use_with readline)"
201 +
202 + if [ "${MULTIBUILD_VARIANT}" == "shared" ]; then
203 + myconf="${myconf} \
204 + --with-ngshared"
205 + elif [ "${MULTIBUILD_VARIANT}" == "tcl" ]; then
206 + myconf="${myconf} \
207 + --with-tcl"
208 + else
209 + myconf="${myconf} \
210 + $(use_with X x)"
211 + fi
212 +
213 + econf ${myconf}
214 +}
215 +
216 +src_compile() {
217 + multibuild_foreach_variant ngspice_compile
218 +}
219 +
220 +ngspice_compile() {
221 + pushd "${BUILD_DIR}"
222 + default
223 +}
224 +
225 +src_install() {
226 + multibuild_foreach_variant ngspice_install
227 +
228 + # merge the installations of all variants
229 + for v in "${MULTIBUILD_VARIANTS[@]}" ; do
230 + cp -a "${D}_${v}"/* "${D}" || die "Failed to combine multibuild installations"
231 + rm -rf "${D}_${v}"
232 + done
233 +
234 + use tcl && DOCS+=( README.tcl )
235 + use doc && DOCS+=( "${DISTDIR}"/${P}-manual.pdf )
236 +
237 + default
238 +
239 + # We don't need ngmakeidx to be installed
240 + rm -f "${D}"/usr/bin/ngmakeidx
241 + rm -f "${D}"/usr/share/man/man1/ngmakeidx.1
242 +
243 + if use examples; then
244 + use tcl || rm -rf examples/tclspice
245 +
246 + insinto /usr/share/${PN}
247 + doins -r examples
248 + fi
249 +}
250 +
251 +ngspice_install() {
252 + pushd "${BUILD_DIR}"
253 +
254 + emake DESTDIR="${D}_${MULTIBUILD_VARIANT}" install
255 +
256 + # Strip shared-library and Tcl-module builds to the bare minimum;
257 + # all the support files will have been handled by the 'binaries' build.
258 + if [ "${MULTIBUILD_VARIANT}" != "binaries" ]; then
259 + rm -rf "${D}_${MULTIBUILD_VARIANT}"/usr/bin{,.debug}
260 + rm -rf "${D}_${MULTIBUILD_VARIANT}"/usr/share
261 + rm -rf "${D}_${MULTIBUILD_VARIANT}"/usr/$(get_libdir)/*.la
262 + rm -rf "${D}_${MULTIBUILD_VARIANT}"/usr/$(get_libdir)/ngspice/*.cm{,.debug}
263 + fi
264 +}
265 +
266 +src_test() {
267 + multibuild_foreach_variant ngspice_test
268 +}
269 +
270 +ngspice_test() {
271 + pushd "${BUILD_DIR}"
272 + default
273 +}