diff options
| author | Phillip Lord | 2021-01-18 09:37:48 +0000 |
|---|---|---|
| committer | Phillip Lord | 2021-01-20 18:19:15 +0000 |
| commit | 1e1b94a95dadbbbb0831196f3c1803eb6dbd7a31 (patch) | |
| tree | f1416d3ebd1a6e98e2ca155c26c78e8c3774fed9 | |
| parent | 152964362f905ba4f6d60d8c082330b739b8bc8e (diff) | |
| download | emacs-feature/internal-msys.tar.gz emacs-feature/internal-msys.zip | |
Enable automatic co-install of msysfeature/internal-msys
| -rw-r--r-- | etc/w32-msys-install.el | 106 | ||||
| -rw-r--r-- | etc/w32-msys-site-start.el | 11 |
2 files changed, 117 insertions, 0 deletions
diff --git a/etc/w32-msys-install.el b/etc/w32-msys-install.el new file mode 100644 index 00000000000..6506678c873 --- /dev/null +++ b/etc/w32-msys-install.el | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | ;;; w32-feature.el --- Check Availability of Emacs Features -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2020-2021 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Phillip Lord <phillip.lord@russet.org.uk> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; This file provides tests for various features of Emacs. It is | ||
| 25 | ;; designed to check whether bundled binary distributions of Emacs on | ||
| 26 | ;; windows are fully functional. | ||
| 27 | |||
| 28 | ;; By default is checks whether the features that we are expect to be | ||
| 29 | ;; available on Emacs for Windows are reported to be available. It | ||
| 30 | ;; should be possible to run these tests from a distributed version of | ||
| 31 | ;; Emacs. | ||
| 32 | |||
| 33 | ;; In addition, it provides a single command | ||
| 34 | ;; `w32-feature-load-tests'. If the full source repository of Emacs is | ||
| 35 | ;; available, this will load selected files from the repository which | ||
| 36 | ;; test these features. | ||
| 37 | |||
| 38 | ;;; Code: | ||
| 39 | (defvar w32-msys-process-log "*w32-process-log*") | ||
| 40 | (defvar w32-msys-buffer "*w32-install*") | ||
| 41 | |||
| 42 | (defvar w32-install-queue nil) | ||
| 43 | |||
| 44 | (defun w32-msys-run (command) | ||
| 45 | (with-current-buffer | ||
| 46 | (get-buffer-create w32-msys-process-log) | ||
| 47 | (goto-char (point-max)) | ||
| 48 | (insert (format "%s\n\n\n" | ||
| 49 | (mapconcat 'identity command " ")))) | ||
| 50 | (make-process | ||
| 51 | :name "w32-msys-install" | ||
| 52 | :buffer w32-msys-process-log | ||
| 53 | :sentinel 'w32-msys-install-sentinel | ||
| 54 | :command command)) | ||
| 55 | |||
| 56 | (defun w32-msys-install-sentinel (p state) | ||
| 57 | (cond | ||
| 58 | ((equal state "finished\n") | ||
| 59 | (if w32-install-queue | ||
| 60 | (w32-msys-install-next-queue) | ||
| 61 | (w32-msys-complete))) | ||
| 62 | (t | ||
| 63 | (message "unexepect state: %s" state)))) | ||
| 64 | |||
| 65 | (defun w32-msys-install-add-to-site-start () | ||
| 66 | (write-region | ||
| 67 | "(load-library (expand-file-name \"w32-msys-site-start.el\" data-directory))" | ||
| 68 | nil | ||
| 69 | (expand-file-name "../site-lisp/site-start.el" data-directory))) | ||
| 70 | |||
| 71 | (defun w32-msys-install-next-queue () | ||
| 72 | (let ((c (car w32-install-queue))) | ||
| 73 | (setq w32-install-queue (cdr w32-install-queue)) | ||
| 74 | (w32-msys-run c))) | ||
| 75 | |||
| 76 | (defun w32-msys-run-queue () | ||
| 77 | (setq w32-install-queue (reverse w32-install-queue)) | ||
| 78 | (w32-msys-install-next-queue)) | ||
| 79 | |||
| 80 | (defun w32-msys-command (command-line) | ||
| 81 | (setq w32-install-queue (cons (split-string command-line " ") | ||
| 82 | w32-install-queue))) | ||
| 83 | |||
| 84 | (defun w32-msys-install () | ||
| 85 | (interactive) | ||
| 86 | (w32-msys-install-add-to-site-start) | ||
| 87 | ;; Assume for now that msys has been set up correctly | ||
| 88 | (w32-msys-command "pacman --noconfirm -Su") | ||
| 89 | (w32-msys-command "pacman --noconfirm -S git") | ||
| 90 | (w32-msys-run-queue)) | ||
| 91 | |||
| 92 | (defun w32-msys-install-dialog () | ||
| 93 | (interactive) | ||
| 94 | (setq mode-line-format nil) | ||
| 95 | (scroll-bar-mode 0) | ||
| 96 | (menu-bar-mode 0) | ||
| 97 | (tool-bar-mode 0) | ||
| 98 | (w32-msys-install)) | ||
| 99 | |||
| 100 | (defun w32-msys-complete () | ||
| 101 | (message "complete")) | ||
| 102 | |||
| 103 | ;; (setq mode-line-format nil) | ||
| 104 | ;; (scroll-bar-mode 0) | ||
| 105 | |||
| 106 | ;;; w32-msys-install.el ends here | ||
diff --git a/etc/w32-msys-site-start.el b/etc/w32-msys-site-start.el new file mode 100644 index 00000000000..4decef808e0 --- /dev/null +++ b/etc/w32-msys-site-start.el | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | (defvar w32-msys-site-start-install-dir | ||
| 2 | (expand-file-name (concat data-directory "../../../../"))) | ||
| 3 | |||
| 4 | (defvar w32-msys-top-level-dir (concat w32-msys-site-start-install-dir "msys64")) | ||
| 5 | |||
| 6 | (when (file-exists-p w32-msys-top-level-dir) | ||
| 7 | (setenv "PATH" (concat (getenv "PATH") | ||
| 8 | (replace-regexp-in-string "/" "\\\\" | ||
| 9 | w32-msys-top-level-dir) | ||
| 10 | "\\usr\\bin;")) | ||
| 11 | (add-to-list 'exec-path (concat w32-msys-top-level-dir "/usr/bin"))) | ||