recipes: Honor CPPFLAGS (through QICPPFLAGS) whenever is possible
[dragora.git] / recipes / x-apps / emacs / recipe
blob09f2765b6f2b191f556fe24ddcba19cd2e923be6
1 # Build recipe for emacs.
3 # Copyright (C) 2020 Kevin "The Nuclear" Bloom, <kevin.bloom@posteo.net>.
4 # Copyright (c) 2020-2021 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.1
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=x-apps
28 tarname=${program}-${version}.tar.gz
29 # srcdir=${program}-${version}    # Not needed in major releases
31 # Remote source(s)
32 fetch=http://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=http://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" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
60     $configure_args \
61     --libdir=/usr/lib${libSuffix} \
62     --infodir=$infodir \
63     --mandir=$mandir \
64     --docdir=$docdir \
65     --program-prefix= \
66     --program-suffix= \
67     --with-modules \
68     --with-x \
69     --with-x-toolkit=gtk3 \
70     --without-libsystemd \
71     --without-gconf \
72     --without-gsettings \
73     --without-compress-install \
74     --build="$(gcc -dumpmachine)"
76     make -j${jobs} V=1
77     make -j${jobs} DESTDIR="$destdir" install-strip
79     # A world without systemd is a healthy world...
80     rm -rf "${destdir}/usr/lib${libSuffix}/systemd"
81     rmdir "${destdir}/usr/lib${libSuffix}" 2> /dev/null || true
83     # Re-create directory for games
84     mkdir -p "${destdir}/var/games/emacs"
85     chown :games "${destdir}/var/games/emacs"
87     if test -d "${destdir}/$infodir"
88     then
89         # Delete index file for the package
90         rm -f "${destdir}/${infodir}/dir"
92         # Compress info documents
93         lzip -9 "${destdir}/${infodir}"/* || true
94     fi
96     # Compress and link man pages (if needed)
97     if test -d "${destdir}/$mandir"
98     then
99         (
100             cd "${destdir}/$mandir"
101             find . -type f -exec lzip -9 {} +
102             find . -type l | while read -r file
103             do
104                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
105                 rm -- "$file"
106             done
107         )
108     fi
110     # Copy documentation
111     mkdir -p "${destdir}${docsdir}"
112     cp -p $docs "${destdir}${docsdir}"