dev-lang/erlang: bump up to 22.3.3
[gentoo.git] / dev-lang / tk / tk-8.6.9.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools multilib-minimal prefix toolchain-funcs virtualx
7
8 MY_P="${PN}${PV/_beta/b}"
9
10 DESCRIPTION="Tk Widget Set"
11 HOMEPAGE="http://www.tcl.tk/"
12 SRC_URI="mirror://sourceforge/tcl/${MY_P}-src.tar.gz"
13
14 LICENSE="tcltk"
15 SLOT="0/8.6"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="debug +threads truetype aqua xscreensaver"
18 RESTRICT="!test? ( test )"
19
20 RDEPEND="
21         !aqua? (
22                 >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}]
23                 >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
24                 >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}]
25                 truetype? ( >=x11-libs/libXft-2.3.1-r1[${MULTILIB_USEDEP}] )
26                 xscreensaver? ( >=x11-libs/libXScrnSaver-1.2.2-r1[${MULTILIB_USEDEP}] )
27         )
28         ~dev-lang/tcl-${PV}:0=[${MULTILIB_USEDEP}]"
29 DEPEND="${RDEPEND}
30         !aqua? ( x11-base/xorg-proto )"
31
32 # Not bumped to 8.6
33 #RESTRICT=test
34
35 SPARENT="${WORKDIR}/${MY_P}"
36 S="${SPARENT}"/unix
37
38 PATCHES=(
39         "${FILESDIR}"/${PN}-8.5.11-fedora-xft.patch
40         "${FILESDIR}"/${PN}-8.5.13-multilib.patch
41         "${FILESDIR}"/${PN}-8.4.15-aqua.patch
42         "${FILESDIR}"/${P}-conf.patch # Bug 125971
43 )
44
45 src_prepare() {
46         find \
47                 "${SPARENT}"/compat/* \
48                 -delete || die
49
50         pushd "${SPARENT}" &>/dev/null || die
51         default
52         popd &>/dev/null || die
53         eprefixify Makefile.in
54
55         # Make sure we use the right pkg-config, and link against fontconfig
56         # (since the code base uses Fc* functions).
57         sed \
58                 -e 's/FT_New_Face/XftFontOpen/g' \
59                 -e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
60                 -e 's:xft freetype2:xft freetype2 fontconfig:' \
61                 -i configure.in || die
62         rm configure || die
63
64         tc-export CC
65
66         sed \
67                 -e '/chmod/s:555:755:g' \
68                 -i Makefile.in || die
69
70         sed \
71                 -e 's:-O[2s]\?::g' \
72                 -i tcl.m4 || die
73
74         mv configure.{in,ac} || die
75
76         eautoconf
77
78         multilib_copy_sources
79 }
80
81 multilib_src_configure() {
82         if tc-is-cross-compiler ; then
83                 export ac_cv_func_strtod=yes
84                 export tcl_cv_strtod_buggy=1
85         fi
86
87         local mylibdir=$(get_libdir)
88
89         econf \
90                 --with-tcl="${EPREFIX}/usr/${mylibdir}" \
91                 $(use_enable threads) \
92                 $(use_enable aqua) \
93                 $(use_enable truetype xft) \
94                 $(use_enable xscreensaver xss) \
95                 $(use_enable debug symbols)
96 }
97
98 multilib_src_test() {
99         virtx emake test
100 }
101
102 multilib_src_install() {
103         #short version number
104         local v1=$(ver_cut 1-2)
105         local mylibdir=$(get_libdir)
106
107         S= default
108
109         # normalize $S path, bug #280766 (pkgcore)
110         local nS="$(cd "${S}"; pwd)"
111
112         # fix the tkConfig.sh to eliminate refs to the build directory
113         # and drop unnecessary -L inclusion to default system libdir
114
115         sed \
116                 -e "/^TK_BUILD_LIB_SPEC=/s:-L${S}-\w*\.\w* ::g" \
117                 -e "/^TK_LIB_SPEC=/s:-L${EPREFIX}/usr/${mylibdir} *::g" \
118                 -e "/^TK_SRC_DIR=/s:${SPARENT}:${EPREFIX}/usr/${mylibdir}/tk${v1}/include:g" \
119                 -e "/^TK_BUILD_STUB_LIB_SPEC=/s:-L${S}-\w*\.\w* *::g" \
120                 -e "/^TK_STUB_LIB_SPEC=/s:-L${EPREFIX}/usr/${mylibdir} *::g" \
121                 -e "/^TK_BUILD_STUB_LIB_PATH=/s:${S}-\w*\.\w*:${EPREFIX}/usr/${mylibdir}:g" \
122                 -e "/^TK_LIB_FILE=/s:'libtk${v1}..TK_DBGX..so':\"libk${v1}\$\{TK_DBGX\}.so\":g" \
123                 -i "${ED}"/usr/${mylibdir}/tkConfig.sh || die
124         if use prefix && [[ ${CHOST} != *-darwin* && ${CHOST} != *-mint* ]] ; then
125                 sed \
126                         -e "/^TK_CC_SEARCH_FLAGS=/s|'$|:${EPREFIX}/usr/${mylibdir}'|g" \
127                         -e "/^TK_LD_SEARCH_FLAGS=/s|'$|:${EPREFIX}/usr/${mylibdir}'|" \
128                         -i "${ED}"/usr/${mylibdir}/tkConfig.sh || die
129         fi
130
131         # install private headers
132         insinto /usr/${mylibdir}/tk${v1}/include/unix
133         doins "${S}"/*.h
134         insinto /usr/${mylibdir}/tk${v1}/include/generic
135         doins "${SPARENT}"/generic/*.h
136         rm -f "${ED}"/usr/${mylibdir}/tk${v1}/include/generic/{tk,tkDecls,tkPlatDecls}.h || die
137
138         # install symlink for libraries
139         dosym libtk${v1}$(get_libname) /usr/${mylibdir}/libtk$(get_libname)
140         dosym libtkstub${v1}.a /usr/${mylibdir}/libtkstub.a
141
142         if multilib_is_native_abi; then
143                 dosym wish${v1} /usr/bin/wish
144                 dodoc "${SPARENT}"/{ChangeLog*,README,changes}
145         fi
146 }