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

View File

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