1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic toolchain-funcs
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"
16 KEYWORDS="amd64 ~ppc ~x86"
21 >=app-misc/editor-wrapper-3
33 "${FILESDIR}"/${P}-gcc-4.1.patch
34 # Bug https://bugs.gentoo.org/783192
35 "${FILESDIR}"/${P}-arlocal.patch
39 # spice accepts -O1 at most
42 # Avoid re-creating WORKDIR due to stupid mtime
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" \
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
66 ./util/build linux || die "build failed"
67 obj/bin/makeidx lib/helpdir/spice.txt || die "makeidx failed"
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
77 dodir /usr/$(get_libdir)/spice
78 cp -R lib/* "${ED}"/usr/$(get_libdir)/spice/ || die "failed to copy libraries"
81 dodoc readme readme.Linux notes/spice2