1 # Build recipe for ncurses.
3 # Copyright (c) 2016-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tgz
28 termcap_file=termcap-20201128.src.gz
32 https://invisible-mirror.net/archives/ncurses/current/$tarname
33 https://invisible-mirror.net/archives/ncurses/current/$termcap_file
37 Emulation library of Curses.
39 The Ncurses (new curses) library is a free software emulation of
40 curses in System V Release 4.0. The ncurses code was developed
41 under GNU/Linux. It has been in use for some time with OpenBSD
42 as the system curses library, and on FreeBSD and NetBSD as an
45 The distribution includes the library and support utilities,
46 including a terminfo compiler \"tic\", a decompiler \"infocmp\",
47 clear, tput, tset, and a termcap conversion tool \"captoinfo\".
50 homepage=https://www.gnu.org/software/ncurses
53 # Source documentation
54 docs="ANNOUNCE AUTHORS COPYING NEWS README TO-DO VERSION"
55 docsdir="${docdir}/${program}-${version}"
59 unpack "${tardir}/$tarname"
63 # Set sane permissions
64 chmod -R u+w,go-w,a+rX-s .
66 ./configure CPPFLAGS="$QICPPFLAGS" \
67 CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
69 --libdir=/usr/lib${libSuffix} \
78 --with-pkg-config-libdir=/usr/lib${libSuffix}/pkgconfig \
84 --build="$(gcc -dumpmachine)"
87 mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
88 make -j${jobs} DESTDIR="$destdir" install
90 # Insert termcap file provided by "Thomas E. Dickey"
91 mkdir -p "${destdir}/etc"
92 zcat "${tardir}/$termcap_file" > "${destdir}/etc/termcap"
93 chmod 644 "${destdir}/etc/termcap"
96 touch "${destdir}/etc/.graft-config"
98 # Provide non-widec compatibility
100 for name in ncurses form panel menu
102 rm -f "${destdir}/usr/lib${libSuffix}/lib${name}.so"
104 echo "INPUT(-l${name}w)" > \
105 "${destdir}/usr/lib${libSuffix}/lib${name}.so"
107 echo "INPUT(-l${name}w)" > \
108 "${destdir}/usr/lib${libSuffix}/lib${name}.a"
111 cd "${destdir}/usr/lib${libSuffix}/pkgconfig" && \
112 ln -sf ${name}w.pc ${name}.pc
116 major_version=$(echo $version | cut -f 1 -d .)
117 for name in tic tinfo
119 echo "INPUT(libncursesw.so.${major_version})" > \
120 "${destdir}/usr/lib${libSuffix}/lib${name}.so"
122 ln -sf libncursesw.so.${major_version} \
123 "${destdir}/usr/lib${libSuffix}/lib${name}.so.${major_version}"
125 unset -v major_version
127 # Backward compatibility
129 cd "${destdir}/usr/lib${libSuffix}" || exit 2
130 echo "INPUT(-lncursesw)" > libcursesw.so
131 ln -sf libncurses.so libcurses.so
132 ln -sf libncurses++w.a libncurses++.a
135 ln -sf ncursesw6-config "${destdir}/usr/bin/ncurses6-config"
137 # Compress and link man pages (if needed)
138 if test -d "${destdir}/$mandir"
141 cd "${destdir}/$mandir"
142 find . -type f -exec lzip -9 {} +
143 find . -type l | while read -r file
145 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
152 mkdir -p "${destdir}${docsdir}"
153 cp -p $docs "${destdir}${docsdir}/"