aboutsummaryrefslogtreecommitdiff
path: root/guix.scm
blob: 12f4dc71b6d49150bab16e7079d0fb2e29594f94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(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