# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup active_variants 1.1 # Need openat() PortGroup legacysupport 1.1 legacysupport.newest_darwin_requires_legacy 13 name emacs categories editors license GPL-3+ maintainers {dports @drkp} {@catap korins.ky:kirill} openmaintainer description The GNU Emacs text editor long_description \ GNU Emacs is a self-documenting, customizable, extensible real-time \ display editor. Users new to Emacs will be able to use basic \ features fairly rapidly by studying the tutorial and using the \ self-documentation features. Emacs also has an extensive \ interactive manual browser. It is easily extensible since its \ editing commands are written in Lisp. platforms darwin freebsd homepage https://www.gnu.org/software/emacs/emacs.html master_sites gnu if {$subport eq $name} { conflicts emacs-devel } subport emacs-devel { conflicts $name } subport emacs-app { conflicts emacs-app-devel } subport emacs-app-devel { conflicts emacs-app } depends_build-append port:autoconf port:automake port:libtool configure.args --disable-silent-rules \ --without-ns \ --without-x \ --without-dbus \ --without-gconf \ --without-libotf \ --without-m17n-flt \ --without-tree-sitter \ --with-libgmp \ --with-gnutls \ --with-json \ --with-xml2 \ --with-modules \ --with-sqlite3 \ --with-webp \ --infodir ${prefix}/share/info/${name} depends_build-append port:pkgconfig \ port:texinfo depends_lib-append port:gmp \ path:lib/pkgconfig/gnutls.pc:gnutls \ port:jansson \ port:libxml2 \ port:ncurses \ port:sqlite3 \ port:webp compiler.blacklist-append *gcc-4.0 *gcc-4.2 post-destroot { xinstall -d ${destroot}${prefix}/share/emacs/${version}/leim delete ${destroot}${prefix}/bin/ctags delete ${destroot}${prefix}/share/man/man1/ctags.1.gz if {$subport eq $name || $subport eq "emacs-devel"} { file copy ${filespath}/site-start.el \ ${destroot}${prefix}/share/emacs/site-lisp/ reinplace "s|__PREFIX__|${prefix}|g" \ ${destroot}${prefix}/share/emacs/site-lisp/site-start.el # avoid conflicts with xemacs move ${destroot}${prefix}/bin/etags ${destroot}${prefix}/bin/etags-emacs move ${destroot}${prefix}/share/man/man1/etags.1.gz ${destroot}${prefix}/share/man/man1/etags-emacs.1.gz } } platform darwin { post-patch { # Leopard's Xcode 3.1.x ld(1) man page claims -no_pie is supported, but it's not if {${os.major} < 9} { reinplace "s:-fno-pie::" ${worksrcpath}/configure } elseif {${os.major} > 10} { configure.ldflags-append -Wl,-no_pie } # Without this flag, there are more than 90000 warnings if the # system's `clang` compiler is used, increasing the log file # size by a factor of 200, see # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56736 if {${os.major} >= 11 || ${os.major} <= 12} { configure.cflags-append -Wno-attributes } } } if {$subport eq $name || $subport eq "emacs-app"} { version 29.3 revision 0 checksums rmd160 74592d7dba2f02b2d827a74b5a5aa5e2077fc73f \ sha256 2de8df5cab8ac697c69a1c46690772b0cf58fe7529f1d1999582c67d927d22e4 \ size 78508272 patchfiles-append \ patch-allow-powerpc.diff } if {$subport eq "emacs-devel" || $subport eq "emacs-app-devel"} { PortGroup github 1.0 # do not forget to check that configure hasn't introduce some suprises via # git diff [old]..[new] -- '**/configure.ac' github.setup emacs-mirror emacs 2c887f497c723c2397888e2f406faa4de3a8208a epoch 5 version 20240118 revision 0 master_sites ${github.master_sites} checksums rmd160 ff0c37c5f8df3e7e0c8c65fdeca086d64a455129 \ sha256 b8e0ae5ecca0d2f908759dacd00503f2d4e44562443ce2ac6c5f335dc8960f52 \ size 49660683 patchfiles-append \ patch-allow-powerpc-devel.diff pre-configure { system -W ${worksrcpath} "sh ./autogen.sh" } livecheck.type none if {[variant_isset nativecomp]} { notes "Devel subport of emacs not always keep compatibility for native \ compiled files, better to cleanup your ~/.emacs.d/.local/cache/eln" } } else { livecheck.type regex livecheck.url https://ftp.gnu.org/gnu/emacs/?C=M&O=D livecheck.regex ${name}-(\\d+\\.\\d+\\w*)\\.tar } if {$subport eq $name || $subport eq "emacs-devel"} { PortGroup muniversal 1.0 variant x11 description {Builds emacs as a X11 program with Lucid widgets} { configure.args-delete --without-x configure.args-append --with-x-toolkit=lucid \ --without-xaw3d \ --without-imagemagick \ --with-xpm \ --with-jpeg \ --with-tiff \ --with-gif \ --with-png \ --with-lcms2 \ --without-rsvg \ --with-xft depends_lib-append port:xorg-libXmu \ port:xorg-libXaw \ port:xpm \ path:include/turbojpeg.h:libjpeg-turbo \ port:tiff \ port:giflib \ port:libpng \ port:lcms2 \ port:Xft2 \ path:lib/pkgconfig/harfbuzz.pc:harfbuzz # autoconf appears to be dropping linker flags for freetype & # fontconfig; work around this. See #28083 configure.ldflags-append -lfreetype -lfontconfig } variant motif requires x11 description {Builds emacs as an X11 program with Motif widgets} { configure.args-delete --with-x-toolkit=lucid configure.args-append --with-x-toolkit=motif depends_lib-append lib:libXm:openmotif } variant gtk requires x11 description {Builds emacs as an X11 program with GTK+3 widgets} { configure.args-delete --with-x-toolkit=lucid configure.args-delete --without-gconf configure.args-delete --without-rsvg configure.args-append --with-x-toolkit=gtk3 configure.args-append --with-gconf configure.args-append --with-rsvg depends_lib-append path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \ path:lib/pkgconfig/glib-2.0.pc:glib2 \ port:gconf \ path:lib/pkgconfig/librsvg-2.0.pc:librsvg # see #21917 require_active_variants gtk2 x11 } # imagemagick variant requires either x11 or quartz, so we have to # define it twice; see #53315 variant imagemagick requires x11 description {Use ImageMagick} { depends_lib-append port:ImageMagick configure.args-append --with-imagemagick } variant dbus description {Builds emacs with D-Bus support} { # our dbus is autolaunched by launchd, so disable the check that it's running patchfiles-append patch-src_dbusbind.c.diff configure.args-delete --without-dbus configure.args-append --with-dbus depends_lib-append port:dbus } variant xwidgets requires gtk description {Enable use of xwidgets in Emacs buffers} { configure.args-append --with-xwidgets } post-destroot { xinstall -m 0755 -d ${destroot}${prefix}/include/emacs xinstall -m 0644 ${worksrcpath}/src/emacs-module.h \ ${destroot}${prefix}/include/emacs } } if {$subport eq "emacs-app" || $subport eq "emacs-app-devel"} { categories-append aqua configure.args-append --with-ns \ --with-lcms2 \ --without-harfbuzz \ --without-imagemagick \ --without-rsvg \ --without-xaw3d \ configure.args-delete --without-ns --without-x depends_lib-append port:lcms2 universal_variant no patchfiles-append patch-Info.plist.in.diff post-patch { reinplace "s,@PATH@,${prefix}/bin:${prefix}/sbin:/usr/bin:/bin:/usr/sbin:/sbin," ${worksrcpath}/nextstep/templates/Info.plist.in } destroot { system -W ${worksrcpath} "make install" xinstall -m 0755 -d ${destroot}${applications_dir} file copy ${worksrcpath}/nextstep/Emacs.app \ ${destroot}${applications_dir} # fix read-permission to resources system "chmod a+r ${destroot}${applications_dir}/Emacs.app/Contents/Resources/*" file copy ${filespath}/site-start-app.el \ ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el reinplace "s|__PREFIX__|${prefix}|g" \ ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el } variant imagemagick description {Use ImageMagick} { depends_lib-append port:ImageMagick configure.args-delete --without-imagemagick configure.args-append --with-imagemagick } variant rsvg description {Use librsvg} { depends_lib-append path:lib/pkgconfig/librsvg-2.0.pc:librsvg configure.args-delete --without-rsvg configure.args-append --with-rsvg } variant xwidgets description {Enable use of xwidgets in Emacs buffers} { configure.args-append --with-xwidgets } default_variants-append +rsvg } variant nativecomp description {Builds emacs with native compilation support} { set gcc_v 13 depends_lib-append port:gcc${gcc_v} configure.args-append --with-native-compilation=aot compiler.cpath-prepend ${prefix}/include/gcc${gcc_v} compiler.library_path-prepend ${prefix}/lib/gcc${gcc_v} configure.ldflags-append "-Wl,-rpath ${prefix}/lib/gcc${gcc_v}" } variant treesitter description {Builds emacs with tree-sitter support} { configure.args-delete --without-tree-sitter configure.args-append --with-tree-sitter depends_lib-append port:tree-sitter depends_run-append \ port:tree-sitter-typescript \ port:tree-sitter-javascript \ port:tree-sitter-tsx \ port:tree-sitter-c \ port:tree-sitter-cpp \ port:tree-sitter-java \ port:tree-sitter-python \ port:tree-sitter-css \ port:tree-sitter-json \ port:tree-sitter-c-sharp \ port:tree-sitter-bash \ port:tree-sitter-dockerfile \ port:tree-sitter-cmake \ port:tree-sitter-toml \ port:tree-sitter-go \ port:tree-sitter-go-mod \ port:tree-sitter-yaml \ port:tree-sitter-rust \ port:tree-sitter-ruby if {$subport eq "emacs-devel" || $subport eq "emacs-app-devel"} { depends_run-append \ port:tree-sitter-html \ port:tree-sitter-heex \ port:tree-sitter-elixir \ port:tree-sitter-lua } } default_variants-append +treesitter # JIT not supported in gcc for i386, so configure will fail. # On ppc it is supported, but the build with +nativecomp segfaults. # https://trac.macports.org/ticket/69677 if {${configure.build_arch} ni [list i386 ppc]} { default_variants-append +nativecomp }