From 1147c993eedff6391cca74223721dbc49a20e4be Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Fri, 21 May 2021 20:37:01 +0200 Subject: [PATCH] [Emacs, AUR] Update and add Emacs PKGBUILD, upgrade org-mode This commit rebases my Emacs PKGBUILD on the one used by `emacs-git'. By default, my compiler will now use the gold linker, native-compilation, and ahead of time elisp native compilation. It stills include PDF documentation and xwidgets browser, but removes the HTML docs. Recently, the `contrib/' directory of org moved to a different repository. This broke the previous `emacs-org-mode-git' package. This commit adds a new PKGBUILD for `emacs-org-mode-git' and adds a configuration snippet for `org-contrib' in my vanilla Emacs configuration. --- Documents/code/AUR/emacs/PKGBUILD | 184 ++++++++---------- Documents/code/AUR/org-mode/PKGBUILD | 39 ++++ .../code/AUR/org-mode/emacs-org-mode.install | 44 +++++ org/config/emacs.org | 21 +- 4 files changed, 187 insertions(+), 101 deletions(-) create mode 100644 Documents/code/AUR/org-mode/PKGBUILD create mode 100644 Documents/code/AUR/org-mode/emacs-org-mode.install diff --git a/Documents/code/AUR/emacs/PKGBUILD b/Documents/code/AUR/emacs/PKGBUILD index b27d645..8995950 100644 --- a/Documents/code/AUR/emacs/PKGBUILD +++ b/Documents/code/AUR/emacs/PKGBUILD @@ -1,16 +1,5 @@ -# Maintainer: Andrew Whatson -# Maintainer of emacs-git: Pedro A. López-Valencia - -################################################################################ -# The difference between this PKGBUILD and the one from `emacs-git` is that: -# - this one builds emacs from `feature/native-comp` branch. -# - built-in packages are native compiled by default. -# - link-time optimization is disabled by default. -# -# Pre-compiling all built-in elisp modules takes *hours* on fast systems. You -# can set FAST_BOOT="YES" to pre-compile the bare minimum, then you'll need to -# manage native-compilation later (eg. with comp-deferred-compilation). -################################################################################ +# Maintainer: Pedro A. López-Valencia +# Maintainer of emacs-phundrak-git: Lucien Cartier-Tilet ################################################################################ # CAVEAT LECTOR: This PKGBUILD is highly opinionated. I give you @@ -25,7 +14,7 @@ ################################################################################ ################################################################################ -# Assign "YES" to the variable you want enabled; empty or other value +# Assign "YES" to the variable you want enabled; empty or any other value # for NO. # # Where you read experimental, replace with foobar. @@ -33,10 +22,17 @@ # ################################################################################ CHECK= # Run tests. May fail, this is developement after all. -CLANG="NO" # Use clang. -LTO="YES" # Enable link-time optimization. Not that experimental anymore. - # Seems fixed in GCC, so I've reenabled binutils support, please - # report any bug, to make it use clang by default again. +CLANG= # Use clang. +GOLD="YES" # Use the gold linker. +LTO="YES" # Enable link-time optimization. Read emacs's INSTALL before + # attempting to use it with clang. +JIT="YES" # Enable native just-in-time compilation. libgccjit is in AUR. + # This compiles only performance critical elisp files. + # To compile all elisp on demand, set + # comp-deferred-compilation non-nil +AOT="YES" # Precompile all included elisp. It takes a long time. + # You still need to enable on-demand compilation + # for your own packages. CLI= # CLI only binary. NOTKIT= # Use no toolkit widgets. Like B&W Twm (001d sk00l). LUCID= # Use the lucid, a.k.a athena, toolkit. Like XEmacs, sorta. @@ -48,63 +44,55 @@ LUCID= # Use the lucid, a.k.a athena, toolkit. Like XEmacs, sorta. # Xft, if you choose no toolkit or Lucid. # GTK2= # GTK2 support. Why would you? -M17N= # Enable m17n international table input support. - # You are far better off using harfbuzz+freetype2 - # But this gives independence if you need it. - # In fact, right now harfbuzz is hardwired, I have to - # be convinced it should be refactored. -CAIRO="YES" # GOOD NEWS! No longer experimental and fully supported. - # This is now, along with harfbuzz, the prefered font - # and text shaping engine. - # If using GTK+, you'll get printing for free. +NOCAIRO= # Disable here. XWIDGETS="YES" # Use GTK+ widgets pulled from webkit2gtk. Usable. DOCS_HTML= # Generate and install html documentation. DOCS_PDF="YES" # Generate and install pdf documentation. MAGICK= # ImageMagick 7 support. Deprecated (read the logs). - # ImageMagick, like flash, is a bug ridden pest that - # won't die; yet it is useful if you know what you - # are doing. - # -->>If you just *believe* you need it, you don't.<<-- -PDUMPER="YES" # Enable pdumper support unconditionally -NOGZ= # Don't compress .el files. -FAST_BOOT= # Only native-compile the bare minimum. Intended for use with - # deferred compilation to native-compile on-demand at runtime. -PROFILING= # Enable gprof profiling support. + # ImageMagick, like flash, won't die... + # -->>If you just *believe* you need ImageMagick, you don't.<<-- +NOGZ="YES" # Don't compress .el files. ################################################################################ ################################################################################ -pkgname="emacs-phundrak-git" -pkgver=28.0.50.148419 +if [[ $CLI == "YES" ]] ; then + pkgname="emacs-nox-phundrak-git" +else + pkgname="emacs-phundrak-git" +fi +pkgver=28.0.50.148423 pkgrel=1 -pkgdesc="GNU Emacs. Development native-comp branch. Phundrak’s tweaks." -arch=('x86_64' ) +pkgdesc="GNU Emacs. Development master branch with Phundrak’s tweaks." +arch=('x86_64') url="http://www.gnu.org/software/emacs/" -license=('GPL3' ) -depends=('alsa-lib' 'gnutls' 'libxml2' 'jansson' 'libotf' 'harfbuzz' 'gpm' 'libgccjit') +license=('GPL3') +depends_nox=('alsa-lib' 'gnutls' 'libxml2' 'jansson' 'gpm') +depends=("${depends_nox[@]}" 'm17n-lib' 'libotf' 'harfbuzz') makedepends=('git') -provides=('emacs' 'emacs-seq') -conflicts=('emacs' 'emacs26-git' 'emacs-27-git' 'emacs-git' 'emacs-seq' 'emacs-native-comp-git' 'emacs-pgtk-native-comp-git') -replaces=('emacs26-git' 'emacs27-git' 'emacs-git' 'emacs-seq') +provides=('emacs' 'emacs26-git' 'emacs-27-git' 'emacs-seq' 'emacs-nox' 'emacs-git') +conflicts=('emacs' 'emacs26-git' 'emacs-27-git' 'emacs-seq' 'emacs-nox' 'emacs-git') +replaces=('emacs' 'emacs26-git' 'emacs-27-git' 'emacs-seq' 'emacs-nox' 'emacs-git') source=("emacs-git::git://git.savannah.gnu.org/emacs.git") +# If Savannah fails for reasons, use Github's mirror +#source=("emacs-git::git://github.com/emacs-mirror/emacs.git") +OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug) md5sums=('SKIP') -# If Savannah access is blocked for reasons, use Github instead. -# Edit the config file of your local repo copy as well. -# source=("emacs-git::git://github.com/emacs-mirror/emacs.git#branch=feature/native-comp") ################################################################################ - ################################################################################ CFLAGS+=" -O3 -march=native -mtune=native" CXXFLAGS+=" -O3 -march=native -mtune=native" -if [[ $LTO == "YES" ]]; then - CFLAGS+=" -flto" - CXXFLAGS+=" -flto" - if [[ $CLANG != "YES" ]]; then - CFLAGS+=" -fuse-linker-plugin" - CXXFLAGS+=" -fuse-linker-plugin" - fi +if [[ $GOLD == "YES" && ! $CLANG == "YES" ]]; then + export LD=/usr/bin/ld.gold + export CFLAGS+=" -fuse-ld=gold"; + export CXXFLAGS+=" -fuse-ld=gold"; +elif [[ $GOLD == "YES" && $CLANG == "YES" ]]; then + echo ""; + echo "Clang rather uses its own linker."; + echo ""; + exit 1; fi if [[ $CLANG == "YES" ]]; then @@ -117,38 +105,51 @@ if [[ $CLANG == "YES" ]]; then export CCFLAGS+=' -fuse-ld=lld' ; export CXXFLAGS+=' -fuse-ld=lld' ; makedepends+=( 'clang' 'lld' 'llvm') ; -else - export LD="/usr/bin/ld.gold" - export CFLAGS+=" -fuse-ld=gold" - export CXXFLAGS+=" -fuse-ld=gold" fi -if [[ $NOTKIT == "YES" ]]; then - depends+=( 'dbus' 'hicolor-icon-theme' 'libxinerama' 'libxrandr' 'lcms2' 'librsvg' ); +if [[ $LTO == "YES" ]]; then + if [[ $CLANG != "YES" ]]; then + CFLAGS+=" -flto -fuse-linker-plugin" + CXXFLAGS+=" -flto -fuse-linker-plugin" +else + CFLAGS+=" -flto" + CXXFLAGS+=" -flto" + fi +fi + +if [[ $JIT == "YES" ]]; then + if [[ $CLI == "YES" ]]; then + depends_nox+=( 'libgccjit' ); + else + depends+=( 'libgccjit' ); + fi +fi + +if [[ $CLI == "YES" ]]; then + depends=("${depends_nox[@]}"); +elif [[ $NOTKIT == "YES" ]]; then + depends+=( 'dbus' 'hicolor-icon-theme' 'libxinerama' 'libxrandr' 'lcms2' 'librsvg' 'libxfixes' ); + makedepends+=( 'xorgproto' ); elif [[ $LUCID == "YES" ]]; then - depends+=( 'dbus' 'hicolor-icon-theme' 'libxinerama' 'libxfixes' 'lcms2' 'librsvg' 'xaw3d' 'xorgproto' ); + depends+=( 'dbus' 'hicolor-icon-theme' 'libxinerama' 'libxfixes' 'lcms2' 'librsvg' 'xaw3d' 'libxrandr' ); makedepends+=( 'xorgproto' ); elif [[ $GTK2 == "YES" ]]; then - depends+=( 'gtk2' ); + depends+=( 'gtk2' 'lcms2' ); makedepends+=( 'xorgproto' ); else depends+=( 'gtk3' ); makedepends+=( 'xorgproto' ); fi -if [[ $M17N == "YES" ]]; then - depends+=( 'm17n-lib' ); -fi - if [[ $MAGICK == "YES" ]]; then depends+=( 'imagemagick' 'libjpeg-turbo' 'giflib' ); -elif [[ ! $NOX == "YES" ]]; then +elif [[ ! $NOX == "YES" ]] && [[ ! $CLI == "YES" ]]; then depends+=( 'libjpeg-turbo' 'giflib' ); -else +elif [[ $CLI == "YES" ]]; then depends+=(); fi -if [[ $CAIRO == "YES" ]]; then +if [[ ! $NOCAIRO == "YES" ]] && [[ ! $CLI == "YES" ]] ; then depends+=( 'cairo' ); fi @@ -190,7 +191,7 @@ prepare() { if [[ $CHECK == "YES" ]]; then check() { cd "$srcdir/emacs-git" - make -j check + make check } fi @@ -206,7 +207,6 @@ build() { --with-gameuser=:games --with-sound=alsa --with-modules - --with-native-compilation --with-json # Beware https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25228 # dconf and gconf break font settings you set in ~/.emacs. @@ -228,12 +228,12 @@ if [[ $LTO == "YES" ]]; then _conf+=( '--enable-link-time-optimization' ); fi -if [[ $PROFILING == "YES" ]]; then - _conf+=( '--enable-profiling' ); +if [[ $JIT == "YES" ]]; then + _conf+=( '--with-native-compilation' ); fi if [[ $CLI == "YES" ]]; then - _conf+=( '--without-x' '--with-x-toolkit=no' '--without-xft' '--without-lcms2' '--without-rsvg' ); + _conf+=( '--without-x' '--with-x-toolkit=no' '--without-xft' '--without-lcms2' '--without-rsvg' '--without-jpeg' '--without-gif' '--without-tiff' '--without-png' ); elif [[ $NOTKIT == "YES" ]]; then _conf+=( '--with-x-toolkit=no' '--without-toolkit-scroll-bars' '--with-xft' '--without-xaw3d' ); elif [[ $LUCID == "YES" ]]; then @@ -244,30 +244,27 @@ else _conf+=( '--with-x-toolkit=gtk3' '--without-xaw3d' ); fi -if [[ ! $M17N == "YES" ]]; then - _conf+=( '--without-m17n-flt' ); -fi - if [[ $MAGICK == "YES" ]]; then _conf+=( '--with-imagemagick'); +else + _conf+=(); fi -if [[ $CAIRO == "YES" ]]; then - _conf+=( '--with-cairo' ); +if [[ $NOCAIRO == "YES" || $CLI == "YES" ]]; then + _conf+=( '--without-cairo' ); fi if [[ $XWIDGETS == "YES" ]]; then _conf+=( '--with-xwidgets' ); fi -if [[ $PDUMPER == "YES" ]]; then - _conf+=( '--with-pdumper' ); -fi - if [[ $NOGZ == "YES" ]]; then _conf+=( '--without-compress-install' ); fi +# ctags/etags may be provided by other packages, e.g, universal-ctags +_conf+=('--program-transform-name=s/\([ec]tags\)/\1.emacs/') + ################################################################################ ################################################################################ @@ -282,10 +279,10 @@ fi # Please note that incremental compilation implies that you # are reusing your src directory! # - if [[ $FAST_BOOT == "YES" ]]; then - make -j NATIVE_FAST_BOOT=1 + if [[ $JIT == "YES" ]] && [[ $AOT == "YES" ]]; then + make NATIVE_FULL_AOT=1 else - make -j + make fi # You may need to run this if 'loaddefs.el' files become corrupt. @@ -312,15 +309,6 @@ package() { if [[ $DOCS_HTML == "YES" ]]; then make DESTDIR="$pkgdir/" install-html; fi if [[ $DOCS_PDF == "YES" ]]; then make DESTDIR="$pkgdir/" install-pdf; fi - # remove conflict with ctags package - mv "$pkgdir"/usr/bin/{ctags,ctags.emacs} - - if [[ $NOGZ == "YES" ]]; then - mv "$pkgdir"/usr/share/man/man1/{ctags.1,ctags.emacs.1}; - else - mv "$pkgdir"/usr/share/man/man1/{ctags.1.gz,ctags.emacs.1.gz} - fi - # fix user/root permissions on usr/share files find "$pkgdir"/usr/share/emacs/ | xargs chown root:root diff --git a/Documents/code/AUR/org-mode/PKGBUILD b/Documents/code/AUR/org-mode/PKGBUILD new file mode 100644 index 0000000..f9c02b2 --- /dev/null +++ b/Documents/code/AUR/org-mode/PKGBUILD @@ -0,0 +1,39 @@ +# contributor: zhuqin +# Maintainer: Stefan Husmann + +pkgname=emacs-org-mode-git +pkgver=9.4.6.r541.g52b09799c +pkgrel=1 +epoch=1 +pkgdesc="Emacs Org Mode from git" +arch=('any') +url="http://orgmode.org/" +depends=('emacs') +makedepends=('git' 'texlive-core' 'perl' 'awk') +optdepends=('java-environment: for using ditaa.jar in the contrib directory' + 'zsh: for using dir2org.zsh in the contrib directory') +license=('GPL') +provides=("emacs-org-mode=$pkgver") +conflicts=('emacs-org-mode') +install=emacs-org-mode.install +source=(emacs-org-mode::git+https://code.orgmode.org/bzg/org-mode.git) +md5sums=('SKIP') + +pkgver() { + cd ${pkgname%-git} + git describe --tags | sed 's+-+.r+' | cut -c9- | tr - . +} + + build() { + cd ${pkgname%-git} + make +} + +package () { + cd ${pkgname%-git} + + make DESTDIR="$pkgdir" install + mkdir -p "$pkgdir"/usr/share/info/orgmode + find "$pkgdir"/usr/share/info -maxdepth 1 -type f -exec mv {} "$pkgdir"/usr/share/info/orgmode \; + install -d "$pkgdir"/usr/share/emacs/site-lisp/org_contrib +} diff --git a/Documents/code/AUR/org-mode/emacs-org-mode.install b/Documents/code/AUR/org-mode/emacs-org-mode.install new file mode 100644 index 0000000..57b075c --- /dev/null +++ b/Documents/code/AUR/org-mode/emacs-org-mode.install @@ -0,0 +1,44 @@ +INFODIR=/usr/share/info + +pre_install() { +##! for file in {org,org-?.gz} ; do +##! if [ -e $INFODIR/$file ] ; then +##! echo "Removing $INFODIR/$file" +##! install-info --delete $INFODIR/$file $INFODIR/dir 2> /dev/null +##! rm -f $INFODIR/$file +##! fi +##! done + cat << EOM +To enable this version of org-mode instead of the one shipped with emacs, +add the line: + (require 'org-install) +to your .emacs file. + +NOTE: info documentation for emacs-org-mode goes now as 'orgmode' in /usr/share/info, + It does NOT replace the 'org' info files shipped with emacs: + $ info orgmode ## this version + $ info org ## emacs' org version +EOM +} + +post_install() { +##! mv $INFODIR/orgmode.gz $INFODIR/org.gz +##! install-info $INFODIR/org.gz $INFODIR/dir 2> /dev/null +##! and comment out the following line: + install-info --name='orgmode' --description='Org Mode provided by emacs-org-mode (AUR)' $INFODIR/orgmode.gz $INFODIR/dir 2> /dev/null + echo "For odt export, define a variable org-odt-data-dir to point " + echo "to an existing directory, e.g." + echo "(defvar org-odt-data-dir \"~/.emacs.d/org/etc\")" +} + +post_upgrade() { + post_install +} + + +pre_remove() { + install-info --delete $INFODIR/orgmode.gz $INFODIR/dir 2> /dev/null +##! comment out the line above and uncomment the following: +##! install-info --delete $INFODIR/org.gz $INFODIR/dir 2> /dev/null +##! rm $INFODIR/org.gz 2> /dev/null +} diff --git a/org/config/emacs.org b/org/config/emacs.org index 5613409..a11464b 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -1091,8 +1091,6 @@ I like it, so [[https://github.com/Phundrak/eshell-info-banner.el][I’ve writte :init ;; (add-hook 'org-mode-hook #'visual-line-mode) (auto-fill-mode -1) - (require 'ox-extra) - (ox-extras-activate '(ignore-headlines)) :general (:states 'normal @@ -1249,6 +1247,23 @@ I like it, so [[https://github.com/Phundrak/eshell-info-banner.el][I’ve writte (evil-org-agenda-set-keys)) #+end_src +Since very recently, the ~contrib/lisp/~ directory of org moved out of +the main repository to [[https://git.sr.ht/~bzg/org-contrib][this repository]]. On the other hand, +~contrib/scripts/~ moved to [[https://code.orgmode.org/bzg/worg/src/master/code][the worg repository]], but I don’t need +it. The main reason I want ~org-contrib~ is due to ~ox-extra~ that allow +the usage of the ~:ignore:~ tag in org. +#+begin_src emacs-lisp + (use-package org-contrib + :straight (org-contrib + :type git + :host nil + :repo "https://git.sr.ht/~bzg/org-contrib" + :build t) + :init + (require 'ox-extra) + (ox-extras-activate '(latex-header-blocks ignore-headlines))) +#+end_src + **** Agenda :PROPERTIES: :header-args:emacs-lisp: :tangle no :exports code :results silent @@ -2356,7 +2371,7 @@ Undefining some stuff to make keybind prefixes work correctly. epa-key-list-mode-map special-mode-map splash-screen-keymap undo-tree-visualizer-mode-map magit-blame-read-only-mode-map org-agenda-keymap org-agenda-mode-map git-rebase-mode-map - Buffer-menu-mode-map custom-mode-map) + Buffer-menu-mode-map custom-mode-map gfm-view-mode-map) "SPC" nil) (general-define-key