From dd78b22f7f7890e48311e5d06e21c6c9ef823d9c Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sat, 11 Dec 2021 14:52:49 +0000 Subject: [PATCH] Refactore the installation process --- Makefile | 75 ++++----- config/fg42.user.el | 314 +++++++++++++++++++++++++------------- config/fg42.user.v3.el | 220 -------------------------- scripts/install_files.sh | 101 +++++++++--- scripts/templates/fg42 | 19 +++ scripts/templates/fg42-wm | 37 +++++ 6 files changed, 376 insertions(+), 390 deletions(-) delete mode 100644 config/fg42.user.v3.el create mode 100644 scripts/templates/fg42 create mode 100644 scripts/templates/fg42-wm diff --git a/Makefile b/Makefile index 629456b..7508409 100644 --- a/Makefile +++ b/Makefile @@ -1,51 +1,29 @@ +#! /bin/bash +# Fg42 - Emacs Editor for advance users +# +# Copyright (c) 2010-2022 Sameer Rahmani +# +# 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, version 2. +# +# 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 . + +my_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + .PHONY: update update: - @git remote set-url origin git://gitlab.com/FG42/FG42.git @git pull origin master -.PHONY: install-cli -install-ci: - @echo "Downloading and installing fonts..." - @mkdir -p ~/.fonts - @wget "https://github.com/FG42/fonts/archive/0.1.0.tar.gz" -O ~/.fonts/fg42.tar.gz - @tar zxf ~/.fonts/fg42.tar.gz -C ~/.fonts --strip 1 - @cp ./config/fg42.user.el ${HOME}/.fg42.el - @echo "Creating the link..." - @echo "#! /bin/sh" > ./fg42 - @echo "export FG42_HOME=$(shell pwd)" >> ./fg42 - @echo "export LIBRARY_PATH=$(gcc -print-search-dirs| sed -n '/^libraries:/{s:^[^/]*::;p}')" >> ./fg42 - @echo 'emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 - @chmod +x ./fg42 - .PHONY: install install: - @echo "Downloading and installing fonts..." - @mkdir -p ~/.fonts - @wget "https://github.com/FG42/fonts/archive/0.1.0.tar.gz" -O ~/.fonts/fg42.tar.gz - @tar zxf ~/.fonts/fg42.tar.gz -C ~/.fonts --strip 1 - @cp ./config/fg42.user.el ${HOME}/.fg42.el - @echo "Creating the link..." - @echo "#! /bin/sh" > ./fg42 - @cp ./scripts/fg42-wm ./fg42-wm - @echo "export FG42_HOME=$(shell pwd)" >> ./fg42 - @echo "export FG42_HOME=$(shell pwd)" >> ./fg42-wm - @echo "export LIBRARY_PATH=$(gcc -print-search-dirs| sed -n '/^libraries:/{s:^[^/]*::;p}')" >> ./fg42 - @echo "export LIBRARY_PATH=$(gcc -print-search-dirs| sed -n '/^libraries:/{s:^[^/]*::;p}')" >> ./fg42-wm - @echo 'FG42_WM=false emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 - @echo 'FG42_WM=true emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42-wm - @chmod +x ./fg42 - @chmod +x ./fg42-wm - @sudo mkdir -p /usr/local/bin/ - @sudo rm -f /usr/local/bin/fg42 - @sudo rm -f /usr/local/bin/fg42-wm - @sudo ln -s `pwd`/fg42 /usr/local/bin/fg42 - @sudo ln -s `pwd`/fg42-wm /usr/local/bin/fg42-wm - @echo "Copying share files..." - @sudo mkdir -p /usr/share/fg42/ - @sudo cp ./share/applications/fg42.desktop /usr/local/share/applications - @sudo cp -r ./share/icons/hicolor/ /usr/local/share/icons - @sudo cp -r ./share/* /usr/share/fg42/ - @sudo cp -r ./share/xsessions/fg42.desktop /usr/share/xsessions/ + /bin/sh $(my_dir)/scripts/install_files.sh runners @echo " " @echo "------------------------------------------------------------------------------------" @echo "Make sure to install external dependencies of FG42. For more info checkout README.md" @@ -53,17 +31,16 @@ install: .PHONY: install-fonts install-fonts: - @mkdir -p ~/.fonts/ - @cp -rv ./share/fonts/vazir/* ~/.fonts/ + /bin/sh $(my_dir)/scripts/install_files.sh fonts -.PHONY: compile -compile: - @$(PWD)/fg42-new --script scripts/compiler.el +.PHONY: install-extras +install-extras: + /bin/sh $(my_dir)/scripts/install_files.sh extras -.PHONY: clean + +.PHONY: doc-clean clean: @rm -rf $(shell find `pwd` -iname "*~") - @rm -rf $(shell find `pwd`/core -iname "*.elc") @rm -rf build .PHONY: dev-docs diff --git a/config/fg42.user.el b/config/fg42.user.el index ea88e78..5f896fd 100644 --- a/config/fg42.user.el +++ b/config/fg42.user.el @@ -1,113 +1,219 @@ -;; Uncomment this for debugging purposes -;;(setq debug-on-error t) -;; THEME -;; ===== -;; Load the default theme -;; Other options are: -;; (theme themes/color-theme-spacemacs-light) -;; (theme themes/color-theme-spacemacs-dark) -;; (theme themes/color-theme-doom-dracula) -(theme themes/color-theme-doom-one) -;; (theme themes/color-theme-doom-molokai) - -;; ABILITIES -;; ========= -;; Disable abilities which you don't want. -(disable 'rbenv 'helm 'spell 'linum 'tabbar 'ido 'ivy - 'smart-mode-line 'desktop-mode 'jedi - 'dired+ 'guru 'emoji 'elpy 'github - 'versioned-backup) - - -;; EXTENSIONS -;; ========== -;; Uncomment extensions that you may need. -(activate-extensions 'editor - 'development - 'web - 'editor-theme - 'javascript - 'typescript - 'ruby - 'clojure - 'haskell - 'php - 'go - 'common-lisp - 'python - 'arduino - 'java - 'racket - 'devops - 'irc - 'latex) - - -;; What are you ? -(i-am-god) - -;; i-am-god => Emacs user. -;; i-am-human => A user of other boring editors. -;; i-am-evil => An evil user. A vim user. - - -;; Example of things you can do in your ~/.fg42.el config file: +;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- ;; -;; Setting your TODO file path: -;; (setq fg42-todo-file "~/.TODO.org") -;; or you can open a remote TODO file -;; (add-hook 'fg42-before-open-todo-hook 'disable-projectile) -;; (setq fg42-todo-file "/ssh:user@host:/home/USER/.TODO.org") +;; Copyright (c) 2010-2020 Sameer Rahmani ;; -;; Set some environment variables for your fg42 to use -;; (setenv "http_proxy" "localhost:8118") -;; (setenv "https_proxy" "localhost:8118") +;; Author: Sameer Rahmani +;; URL: https://gitlab.com/FG42/FG42 +;; Version: 3.0.0 ;; -;; Alwasy open a your TODO file as your first buffer -;; (add-hook 'fg42-after-initialize-hook 'fg42-open-todo) +;; 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 . +;; +;;; Commentary: +;;; Code: +(setq debug-on-error t) -;; If you're using tools like rbenv or nodenv or other similar tools -;; to manage versions of your favorite language, then you need to -;; add their shims to your path. Follow the example below: -;; -;; (setenv "PATH" (concat "/home/USER/.rbenv/shims:" -;; "/home/USER/.nodenv/shims:" -;; "/home/USER/bin:" (getenv "PATH"))) -;; -;; Ofcourse you need to change the USER to your username +(require 'fg42/flags) +(require 'cubes/editor) +(require 'cubes/elisp) +(require 'cubes/region-expansion) +(require 'cubes/wm) +(require 'cubes/autocompletion) +(require 'cubes/golang) +(require 'cubes/project) +(require 'cubes/irc) +(require 'cubes/terminal) +(require 'cubes/java) +(require 'cubes/python) +(require 'cubes/snippets) +(require 'cubes/org) +(require 'cubes/git) +(require 'cubes/bookmark) +(require 'cubes/terraform) +(require 'cubes/graph) -;; If you have a separate bin directory as well you can add it -;; to the exec-path as follows: -;; -;; (add-to-list 'exec-path "/home/USER/bin") -;; -;; abilities like clojure which uses the lien tools need to find -;; specific tools (lein in this case) in your exec-path. +;; ============== MY STUFF ============================== + +(setq max-specpdl-size 13000) +(setq max-lisp-eval-depth 10000) + +(custom-set-faces + '(mini-modeline-mode-line + ((((background light)) + :background "#aa0000" :height 0.1 :box nil) + (t + :background "#bd93f9" :height 0.1 :box nil)))) + +(defvar global-font-size 11) -;; IRC Extension configuration ------------------------------------------------ -;; Setup all the servers and channels you need -;; (setq irc-servers -;; '(("irc.freenode.net" -;; :port 6697 -;; :encryption tls -;; :channels ("#5hit" "#emacs")))) +(setq lsp-clients-clangd-executable "/home/lxsameer/usr/lib/llvm-13rc2/bin/clangd") +(defconst LLVM_DIR "/home/lxsameer/src/serene/llvm-project") +(defconst llvm-config-dir (concat LLVM_DIR "/llvm/utils/emacs/")) +(defconst mlir-config-dir (concat LLVM_DIR "/mlir/utils/emacs/")) -;; Set you nickname -;; (setq irc-nickname "awesome-fg42-user") -;; You can use password manager for storing you IRC credentials. -;; NOTE: you need to have a pair of GPG keys for this. -;; -;; Add the following to your ~/.authinfo.gpg : -;; -;; machine freenode login port nickserv password -;; -;; Or if you don't want to use the password manager your can directly -;; set it up like this: -;; (setq irc-auth '(("freenode" nickserv "some_user" "p455w0rd") -;; ("freenode" chanserv "some_user" "#channel" "passwd99")) -;; -;; -;; If you want to change the default font uncomment the following line -;;(setq fg42-font "Terminus") +(add-hook 'c++-mode-hook (lambda () + (load (concat llvm-config-dir "emacs.el")) + (load (concat llvm-config-dir "llvm-mode.el")) + (load (concat llvm-config-dir "tablegen-mode.el")))) + +(autoload 'mlir-mode (concat mlir-config-dir "mlir-mode") "Code highlighting for MLIR" t) +(add-to-list 'auto-mode-alist '("\\.mlir\\'" . mlir-mode)) + + +(autoload 'llvm-mode (concat llvm-config-dir "llvm-mode") "Code highlighting for LLVMIR" t) +(add-to-list 'auto-mode-alist '("\\.llvmir\\'" . llvm-mode)) + +(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) +(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) + +(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) +(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) + +(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) +(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) + +(load-file "/home/lxsameer/src/serene/serene/resources/emacs/serene-dev.el") + + + +;; =========== FG42 stuff =============================== +;; (use-flags wm font-icons cursor-type +;; exec-path-from-shell golang +;; rcirc pinentry vterm +;; company lsp flycheck smart-mode-line wm fg42/region-expansion-cube +;; selectrum window-navigation buffer-navigation font-icons) + +(use-flags + (fg42/merge-with-default-flags + wm + python + golang + rcirc + vterm + company + lsp + flycheck + fg42/region-expansion-cube)) + +;; ================== my stuff mixed with FG42 stuff =================== +(when-wm + (setq global-font-size 8) + (custom-set-faces + '(mini-modeline-mode-line + ((((background light)) + :background "#aa0000" :height 0.1 :box nil) + (t + :background "#6272a4" :height 0.1 :box nil)))) + (fg42/wm-cube :number-of-workspaces 9) + + (defvar monitors + '(:hdmi-only + ("--output HDMI-1 --primary" + "--output eDP-1 --off") + :hdmi-main + ("--output HDMI-1 --primary" + "--output eDP-1 --mode 1920x1080 --left-of HDMI-1") + :edp-only + ("--output eDP-1 --mode 1920x1080" + "--output HDMI-1 --off"))) + + (require 'seq) + (defun monitor-profiles () + (mapcar + #'car + (seq-partition monitors 2))) + + (defun monitor (mon) + (interactive + (list (completing-read + "Monitor Profole: " + (monitor-profiles)))) + + (let ((cmd (mapconcat (lambda (x) (format "xrandr %s" x)) + (plist-get monitors (intern (format "%s" mon))) + " && "))) + (message "Setting monitor profile: %s" cmd) + (async-shell-command cmd "*xrandr*"))) + + (comment + ;; how to run it via elisp + (monitor :hdmi-only)) + + (use-flags + (fg42/merge-with-default-flags + wm + -python + -golang + rcirc + vterm + -company + -projectile + -lsp + -flycheck + fg42/region-expansion-cube))) + +;; =========== FG42 stuff =============================== + +;; Both are part of the editor cube but we want to override +;; their behavior + + +(fg42/cursor-cube :type 'bar :color "#bd93f9") +(fg42/font-cube :font-size global-font-size) +(fg42/editor-cube) + +;;(fg42/imenu-cube) +(fg42/elisp-cube) +(fg42/region-expansion-cube) +(fg42/graphviz-cube) +(fg42/company-cube) +(fg42/lsp-cube) +(fg42/c++-cube) +(fg42/python-cube) +(fg42/yaml-cube) +(fg42/flycheck-cube) +(fg42/org-cube) +(fg42/golang-cube) +(fg42/projectile-cube) +(fg42/rcirc-cube :server '(("irc.libera.chat" :channels ("#fg42" "#5hit" "#serene-lang" "#technotux" "#emacs" "#c++") :nick "lxsameer") + ("irc.oftc.net" :channels ("#llvm") :nick "lxsameer"))) + +(fg42/vterm-cube) +(fg42/git-cube) +(fg42/alert-cube) +(fg42/bookmark-cube) +(fg42/terraform-cube :terraform-lsp-path "~/bin/terraform-lsp") +(fg42/java-cube) +(fg42/yasnippet-cube) +;; Themes should be the last cube and anything that wants to manipulate a face +;; has to use either `fg42/before-initializing-theme-hook' or +;; `fg42/after-initializing-theme-hook' hooks. +(fg42/dracula-theme-cube) + +;;(global-set-key (kbd "C-t") 'forward-char) +;;(g lobal-set-key (kbd "C-n") 'backward-char) +;;(global-set-key (kbd "M-n") 'backward-word) +;;(global-set-key (kbd "M-t") 'forward-word) +;;(global-set-key (kbd "C-,") 'previous-line) +;;(global-set-key (kbd "C-.") 'next-line) + +(set-face-attribute 'region nil :background "#888") + + +;; ============== MY STUFF ============================== +(serene/setup-dev-env) + +(provide 'fg42.user.v3) +;;; fg42.user.v3.el ends here diff --git a/config/fg42.user.v3.el b/config/fg42.user.v3.el deleted file mode 100644 index fb3773a..0000000 --- a/config/fg42.user.v3.el +++ /dev/null @@ -1,220 +0,0 @@ -;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- -;; -;; Copyright (c) 2010-2020 Sameer Rahmani -;; -;; Author: Sameer Rahmani -;; 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 . -;; -;;; Commentary: -;;; Code: -(setq debug-on-error t) - -(require 'fg42/flags) -(require 'cubes/editor) -(require 'cubes/elisp) -(require 'cubes/region-expansion) -(require 'cubes/wm) -(require 'cubes/modeline) -(require 'cubes/autocompletion) -(require 'cubes/golang) -(require 'cubes/project) -(require 'cubes/irc) -(require 'cubes/terminal) -(require 'cubes/java) -(require 'cubes/python) -(require 'cubes/snippets) -(require 'cubes/org) -(require 'cubes/git) -(require 'cubes/bookmark) -(require 'cubes/terraform) -(require 'cubes/graph) - -;; ============== MY STUFF ============================== - -(setq max-specpdl-size 13000) -(setq max-lisp-eval-depth 10000) - -(custom-set-faces - '(mini-modeline-mode-line - ((((background light)) - :background "#aa0000" :height 0.1 :box nil) - (t - :background "#bd93f9" :height 0.1 :box nil)))) - -(defvar global-font-size 11) - - -(setq lsp-clients-clangd-executable "/home/lxsameer/usr/lib/llvm-13rc2/bin/clangd") -(defconst LLVM_DIR "/home/lxsameer/src/serene/llvm-project") -(defconst llvm-config-dir (concat LLVM_DIR "/llvm/utils/emacs/")) -(defconst mlir-config-dir (concat LLVM_DIR "/mlir/utils/emacs/")) - - -(add-hook 'c++-mode-hook (lambda () - (load (concat llvm-config-dir "emacs.el")) - (load (concat llvm-config-dir "llvm-mode.el")) - (load (concat llvm-config-dir "tablegen-mode.el")))) - -(autoload 'mlir-mode (concat mlir-config-dir "mlir-mode") "Code highlighting for MLIR" t) -(add-to-list 'auto-mode-alist '("\\.mlir\\'" . mlir-mode)) - - -(autoload 'llvm-mode (concat llvm-config-dir "llvm-mode") "Code highlighting for LLVMIR" t) -(add-to-list 'auto-mode-alist '("\\.llvmir\\'" . llvm-mode)) - -(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) -(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) - -(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) -(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) - -(autoload 'tablegen-mode (concat llvm-config-dir "tablegen-mode") "Code highlighting for tablegen" t) -(add-to-list 'auto-mode-alist '("\\.td\\'" . tablegen-mode)) - -(load-file "/home/lxsameer/src/serene/serene/resources/emacs/serene-dev.el") - - - -;; =========== FG42 stuff =============================== -;; (use-flags wm font-icons cursor-type -;; exec-path-from-shell golang -;; rcirc pinentry vterm -;; company lsp flycheck smart-mode-line wm fg42/region-expansion-cube -;; selectrum window-navigation buffer-navigation font-icons) - -(use-flags - (fg42/merge-with-default-flags - wm - python - golang - rcirc - vterm - company - lsp - flycheck - fg42/region-expansion-cube)) - -;; ================== my stuff mixed with FG42 stuff =================== -(when-wm - (setq global-font-size 8) - (custom-set-faces - '(mini-modeline-mode-line - ((((background light)) - :background "#aa0000" :height 0.1 :box nil) - (t - :background "#6272a4" :height 0.1 :box nil)))) - (fg42/wm-cube :number-of-workspaces 9) - - (defvar monitors - '(:hdmi-only - ("--output HDMI-1 --primary" - "--output eDP-1 --off") - :hdmi-main - ("--output HDMI-1 --primary" - "--output eDP-1 --mode 1920x1080 --left-of HDMI-1") - :edp-only - ("--output eDP-1 --mode 1920x1080" - "--output HDMI-1 --off"))) - - (require 'seq) - (defun monitor-profiles () - (mapcar - #'car - (seq-partition monitors 2))) - - (defun monitor (mon) - (interactive - (list (completing-read - "Monitor Profole: " - (monitor-profiles)))) - - (let ((cmd (mapconcat (lambda (x) (format "xrandr %s" x)) - (plist-get monitors (intern (format "%s" mon))) - " && "))) - (message "Setting monitor profile: %s" cmd) - (async-shell-command cmd "*xrandr*"))) - - (comment - ;; how to run it via elisp - (monitor :hdmi-only)) - - (use-flags - (fg42/merge-with-default-flags - wm - -python - -golang - rcirc - vterm - -company - -projectile - -lsp - -flycheck - fg42/region-expansion-cube))) - -;; =========== FG42 stuff =============================== - -;; Both are part of the editor cube but we want to override -;; their behavior - -(fg42/modeline-cube) -(fg42/cursor-cube :type 'bar :color "#bd93f9") -(fg42/font-cube :font-size global-font-size) -(fg42/editor-cube) - -;;(fg42/imenu-cube) -(fg42/elisp-cube) -(fg42/region-expansion-cube) -(fg42/graphviz-cube) -(fg42/company-cube) -(fg42/lsp-cube) -(fg42/c++-cube) -(fg42/python-cube) -(fg42/yaml-cube) -(fg42/flycheck-cube) -(fg42/org-cube) -(fg42/golang-cube) -(fg42/projectile-cube) -(fg42/rcirc-cube :server '(("irc.libera.chat" :channels ("#fg42" "#5hit" "#serene-lang" "#technotux" "#emacs" "#c++") :nick "lxsameer") - ("irc.oftc.net" :channels ("#llvm") :nick "lxsameer"))) - -(fg42/vterm-cube) -(fg42/git-cube) -(fg42/alert-cube) -(fg42/bookmark-cube) -(fg42/terraform-cube :terraform-lsp-path "~/bin/terraform-lsp") -(fg42/java-cube) -(fg42/yasnippet-cube) -;; Themes should be the last cube and anything that wants to manipulate a face -;; has to use either `fg42/before-initializing-theme-hook' or -;; `fg42/after-initializing-theme-hook' hooks. -(fg42/dracula-theme-cube) - -;;(global-set-key (kbd "C-t") 'forward-char) -;;(g lobal-set-key (kbd "C-n") 'backward-char) -;;(global-set-key (kbd "M-n") 'backward-word) -;;(global-set-key (kbd "M-t") 'forward-word) -;;(global-set-key (kbd "C-,") 'previous-line) -;;(global-set-key (kbd "C-.") 'next-line) - -(set-face-attribute 'region nil :background "#888") - - -;; ============== MY STUFF ============================== -(serene/setup-dev-env) - -(provide 'fg42.user.v3) -;;; fg42.user.v3.el ends here diff --git a/scripts/install_files.sh b/scripts/install_files.sh index db3e76c..1a942a1 100644 --- a/scripts/install_files.sh +++ b/scripts/install_files.sh @@ -1,21 +1,88 @@ -# Copyright (c) 2014 lxsameer +#! /bin/bash +# Fg42 - Emacs Editor for advance users # -# 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. +# Copyright (c) 2010-2022 Sameer Rahmani # -# 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/. +# 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, version 2. +# +# 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 . -function do_install() { - info "Install files in /usr/local/share" - info "If you are not a sudoer just copy ./.build/share to /usr/local/share manually" - info "and create a link to ./kuso in your /usr/local/bin/kuso" - sudo cp -r .build/share /usr/local/ - sudo ln -f -s `pwd`/kuso /usr/local/bin/kuso +current=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P) +fg42_home=$current/.. + +# Coloring Functions +function info() { + if [ "$1" ] + then + echo -e "[\033[01;32mINFO\033[00m]: $1" + fi } + +function error(){ + if [ "$1" ] + then + echo -e "[\033[01;31mERR\033[00m]: $1" + fi +} + +function warn(){ + if [ "$1" ] + then + echo -e "[\033[01;33mWARN\033[00m]: $1" + fi +} + +function install_fonts() { + info "Downloading and installing fonts..." + mkdir -p ~/.fonts + wget "https://dl.fg42.org/fonts/0.1.0.tar.gz" -O ~/.fonts/fg42.tar.gz + tar zxf ~/.fonts/fg42.tar.gz -C ~/.fonts --strip 1 + + cp -r $fg42_home/share/fonts/vazir/* ~/.fonts/ + info "Font installation is done." +} + +install_runners() { + info "Creating the runner scripts..." + cp $current/templates/fg42 > $current/../fg42 + cp $current/templates/fg42-wm > $current/../fg42-wm + sed -i "s/___FG42_HOME___/$fg42_home" $fg42_home/fg42 + sed -i "s/___FG42_HOME___/$fg42_home" $fg42_home/fg42-wm + + chmod +x $fg42_home/fg42 + chmod +x $fg42_home/fg42-wm + + info "Installing the runners..." + + sudo mkdir -p /usr/local/bin/ + sudo rm -f /usr/local/bin/fg42 + sudo rm -f /usr/local/bin/fg42-wm + sudo ln -s $fg42_home/fg42 /usr/local/bin/fg42 + sudo ln -s $fg42_home/fg42-wm /usr/local/bin/fg42-wm + + info "Copying share files..." + sudo mkdir -p /usr/share/fg42/ + sudo cp $fg42_home/share/applications/fg42.desktop /usr/local/share/applications + sudo cp -r $fg42_home/share/icons/hicolor/ /usr/local/share/icons + sudo cp -r $fg42_home/share/* /usr/share/fg42/ + sudo cp -r $fg42_home/share/xsessions/fg42.desktop /usr/share/xsessions/ +} + +install_extras() { + info "Copying share files..." + sudo mkdir -p /usr/share/fg42/ + sudo cp $fg42_home/share/applications/fg42.desktop /usr/local/share/applications + sudo cp -r $fg42_home/share/icons/hicolor/ /usr/local/share/icons + sudo cp -r $fg42_home/share/* /usr/share/fg42/ + sudo cp -r $fg42_home/share/xsessions/fg42.desktop /usr/share/xsessions/ +} + +install_$1 diff --git a/scripts/templates/fg42 b/scripts/templates/fg42 new file mode 100644 index 0000000..a81e907 --- /dev/null +++ b/scripts/templates/fg42 @@ -0,0 +1,19 @@ +#! /bin/sh +# Fg42 - Emacs Editor for advance users +# +# Copyright (c) 2010-2022 Sameer Rahmani +# +# 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, version 2. +# +# 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 . + +export FG42_HOME=___FG42_HOME___ +LIBRARY_PATH=$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH FG42_WM=false ${EMACS_PATH:-emacs} --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $FG42_HOME/fg42-config.el "$@" diff --git a/scripts/templates/fg42-wm b/scripts/templates/fg42-wm new file mode 100644 index 0000000..0367f4c --- /dev/null +++ b/scripts/templates/fg42-wm @@ -0,0 +1,37 @@ +#! /bin/sh +# Fg42 - Emacs Editor for advance users +# +# Copyright (c) 2010-2022 Sameer Rahmani +# +# 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, version 2. +# +# 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 . + +# Disable access control for the current user. +xhost +SI:localuser:$USER + +# Make Java applications aware this is a non-reparenting window manager. +export _JAVA_AWT_WM_NONREPARENTING=1 + +# Set default cursor. +xsetroot -cursor_name left_ptr + +# Set keyboard repeat rate. +xset r rate 400 30 + +# Uncomment the following block to use the exwm-xim module. +#export XMODIFIERS=@im=exwm-xim +#export GTK_IM_MODULE=xim +#export QT_IM_MODULE=xim +#export CLUTTER_IM_MODULE=xim +export FG42_HOME=___FG42_HOME___ + +LIBRARY_PATH=$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH FG42_WM=true ${EMACS_PATH:-emacs} --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $FG42_HOME/fg42-config.el "$@"