dev-lang: Remove *-fbsd KEYWORDS
[gentoo.git] / dev-lang / tcl / tcl-8.6.9.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools flag-o-matic multilib-minimal toolchain-funcs
7
8 MY_P="${PN}${PV}"
9
10 DESCRIPTION="Tool Command Language"
11 HOMEPAGE="http://www.tcl.tk/"
12 SRC_URI="mirror://sourceforge/tcl/${PN}-core${PV}-src.tar.gz"
13
14 LICENSE="tcltk"
15 SLOT="0/8.6"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="debug +threads"
18
19 RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]"
20 DEPEND="${RDEPEND}"
21
22 SPARENT="${WORKDIR}/${MY_P}"
23 S="${SPARENT}"/unix
24
25 PATCHES=(
26         "${FILESDIR}"/${PN}-8.5.13-multilib.patch
27         "${FILESDIR}"/${PN}-8.6.8-conf.patch # Bug 125971
28 )
29
30 src_prepare() {
31         find \
32                 "${SPARENT}"/compat/* \
33                 "${SPARENT}"/doc/try.n \
34                 -delete || die
35
36         pushd "${SPARENT}" &>/dev/null || die
37         default
38         popd &>/dev/null || die
39
40         # workaround stack check issues, bug #280934
41         use hppa && append-cflags "-DTCL_NO_STACK_CHECK=1"
42
43         tc-export CC
44
45         sed \
46                 -e '/chmod/s:555:755:g' \
47                 -i Makefile.in || die
48
49         sed \
50                 -e 's:-O[2s]\?::g' \
51                 -i tcl.m4 || die
52
53         mv configure.{in,ac} || die
54
55         eautoconf
56
57         multilib_copy_sources
58 }
59
60 multilib_src_configure() {
61         # We went ahead and deleted the whole compat/ subdir which means
62         # the configure tests to detect broken versions need to pass (else
63         # we'll fail to build).  This comes up when cross-compiling, but
64         # might as well get a minor configure speed up normally.
65         export ac_cv_func_memcmp_working="yes"
66         export tcl_cv_str{str,toul,tod}_unbroken="ok"
67         export tcl_cv_strtod_buggy="no"
68
69         econf \
70                 $(use_enable threads) \
71                 $(use_enable debug symbols)
72 }
73
74 multilib_src_install() {
75         #short version number
76         local v1=$(ver_cut 1-2)
77         local mylibdir=$(get_libdir)
78
79         S= default
80         # fix the tclConfig.sh to eliminate refs to the build directory
81         # and drop unnecessary -L inclusion to default system libdir
82
83         sed \
84                 -e "/^TCL_BUILD_LIB_SPEC=/s:-L$(pwd) *::g" \
85                 -e "/^TCL_LIB_SPEC=/s:-L${EPREFIX}/usr/${mylibdir} *::g" \
86                 -e "/^TCL_SRC_DIR=/s:${SPARENT}:${EPREFIX}/usr/${mylibdir}/tcl${v1}/include:g" \
87                 -e "/^TCL_BUILD_STUB_LIB_SPEC=/s:-L$(pwd) *::g" \
88                 -e "/^TCL_STUB_LIB_SPEC=/s:-L${EPREFIX}/usr/${mylibdir} *::g" \
89                 -e "/^TCL_BUILD_STUB_LIB_PATH=/s:$(pwd):${EPREFIX}/usr/${mylibdir}:g" \
90                 -e "/^TCL_LIBW_FILE=/s:'libtcl${v1}..TCL_DBGX..so':\"libtcl${v1}\$\{TCL_DBGX\}.so\":g" \
91                 -i "${ED}"/usr/${mylibdir}/tclConfig.sh || die
92         if use prefix && [[ ${CHOST} != *-darwin* && ${CHOST} != *-mint* ]] ; then
93                 sed \
94                         -e "/^TCL_CC_SEARCH_FLAGS=/s|'$|:${EPREFIX}/usr/${mylibdir}'|g" \
95                         -e "/^TCL_LD_SEARCH_FLAGS=/s|'$|:${EPREFIX}/usr/${mylibdir}'|" \
96                         -i "${ED}"/usr/${mylibdir}/tclConfig.sh || die
97         fi
98
99         # install private headers
100         insinto /usr/${mylibdir}/tcl${v1}/include/unix
101         doins *.h
102         insinto /usr/${mylibdir}/tcl${v1}/include/generic
103         doins "${SPARENT}"/generic/*.h
104         rm -f "${ED}"/usr/${mylibdir}/tcl${v1}/include/generic/{tcl,tclDecls,tclPlatDecls}.h || die
105
106         # install symlink for libraries
107         dosym libtcl${v1}$(get_libname) /usr/${mylibdir}/libtcl$(get_libname)
108         dosym libtclstub${v1}.a /usr/${mylibdir}/libtclstub.a
109
110         if multilib_is_native_abi; then
111                 dosym tclsh${v1} /usr/bin/tclsh
112                 dodoc "${SPARENT}"/{ChangeLog*,README,changes}
113         fi
114 }
115
116 pkg_postinst() {
117         for version in ${REPLACING_VERSIONS}; do
118                 if ver_test 8.6 -lt ${version}; then
119                         echo
120                         ewarn "You're upgrading from <${P}, you must recompile the other"
121                         ewarn "packages on your system that link with tcl after the upgrade"
122                         ewarn "completes. To perform this action, please run revdep-rebuild"
123                         ewarn "in package app-portage/gentoolkit."
124                         ewarn "If you have dev-lang/tk and dev-tcltk/tclx installed you should"
125                         ewarn "upgrade them before this recompilation, too,"
126                         echo
127                 fi
128         done
129 }