Switch the default emacs
binary to pure-GTK, suitable for Wayland
Rename the old default hybrid GTK/X11 binary to `emacs-gtk+x11`.
This commit is contained in:
parent
e27f9eabc4
commit
6a39a2112e
26
emacs-desktop.patch
Normal file
26
emacs-desktop.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 90e902854c53c6ab5ef8711af27f42fbc77d9ffe Mon Sep 17 00:00:00 2001
|
||||
From: Peter Oliver <git@mavit.org.uk>
|
||||
Date: Mon, 10 Apr 2023 20:55:54 +0100
|
||||
Subject: [PATCH] Use a wrapper to avoid the pure GTK build on X11, where it is
|
||||
unsupported.
|
||||
|
||||
---
|
||||
etc/emacs.desktop | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/etc/emacs.desktop b/etc/emacs.desktop
|
||||
index 0d7cac14da5..eabc78bb884 100644
|
||||
--- a/etc/emacs.desktop
|
||||
+++ b/etc/emacs.desktop
|
||||
@@ -3,7 +3,7 @@ Name=Emacs
|
||||
GenericName=Text Editor
|
||||
Comment=Edit text
|
||||
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
|
||||
-Exec=emacs %F
|
||||
+Exec=emacs-desktop %F
|
||||
Icon=emacs
|
||||
Type=Application
|
||||
Terminal=false
|
||||
--
|
||||
2.39.2
|
||||
|
19
emacs-desktop.sh
Executable file
19
emacs-desktop.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The pure GTK build of emacs is not supported on X11, so try to avoid
|
||||
# using if there is an alternative.
|
||||
|
||||
if [ "$XDG_SESSION_TYPE" = 'x11' ]; then
|
||||
emacs="$(readlink -f /usr/bin/emacs)"
|
||||
emacs="${emacs##*/}"
|
||||
emacs="${emacs%-*.*.*}"
|
||||
if [ "$emacs" = 'emacs' ]; then
|
||||
if type emacs-gtk+x11 >/dev/null; then
|
||||
exec emacs-gtk+x11 "$@"
|
||||
elif type emacs-lucid >/dev/null; then
|
||||
exec emacs-lucid "$@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exec emacs "$@"
|
26
emacs-pgtk-on-x-error-message.patch
Normal file
26
emacs-pgtk-on-x-error-message.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From eaaf4883aee50974eeb03e529a29585f8ddc1d9d Mon Sep 17 00:00:00 2001
|
||||
From: Bhavin Gandhi <bhavin192@geeksocket.in>
|
||||
Date: Wed, 31 May 2023 22:44:54 +0530
|
||||
Subject: [PATCH] Add package names to PGTK on X error message
|
||||
|
||||
---
|
||||
src/pgtkterm.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
|
||||
index c00e13550bd..ce51bff5947 100644
|
||||
--- a/src/pgtkterm.c
|
||||
+++ b/src/pgtkterm.c
|
||||
@@ -6680,7 +6680,8 @@ pgtk_display_x_warning (GdkDisplay *display)
|
||||
" System. That configuration is unsupported and"
|
||||
" will lead to sporadic crashes during transfer of"
|
||||
" large selection data. It will also lead to"
|
||||
- " various problems with keyboard input.");
|
||||
+ " various problems with keyboard input."
|
||||
+ "\nInstall emacs-gtk+x11 or emacs-lucid package.");
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), label);
|
||||
gtk_widget_show (label);
|
||||
--
|
||||
2.40.1
|
||||
|
133
emacs.spec
133
emacs.spec
@ -18,13 +18,17 @@ Source6: default.el
|
||||
# Emacs Terminal Mode, #551949, #617355
|
||||
Source7: emacs-terminal.desktop
|
||||
Source8: emacs-terminal.sh
|
||||
Source9: emacs-desktop.sh
|
||||
# rhbz#713600
|
||||
Patch1: emacs-spellchecker.patch
|
||||
Patch2: emacs-system-crypto-policies.patch
|
||||
# causes a dependency on pkgconfig(systemd)
|
||||
# => remove it if we stop using this patch
|
||||
Patch3: emacs-libdir-vs-systemd.patch
|
||||
# Avoid using the pure GTK build on X11 where it is unsupported:
|
||||
Patch4: emacs-desktop.patch
|
||||
Patch5: 0001-configure-Remove-obsolete-check-for-b-i486-linuxaout.patch
|
||||
Patch6: emacs-pgtk-on-x-error-message.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: atk-devel
|
||||
@ -95,7 +99,7 @@ Requires(preun): %{_sbindir}/alternatives
|
||||
Requires(posttrans): %{_sbindir}/alternatives
|
||||
Requires: emacs-common = %{epoch}:%{version}-%{release}
|
||||
Provides: emacs(bin) = %{epoch}:%{version}-%{release}
|
||||
Supplements: ((libwayland-server or xorg-x11-server-Xorg) and emacs-common)
|
||||
Supplements: (libwayland-server and emacs-common)
|
||||
|
||||
%define site_lisp %{_datadir}/emacs/site-lisp
|
||||
%define site_start_d %{site_lisp}/site-start.d
|
||||
@ -104,16 +108,33 @@ Supplements: ((libwayland-server or xorg-x11-server-Xorg) and emacs-common)
|
||||
%define emacs_libexecdir %{_libexecdir}/emacs/%{version}/%{_host}
|
||||
%define native_lisp %{_libdir}/emacs/%{version}/native-lisp
|
||||
|
||||
%description
|
||||
Emacs is a powerful, customizable, self-documenting, modeless text
|
||||
%global desc %{expand:Emacs is a powerful, customizable, self-documenting, modeless text
|
||||
editor. Emacs contains special code editing features, a scripting
|
||||
language (elisp), and the capability to read mail, news, and more
|
||||
without leaving the editor.
|
||||
}
|
||||
|
||||
This package provides an emacs binary with support for X windows.
|
||||
%description
|
||||
%desc
|
||||
This package provides an emacs binary with support for Wayland, using the
|
||||
GTK toolkit.
|
||||
|
||||
%package gtk+x11
|
||||
Summary: GNU Emacs text editor with GTK toolkit X support
|
||||
Requires: libgccjit
|
||||
Requires(preun): %{_sbindir}/alternatives
|
||||
Requires(posttrans): %{_sbindir}/alternatives
|
||||
Requires: emacs-common = %{epoch}:%{version}-%{release}
|
||||
Provides: emacs(bin) = %{epoch}:%{version}-%{release}
|
||||
Supplements: (xorg-x11-server-Xorg and emacs-common)
|
||||
|
||||
%description gtk+x11
|
||||
%desc
|
||||
This package provides an emacs-gtk+x11 binary with support for the X
|
||||
Window System, using the GTK toolkit.
|
||||
|
||||
%package lucid
|
||||
Summary: GNU Emacs text editor with LUCID toolkit X support
|
||||
Summary: GNU Emacs text editor with Lucid toolkit X support
|
||||
Requires: google-noto-sans-mono-vf-fonts
|
||||
Requires(preun): %{_sbindir}/alternatives
|
||||
Requires(posttrans): %{_sbindir}/alternatives
|
||||
@ -121,13 +142,9 @@ Requires: emacs-common = %{epoch}:%{version}-%{release}
|
||||
Provides: emacs(bin) = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description lucid
|
||||
Emacs is a powerful, customizable, self-documenting, modeless text
|
||||
editor. Emacs contains special code editing features, a scripting
|
||||
language (elisp), and the capability to read mail, news, and more
|
||||
without leaving the editor.
|
||||
|
||||
This package provides an emacs binary with support for X windows
|
||||
using LUCID toolkit.
|
||||
%desc
|
||||
This package provides an emacs-lucid binary with support for the X
|
||||
Window System, using the Lucid toolkit.
|
||||
|
||||
%package nox
|
||||
Summary: GNU Emacs text editor without X support
|
||||
@ -137,13 +154,9 @@ Requires: emacs-common = %{epoch}:%{version}-%{release}
|
||||
Provides: emacs(bin) = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description nox
|
||||
Emacs is a powerful, customizable, self-documenting, modeless text
|
||||
editor. Emacs contains special code editing features, a scripting
|
||||
language (elisp), and the capability to read mail, news, and more
|
||||
without leaving the editor.
|
||||
|
||||
This package provides an emacs binary with no X windows support for running
|
||||
on a terminal.
|
||||
%desc
|
||||
This package provides an emacs-nox binary with no graphical display
|
||||
support, for running on a terminal.
|
||||
|
||||
%package common
|
||||
Summary: Emacs common files
|
||||
@ -154,7 +167,7 @@ Requires(preun): %{_sbindir}/alternatives
|
||||
Requires(posttrans): %{_sbindir}/alternatives
|
||||
Requires: %{name}-filesystem = %{epoch}:%{version}-%{release}
|
||||
Requires: libgccjit
|
||||
Recommends: (emacs or emacs-lucid or emacs-nox)
|
||||
Recommends: (emacs or emacs-gtk+x11 or emacs-lucid or emacs-nox)
|
||||
Recommends: enchant2
|
||||
Recommends: info
|
||||
Provides: %{name}-el = %{epoch}:%{version}-%{release}
|
||||
@ -174,13 +187,9 @@ Recommends: git
|
||||
|
||||
|
||||
%description common
|
||||
Emacs is a powerful, customizable, self-documenting, modeless text
|
||||
editor. Emacs contains special code editing features, a scripting
|
||||
language (elisp), and the capability to read mail, news, and more
|
||||
without leaving the editor.
|
||||
|
||||
This package contains all the common files needed by emacs, emacs-lucid
|
||||
or emacs-nox.
|
||||
%desc
|
||||
This package contains all the common files needed by emacs, emacs-gtk+x11,
|
||||
emacs-lucid, or emacs-nox.
|
||||
|
||||
%package terminal
|
||||
Summary: A desktop menu item for GNU Emacs terminal.
|
||||
@ -262,8 +271,8 @@ ln -s ../configure .
|
||||
%{setarch} %make_build
|
||||
cd ..
|
||||
|
||||
# Build GTK+ binary
|
||||
mkdir build-gtk && cd build-gtk
|
||||
# Build GTK/X11 binary
|
||||
mkdir build-gtk+x11 && cd build-gtk+x11
|
||||
ln -s ../configure .
|
||||
|
||||
LDFLAGS=-Wl,-z,relro; export LDFLAGS;
|
||||
@ -277,8 +286,23 @@ LDFLAGS=-Wl,-z,relro; export LDFLAGS;
|
||||
%{setarch} %make_build
|
||||
cd ..
|
||||
|
||||
# Build pure GTK binary
|
||||
mkdir build-pgtk && cd build-pgtk
|
||||
ln -s ../configure .
|
||||
|
||||
LDFLAGS=-Wl,-z,relro; export LDFLAGS;
|
||||
|
||||
%configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg \
|
||||
--with-tiff --with-xpm --with-pgtk --with-gpm=no \
|
||||
--with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json \
|
||||
--with-native-compilation=aot --with-tree-sitter --with-sqlite3 \
|
||||
--with-webp
|
||||
%{setarch} %make_build bootstrap
|
||||
%{setarch} %make_build
|
||||
cd ..
|
||||
|
||||
# Remove versioned file so that we end up with .1 suffix and only one DOC file
|
||||
rm build-{gtk,lucid,nox}/src/emacs-%{version}.*
|
||||
rm build-{gtk+x11,lucid,nox,pgtk}/src/emacs-%{version}.*
|
||||
|
||||
# Create pkgconfig file
|
||||
cat > emacs.pc << EOF
|
||||
@ -301,7 +325,7 @@ cat > macros.emacs << EOF
|
||||
EOF
|
||||
|
||||
%install
|
||||
cd build-gtk
|
||||
cd build-pgtk
|
||||
%make_install
|
||||
cd ..
|
||||
|
||||
@ -313,7 +337,10 @@ touch %{buildroot}%{_bindir}/emacs
|
||||
gunzip %{buildroot}%{_datadir}/emacs/%{version}/lisp/jka-compr.el.gz
|
||||
gunzip %{buildroot}%{_datadir}/emacs/%{version}/lisp/jka-cmpr-hook.el.gz
|
||||
|
||||
# Install the emacs with LUCID toolkit
|
||||
# Install the emacs with GTK toolkit
|
||||
install -p -m 0755 build-gtk+x11/src/emacs %{buildroot}%{_bindir}/emacs-%{version}-gtk+x11
|
||||
|
||||
# Install the emacs with Lucid toolkit
|
||||
install -p -m 0755 build-lucid/src/emacs %{buildroot}%{_bindir}/emacs-%{version}-lucid
|
||||
|
||||
# Install the emacs without X
|
||||
@ -362,6 +389,9 @@ rm -f %{buildroot}%{_infodir}/dir
|
||||
desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
|
||||
%SOURCE7
|
||||
|
||||
# Install a wrapper to avoid running the Wayland-only build on X11
|
||||
install -p -m 0755 %SOURCE9 %{buildroot}%{_bindir}/emacs-desktop
|
||||
|
||||
# Remove duplicate desktop-related files
|
||||
rm %{buildroot}%{_datadir}/%{name}/%{version}/etc/%{name}.{desktop,service}
|
||||
|
||||
@ -400,8 +430,11 @@ grep -vhE '%{site_lisp}(|/(default\.el|site-start\.d|site-start\.el))$' {common,
|
||||
rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg
|
||||
|
||||
# Install all the pdmp with fingerprints
|
||||
gtk_pdmp="emacs-$(./build-gtk/src/emacs --fingerprint 2>&1 | sed 's/.* //').pdmp"
|
||||
install -p -m 0644 build-gtk/src/emacs.pdmp %{buildroot}%{emacs_libexecdir}/${gtk_pdmp}
|
||||
pgtk_pdmp="emacs-$(./build-pgtk/src/emacs --fingerprint 2>&1 | sed 's/.* //').pdmp"
|
||||
install -p -m 0644 build-pgtk/src/emacs.pdmp %{buildroot}%{emacs_libexecdir}/${pgtk_pdmp}
|
||||
|
||||
gtkx11_pdmp="emacs-$(./build-gtk+x11/src/emacs --fingerprint 2>&1 | sed 's/.* //').pdmp"
|
||||
install -p -m 0644 build-gtk+x11/src/emacs.pdmp %{buildroot}%{emacs_libexecdir}/${gtkx11_pdmp}
|
||||
|
||||
lucid_pdmp="emacs-$(./build-lucid/src/emacs --fingerprint 2>&1 | sed 's/.* //').pdmp"
|
||||
install -p -m 0644 build-lucid/src/emacs.pdmp %{buildroot}%{emacs_libexecdir}/${lucid_pdmp}
|
||||
@ -410,16 +443,22 @@ nox_pdmp="emacs-$(./build-nox/src/emacs --fingerprint 2>&1 | sed 's/.* //').pdmp
|
||||
install -p -m 0644 build-nox/src/emacs.pdmp %{buildroot}%{emacs_libexecdir}/${nox_pdmp}
|
||||
|
||||
# Install native compiled Lisp of all builds
|
||||
gtk_comp_native_ver=$(ls -1 build-gtk/native-lisp)
|
||||
pgtk_comp_native_ver=$(ls -1 build-pgtk/native-lisp)
|
||||
gtkx11_comp_native_ver=$(ls -1 build-gtk+x11/native-lisp)
|
||||
lucid_comp_native_ver=$(ls -1 build-lucid/native-lisp)
|
||||
nox_comp_native_ver=$(ls -1 build-nox/native-lisp)
|
||||
cp -ar build-gtk/native-lisp/${gtk_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
cp -ar build-pgtk/native-lisp/${pgtk_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
cp -ar build-gtk+x11/native-lisp/${gtkx11_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
cp -ar build-lucid/native-lisp/${lucid_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
cp -ar build-nox/native-lisp/${nox_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
|
||||
(TOPDIR=${PWD}
|
||||
cd %{buildroot}
|
||||
find .%{native_lisp}/${gtk_comp_native_ver} \( -type f -name '*eln' -fprintf $TOPDIR/gtk-eln-filelist "%%%%attr(755,-,-) %%p\n" \) -o \( -type d -fprintf $TOPDIR/gtk-dirs "%%%%dir %%p\n" \)
|
||||
find .%{native_lisp}/${gtkx11_comp_native_ver} \( -type f -name '*eln' -fprintf $TOPDIR/gtk+x11-eln-filelist "%%%%attr(755,-,-) %%p\n" \) -o \( -type d -fprintf $TOPDIR/gtk+x11-dirs "%%%%dir %%p\n" \)
|
||||
)
|
||||
(TOPDIR=${PWD}
|
||||
cd %{buildroot}
|
||||
find .%{native_lisp}/${pgtk_comp_native_ver} \( -type f -name '*eln' -fprintf $TOPDIR/pgtk-eln-filelist "%%%%attr(755,-,-) %%p\n" \) -o \( -type d -fprintf $TOPDIR/pgtk-dirs "%%%%dir %%p\n" \)
|
||||
)
|
||||
(TOPDIR=${PWD}
|
||||
cd %{buildroot}
|
||||
@ -429,7 +468,8 @@ cp -ar build-nox/native-lisp/${nox_comp_native_ver} %{buildroot}%{native_lisp}
|
||||
cd %{buildroot}
|
||||
find .%{native_lisp}/${nox_comp_native_ver} \( -type f -name '*eln' -fprintf $TOPDIR/nox-eln-filelist "%%%%attr(755,-,-) %%p\n" \) -o \( -type d -fprintf $TOPDIR/nox-dirs "%%%%dir %%p\n" \)
|
||||
)
|
||||
echo %{emacs_libexecdir}/${gtk_pdmp} >> gtk-eln-filelist
|
||||
echo %{emacs_libexecdir}/${pgtk_pdmp} >> pgtk-eln-filelist
|
||||
echo %{emacs_libexecdir}/${gtkx11_pdmp} >> gtk+x11-eln-filelist
|
||||
echo %{emacs_libexecdir}/${lucid_pdmp} >> lucid-eln-filelist
|
||||
echo %{emacs_libexecdir}/${nox_pdmp} >> nox-eln-filelist
|
||||
|
||||
@ -462,6 +502,14 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop
|
||||
%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version}-lucid 70 || :
|
||||
%{_sbindir}/alternatives --install %{_bindir}/emacs-lucid emacs-lucid %{_bindir}/emacs-%{version}-lucid 60 || :
|
||||
|
||||
%preun gtk+x11
|
||||
%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}-gtk+x11 || :
|
||||
%{_sbindir}/alternatives --remove emacs-gtk+x11 %{_bindir}/emacs-%{version}-gtk+x11 || :
|
||||
|
||||
%posttrans gtk+x11
|
||||
%{_sbindir}/alternatives --install %{_bindir}/emacs emacs %{_bindir}/emacs-%{version}-gtk+x11 75 || :
|
||||
%{_sbindir}/alternatives --install %{_bindir}/emacs-gtk+x11 emacs-gtk+x11 %{_bindir}/emacs-%{version}-gtk+x11 60 || :
|
||||
|
||||
%preun nox
|
||||
%{_sbindir}/alternatives --remove emacs %{_bindir}/emacs-%{version}-nox || :
|
||||
%{_sbindir}/alternatives --remove emacs-nox %{_bindir}/emacs-%{version}-nox || :
|
||||
@ -477,9 +525,15 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop
|
||||
%{_sbindir}/alternatives --install %{_bindir}/etags emacs.etags %{_bindir}/etags.emacs 80 \
|
||||
--slave %{_mandir}/man1/etags.1.gz emacs.etags.man %{_mandir}/man1/etags.emacs.1.gz || :
|
||||
|
||||
%files -f gtk-eln-filelist -f gtk-dirs
|
||||
%files -f pgtk-eln-filelist -f pgtk-dirs
|
||||
%{_bindir}/emacs-%{version}
|
||||
%attr(0755,-,-) %ghost %{_bindir}/emacs
|
||||
%{_datadir}/glib-2.0/schemas/org.gnu.emacs.defaults.gschema.xml
|
||||
|
||||
%files gtk+x11 -f gtk+x11-eln-filelist -f gtk+x11-dirs
|
||||
%{_bindir}/emacs-%{version}-gtk+x11
|
||||
%attr(0755,-,-) %ghost %{_bindir}/emacs
|
||||
%attr(0755,-,-) %ghost %{_bindir}/emacs-gtk+x11
|
||||
|
||||
%files lucid -f lucid-eln-filelist -f lucid-dirs
|
||||
%{_bindir}/emacs-%{version}-lucid
|
||||
@ -498,6 +552,7 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop
|
||||
%doc doc/NEWS BUGS README
|
||||
%{_bindir}/ebrowse
|
||||
%{_bindir}/emacsclient
|
||||
%{_bindir}/emacs-desktop
|
||||
%{_bindir}/etags.emacs
|
||||
%{_bindir}/gctags
|
||||
%{_datadir}/applications/emacs.desktop
|
||||
|
Loading…
Reference in New Issue
Block a user