FG42/build.el

97 lines
3.0 KiB
EmacsLisp
Raw Permalink Normal View History

:;exec `echo $EMACS_PATH` --no-site-file --no-site-lisp --batch -L ./ -l "$0" -f main "$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)" "$@"
;;; Buid --- The builder for FG42 -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2023 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 3.0.0
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with thnis program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a
;; unit which defines different abilities in a deterministic and idempotent
;; way. Cubes are composable and a composition of cubes creates an editor.
;;
;;; Code:
2020-05-17 18:12:28 +01:00
(setq debug-on-error t)
(defconst fg42/CORE_DIR (concat (getenv "HOME") "/.fg42/core"))
(add-to-list 'load-path fg42/CORE_DIR)
(setenv "FG42_HOME" (concat (getenv "HOME") "/.fg42/"))
(setq user-emacs-directory (concat (getenv "FG42_HOME") "emacs.d"))
(require 'fg42/build/core)
(require 'fg42/build/utils)
(defvar FG42-VERSION "3.0.0-snapshot"
"The version number of the current build of FG42.")
(defconst build/usage "
Usage:
build.el [PARAMS] COMMAND [...]
COMMANDS:
clean [DIRS] - Clean up the given list of directories (default: \"code\" \"fbt\").
docs - Build the documents and convert them to HTML
PARAMS:
:d - Turns on the debug mode.
:e expr - Run the given `expr' before any operation.
")
(defun print-help (command)
"Print out a usage instructions and print out the invalid msg for COMMAND."
(when command
(warn "I don't know about '%s' command.\n" command))
(message build/usage))
(defproject FG42
project-root (nth 2 command-line-args-left)
docs-actions '(fg42/build-prepare-docs))
(command-> command args
((string= command "docs")
(do-command
(require 'fg42/build/docs)
(fg42/build-docs build-dir)))
;; TODO: create a new command to update the license headers for
;; the copyright years. Hint: just run:
;; sed 's/2010-2023/2010-2023/' -i `git ls-tree -r master --name-only'
((string= command "compile")
(do-command
(native-compile-async fg42/CORE_DIR 'recursively)
(native-compile-async "~/.fg42.el")
(print "Compiling FG42 files ...")
(while (or comp-files-queue
(> (comp-async-runnings) 0))
(print ".")
(sleep-for 1))
(message "Done"))))
(provide 'build)
;;; build.el ends here