summaryrefslogtreecommitdiff
path: root/emacs/PKGBUILD
blob: 076ad994626c0d88992d6520c4e0a4eb6c66c4fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Maintainer (Arch): Juergen Hoetzel <juergen@archlinux.org>
# Contributor (Arch): Renchi Raju <renchi@green.tam.uiuc.edu>
# Maintainer: André Silva <emulatorman@hyperbola.info>
# Contributor: Jesús E. <heckyel@hyperbola.info>
# Contributor: Tobias Dausend <throgh@hyperbola.info>
pkgname=emacs
pkgver=29.4
_debver=$pkgver
_debrel=2
pkgrel=2
pkgdesc="The extensible, customizable, self-documenting real-time display editor"
arch=('i686' 'x86_64')
url='https://www.gnu.org/software/emacs/emacs.html'
license=('GPL-3')
depends=('librsvg-legacy' 'gpm' 'giflib' 'libxpm' 'libotf' 'm17n-lib' 'gtk' 'hicolor-icon-theme'
		'desktop-file-utils' 'alsa-lib' 'gnutls' 'jansson')
makedepends=('quilt')
source=("https://ftp.gnu.org/gnu/emacs/${pkgname}-${pkgver}.tar.xz"
		"https://deb.debian.org/debian/pool/main/e/emacs/emacs_${_debver}+1-${_debrel}~bpo12+1.debian.tar.xz"
		"modify-startup.patch")
sha512sums=('66b38081cb01d2c46ff7beefb45986cc225b4c922c30712ad0d456c6cae5507176ed99418c8f26948c5375c8afde4e4b2507d23ed997dbb5392d12150a121d80'
            '19e4cdda20009d9dcb65ebc4f6d6b15cb2d0d2927d0a77911196f6a29225b2ebc0a84e9e3cab4dbf6de6dad1ee916b8a8d4cee9c10910b19218874158226ca76'
            '223c8992b730678ea67edda8b8a92e779e96cbf9f41b2cb0fc70029ded6bfbedfbebf90f19af6f9a17c9dd16564aa3b6b97623cec8e1d55ead3a3438efbb8250')
prepare() {
 cd "$srcdir"/$pkgname-$pkgver
 if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
 # Debian patches
 export QUILT_PATCHES=debian/patches
 export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
 export QUILT_DIFF_ARGS='--no-timestamps'
 mv "$srcdir"/debian .
 # Doesn't apply
 rm -v debian/patches/0001-Prefer-usr-share-info-emacs.patch || true
 rm -v debian/patches/0002-Run-debian-startup-and-set-debian-emacs-flavor.patch || true
 rm -v debian/patches/0003-Remove-files-that-appear-to-be-incompatible-with-the.patch || true
 rm -v debian/patches/0004-Adjust-documentation-references-for-Debian.patch || true
 rm -v debian/patches/0005-Modify-the-output-of-version-to-indicate-Debian-modi.patch || true
 rm -v debian/patches/0008-Mark-vc-bzr-test-fauilt-bzr-autoloads-as-unstable-fo.patch || true
 quilt push -av
 fi
 # patchout startup-links
 rm lisp/startup.elc
 patch -Np1 -i ${srcdir}/modify-startup.patch
}
build() {
cd "$srcdir"/$pkgname-$pkgver
ac_cv_lib_gif_EGifPutExtensionLast=yes
CFLAGS="-O3 -march=native" ./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --with-x-toolkit=gtk \
  --with-modules \
  --with-json \
  --without-dbus \
  --without-libsystemd \
  --without-tiff \
  --without-xft \
  --without-sound \
  --without-toolkit-scroll-bars \
  --without-xaw3d
make ${MAKEFLAGS}
#  --without-imagemagick \
#  --without-compress \
}

package() {
 cd "$srcdir"/$pkgname-$pkgver
 make ${MAKEFLAGS} DESTDIR="$pkgdir" install
 # remove conflict with ctags package
 mv "$pkgdir"/usr/bin/{ctags,ctags.emacs}
 mv "$pkgdir"/usr/share/man/man1/{ctags.1.gz,ctags.emacs.1}
 # remove systemd-related data
 rm -rf "$pkgdir"/usr/lib
 rm "$pkgdir"/usr/share/emacs/$pkgver/etc/emacs.service
 # remove internal package-manager for emacs
 # we do not support such as of being a high risk to endanger user-freedom
 rm "$pkgdir"/usr/share/emacs/$pkgver/etc/package-keyring.gpg
 rm "$pkgdir"/usr/share/emacs/$pkgver/lisp/emacs-lisp/{package,package-vc,package-x}.el.gz
 rm "$pkgdir"/usr/share/emacs/$pkgver/lisp/emacs-lisp/{package,package-vc,package-x}.elc
 # fix user/root permissions on usr/share files
 find "$pkgdir"/usr/share/emacs/$pkgver -exec chown root:root {} \;
 install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
}