recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / tools / mc / recipe
blob3ecf09896c002062efe0ba9030b42c45cf8863f0
1 # Build recipe for mc (Midnight Commander).
3 # Copyright (c) 2017-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=mc
21 version=4.8.27
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=tools
27 tarname=${program}-${version}.tar.bz2
29 # Remote source(s)
30 fetch=http://ftp.midnight-commander.org/$tarname
32 description="
33 File manager and user shell.
35 GNU Midnight Commander can be used locally or remotely, on the console
36 or under X Window System.  By using full screen space of the terminals,
37 it provides an intuitive user interface to the operating system,
38 aiming to be a useful tool for users with any level of experience,
39 from a newbie to a guru.
42 homepage=https://www.midnight-commander.org
43 license=GPLv3+
45 # Source documentation
46 docs="AUTHORS COPYING ChangeLog NEWS README"
47 docsdir="${docdir}/${program}-${version}"
49 build()
51     unpack "${tardir}/$tarname"
53     cd "$srcdir"
55     # Apply a patch in order to build against Musl
56     # (Thanks to "Alpine Linux")
57     patch -p1 < "${worktree}/patches/mc/fix-cchar_t.patch"
59     # Set sane permissions
60     chmod -R u+w,go-w,a+rX-s .
62     ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
63      $configure_args \
64      --libdir=/usr/lib${libSuffix} \
65      --infodir=$infodir \
66      --mandir=$mandir \
67      --docdir=$docsdir \
68      --enable-nls \
69      --with-search-engine=pcre \
70      --with-screen=ncurses \
71      --without-x \
72      --with-gpm-mouse \
73      --build="$(gcc -dumpmachine)"
75     make -j${jobs} V=1
76     make -j${jobs} DESTDIR="$destdir" install
78     # To manage .new files
79     touch "${destdir}/etc/mc/.graft-config"
81     # Compress info documents deleting index file for the package
82     if test -d "${destdir}/$infodir"
83     then
84         rm -f "${destdir}/${infodir}/dir"
85         lzip -9 "${destdir}/${infodir}"/*
86     fi
88     # Compress and link man pages (if needed)
89     if test -d "${destdir}/$mandir"
90     then
91         (
92             cd "${destdir}/$mandir"
93             find . -type f -exec lzip -9 {} +
94             find . -type l | while read -r file
95             do
96                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
97                 rm -- "$file"
98             done
99         )
100     fi
102     # Copy documentation
103     mkdir -p "${destdir}/$docsdir"
104     cp -p $docs "${destdir}/$docsdir"