1 # Build recipe for less.
3 # Copyright (c) 2016-2018 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.
21 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/tools"
24 tarname=${program}-${version}.tar.gz
27 fetch=http://ftp.gnu.org/gnu/less/$tarname
32 Less is a pager. A pager is a program that displays text files.
34 This package also includes the 'lesspipe.sh' script.
37 homepage=http://www.gnu.org/software/less
40 # Source documentation
41 docs="COPYING LICENSE NEWS README"
42 docsdir="${docdir}/${program}-${version}"
48 unpack "${tardir}/$tarname"
52 # Set sane permissions
53 chmod -R u+w,go-w,a+rX-s .
55 ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
60 --build="$(cc -dumpmachine)"
63 make -j${jobs} DESTDIR="$destdir" install
65 # Include our custom lesspipe.sh version (which has support for lzip)
67 cp -p "${worktree}/archive/less/usr/bin/lesspipe.sh" "${destdir}/usr/bin"
68 chmod 755 "${destdir}/usr/bin/lesspipe.sh"
70 # Include profile file
71 mkdir -p "${destdir}/etc/profile.d"
72 cat "${worktree}/archive/less/etc/profile.d/less.sh" \
73 > "${destdir}/etc/profile.d/less.sh"
75 # To handle config file(s)
76 touch "${destdir}/etc/profile.d/.graft-config"
78 # Compress and link man pages (if needed)
79 if test -d "${destdir}/$mandir"
82 cd "${destdir}/$mandir"
83 find . -type f -exec lzip -9 '{}' +
84 find . -type l | while read -r file
86 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
93 mkdir -p "${destdir}${docsdir}"
97 cp -p $file "${destdir}${docsdir}"