Gentoo Archives: gentoo-alt

From: "Gregory M. Turner" <gmt@×××××.us>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] readline->libncursesw.so?
Date: Sat, 18 Aug 2012 03:16:01
Message-Id: 502EF6F4.3040507@malth.us
1 This is pretty much off-topic, but:
2
3 o It's kind-of off-topic everywhere
4 o I've only tested this on prefix
5 o I've posted too many low-content posts on -dev lately :)
6
7 The "inspiration" for this comes from the readline cygport. I had a
8 similar patch in my overlay tree, where, frankly, I tend to slavishly
9 imitate cygports, at least until I manage to understand it and can
10 intelligently gentoo-ize their changes.
11
12 Anyhow, it occurred to me that there might be nothing cygwin-specific
13 about this particular patch, so I tested it on an x86-linux overlay and
14 "it works" (so far). If there's any interest I could test more
15 environments.
16
17 I guess I should say what I'm talking about. The following patches the
18 readline ebuild so that libreadline will depend on libncursesw instead
19 of libncurses (if and only if the unicode use-flag is enabled). From
20 what I can glean from the interweb, some distros do this and some don't.
21 As for what the actual advantages or disadvantages might be,
22 I really have no clue.
23
24 I have heard some buzz that loading ncurses and ncursesw into the same
25 process space can cause problems, so there is, purportedly, at least,
26 some potential for this to trigger a reverse-dependency cascade forcing
27 ncursesw down the throat of a bunch of different ebuilds (if the unicode
28 use-flag is set)
29
30 Whether that's a bad or a good thing is open for debate.
31
32 I'm skeptical, insofar as it fixes something that doesn't seem broken,
33 but thought I should document, somewhere, that it "works for me," and
34 see if maybe someone who knows and/or cares more about this than I has
35 any input.
36
37 diff -u a/sys-libs/readline/readline-6.2_p1-r1.ebuild
38 b/sys-libs/readline/readline-6.2_p1-r1.ebuild
39 --- a/sys-libs/readline/readline-6.2_p1-r1.ebuild 2012-05-26
40 07:44:24.000000000 -0700
41 +++ b/sys-libs/readline/readline-6.2_p1-r1.ebuild 2012-08-17
42 16:12:39.704843218 -0700
43 @@ -2,6 +2,7 @@
44 # Distributed under the terms of the GNU General Public License v2
45 # $Header:
46 /var/cvsroot/gentoo-x86/sys-libs/readline/readline-6.2_p1-r1.ebuild,v
47 1.4 2012/04/30 01:36:43 vapier Exp $
48
49 +EAPI=2
50 inherit eutils multilib toolchain-funcs flag-o-matic
51
52 # Official patches
53 @@ -33,9 +34,9 @@
54 LICENSE="GPL-3"
55 SLOT="0"
56 KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux
57 ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos
58 ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris
59 ~x86-solaris"
60 -IUSE="static-libs"
61 +IUSE="static-libs unicode"
62
63 -RDEPEND=">=sys-libs/ncurses-5.2-r2"
64 +RDEPEND=">=sys-libs/ncurses-5.2-r2[unicode=]"
65 DEPEND="${RDEPEND}"
66
67 S=${WORKDIR}/${MY_P}
68 @@ -45,6 +46,9 @@
69
70 cd "${S}"
71 [[ ${PLEVEL} -gt 0 ]] && epatch $(patches -s)
72 +}
73 +
74 +src_prepare() {
75
76 epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
77 epatch "${FILESDIR}"/${PN}-5.2-no-ignore-shlib-errors.patch #216952
78 @@ -60,8 +64,11 @@
79 epatch "${FILESDIR}"/${PN}-6.1-aix-expfull.patch
80 epatch "${FILESDIR}"/${PN}-6.1-aix-soname.patch
81
82 + ncursesw=
83 + use unicode && ncursesw=w
84 +
85 # force ncurses linking #71420
86 - sed -i -e 's:^SHLIB_LIBS=:SHLIB_LIBS=-lncurses:'
87 support/shobj-conf || die "sed"
88 + sed -i -e "s:^SHLIB_LIBS=:SHLIB_LIBS=-lncurses${ncursesw}:"
89 support/shobj-conf || die "sed"
90
91 # fix building under Gentoo/FreeBSD; upstream FreeBSD deprecated
92 # objformat for years, so we don't want to rely on that.
93 @@ -73,12 +80,14 @@
94 ln -s ../.. examples/rlfe/readline # for local readline headers
95 }
96
97 -src_compile() {
98 +src_configure() {
99 # fix implicit decls with widechar funcs
100 append-cppflags -D_GNU_SOURCE
101 #
102 http://lists.gnu.org/archive/html/bug-readline/2010-07/msg00013.html
103 append-cppflags -Dxrealloc=_rl_realloc -Dxmalloc=_rl_malloc
104 -Dxfree=_rl_free
105
106 + use unicode && append-cppflags -I/usr/include/ncursesw
107 +
108 # This is for rlfe, but we need to make sure LDFLAGS doesn't change
109 # so we can re-use the config cache file between the two.
110 append-ldflags -L.
111 @@ -86,6 +95,15 @@
112 --cache-file="${S}"/config.cache \
113 --with-curses \
114 $(use_enable static-libs static)
115 + if ! tc-is-cross-compiler ; then
116 + # code is full of AC_TRY_RUN()
117 + cd examples/rlfe
118 + econf --cache-file="${S}"/config.cache
119 + fi
120 +}
121 +
122 +src_compile() {
123 + cd "${S}"
124 emake || die
125
126 if ! tc-is-cross-compiler ; then
127 @@ -96,7 +114,6 @@
128 ln -s ../../shlib/lib${l}*$(get_libname)*
129 lib${l}$(get_libname)
130 ln -sf ../../lib${l}.a lib${l}.a
131 done
132 - econf --cache-file="${S}"/config.cache
133 emake || die
134 fi
135 }
136 ------------------------
137 -gmt