ncurses: Use symlinks instead of linker scripts

The effect will not change, but with symlinks ld can save some time
invoking open(), read(), etc. syscalls and parsing the linker scripts.

Note that I've also removed "libcursesw" symlink because this library
has never existed.  Instead libcurses.so is created as a symlink
direct to libncursesw.so.
This commit is contained in:
Xi Ruoyao 2024-01-19 12:57:51 +08:00
parent d282f88dea
commit 943f22504e
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
2 changed files with 19 additions and 16 deletions

View File

@ -156,7 +156,7 @@ popd</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
ln -sv libncursesw.so $LFS/usr/lib/libncurses.so
sed -e 's/^#if.*XOPEN.*$/#if 1/' \
-i $LFS/usr/include/curses.h</userinput></screen>
<!--
@ -178,12 +178,11 @@ sed -e 's/^#if.*XOPEN.*$/#if 1/' \
</varlistentry>
<varlistentry>
<term><command>echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so</command></term>
<term><command>ln -sv libncursesw.so $LFS/usr/lib/libncurses.so</command></term>
<listitem>
<para>The <filename>libncurses.so</filename> library is needed by
a few packages we will build soon. We create this small linker
script, as this is what is done in <xref
linkend="chapter-building-system"/>.</para>
a few packages we will build soon. We create this symlink to use
<filename>libncursesw.so</filename> as a replacement.</para>
</listitem>
</varlistentry>

View File

@ -144,22 +144,22 @@ sed -e 's/^#if.*XOPEN.*$/#if 1/' \
cp -av dest/* /</userinput></screen>
<para>Many applications still expect the linker to be able to find
non-wide-character Ncurses libraries. Trick such applications into linking with
wide-character libraries by means of symlinks and linker scripts:</para>
non-wide-character Ncurses libraries. Trick such applications into
linking with wide-character libraries by means of symlinks
(note that the <filename class='extension'>.so</filename> links are
only safe with <filename>curses.h</filename> edited to always use the
wide-character ABI):</para>
<screen><userinput remap="install">for lib in ncurses form panel menu ; do
rm -vf /usr/lib/lib${lib}.so
echo "INPUT(-l${lib}w)" &gt; /usr/lib/lib${lib}.so
ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
ln -sfv lib${lib}w.so /usr/lib/lib${lib}.so
ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
done</userinput></screen>
<para>Finally, make sure that old applications that look for
<filename class="libraryfile">-lcurses</filename> at build time are still
buildable:</para>
<screen><userinput remap="install">rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" &gt; /usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so</userinput></screen>
<screen><userinput remap="install">ln -sfv libncursesw.so /usr/lib/libcurses.so</userinput></screen>
<para>If desired, install the Ncurses documentation:</para>
@ -211,13 +211,17 @@ cp -av lib/lib*.so.5* /usr/lib</userinput></screen>
tset
</seg>
<seg>
libcursesw.so (symlink and linker script to libncursesw.so),
libcurses.so (symlink),
libform.so (symlink),
libformw.so,
libmenu.so (symlink),
libmenuw.so,
libncurses.so (symlink),
libncursesw.so,
libncurses++w.so,
libpanelw.so, and their non-wide-character counterparts without "w"
in the library names.</seg>
libpanel.so (symlink),
and libpanelw.so,
</seg>
<seg>
/usr/share/tabset,
/usr/share/terminfo, and