1 # Build recipe for less.
3 # Copyright (c) 2016-2019, 2021 Matias Fonzo, <selk@dragora.org>.
4 # Copyright (c) 2022 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Exit immediately on any error
25 # Define a category for the output of the package name
28 tarname=${program}-${version}.tar.gz
31 fetch=https://ftp.gnu.org/gnu/less/$tarname
36 Less is a pager. A pager is a program that displays text files.
38 This package also includes the 'lesspipe.sh' script.
41 homepage=https://www.gnu.org/software/less
44 # Source documentation
45 docs="COPYING LICENSE NEWS README"
46 docsdir="${docdir}/${program}-${version}"
50 unpack "${tardir}/$tarname"
54 # Set sane permissions
55 chmod -R u+w,go-w,a+rX-s .
57 ./configure CPPFLAGS="$QICPPFLAGS" \
58 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
63 --build="$(gcc -dumpmachine)"
66 make -j${jobs} DESTDIR="$destdir" install
68 # Include our custom lesspipe.sh version (which has support for lzip)
70 cp -p "${worktree}/archive/less/usr/bin/lesspipe.sh" "${destdir}/usr/bin"
71 chmod 755 "${destdir}/usr/bin/lesspipe.sh"
73 # Include profile file
74 mkdir -p "${destdir}/etc/profile.d"
75 cat "${worktree}/archive/less/etc/profile.d/less.sh" \
76 > "${destdir}/etc/profile.d/less.sh"
78 # To handle config file(s)
79 touch "${destdir}/etc/profile.d/.graft-config"
81 # Compress and link man pages (if needed)
82 if test -d "${destdir}/$mandir"
85 cd "${destdir}/$mandir"
86 find . -type f -exec lzip -9 {} +
87 find . -type l | while read -r file
89 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
96 mkdir -p "${destdir}/$docsdir"
97 cp -p $docs "${destdir}/$docsdir"