dev-python/mpmath: Bump to 1.4.0_alpha4
[gentoo/gentoo.git] / sci-electronics / spice / spice-3.5.5-r4.ebuild
blob383863ebe1d06d5895c76b85ecb0c6b0492cc1aa
1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit flag-o-matic toolchain-funcs
8 MY_P="spice3f5sfix"
9 DESCRIPTION="general-purpose circuit simulation program"
10 HOMEPAGE="http://bwrcs.EECS.Berkeley.EDU/Classes/IcBook/SPICE/"
11 SRC_URI="https://www.ibiblio.org/pub/Linux/apps/circuits/${MY_P}.tar.gz"
12 S=${WORKDIR}/${MY_P}
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="amd64 ~ppc ~x86"
18 RDEPEND="
19         sys-libs/ncurses:0=
20         x11-libs/libXaw
21         >=app-misc/editor-wrapper-3
24 DEPEND="${RDEPEND}
25         x11-base/xorg-proto
28 BDEPEND="
29         virtual/pkgconfig
32 PATCHES=(
33         "${FILESDIR}"/${P}-gcc-4.1.patch
34         # Bug https://bugs.gentoo.org/783192
35         "${FILESDIR}"/${P}-arlocal.patch
38 src_prepare() {
39         # spice accepts -O1 at most
40         replace-flags -O* -O1
42         # Avoid re-creating WORKDIR due to stupid mtime
43         touch ..
45         sed -i -e "s/termcap/ncurses/g" \
46                 -e "s/joe/\/usr\/libexec\/editor/g" \
47                 -e "s/-O2 -s/${CFLAGS}/g" \
48                 -e "s/-lncurses -lm -s/-lncurses -lm ${LDFLAGS}/" \
49                 -e "s/SPICE_DIR)\/lib/SPICE_DIR)\/$(get_libdir)\/spice/g" \
50                 -e "s/\/usr\/local\/spice/\/usr/g" \
51                 -e "s/\/X11R6//" \
52                 conf/linux || die
53         sed -i -e "s/head -1/head -n 1/" util/build || die
55         # fix possible buffer overflow (bug #339539)
56         sed -i -e "s/fgets(buf, BSIZE_SP/fgets(buf, sizeof(buf)/g" \
57                 src/lib/fte/misccoms.c || die
59         # fix missing libtinfo if ncurses compiled with USE=tinfo (bug #605718)
60         sed -i -e "s/-lncurses/$($(tc-getPKG_CONFIG) --libs ncurses)/g" conf/linux || die
62         default
65 src_compile() {
66         ./util/build linux || die "build failed"
67         obj/bin/makeidx lib/helpdir/spice.txt || die "makeidx failed"
70 src_install() {
71         # install binaries
72         dobin obj/bin/{spice3,nutmeg,sconvert,multidec,proc2mod}
73         newbin obj/bin/help spice.help
74         dosym spice3 /usr/bin/spice
75         # install runtime stuff
76         rm lib/make* || die
77         dodir /usr/$(get_libdir)/spice
78         cp -R lib/* "${ED}"/usr/$(get_libdir)/spice/ || die "failed to copy libraries"
79         # install docs
80         doman man/man1/*.1
81         dodoc readme readme.Linux notes/spice2