sci-electronics/kicad-templates: Bump to 5.1.4
[gentoo.git] / sci-electronics / systemc / systemc-2.3.0-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=4
5
6 inherit eutils multilib toolchain-funcs autotools-utils
7 MY_P="${P}a"
8
9 DESCRIPTION="A C++ based modeling platform for VLSI and system-level co-design"
10 HOMEPAGE="http://accellera.org/community/systemc"
11 SRC_URI="http://accellera.org/images/downloads/standards/${PN}/${MY_P}.tar.gz"
12
13 SLOT="0"
14 LICENSE="Apache-2.0"
15 IUSE="doc static-libs"
16 KEYWORDS="~amd64 ~x86"
17
18 RESTRICT="test"
19
20 AUTOTOOLS_IN_SOURCE_BUILD=1
21
22 S="${WORKDIR}/${MY_P}"
23
24 src_prepare() {
25         # drop compiler check to enable use of CXX
26         epatch "${FILESDIR}"/${P}-config.patch
27
28         sed -i -e "s:OPT_CXXFLAGS=\"-O3\":OPT_CXXFLAGS=\"\":g" configure.in || die "Patching configure.in failed"
29
30         sed -i -e "s:lib-\$(TARGET_ARCH):$(get_libdir):g" $(find . -name Makefile.am) || die "Patching Makefile.am failed"
31
32         # respect DESTDIR
33         sed -i -e "s:\$(prefix):\$(DESTDIR)\$(prefix):g" $(find . -name Makefile.am) || die "Patching Makefile.am failed"
34
35         eautoreconf
36
37         sed -i -e "s:\$(DESTDIR)\$(libdir):\$(libdir):g" src/sysc/Makefile.in || die
38
39         for sfile in src/sysc/qt/md/*.s ; do
40                 sed -i -e '$a \
41 #if defined(__linux__) && defined(__ELF__) \
42 .section .note.GNU-stack,"",%progbits \
43 #endif' "${sfile}" || die "Patching ${sfile} failed"
44         done
45 }
46
47 src_configure() {
48         econf $(use_enable static-libs static) CXX=$(tc-getCXX)
49 }
50
51 src_compile() {
52         cd src
53         default
54 }
55
56 src_install() {
57         dodoc AUTHORS ChangeLog INSTALL NEWS README RELEASENOTES
58         use doc && dodoc -r docs/*
59         cd src
60         autotools-utils_src_install
61 }
62
63 pkg_postinst() {
64         elog "If you want to run the examples, you need to :"
65         elog "    tar xvfz ${PORTAGE_ACTUAL_DISTDIR}/${A}"
66         elog "    cd ${MY_P}"
67         elog "    find examples -name 'Makefile.*' -exec sed -i -e 's/-lm/-lm -lpthread/' '{}' \;"
68         elog "    ./configure"
69         elog "    cd examples"
70         elog "    make check"
71 }