1 # Build recipe for ncurses.
3 # Copyright (c) 2016-2022 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-20210816.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}"
57 _DEFAULT_NCURSES_BUILD_OPTIONS="
58 --libdir=/usr/lib${libSuffix} \
67 --with-pkg-config-libdir=/usr/lib${libSuffix}/pkgconfig \
68 --with-manpage-format=normal \
70 --with-termlib=tinfo \
76 --build="$(gcc -dumpmachine)"
81 unpack "${tardir}/$tarname"
85 # Set sane permissions
86 chmod -R u+w,go-w,a+rX-s .
88 unset -v TERMINFO; # Just in case.
90 ./configure CPPFLAGS="$QICPPFLAGS -D_GNU_SOURCE" \
91 CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
92 $configure_args --includedir=/usr/include/ncurses \
93 $_DEFAULT_NCURSES_BUILD_OPTIONS \
94 --with-manpages --enable-widec --with-normal
97 make -j${jobs} DESTDIR="$destdir" install
99 unset -v _DEFAULT_NCURSES_BUILD_OPTIONS
101 # Provide non-widec compatibility
103 for name in form panel menu
105 rm -f "${destdir}/usr/lib${libSuffix}/lib${name}.so" \
106 "${destdir}/usr/lib${libSuffix}/lib${name}.a"
108 echo "INPUT(-l${name}w)" > \
109 "${destdir}/usr/lib${libSuffix}/lib${name}.so"
110 echo "INPUT(-l${name}w)" > \
111 "${destdir}/usr/lib${libSuffix}/lib${name}.a"
114 cd "${destdir}/usr/lib${libSuffix}/pkgconfig" && \
115 ln -sf ${name}w.pc ${name}.pc
120 # Do not leave behind this symbolic link for pkgconfig
121 ln -sf ncursesw.pc "${destdir}/usr/lib${libSuffix}/pkgconfig/ncurses.pc"
123 # Make symlinks for compatibility
125 cd "${destdir}/usr/include" || exit 1
126 ln -sf ncurses ncursesw
127 for header in ncurses/*
133 # Insert termcap file provided by "Thomas E. Dickey"
134 mkdir -p "${destdir}/etc"
135 zcat "${tardir}/$termcap_file" > "${destdir}/etc/termcap"
136 chmod 644 "${destdir}/etc/termcap"
137 unset -v termcap_file
139 touch "${destdir}/etc/.graft-config"
141 # Make sure to link against -ltinfo
143 major_version=$(echo $version | cut -f 1 -d .)
145 cd "${destdir}/usr/lib${libSuffix}" || exit 1
146 rm -f libncursesw.so libncurses.so libncurses.a libtermcap.so libtermcap.a
148 echo "INPUT(libncursesw.so.${major_version} -ltinfo)" > libncurses.so
149 echo "INPUT(libncursesw.a -ltinfo)" > libncurses.a
151 echo "INPUT(libncursesw.so.${major_version} -ltinfo)" > libncursesw.so
153 echo "INPUT(-ltinfo)" > libtermcap.so
154 echo "INPUT(-ltinfo)" > libtermcap.a
157 # Compress and link man pages (if needed)
158 if test -d "${destdir}/$mandir"
161 cd "${destdir}/$mandir"
162 find . -type f -exec lzip -9 {} +
163 find . -type l | while read -r file
165 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
172 mkdir -p "${destdir}${docsdir}"
173 cp -p $docs "${destdir}${docsdir}/"