Start mass upgrade
[dragora.git] / recipes / libs / readline / recipe
blob0a961bca851861367d115ed6344a4b4215403f38
1 # Build recipe for readline.
3 # Copyright (c) 2016-2019, 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
18 set -e
20 program=readline
21 version=8.1
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=libs
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=ftp://ftp.gnu.org/gnu/readline/$tarname
32 description="
33 A library with line-editing capabilities.
35 GNU readline is a software library created and maintained by the
36 GNU Project.  It is licensed under the GPL, and used in projects
37 such as GNU bash.  It provides line-editing capabilities.
40 homepage=https://www.gnu.org/software/readline
41 license=GPLv3+
43 # Source documentation
44 docs="CHANGELOG CHANGES COPYING NEWS README USAGE"
45 docsdir="${docdir}/${program}-${version}"
47 build()
49     unpack "${tardir}/$tarname"
51     cd "$srcdir"
53     # Set sane permissions
54     chmod -R u+w,go-w,a+rX-s .
56     # Apply patches from upstream
57     for file in "${worktree}"/patches/readline/readline81-???*
58     do
59         if test -f "$file"
60         then
61             patch -Np0 -i "$file"
62         fi
63     done
65     # To avoid underlink against -lncursesw
66     patch -Np1 -i "${worktree}/patches/readline/readline-ncurses-link.patch"
68     # Reinstalling Readline will cause the old libraries to be moved to
69     # <libraryname>.old, this avoid printing a harmful message about
70     # the static libraries (thanks to LFS)
71     sed -i '/MV.*old/d' Makefile.in
72     sed -i '/{OLDSUFF}/c:' support/shlib-install
74     ./configure CPPFLAGS="$QICPPFLAGS" \
75     CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
76      $configure_args \
77      --libdir=/usr/lib${libSuffix} \
78      --infodir=$infodir \
79      --mandir=$mandir \
80      --docdir=$docsdir \
81      --enable-static=yes \
82      --enable-shared=yes \
83      --build="$(gcc -dumpmachine)"
85     make -j${jobs} V=1
86     make -j${jobs} V=1 DESTDIR="$destdir" install
88     # Copy our custom inputrc file
89     mkdir -p "${destdir}/etc"
90     cp -p "${worktree}/archive/readline/etc/inputrc" "${destdir}/etc/"
91     chmod 644 "${destdir}/etc/inputrc"
93     touch "${destdir}/etc/.graft-config"
95     # Compress info documents deleting index file for the package
96     if test -d "${destdir}/$infodir"
97     then
98         rm -f "${destdir}/${infodir}/dir"
99         lzip -9 "${destdir}/${infodir}"/*
100     fi
102     # Compress and link man pages (if needed)
103     if test -d "${destdir}/$mandir"
104     then
105         (
106             cd "${destdir}/$mandir"
107             find . -type f -exec lzip -9 {} +
108             find . -type l | while read -r file
109             do
110                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
111                 rm -- "$file"
112             done
113         )
114     fi
116     # Copy documentation
117     mkdir -p "${destdir}${docsdir}"
118     cp -p $docs "${destdir}${docsdir}"