Browse Source

[FBT]: Add support for setting FG42 home and version number

Signed-off-by: Sameer Rahmani <lxsameer@gnu.org>
pull/2/head
Sameer Rahmani 2 years ago
parent
commit
c6f84490a6
  1. 14
      .gitlab-ci.yml
  2. 31
      fbt
  3. 2
      fg42-new
  4. 30
      scripts/compiler.el

14
.gitlab-ci.yml

@ -10,6 +10,20 @@ stages:
script:
- cd ~/.fg42/ && fg42 -nw --script build.el
.build-v3:
image: debian:stable-slim
stage: build
before_script:
- apt update && apt install -y make wget git emacs sudo
- git clone -b fpkg-v2 https://gitlab.com/FG42/FG42 ~/.fg42/ && ~/.fg42/fbt build
build-branches-v3:
extends: .build-v3
only:
- branches
except:
- tags
build-branches:
extends: .build
only:

31
fbt

@ -1,4 +1,4 @@
:;exec emacs --no-site-file --no-site-lisp -batch -l "$0" -f main "$@"
:;exec emacs --no-site-file --no-site-lisp -batch -l "$0" -f main "$(cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" "$@"
;;; FGBuildTool --- The build tool for FG42
;;
;; Copyright (c) 2010-2020 Sameer Rahmani <lxsameer@gnu.org>
@ -23,6 +23,8 @@
;;
;;; Commentary:
;;; Code:
(defvar FG42_VERSION "3.0.0-snapshot"
"The version number of the current build of FG42.")
(defun compile (dir)
"Compile all the elisp files in the given DIR regardless of timestamp.
@ -38,14 +40,33 @@ The DIR should be relative to FG42_HOME."
(compile "core"))
(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 "Usage:\n")
(message "compile [DIR] - Compiles the given DIR to bytecodes (default: \"core\")")
(message "build - Builds FG42 by compiling the code and installing dependencies."))
(defun main ()
"Execute a subcommand by looking into input arguments of the script."
(print (version))
(let ((command (car command-line-args-left))
(args (cdr command-line-args-left)))
(message (version))
(message "\nFG42 Built tool v%s\n\n" FG42_VERSION)
(let ((fg42-home (car command-line-args-left))
(command (cadr command-line-args-left))
(args (cddr command-line-args-left)))
;; FG42 Needs this env var to know where had it been installed
(setenv "FG42_HOME" fg42-home)
(setenv "FG42_VERSION" FG42_VERSION)
(cond
((string= command "compile") (funcall #'compile (or (car args) "core")))
((string= command "build") (funcall #'build args)))))
((string= command "build") (funcall #'build args))
(t (print-help command)))))
;; Local Variables:
;; mode: emacs-lisp

2
fg42-new

@ -1,6 +1,6 @@
#! /bin/sh
export FG42_HOME="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
export FG42_HOME="$(cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
FG42_WM=false emacs --name FG42 \
--no-site-file --no-site-lisp --no-splash --title FG42 \

30
scripts/compiler.el

@ -1,30 +0,0 @@
;;; FG42ByteCompiler --- The byte compiler for FG42 libraries and extensions
;;
;; Copyright (c) 2010-2020 Sameer Rahmani <lxsameer@gnu.org>
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://gitlab.com/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 this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;
;;; Commentary:
;;; Code:
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/core"))
(message "Compiling FG42 core...")
(byte-recompile-directory (concat (getenv "FG42_HOME") "/core") 0 t)
;;; compiler.el ends here
Loading…
Cancel
Save