recipes: libs/ncurses: Upgraded to version 6.2-20210313
[dragora.git] / recipes / libs / ncurses / recipe
blob9d243363cbf9b2596c14fe93d0195d5db3133550
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
18 set -e
20 program=ncurses
21 version=6.2-20210313
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=libs
27 tarname=${program}-${version}.tgz
28 termcap_file=termcap-20201128.src.gz
30 # Remote source(s)
31 fetch="
32   https://invisible-mirror.net/archives/ncurses/current/$tarname
33   https://invisible-mirror.net/archives/ncurses/current/$termcap_file
36 description="
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
43 external package.
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
51 license=Custom
53 # Source documentation
54 docs="ANNOUNCE AUTHORS COPYING NEWS README TO-DO VERSION"
55 docsdir="${docdir}/${program}-${version}"
57 build()
59     unpack "${tardir}/$tarname"
61     cd "$srcdir"
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" \
68      $configure_args \
69      --libdir=/usr/lib${libSuffix} \
70      --mandir=$mandir \
71      --enable-widec \
72      --enable-symlinks \
73      --enable-termcap \
74      --enable-pc-files \
75      --enable-xmc-glitch \
76      --disable-stripping \
77      --disable-relink \
78      --with-pkg-config-libdir=/usr/lib${libSuffix}/pkgconfig \
79      --with-shared \
80      --with-gpm \
81      --without-tests \
82      --without-debug \
83      --without-ada \
84      --build="$(gcc -dumpmachine)"
86     make -j${jobs} V=1
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"
94     unset -v termcap_file
96     touch "${destdir}/etc/.graft-config"
98     # Provide non-widec compatibility
100     for name in ncurses form panel menu
101     do
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"
110         (
111             cd "${destdir}/usr/lib${libSuffix}/pkgconfig" && \
112              ln -sf ${name}w.pc ${name}.pc
113         )
114     done
116     major_version=$(echo $version | cut -f 1 -d .)
117     for name in tic tinfo
118     do
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}"
124     done
125     unset -v major_version
127     # Backward compatibility
128     (
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
133     )
134     # Just in case
135     ln -sf ncursesw6-config "${destdir}/usr/bin/ncurses6-config"
137     # Compress and link man pages (if needed)
138     if test -d "${destdir}/$mandir"
139     then
140         (
141             cd "${destdir}/$mandir"
142             find . -type f -exec lzip -9 {} +
143             find . -type l | while read -r file
144             do
145                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
146                 rm -- "$file"
147             done
148         )
149     fi
151     # Copy documentation
152     mkdir -p "${destdir}${docsdir}"
153     cp -p $docs "${destdir}${docsdir}/"