diff options
Diffstat (limited to 'community/emacs/APKBUILD')
-rw-r--r-- | community/emacs/APKBUILD | 348 |
1 files changed, 270 insertions, 78 deletions
diff --git a/community/emacs/APKBUILD b/community/emacs/APKBUILD index ae7b58ebe59..a957398f530 100644 --- a/community/emacs/APKBUILD +++ b/community/emacs/APKBUILD @@ -1,44 +1,86 @@ -# Maintainer: stef <l0ls0fo2i@ctrlc.hu> +# Contributor: Natanael Copa <ncopa@alpinelinux.org> # Contributor: Timo Teräs <timo.teras@iki.fi> +# Maintainer: Celeste <cielesti@protonmail.com> pkgname=emacs -pkgver=27.2 +pkgver=29.3 pkgrel=1 -pkgdesc="The extensible, customizable, self-documenting real-time display editor" -arch="all" -depends="emacs-nox" +_pkgdesc="Extensible, customizable, self-documenting real-time display editor" +pkgdesc="$_pkgdesc (common files)" url="https://www.gnu.org/software/emacs/emacs.html" +arch="all" license="GPL-3.0-or-later" -makedepends="autoconf automake linux-headers gawk ncurses-dev - ncurses-libs gnutls-dev gmp-dev jansson-dev harfbuzz-dev" -subpackages="$pkgname-doc $pkgname-nox" +makedepends=" + !libexecinfo-dev + alsa-lib-dev + autoconf + automake + fontconfig-dev + gawk + giflib-dev + glib-dev + gmp-dev + gnutls-dev + gtk+3.0-dev + harfbuzz-dev + jansson-dev + libgccjit-dev + libjpeg-turbo-dev + libpng-dev + librsvg-dev + libwebp-dev + libxaw-dev + libxml2-dev + libxpm-dev + linux-headers + ncurses-dev + pango-dev + sqlite-dev + tiff-dev + tree-sitter-dev + " +subpackages=" + $pkgname-doc + $pkgname-nox + $pkgname-gtk3 + $pkgname-gtk3-nativecomp:gtk3_nativecomp + $pkgname-pgtk + $pkgname-pgtk-nativecomp:pgtk_nativecomp + $pkgname-x11 + $pkgname-x11-nativecomp:x11_nativecomp + " source="https://ftp.gnu.org/gnu/emacs/emacs-$pkgver.tar.xz - no-git-repo.patch" - -case $CARCH in - mips64|riscv64|s390x) - # limited by librsvg (rust) - _docdir="nox" - ;; - *) - makedepends="$makedepends glib-dev fontconfig-dev libpng-dev - librsvg-dev giflib-dev libxpm-dev gtk+3.0-dev alsa-lib-dev - libxml2-dev pango-dev tiff-dev libjpeg-turbo-dev libxaw-dev" - subpackages="$subpackages $pkgname-x11 $pkgname-gtk3" - _docdir="gtk3" - ;; -esac + no-git-repo.patch + " + +# secfixes: +# 28.2-r6: +# - CVE-2023-27986 +# 28.2-r5: +# - CVE-2023-27985 +# 28.2-r3: +# - CVE-2022-45939 prepare() { - cd "$builddir/$1" default_prepare ./autogen.sh + rm etc/emacs.service # systemd unit + + mkdir -p nox + mv ./* nox || true + + cp -a nox x11 + cp -a nox x11-nativecomp + cp -a nox gtk3 + cp -a nox gtk3-nativecomp + cp -a nox pgtk + cp -a nox pgtk-nativecomp } _build_variant() { cd "$builddir/$1" shift - CFLAGS=-fno-pie \ - LDFLAGS=-no-pie \ + CFLAGS="$CFLAGS -O2 -flto=auto" \ + CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \ ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -46,12 +88,12 @@ _build_variant() { --sysconfdir=/etc \ --libexecdir=/usr/lib \ --localstatedir=/var \ - --without-makeinfo \ --with-gameuser=:games \ --with-gpm \ --with-harfbuzz \ --with-json \ "${@}" + make } @@ -65,6 +107,18 @@ _build_x11() { --with-tiff=yes } +_build_x11_nativecomp() { + _build_variant x11-nativecomp \ + --with-x-toolkit=athena \ + --without-toolkit-scroll-bars \ + --without-dbus \ + --with-xft \ + --with-jpeg=yes \ + --with-tiff=yes \ + --with-native-compilation=aot \ + --without-compress-install +} + _build_gtk3() { _build_variant gtk3 \ --with-x-toolkit=gtk3 \ @@ -73,6 +127,34 @@ _build_gtk3() { --with-tiff=no } +_build_gtk3_nativecomp() { + _build_variant gtk3-nativecomp \ + --with-x-toolkit=gtk3 \ + --with-xft \ + --with-jpeg=yes \ + --with-tiff=no \ + --with-native-compilation=aot +} + +_build_pgtk() { + _build_variant pgtk \ + --with-x-toolkit=gtk3 \ + --with-pgtk \ + --with-xft \ + --with-jpeg=yes \ + --with-tiff=no +} + +_build_pgtk_nativecomp() { + _build_variant pgtk-nativecomp \ + --with-x-toolkit=gtk3 \ + --with-pgtk \ + --with-xft \ + --with-jpeg=yes \ + --with-tiff=no \ + --with-native-compilation=aot +} + _build_nox() { _build_variant nox \ --without-sound \ @@ -81,82 +163,192 @@ _build_nox() { } build() { - mkdir -p nox - mv ./* nox || true - - case "$CARCH" in - mips64|riscv64|s390x) - # limited by librsvg (rust) - _build_nox - ;; - *) - cp -a nox x11 - cp -a nox gtk3 - _build_nox - _build_x11 - _build_gtk3 - ;; - esac + _build_nox + _build_x11 + _build_x11_nativecomp + _build_gtk3 + _build_gtk3_nativecomp + _build_pgtk + _build_pgtk_nativecomp } package() { - mkdir -p "$pkgdir" + make DESTDIR="$pkgdir" install -C gtk3 + + cd "$pkgdir" + # resolve conflict with ctags package + mv usr/bin/ctags \ + usr/bin/ctags.emacs + mv usr/share/man/man1/ctags.1.gz \ + usr/share/man/man1/ctags.emacs.1.gz + + # remove things that are per-subpackage and not common + rm -r \ + usr/bin/emacs \ + usr/bin/emacsclient \ + usr/bin/emacs-$pkgver \ + usr/lib/emacs/$pkgver/*/emacs*.pdmp \ + usr/lib/systemd \ + usr/share/emacs/$pkgver/lisp \ + usr/share/emacs/$pkgver/site-lisp + + # fix perms on /var/games + chmod 775 var/games + chmod 775 var/games/emacs + chmod 664 var/games/emacs/* + chown -R root:games var/games + + # fix user/root permissions on usr/share files + find usr/share/emacs/ -exec chown root:root {} \; + find usr/lib -perm -g+s,g+x ! -type d -exec chmod g-s {} \; } doc() { - depends="" - mkdir -p "$subpkgdir" - cd "$builddir"/"$_docdir" - make DESTDIR="$subpkgdir" install - # remove conflict with ctags package - mv "$subpkgdir"/usr/share/man/man1/ctags.1.gz "$subpkgdir"/usr/share/man/man1/ctags.emacs.1.gz - # only keep info and man directories, all other is in the specific package - rm -rf "${subpkgdir:?}"/usr/bin \ - "$subpkgdir"/usr/lib \ - "$subpkgdir"/usr/share/appdata \ - "$subpkgdir"/usr/share/applications \ - "$subpkgdir"/usr/share/emacs \ - "$subpkgdir"/usr/share/icons \ - "${subpkgdir:?}"/var \ - "$subpkgdir"/usr/lib/systemd + default_doc + pkgdesc="$_pkgdesc (documentation)" } _subpackage() { cd "$builddir/$1" make DESTDIR="$subpkgdir" install - # remove conflict with ctags package - mv "$subpkgdir"/usr/bin/ctags "$subpkgdir"/usr/bin/ctags.emacs - rm -rf "$subpkgdir"/usr/share/info \ - "$subpkgdir"/usr/share/man + cd "$subpkgdir" + + # remove things that are in -common + rm -rf \ + usr/bin/ctags \ + usr/bin/ebrowse \ + usr/bin/etags \ + usr/include \ + usr/lib/emacs/$pkgver/*/hexl \ + usr/lib/emacs/$pkgver/*/movemail \ + usr/lib/emacs/$pkgver/*/rcs2log \ + usr/lib/emacs/$pkgver/*/update-game-score \ + usr/lib/systemd \ + usr/share/applications \ + usr/share/emacs/$pkgver/etc \ + usr/share/icons \ + usr/share/info \ + usr/share/man \ + usr/share/metainfo \ + var/games # fix user/root permissions on usr/share files - find "$subpkgdir"/usr/share/emacs/ -exec chown root:root {} \; - find "$subpkgdir"/usr/lib -perm -g+s,g+x ! -type d -exec chmod g-s {} \; - # fix perms on /var/games - chmod 775 "$subpkgdir"/var/games - chmod 775 "$subpkgdir"/var/games/emacs - chmod 664 "$subpkgdir"/var/games/emacs/* - chown -R root:games "$subpkgdir"/var/games + find usr/share/emacs/ -exec chown root:root {} \; + find usr/lib -perm -g+s,g+x ! -type d -exec chmod g-s {} \; } nox() { - pkgdesc="$pkgdesc - without X11" - depends="!emacs-x11 !emacs-gtk3" + pkgdesc="$_pkgdesc - non-graphical" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-gtk3-nativecomp + !emacs-pgtk + !emacs-pgtk-nativecomp + !emacs-x11 + !emacs-x11-nativecomp + " _subpackage nox } x11() { - pkgdesc="$pkgdesc - with X11" - depends="!emacs-nox !emacs-gtk3 hicolor-icon-theme desktop-file-utils" + pkgdesc="$_pkgdesc - with X11" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-gtk3-nativecomp + !emacs-pgtk + !emacs-pgtk-nativecomp + !emacs-nox + !emacs-x11-nativecomp + desktop-file-utils + hicolor-icon-theme + " _subpackage x11 } +x11_nativecomp() { + pkgdesc="$_pkgdesc - with X11 and native compilation" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-gtk3-nativecomp + !emacs-pgtk + !emacs-pgtk-nativecomp + !emacs-nox + !emacs-x11 + desktop-file-utils + hicolor-icon-theme + " + _subpackage x11-nativecomp +} + gtk3() { - pkgdesc="$pkgdesc - with GTK3" - depends="!emacs-nox !emacs-x11 hicolor-icon-theme desktop-file-utils" + pkgdesc="$_pkgdesc - with GTK3" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3-nativecomp + !emacs-pgtk + !emacs-pgtk-nativecomp + !emacs-nox + !emacs-x11 + !emacs-x11-nativecomp + desktop-file-utils + hicolor-icon-theme + " _subpackage gtk3 } -sha512sums="0f63a5a8709b113ef790c1a64845dad05ead096f93f62164ff221c517a35b91ea7bced75a992d794981a85382cda03cca7338da2f5ef8f6ef1459b88018a4ce9 emacs-27.2.tar.xz -5a2d1d10d66fd335b16d9f2d6d1e45e093067db87f8ef2d14a8c921cc94b3e226310c7cc691d19eb91eaf16de9ae4f20ff8be3596a4906b0514fa5f098328d97 no-git-repo.patch" +gtk3_nativecomp() { + pkgdesc="$_pkgdesc - with GTK3 and native compilation" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-pgtk + !emacs-pgtk-nativecomp + !emacs-nox + !emacs-x11 + !emacs-x11-nativecomp + desktop-file-utils + hicolor-icon-theme + " + _subpackage gtk3-nativecomp +} + +pgtk() { + pkgdesc="$_pkgdesc - with pure GTK" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-gtk3-nativecomp + !emacs-pgtk-nativecomp + !emacs-nox + !emacs-x11 + !emacs-x11-nativecomp + desktop-file-utils + hicolor-icon-theme + " + _subpackage pgtk +} + +pgtk_nativecomp() { + pkgdesc="$_pkgdesc - with pure GTK and native compilation" + depends=" + $pkgname=$pkgver-r$pkgrel + !emacs-gtk3 + !emacs-gtk3-nativecomp + !emacs-pgtk + !emacs-nox + !emacs-x11 + !emacs-x11-nativecomp + desktop-file-utils + hicolor-icon-theme + " + _subpackage pgtk-nativecomp +} + +sha512sums=" +efaecfc46a0b88f61de477d92c08ee592b8838e6c34724151a3b1502efa7ebd4d4837733c694807e6de1ba4b8d37d2ec382c6bb2ed000b67ad8f0e11c7df2a6b emacs-29.3.tar.xz +5a2d1d10d66fd335b16d9f2d6d1e45e093067db87f8ef2d14a8c921cc94b3e226310c7cc691d19eb91eaf16de9ae4f20ff8be3596a4906b0514fa5f098328d97 no-git-repo.patch +" |