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
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tar.gz
30 fetch=ftp://ftp.gnu.org/gnu/readline/$tarname
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
43 # Source documentation
44 docs="CHANGELOG CHANGES COPYING NEWS README USAGE"
45 docsdir="${docdir}/${program}-${version}"
49 unpack "${tardir}/$tarname"
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-???*
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" \
77 --libdir=/usr/lib${libSuffix} \
83 --build="$(gcc -dumpmachine)"
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"
98 rm -f "${destdir}/${infodir}/dir"
99 lzip -9 "${destdir}/${infodir}"/*
102 # Compress and link man pages (if needed)
103 if test -d "${destdir}/$mandir"
106 cd "${destdir}/$mandir"
107 find . -type f -exec lzip -9 {} +
108 find . -type l | while read -r file
110 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
117 mkdir -p "${destdir}/$docsdir"
118 cp -p $docs "${destdir}/$docsdir"