From ccf687afe289caa077fd96b48cb9e0c00676549cb2eca50c8e845eeef6c518d7 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 26 Sep 2023 12:41:57 +0000 Subject: [PATCH] Now also with a wayland compatible gtk binary OBS-URL: https://build.opensuse.org/package/show/editors/emacs?expand=0&rev=360 --- emacs.changes | 8 ++++++ emacs.sh | 22 ++++++++++---- emacs.spec | 79 +++++++++++++++++++++++++++++++++++---------------- pdump.patch | 59 ++++++++++++++------------------------ 4 files changed, 101 insertions(+), 67 deletions(-) diff --git a/emacs.changes b/emacs.changes index 171ddb1..fe9008b 100644 --- a/emacs.changes +++ b/emacs.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Sep 26 12:37:30 UTC 2023 - Dr. Werner Fink + +- Now with changed pdump.patch patch from bjorn.bidar@thaodan.de +- Build also wayland gtk based binary +- Support wayland binary by checking for XDG_SESSION_TYPE +- Provide eln native shared binaries for all emacs program binaries + ------------------------------------------------------------------- Tue Sep 26 00:11:46 UTC 2023 - Björn Bidar diff --git a/emacs.sh b/emacs.sh index 75d2bd6..b039954 100644 --- a/emacs.sh +++ b/emacs.sh @@ -5,9 +5,10 @@ # The environment variable EMACS_TOOLKIT is used to determine # the prefered GUI. Possible values/types of EMACS_TOOLKIT are # -# nox -- for pure console based GNU Emacs -# gtk -- for full GTK2/3 based GNU Emacs -# x11 -- for full LUCID based GNU Emacs (used Xaw3d) +# nox -- for pure console based GNU Emacs +# gtk -- for full GTK2/3 based GNU Emacs (for real X11) +# wayland -- for full GTK2/3 based GNU Emacs (for wayland) +# x11 -- for full LUCID based GNU Emacs (used Xaw3d) # # Should work but remember history # bnc#345669 -- Emacs doesn't un-maximize in KDE/KWin @@ -21,11 +22,22 @@ # esac # fi # -: ${EMACS_TOOLKIT:=gtk} +if test -n "${XDG_SESSION_TYPE}" +then + if test "${XDG_SESSION_TYPE}" = wayland -a -x ${0}-wayland + then + : ${EMACS_TOOLKIT:=wayland} + else + : ${EMACS_TOOLKIT:=gtk} + fi +else + : ${EMACS_TOOLKIT:=gtk} +fi # # Enabled again # -if test "$EMACS_TOOLKIT" = gtk; then +if test "$EMACS_TOOLKIT" = gtk -o "$EMACS_TOOLKIT" = wayland +then # Currently (2013/05/24) the parser of the GNOME libs # are broken that is it is not independent from locale LC_NUMERIC=POSIX diff --git a/emacs.spec b/emacs.spec index b4e2108..baec9ea 100644 --- a/emacs.spec +++ b/emacs.spec @@ -148,6 +148,7 @@ BuildRequires: pkgconfig(xrandr) BuildRequires: pkgconfig(xrender) BuildRequires: pkgconfig(xshmfence) BuildRequires: pkgconfig(xt) +BuildRequires: pkgconfig(xwayland) BuildRequires: pkgconfig(xxf86vm) URL: http://www.gnu.org/software/emacs/ Version: 29.1 @@ -256,6 +257,8 @@ Requires: gnu-unifont-bitmap-fonts Requires: ifnteuro Requires: xorg-x11-fonts Requires: xorg-x11-fonts-core +Requires: (ghostscript-fonts-std or urw-base35-fonts) +%glib2_gsettings_schema_requires Enhances: libX11-6 Summary: GNU Emacs: Emacs binary with X Window System Support Group: Productivity/Text/Editors @@ -352,6 +355,7 @@ popd %endif %build +umask 022 %if %{without autoconf} # We don't want to run autoconf if test configure.ac -nt aclocal.m4 -o m4/gnulib-comp.m4 -nt aclocal.m4 ; then @@ -462,6 +466,7 @@ DESKTOP="--with-x \ " GTK="${DESKTOP} \ --with-x-toolkit=gtk3 \ + --without-pgtk \ --with-toolkit-scroll-bars \ --x-includes=%{_x11inc} \ --x-libraries=%{_x11lib} \ @@ -469,11 +474,6 @@ DESKTOP="--with-x \ --with-m17n-flt \ %if %{with cairo} --with-cairo \ -%endif -%if %{with nativecomp} - --with-native-compilation \ -%else - --without-native-compilation \ %endif --with-xwidgets \ " @@ -484,7 +484,6 @@ DESKTOP="--with-x \ --x-libraries=%{_x11lib}:%{_x11data} \ --without-libotf \ --without-m17n-flt \ - --without-native-compilation \ " NOX11="--with-gpm \ --without-x \ @@ -501,7 +500,6 @@ DESKTOP="--with-x \ --without-libotf \ --without-m17n-flt \ --without-harfbuzz \ - --without-native-compilation \ " COMP="--disable-build-details \ %if %{with mailutils} @@ -509,6 +507,11 @@ DESKTOP="--with-x \ --with-mailutils %else --with-pop \ +%endif +%if %{with nativecomp} + --with-native-compilation \ +%else + --without-native-compilation \ %endif --without-hesiod \ --with-gameuser=:games \ @@ -532,27 +535,39 @@ fi ac_cv_lib_gif_EGifPutExtensionLast=yes export ac_cv_lib_gif_EGifPutExtensionLast +parking=$(mktemp -p ${PWD} -d parking.XXXXXX) CFLAGS="$CFLAGS -DPDMP_BASE='\"emacs-nox\"'" ./configure ${COMP} ${PREFIX} ${NOX11} ${SYS} --with-dumping=pdumper %make_build V=1 make -C lisp/ updates compile V=1 for i in $(find site-lisp/ -name '*.el'); do EMACSLOADPATH='' src/emacs -batch -q --no-site -f batch-byte-compile $i done -cp src/emacs emacs-nox -cp src/emacs.pdmp emacs-nox.pdmp +cp -p src/emacs src/emacs-nox +cp -p src/emacs.pdmp src/emacs-nox.pdmp +find native-lisp -type d -exec mkdir -p "${parking}%{_libdir}/emacs/%{version}/{}" \; +find native-lisp -type f -exec install -m 0644 "{}" "${parking}%{_libdir}/emacs/%{version}/{}" \; make distclean # CFLAGS="$CFLAGS -DPDMP_BASE='\"emacs-x11\"'" ./configure ${COMP} ${PREFIX} ${X11} ${SYS} --with-dumping=pdumper %make_build -cp src/emacs emacs-x11 -cp src/emacs.pdmp emacs-x11.pdmp +cp -p src/emacs src/emacs-x11 +cp -p src/emacs.pdmp src/emacs-x11.pdmp +find native-lisp -type d -exec mkdir -p "${parking}%{_libdir}/emacs/%{version}/{}" \; +find native-lisp -type f -exec install -m 0644 "{}" "${parking}%{_libdir}/emacs/%{version}/{}" \; make distclean # CFLAGS="$CFLAGS -DPDMP_BASE='\"emacs-gtk\"'" ./configure ${COMP} ${PREFIX} ${GTK} ${SYS} --with-dumping=pdumper %make_build -cp src/emacs emacs-gtk -cp src/emacs.pdmp emacs-gtk.pdmp -find -name '*.eln' +cp src/emacs src/emacs-gtk +cp src/emacs.pdmp src/emacs-gtk.pdmp +find native-lisp -type d -exec mkdir -p "${parking}%{_libdir}/emacs/%{version}/{}" \; +find native-lisp -type f -exec install -m 0644 "{}" "${parking}%{_libdir}/emacs/%{version}/{}" \; +make distclean +# +CFLAGS="$CFLAGS -DPDMP_BASE='\"emacs-wayland\"'" ./configure ${COMP} ${PREFIX} ${GTK//--without-pgtk/--with-pgtk} ${SYS} --with-dumping=pdumper +%make_build +cp src/emacs src/emacs-wayland +cp src/emacs.pdmp src/emacs-wayland.pdmp %if %{with tex4pdf} # @@ -567,6 +582,7 @@ rm -vf site-start.el.orig popd %install +umask 022 # PATH=/sbin:$PATH ## @@ -577,12 +593,20 @@ mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration} make install DESTDIR=%{buildroot} systemdunitdir=%{_userunitdir} rm -vf %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/*.pdmp -install -m 0755 emacs-nox %{buildroot}%{_bindir} -install -m 0755 emacs-gtk %{buildroot}%{_bindir} -install -m 0755 emacs-x11 %{buildroot}%{_bindir} -install -m 0644 emacs-nox.pdmp %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/ -install -m 0644 emacs-gtk.pdmp %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/ -install -m 0644 emacs-x11.pdmp %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/ +pushd native-lisp/ + ln -sf ../parking.*/usr/lib64/emacs/29.1/native-lisp/* . +popd +for pdmp in emacs-nox emacs-gtk emacs-x11 emacs-wayland +do + install -m 0755 src/${pdmp} %{buildroot}%{_bindir} + install -m 0644 src/${pdmp}.pdmp %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/ + ln -sf ${pdmp}.pdmp %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/${pdmp}-$(src/${pdmp} --fingerprint).pdmp +done +pushd parking.*/%{_libdir}/emacs/%{version}/ + find native-lisp -type d -exec mkdir -p "%{buildroot}%{_libdir}/emacs/%{version}/{}" \; + find native-lisp -type f -exec install -m 0644 "{}" "%{buildroot}%{_libdir}/emacs/%{version}/{}" \; +popd +rm -rf parking.* rm -vf %{buildroot}/usr/bin/emacs rm -vf %{buildroot}%{_libexecdir}/emacs/%{version}/${configuration}/emacs.pdmp install -p %{S:5} %{buildroot}/usr/bin/emacs @@ -769,6 +793,10 @@ if test -e usr/share/emacs/site-lisp/auctex/font-latex.elc ; then TeX-auto-global "")' -f batch-byte-compile font-latex.el > /dev/null 2>&1 cd $owd fi +%glib2_gsettings_schema_post + +%postun -n emacs-x11 +%glib2_gsettings_schema_postun %if 0%{?suse_version} <= 1500 %post info @@ -981,7 +1009,7 @@ fi %{_datadir}/emacs/%{version}/etc/charsets/symbol.map %{_datadir}/emacs/%{version}/etc/compilation.txt %{_datadir}/emacs/%{version}/etc/emacs_lldb.py -%{_datadir}/emacs/%{version}/etc/org.gnu.emacs.defaults.gschema.xml +%{_datadir}/emacs/%{version}/etc/org.gnu.emacs.defaults.gschema.* %dir %{_datadir}/emacs/%{version}/etc/org/ %dir %{_datadir}/emacs/%{version}/etc/org/csl/ %{_datadir}/emacs/%{version}/etc/org/csl/README @@ -3437,17 +3465,20 @@ fi %files -n emacs-nox %defattr(-, root, root) %{_bindir}/emacs-nox -%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-nox.pdmp +%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-nox*.pdmp %files -n emacs-x11 %defattr(-, root, root) %{_bindir}/emacs-x11 %{_bindir}/emacs-gtk -%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-x11.pdmp -%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-gtk.pdmp +%{_bindir}/emacs-wayland +%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-x11*.pdmp +%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-gtk*.pdmp +%{_libexecdir}/emacs/%{version}/*-suse-linux*/emacs-wayland*.pdmp %dir %{appDefaultsDir} %{appDefaultsFile} %{_datadir}/applications/emacs*.desktop +%{_datadir}/glib-2.0/schemas/org.gnu.emacs.defaults.gschema.xml %{_datadir}/icons/hicolor/128x128/apps/emacs.png %{_datadir}/icons/hicolor/16x16/apps/emacs.png %{_datadir}/icons/hicolor/24x24/apps/emacs.png diff --git a/pdump.patch b/pdump.patch index a7d2fc0..5dfa8b9 100644 --- a/pdump.patch +++ b/pdump.patch @@ -1,15 +1,17 @@ -From: Andreas Schwab -Port to GNU Emacs 29.1: Werner Fink +From 54823555425ffabe31b42672b1894d0e3ff1b018 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= +Date: Fri, 10 Feb 2023 23:31:35 +0200 +Subject: [PATCH] Allow to override pdmp base -Index: src/emacs.c -=================================================================== --- - src/emacs.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) + src/emacs.c | 8 ++++++++ + 1 file changed, 8 insertions(+) +diff --git a/src/emacs.c b/src/emacs.c +index 687b8c7f81f0..2d6bfe07d813 100644 --- src/emacs.c -+++ src/emacs.c 2023-08-07 07:30:34.317996305 +0000 -@@ -867,12 +867,16 @@ load_pdump (int argc, char **argv) ++++ src/emacs.c +@@ -920,11 +920,15 @@ load_pdump (int argc, char **argv, char *dump_file) NULL #endif ; @@ -21,38 +23,19 @@ Index: src/emacs.c "Emacs" #else "emacs" - #endif +#endif + #endif ; - /* TODO: maybe more thoroughly scrub process environment in order to -@@ -957,6 +961,29 @@ load_pdump (int argc, char **argv) - path_exec = ns_relocate (path_exec); - #endif - +@@ -1065,7 +1069,11 @@ load_pdump (int argc, char **argv, char *dump_file) + if (IS_DIRECTORY_SEP (*p)) + last_sep = p; + } +#ifdef PDMP_BASE -+ if (emacs_executable && *emacs_executable) -+ { -+ needed = (strlen (path_exec) -+ + 1 -+ + strlen (argv0_base) -+ + 1 -+ + strlen (suffix) -+ + 1); -+ if (bufsize < needed) -+ { -+ xfree (dump_file); -+ dump_file = xpalloc (NULL, &bufsize, needed - bufsize, -1, 1); -+ } -+ sprintf (dump_file, "%s%c%s%s", -+ path_exec, DIRECTORY_SEP, argv0_base, suffix); -+ result = pdumper_load (dump_file, emacs_executable); -+ -+ if (result == PDUMPER_LOAD_SUCCESS) -+ goto out; -+ } ++ argv0_base = PDMP_BASE; ++#else + argv0_base = last_sep ? last_sep + 1 : argv[0]; +#endif -+ - /* Look for "emacs-FINGERPRINT.pdmp" in PATH_EXEC. We hardcode - "emacs" in "emacs-FINGERPRINT.pdmp" so that the Emacs binary - still works if the user copies and renames it. */ + ptrdiff_t needed = (strlen (path_exec) + + 1 + + strlen (argv0_base)