(use-modules (guix packages) (guix build-system gnu) (guix gexp) ((guix licenses) #:prefix license:) (guix search-paths) (gnu packages fonts) (gnu packages gl) (gnu packages llvm) (gnu packages pkg-config) (ice-9 regex)) (define (ecex-source-file? file stat) (or (string-match "/src($|/)" file) (string-match "/include($|/)" file) (string-match "/config($|/)" file) (string-match "/docs($|/)" file) (string-match "/tests($|/)" file) (string-match "/Makefile$" file) (string-match "/LICENSE$" file) (string-match "/README\\.md$" file) (string-match "/compile_flags\\.txt$" file) (string-match "/manifest\\.scm$" file) (string-match "/guix\\.scm$" file) (string-match "/\\.gitignore$" file))) (define-public ecex (package (name "ecex") (version "0.1.0") (source (local-file "." "ecex-checkout" #:recursive? #t #:select? ecex-source-file?)) (build-system gnu-build-system) (arguments (list #:make-flags #~(list "CC=clang" (string-append "PREFIX=" #$output)) #:phases #~(modify-phases %standard-phases (delete 'configure) (replace 'build (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "static" make-flags))) (replace 'check (lambda* (#:key tests? make-flags #:allow-other-keys) (when tests? (apply invoke "make" "check" make-flags)))) (replace 'install (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "install" make-flags))) (add-after 'install 'wrap-ecex (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (font (assoc-ref inputs "font-dejavu")) (font-path (string-append font "/share/fonts/truetype/DejaVuSansMono.ttf"))) (wrap-program (string-append out "/bin/ecex") `("ECEX_INCLUDE" ":" prefix (,(string-append out "/include/ecex"))) `("ECEX_FONT" ":" = (,font-path))))))))) (native-inputs `(("clang-toolchain" ,clang-toolchain) ("pkg-config" ,pkg-config))) (inputs `(("font-dejavu" ,font-dejavu) ("glfw" ,glfw) ("mesa" ,mesa))) (native-search-paths (list (search-path-specification (variable "C_INCLUDE_PATH") (files '("include/ecex"))) (search-path-specification (variable "CPLUS_INCLUDE_PATH") (files '("include/ecex"))))) (home-page "git.cdatgoose.org/ecex.git") (synopsis "Small C editor with CCDJIT-loaded C config and plugins") (description "Ecex is a small editor written in C with GLFW/OpenGL rendering and a C-based config/plugin system loaded through CCDJIT.") (license license:bsd-2))) ecex