Page MenuHomeFreeBSD

editors/emacs-devel: Build pure GTK Emacs by default
ClosedPublic

Authored by jrm on Jan 1 2022, 9:37 PM.

Details

Summary
editors/emacs-devel: Build pure GTK Emacs by default
  • Add PGTK to OPTIONS_DEFAULT
  • Remove M17N, OTF, XFT, XIM, and XPM from OPTIONS_DEFAULT
  • Eliminate X11 dependencies for pure GTK Emacs by
    • removing CAIRO_IMPLIES=XFT and OTF_IMPLIES=XFT
    • adding CAIRO_PREVENTS=XFT and PGTK_PREVENTS=M17N XFT XPM
    • not including USES=xorg.

While here, pull in a new 2022-01-03 revision and incorporate minor formatting changes suggested by portfmt.

Reported by: jbeich
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jrm requested review of this revision.Jan 1 2022, 9:37 PM

While this fixes CAIRO a lot of X11 dependencies are still added by the following:

.if ${FLAVOR:U} != nox
USES+=		desktop-file-utils gnome xorg
USE_XORG=	ice sm x11 xcb xext xfixes xinerama xmu xrandr xrender xt
.endif

but when built with PGTK poudriere shows:

=>> Checking shared library dependencies
 0x0000000000000001 NEEDED               Shared library: [libatk-1.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x0000000000000001 NEEDED               Shared library: [libcairo-gobject.so.2]
 0x0000000000000001 NEEDED               Shared library: [libcairo.so.2]
 0x0000000000000001 NEEDED               Shared library: [libcrypt.so.5]
 0x0000000000000001 NEEDED               Shared library: [libdbus-1.so.3]
 0x0000000000000001 NEEDED               Shared library: [libdl.so.1]
 0x0000000000000001 NEEDED               Shared library: [libexecinfo.so.1]
 0x0000000000000001 NEEDED               Shared library: [libfontconfig.so.1]
 0x0000000000000001 NEEDED               Shared library: [libfreetype.so.6]
 0x0000000000000001 NEEDED               Shared library: [libgdk-3.so.0]
 0x0000000000000001 NEEDED               Shared library: [libgdk_pixbuf-2.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libgif.so.7]
 0x0000000000000001 NEEDED               Shared library: [libgio-2.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libglib-2.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libgmp.so.10]
 0x0000000000000001 NEEDED               Shared library: [libgnutls.so.30]
 0x0000000000000001 NEEDED               Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libgtk-3.so.0]
 0x0000000000000001 NEEDED               Shared library: [libharfbuzz.so.0]
 0x0000000000000001 NEEDED               Shared library: [libintl.so.8]
 0x0000000000000001 NEEDED               Shared library: [libjansson.so.4]
 0x0000000000000001 NEEDED               Shared library: [libjpeg.so.8]
 0x0000000000000001 NEEDED               Shared library: [liblcms2.so.2]
 0x0000000000000001 NEEDED               Shared library: [libm.so.5]
 0x0000000000000001 NEEDED               Shared library: [libmailutils.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_auth.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_dotmail.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_imap.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_maildir.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_mailer.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_mbox.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmu_pop.so.8]
 0x0000000000000001 NEEDED               Shared library: [libmuaux.so.8]
 0x0000000000000001 NEEDED               Shared library: [libncurses.so.8]
 0x0000000000000001 NEEDED               Shared library: [libotf.so.1]
 0x0000000000000001 NEEDED               Shared library: [libpam.so.6]
 0x0000000000000001 NEEDED               Shared library: [libpango-1.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libpangocairo-1.0.so.0]
 0x0000000000000001 NEEDED               Shared library: [libpng16.so.16]
 0x0000000000000001 NEEDED               Shared library: [librsvg-2.so.2]
 0x0000000000000001 NEEDED               Shared library: [librt.so.1]
 0x0000000000000001 NEEDED               Shared library: [libsqlite3.so.0]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libtiff.so.5]
 0x0000000000000001 NEEDED               Shared library: [libunistring.so.2]
 0x0000000000000001 NEEDED               Shared library: [libutil.so.9]
 0x0000000000000001 NEEDED               Shared library: [libwebp.so.7]
 0x0000000000000001 NEEDED               Shared library: [libxml2.so.2]
 0x0000000000000001 NEEDED               Shared library: [libz.so.6]

Also, XFT is currently in OPTIONS_DEFAULT but, at least when PGTK is enabled, doesn't appear to be used.

jrm retitled this revision from editors/emacs-devel: Remove CAIRO_IMPLIES=XFT to editors/emacs-devel: Reduce X11 deps for pure GTK builds.Jan 2 2022, 1:43 AM

Reduce X11 dependencies for pure GTK Emacs by

  • removing CAIRO_IMPLIES=XFT
  • removing XFT and XIM from OPTIONS_DEFAULT
  • not including USES=xorg.

Getting there.

% pkg info emacs-devel-29.0.50.20220101_1,2
emacs-devel-29.0.50.20220101_1,2
Name           : emacs-devel
Version        : 29.0.50.20220101_1,2
Installed on   : Sat Jan  1 21:37:18 2022 AST
Origin         : editors/emacs-devel
Architecture   : FreeBSD:13:amd64
Prefix         : /usr/local
Categories     : editors
Licenses       : GPLv3+
Maintainer     : emacs@FreeBSD.org
WWW            : http://www.gnu.org/software/emacs/
Comment        : GNU editing macros
Options        :
        ACL            : on
        ALSA           : off
        CAIRO          : on
        DBUS           : off
        GCONF          : off
        GFILE          : off
        GIF            : on
        GNUTLS         : on
        GSETTINGS      : off
        GTK2           : off
        GTK3           : on
        HARFBUZZ       : on
        JPEG           : on
        JSON           : on
        KQUEUE         : on
        LCMS2          : on
        M17N           : off
        MAGICK         : off
        MAILUTILS      : off
        MODULES        : on
        NATIVECOMP     : off
        OSS            : on
        OTF            : off
        PGTK           : on
        PNG            : on
        SCROLLBARS     : on
        SOURCES        : on
        SQLITE3        : on
        SVG            : on
        THREADS        : on
        TIFF           : on
        WEBP           : on
        XAW            : off
        XAW3D          : off
        XFT            : off
        XIM            : off
        XML            : on
        XPM            : on
        XWIDGETS       : off
Shared Libs required:
        libjansson.so.4
        libpango-1.0.so.0
        libjpeg.so.8
        libfreetype.so.6
        libsqlite3.so.0
        libcairo.so.2
        libgtk-3.so.0
        libxml2.so.2
        libwebp.so.7
        libgnutls.so.30
        libgif.so.7
        libcairo-gobject.so.2
        libatk-1.0.so.0
        libtiff.so.5
        libgdk_pixbuf-2.0.so.0
        libgio-2.0.so.0
        libglib-2.0.so.0
        libgobject-2.0.so.0
        libharfbuzz.so.0
        libgmp.so.10
        libpng16.so.16
        librsvg-2.so.2
        libintl.so.8
        libfontconfig.so.1
        libgdk-3.so.0
        libpangocairo-1.0.so.0
        liblcms2.so.2
% pkg info -d emacs-devel-29.0.50.20220101_1,2
emacs-devel-29.0.50.20220101_1,2:
        pango-1.48.7
        gtk3-3.24.30_1
        fontconfig-2.13.94_1,1
        libxml2-2.9.12
        gnutls-3.6.16
        indexinfo-0.3.1
        harfbuzz-3.2.0
        freetype2-2.11.1
        gmp-6.2.1
        webp-1.2.1
        tiff-4.3.0
        png-1.6.37_1
        librsvg2-rust-2.52.5
        lcms2-2.12
        jpeg-turbo-2.1.1_1
        giflib-5.2.1
        gdk-pixbuf2-2.40.0
        cairo-1.17.4,3
        jansson-2.14
        glib-2.70.2,2
        gettext-runtime-0.21
        desktop-file-utils-0.26_1
        sqlite3-3.35.5_4,1
        atk-2.36.0

XFT is still enabled by default via OTF_IMPLIES but PGTK does use OTF (see also bug 260873)

-  What window system should Emacs use?                    x11
+  What window system should Emacs use?                    pgtk
[...]
-  Does Emacs use -lXpm?                                   yes
+  Does Emacs use -lXpm?                                   no
[...]
-  Does Emacs use -lm17n-flt?                              yes
+  Does Emacs use -lm17n-flt?
   Does Emacs use -lotf?                                   yes
-  Does Emacs use -lxft?                                   no
+  Does Emacs use -lxft?

Maybe also add

CAIRO_PREVENTS=			XFT
PGTK_PREVENTS=			M17N XFT XPM

P533 is an example build log: without libX11 directly or indirectly. Runtime tested under Sway.

Actually, I'm not sure if OTF is really used. According to the code otf_capability can be provided by HARFBUZZ and libotf seems hidden behind #ifndef USE_CAIRO. font-awesome and noto-jp seem to render OK in emacs-devel built without OTF option.

jrm retitled this revision from editors/emacs-devel: Reduce X11 deps for pure GTK builds to editors/emacs-devel: Build pure GTK Emacs by default.Jan 2 2022, 3:42 PM

We can go the whole hog and make pure GTK builds the default. It's still considered experimental, however the emacs-devel port itself is experimental. I have been testing this build and there are no obvious problems.

Maybe also disable XPM as well: --with-pgtk doesn't define HAVE_X11=yes, so -lXpm detection is skipped.

editors/emacs-devel/Makefile
231

Replace = with += to avoid overriding XPM_USE=XORG=xpm above.

jrm marked an inline comment as done.
  • Remove XPM from OPTIONS_DEFAULT and add XPM to PGTK_PREVENTS
  • Use += to avoid wiping USE_XORG.
This revision is now accepted and ready to land.Jan 3 2022, 5:57 PM