diff --git a/lisp/cli/install.el b/lisp/cli/install.el index 3e1e4ef21..8eaec4abe 100644 --- a/lisp/cli/install.el +++ b/lisp/cli/install.el @@ -15,7 +15,8 @@ ;;; Commands (defcli! ((install i)) - (&flags + ((aot? ("--aot") "Enable ahead-of-time native-compilation (if available)") + &flags (config? ("--config" :yes) "Create `$DOOMDIR' or dummy files therein?") (envfile? ("--env" :yes) "(Re)generate an envvars file? (see `$ doom help env`)") (install? ("--install" :yes) "Auto-install packages?") @@ -91,6 +92,10 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g. (when (or yes? (y-or-n-p "Generate an envvar file? (see `doom help env` for details)")) (call! '(env))))) + (when aot? + (after! straight + (setq straight--native-comp-available t))) + ;; Install Doom packages (if (eq install? :no) (print! (warn "Not installing plugins, as requested")) diff --git a/lisp/cli/sync.el b/lisp/cli/sync.el index ee18ccb54..b9877109e 100644 --- a/lisp/cli/sync.el +++ b/lisp/cli/sync.el @@ -28,6 +28,7 @@ (jobs ("-j" "--jobs" num) "How many threads to use for native compilation") (rebuild? ("-b" "--rebuild") "Rebuild all installed packages, unconditionally") (nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed") + (aot? ("--aot") "Natively compile packages ahead-of-time (if available)") &context context) "Synchronize your config with Doom Emacs. @@ -48,10 +49,17 @@ stale. OPTIONS: -j, --jobs Defaults to the maximum number of threads (or 1, if your CPU's threadcount - can't be determined)." + can't be determined). + --aot + Will only perform AOT native-compilation for packages updated/installed + during the execution of this command. Use --rebuild as well to do so for all + packages." :benchmark t (when (doom-profiles-bootloadable-p) (call! '(profiles sync "--reload"))) + (when aot? + (after! straight + (setq straight--native-comp-available t))) (when jobs (setq native-comp-async-jobs-number (truncate jobs))) (run-hooks 'doom-before-sync-hook) diff --git a/lisp/cli/upgrade.el b/lisp/cli/upgrade.el index 67f9f9897..e2eac21d2 100644 --- a/lisp/cli/upgrade.el +++ b/lisp/cli/upgrade.el @@ -19,7 +19,8 @@ ;;; Commands (defcli! ((upgrade up)) - ((packages? ("-p" "--packages") "Only upgrade packages, not Doom") + ((aot? ("--aot") "Natively compile packages ahead-of-time (if available)") + (packages? ("-p" "--packages") "Only upgrade packages, not Doom") (jobs ("-j" "--jobs" num) "How many CPUs to use for native compilation") (nobuild? ("-B") "Don't rebuild packages when hostname or Emacs version has changed") &context context) @@ -33,6 +34,7 @@ libraries. It is the equivalent of the following shell commands: $ doom sync -u" (let* ((force? (doom-cli-context-suppress-prompts-p context)) (sync-cmd (append '("sync" "-u") + (if aot? '("--aot")) (if nobuild? '("-B")) (if jobs `("-j" ,jobs))))) (cond @@ -57,6 +59,7 @@ libraries. It is the equivalent of the following shell commands: (print! (item "Reloading Doom Emacs")) (doom-cli-context-put context 'upgrading t) (exit! "doom" "upgrade" "-p" + (if aot? "--aot") (if nobuild? "-B") (if force? "--force") (if jobs (format "--jobs=%d" jobs))))