From: John Soo <jsoo1@asu.edu>
To: zimoun <zimon.toutoune@gmail.com>
Cc: 44775@debbugs.gnu.org
Subject: [bug#44775] [PATCH] WIP: Add gccemacs
Date: Tue, 24 Nov 2020 07:28:23 -0800 [thread overview]
Message-ID: <87pn42wz8o.fsf@asu.edu> (raw)
In-Reply-To: <86360zvhkw.fsf@gmail.com> (zimoun's message of "Mon, 23 Nov 2020 23:22:55 +0100")
[-- Attachment #1: Type: text/plain, Size: 113 bytes --]
Hi Guix and zimoun,
I fixed a bug in the build process here. Still no big progress on the
other bugs.
- John
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-gccemacs.patch --]
[-- Type: text/x-patch, Size: 6374 bytes --]
From 03ab270db130b9991fcbfa87b9d1fcc009fba059 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Fri, 20 Nov 2020 22:06:52 -0800
Subject: [PATCH] gnu: Add gccemacs.
---
gnu/packages/emacs.scm | 109 ++++++++++++++++++
gnu/packages/patches/gccemacs-exec-path.patch | 18 +++
2 files changed, 127 insertions(+)
create mode 100644 gnu/packages/patches/gccemacs-exec-path.patch
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7a5dd9010c..98a9aae69b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -53,6 +53,7 @@
#:use-module (gnu packages compression)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages fribidi)
+ #:use-module (gnu packages gcc)
#:use-module (gnu packages gd)
#:use-module (gnu packages gettext)
#:use-module (gnu packages glib)
@@ -426,6 +427,114 @@ editor (console only)")
(delete 'strip-double-wrap)))))
(inputs (package-inputs emacs-no-x))))
+;; feature/native-comp
+(define-public gccemacs-commit
+ "6781cd670d1487bbf0364d80de68ca9733342769")
+
+(define-public gccemacs-version
+ (git-version "28.0.50" "0" gccemacs-commit))
+
+(define-public gccemacs-source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "git://git.sv.gnu.org/emacs.git")
+ (commit gccemacs-commit)))
+ (sha256
+ (base32
+ "13pmrak5jvk5qp4i5iccn0fqa6by8ig8l0n3qqirm67dxrqiz2ya"))
+ (patches (search-patches "gccemacs-exec-path.patch"
+ "emacs-fix-scheme-indent-function.patch"
+ "emacs-ignore-empty-xim-styles.patch"
+ "emacs-source-date-epoch.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ '(with-directory-excursion "lisp"
+ ;; Delete the bundled byte-compiled elisp files and generated
+ ;; autoloads.
+ (for-each delete-file
+ (append (find-files "." "\\.elc$")
+ (find-files "." "loaddefs\\.el$")
+ (find-files "eshell" "^esh-groups\\.el$")))
+
+ ;; Make sure Tramp looks for binaries in the right places on
+ ;; remote Guix System machines, where 'getconf PATH' returns
+ ;; something bogus.
+ (substitute* "net/tramp-sh.el"
+ ;; Patch the line after "(defcustom tramp-remote-path".
+ (("\\(tramp-default-remote-path")
+ (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
+ "~/.guix-profile/bin" "~/.guix-profile/sbin"
+ "/run/current-system/profile/bin"
+ "/run/current-system/profile/sbin")))
+
+ ;; Make sure Man looks for C header files in the right
+ ;; places.
+ (substitute* "man.el"
+ (("\"/usr/local/include\"" line)
+ (string-join
+ (list line
+ "\"~/.guix-profile/include\""
+ "\"/var/guix/profiles/system/profile/include\"")
+ " ")))
+ #t))))
+
+(define add-libgccjit-gcc-lib-to-library-path
+ '(lambda* (#:key inputs #:allow-other-keys)
+ (define (prepend-to-env val var)
+ (let ((current (getenv var)))
+ (setenv
+ var (if (and current (not (string-null? current)))
+ (string-append val ":" current)
+ val))))
+ (let* ((libgccjit (assoc-ref inputs "libgccjit"))
+ (gcc-dirs (find-files
+ libgccjit "^gcc$" #:directories? #t))
+ (gcc-dirs-paths (string-join gcc-dirs ":")))
+ (prepend-to-env gcc-dirs-paths "LIBRARY_PATH")
+ (prepend-to-env gcc-dirs-paths "LD_LIBRARY_PATH")
+ (prepend-to-env gcc-dirs-paths "PATH")
+ #t)))
+
+(define-public gccemacs
+ (package
+ (inherit emacs-next)
+ (name "gccemacs")
+ (version gccemacs-version)
+ (source gccemacs-source)
+ (synopsis "The extensible, customizeable, self-documenting text
+editor (from the native compilation branch)")
+ (inputs
+ `(("libgccjit" ,(canonical-package libgccjit))
+ ,@(package-inputs emacs-next)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments emacs-next)
+ ((#:phases p)
+ `(modify-phases ,p
+ (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+ ,add-libgccjit-gcc-lib-to-library-path)))
+ ((#:configure-flags flags ''())
+ `(cons "--with-nativecomp" ,flags))))))
+
+(define-public gccemacs-no-x
+ (package/inherit emacs-next-no-x
+ (name "gccemacs-no-x")
+ (version gccemacs-version)
+ (source gccemacs-source)
+ (synopsis "The extensible, customizable, self-documenting text
+editor (console only, from the native compilation branch)")
+ (build-system gnu-build-system)
+ (inputs
+ `(("libgccjit" ,(canonical-package libgccjit))
+ ,@(package-inputs emacs-next-no-x)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments emacs-next-no-x)
+ ((#:phases p)
+ `(modify-phases ,p
+ (add-after 'bootstrap 'add-libgccjit-gcc-lib-to-library-path
+ ,add-libgccjit-gcc-lib-to-library-path)))
+ ((#:configure-flags flags ''())
+ `(cons "--with-nativecomp" ,flags))))))
(define-public emacs-no-x-toolkit
(package/inherit emacs
diff --git a/gnu/packages/patches/gccemacs-exec-path.patch b/gnu/packages/patches/gccemacs-exec-path.patch
new file mode 100644
index 0000000000..3c75f9465e
--- /dev/null
+++ b/gnu/packages/patches/gccemacs-exec-path.patch
@@ -0,0 +1,18 @@
+Do not capture the build-time value of $PATH in the 'emacs' executable
+since this can noticeably increase the size of the closure of Emacs
+with things like GCC being referenced.
+
+diff --git a/lisp/loadup.el.old b/lisp/loadup.el
+index 158a4bf..f853a48 100644
+--- a/lisp/loadup.el
++++ b/lisp/loadup.el
+@@ -509,7 +509,8 @@ lost after dumping")))
+ ((equal dump-mode "dump") "emacs")
+ ((equal dump-mode "bootstrap") "emacs")
+ ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
+- (t (error "unrecognized dump mode %s" dump-mode)))))
++ (t (error "unrecognized dump mode %s" dump-mode))))
++ (exec-path nil))
+ (when (and (featurep 'nativecomp)
+ (equal dump-mode "pdump"))
+ ;; Don't enable this before bootstrap is completed the as the
--
2.29.2
next prev parent reply other threads:[~2020-11-24 15:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 9:15 [bug#44775] [PATCH] WIP: Add gccemacs John Soo
2020-11-23 22:22 ` zimoun
2020-11-24 15:06 ` John Soo
2020-12-18 2:50 ` zimoun
2020-11-24 15:28 ` John Soo [this message]
2020-11-29 2:14 ` Morgan Smith
2020-12-11 20:40 ` John Soo
2020-12-17 17:26 ` Morgan Smith
2020-12-18 0:25 ` Andrew Whatson
2023-05-29 12:06 ` bug#44775: " Jelle Licht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pn42wz8o.fsf@asu.edu \
--to=jsoo1@asu.edu \
--cc=44775@debbugs.gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).