1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python{2_7,3_6} )
6 GENTOO_DEPEND_ON_PERL=no
7 inherit eutils multilib perl-module python-r1 toolchain-funcs
9 DESCRIPTION="A library which implements a curses-based widget set for text terminals"
10 HOMEPAGE="http://www.clifford.at/stfl/"
11 SRC_URI="http://www.clifford.at/${PN}/${P}.tar.gz"
15 KEYWORDS="amd64 ppc ~ppc64 x86"
16 IUSE="examples perl python ruby static-libs"
17 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
20 sys-libs/ncurses:0=[unicode]
21 perl? ( dev-lang/perl:= )
22 ruby? ( dev-lang/ruby:* )
23 python? ( ${PYTHON_DEPS} )
26 perl? ( dev-lang/swig )
27 python? ( >=dev-lang/swig-1.3.40 )
28 ruby? ( dev-lang/swig )
34 -e 's/^\(all:.*\) example/\1/' \
35 -e 's/$(CC) -shared/$(CC) $(LDFLAGS) -shared/' \
36 -e 's/ -o $@ $(LDLIBS) $^/ $^ $(LDLIBS) -o $@/' \
37 -e 's/-lncursesw/-lncursesw -pthread/' \
38 Makefile || die "sed failed"
40 if ! use static-libs ; then
41 sed -i -e "/install .* libstfl.a/d" Makefile || die
44 epatch "${FILESDIR}"/${PN}-0.21-python.patch
45 epatch "${FILESDIR}"/${PN}-0.22-soname-symlink.patch
46 epatch "${FILESDIR}"/${PN}-0.22-ruby-sharedlib.patch
49 echo "FOUND_PERL5=1" >> Makefile.cfg
51 echo "FOUND_PERL5=0" >> Makefile.cfg
55 echo "FOUND_RUBY=1" >> Makefile.cfg
57 echo "FOUND_RUBY=0" >> Makefile.cfg
60 echo "FOUND_PYTHON=0" >> Makefile.cfg
63 src_configure() { :; }
66 emake CC="$(tc-getCC)"
69 local BUILD_DIR="${S}/python"
72 # Based on code from python/Makefile.snippet.
74 pushd "${BUILD_DIR}" &>/dev/null || die
75 echo swig -python -threads stfl.i
76 swig -python -threads stfl.i || die
77 echo "$(tc-getCC)" ${CFLAGS} ${LDFLAGS} -shared -pthread -fPIC stfl_wrap.c -I$(python_get_includedir) -I.. ../libstfl.so.${PV} -lncursesw -o _stfl.so
78 "$(tc-getCC)" ${CFLAGS} ${LDFLAGS} -shared -pthread -fPIC stfl_wrap.c -I$(python_get_includedir) -I.. ../libstfl.so.${PV} -lncursesw -o _stfl.so || die
79 popd &>/dev/null || die
81 python_foreach_impl building
86 emake prefix="/usr" DESTDIR="${D}" libdir="$(get_libdir)" install
89 local BUILD_DIR="${S}/python"
92 pushd "${BUILD_DIR}" &>/dev/null || die
93 python_domodule stfl.py _stfl.so
94 popd &>/dev/null || die
96 python_foreach_impl installation
101 local exdir="/usr/share/doc/${PF}/examples"
102 if use examples ; then
104 doins example.{c,stfl}
105 insinto ${exdir}/python
106 doins python/example.py
108 insinto ${exdir}/perl
109 doins perl5/example.pl
112 insinto ${exdir}/ruby
113 doins ruby/example.rb