recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / x-apps / emacs / recipe
blob894c2d9bdb5018ed4647115f37401af0cebc98ad
1 # Build recipe for emacs.
3 # Copyright (C) 2020 Kevin "The Nuclear" Bloom, <kevin.bloom@posteo.net>.
4 # Copyright (c) 2020-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
19 set -e
21 program=emacs
22 version=27.2
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=x-apps
28 tarname=${program}-${version}.tar.xz
29 # srcdir=${program}-${version}    # Not needed in major releases
31 # Remote source(s)
32 fetch=https://ftp.gnu.org/gnu/emacs/$tarname
34 description="
35 The Emacs text editor.
37 GNU Emacs is an extensible, customizable text editor and more.
38 At its core is an interpreter for Emacs Lisp, a dialect of the
39 Lisp programming language with extensions to support text
40 editing.
43 homepage=https://www.gnu.org/software/emacs/
44 license="GPLv3+"
46 # Source documentation
47 docs="BUGS CONTRIBUTE COPYING ChangeLog* README"
48 docsdir="${docdir}/${program}-${version}"
50 build()
52     unpack "${tardir}/$tarname"
54     cd "$srcdir"
56     # Set sane permissions
57     chmod -R u+w,go-w,a+rX-s .
59     ./configure CPPFLAGS="$QICPPFLAGS" \
60     CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
61     $configure_args \
62     --libdir=/usr/lib${libSuffix} \
63     --infodir=$infodir \
64     --mandir=$mandir \
65     --docdir=$docdir \
66     --program-prefix= \
67     --program-suffix= \
68     --with-modules \
69     --with-x \
70     --with-x-toolkit=gtk3 \
71     --without-libsystemd \
72     --without-gconf \
73     --without-gsettings \
74     --without-compress-install \
75     --build="$(gcc -dumpmachine)"
77     make -j${jobs} V=1
78     make -j${jobs} DESTDIR="$destdir" install-strip
80     # A world without systemd is a healthy world...
81     rm -rf "${destdir}/usr/lib${libSuffix}/systemd"
82     rmdir "${destdir}/usr/lib${libSuffix}" 2> /dev/null || true
84     # Re-create directory for games
85     mkdir -p "${destdir}/var/games/emacs"
86     chown :games "${destdir}/var/games/emacs"
88     if test -d "${destdir}/$infodir"
89     then
90         # Delete index file for the package
91         rm -f "${destdir}/${infodir}/dir"
93         # Compress info documents
94         lzip -9 "${destdir}/${infodir}"/* || true
95     fi
97     # Compress and link man pages (if needed)
98     if test -d "${destdir}/$mandir"
99     then
100         (
101             cd "${destdir}/$mandir"
102             find . -type f -exec lzip -9 {} +
103             find . -type l | while read -r file
104             do
105                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
106                 rm -- "$file"
107             done
108         )
109     fi
111     # Copy documentation
112     mkdir -p "${destdir}/$docsdir"
113     cp -p $docs "${destdir}/$docsdir"