changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / skelfile

changeset 697: 08621be7e780
parent: 38e9c3be2392
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 21:45:59 -0400
permissions: -rwxr-xr-x
description: alien C updates
1 ;;; skelfile --- CC/core skelfile -*- mode: skel; -*-
2 :name "core"
3 :author ("Richard Westhaver" . "ellis@rwest.io")
4 :version "0.1.0"
5 :license "MPL"
6 :stash ".stash"
7 :store ".store"
8 :description "The Compiler Company Core"
9 :tags ("core" "lisp" "rust" "emacs" "c")
10 :include ("lisp/lisp.sk" "rust/rust.sk" "emacs/emacs.sk")
11 :vc (:hg "https://vc.compiler.company/core")
12 :bind ((stash ".stash")
13  ;; (cc :env "clang")
14  (emacs-locals :dir-locals
15  (nil . ((indent-tabs-mode . nil)))
16  (rust-mode . ((eglot-workspace-configuration
17  . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
18  (nushell-mode . ((nushell-indent-offset . 2)))
19  (nushell-ts-mode . ((nushell-indent-offset . 2)))
20  (sh-mode . (sh-indentation . 2))
21  (makefile-mode . ((indent-tabs-mode . t)))
22  (slint-mode . ((slint-indent-level . 2)))))
23 :components ((:org "readme")
24  (:mod "emacs")
25  (:mod "lisp")
26  (:mod "rust"))
27 :rules
28 ((all (%stash
29  psl.dat parquet.json rgb.txt
30  save-std save-prelude save-user
31  save-infra save-core save-tests
32  build-tree-sitter-alien build-core fasls
33  ;; build-skel build-organ build-homer build-packy build-rdb
34  ;; rust-bin
35  ))
36  (clean ()
37  #$rm -vrf .stash$#
38  #$find emacs -name '*.elc' -type f -delete$#
39  #$find lisp -name '*.fasl' -type f -delete$#
40  #$echo 'cargo clean:' && cd rust && cargo clean$#)
41  (tree-sitter-alien ()
42  (:build () #$cd lisp/ffi/tree-sitter &&
43  clang -g -O2 -Wall -Wno-unused-value -ltree-sitter -shared \
44  alien.c -o ../../../.stash/libtree-sitter-alien.so$#)
45  (:install () #$cp .stash/libtree-sitter-alien.so /usr/local/lib/$#))
46  (zstd-alien ()
47  (:build () #$cd lisp/ffi/zstd &&
48  clang -g -O2 -Wall -Wno-unused-value -lzstd -shared \
49  alien.c -o ../../../.stash/libzstd-alien.so$#)
50  (:install () #$cp .stash/libzstd-alien.so /usr/local/lib/$#))
51  (psl.dat (%stash)
52  (download "https://publicsuffix.org/list/public_suffix_list.dat"
53  :output (merge-pathnames
54  ".stash/psl.dat"
55  *skel-path*)
56  :if-exists :supersede))
57  (rgb.txt (%stash)
58  (download "https://packy.compiler.company/data/rgb.txt"
59  :output (merge-pathnames
60  ".stash/rgb.txt"
61  *skel-path*)
62  :if-exists :supersede))
63  (x11.lisp (rgb.txt)
64  (color::parse-x11-color-definitions
65  :input ".stash/rgb.txt"
66  :output (merge-pathnames "color/x11.lisp" *skel-path*)))
67  (parquet.thrift (%stash)
68  (download
69  "https://raw.githubusercontent.com/apache/parquet-format/master/src/main/thrift/parquet.thrift"
70  :output (merge-pathnames ".stash/parquet.thrift" *skel-path*)
71  :if-exists :supersede)
72  #$thrift --gen json -out .stash .stash/parquet.thrift$#)
73  (parquet.json (%stash)
74  (download "https://packy.compiler.company/data/parquet.json"
75  :output (merge-pathnames ".stash/parquet.json" *skel-path*)
76  :if-exists :supersede))
77  (freedesktop.org.xml (%stash)
78  (download "https://packy.compiler.company/data/freedesktop.org.xml"
79  :output (merge-pathnames ".stash/freedesktop.org.xml" *skel-path*)))
80  (parquet-test-data (%stash) (download "https://packy.compiler.company/data/test/alltypes_plain.parquet"
81  :output (merge-pathnames ".stash/alltypes_plain.parquet" *skel-path*)
82  :if-exists :supersede))
83  ;; lisp
84  (%stash () #$mkdir -pv .stash$#)
85  (rdb (%stash)
86  (:build ()
87  (with-sbcl (:noinform t :quit t)
88  (ql:quickload :bin/rdb)
89  (asdf:make :bin/rdb))
90  #$mv lisp/bin/rdb .stash/rdb$#)
91  (:install () #$install -C -m 755 .stash/rdb /usr/local/bin/rdb$#))
92  (skel (%stash)
93  (:build ()
94  (with-sbcl (:noinform t :quit t)
95  (ql:quickload :bin/skel)
96  (asdf:make :bin/skel))
97  #$mv lisp/bin/skel .stash/skel$#)
98  (:build-gui ()
99  (with-sbcl (:noinform t :quit t)
100  (push :tools *features*)
101  (ql:quickload :bin/skel)
102  (asdf:make :bin/skel))
103  #$mv lisp/bin/skel .stash/skel$#)
104  (:install () #$install -C -m 755 .stash/skel /usr/local/bin/skel$#))
105  (skc (%stash)
106  (:build ()
107  (with-sbcl (:noinform t :quit t)
108  (ql:quickload :bin/skc)
109  (asdf:make :bin/skc))
110  #$mv lisp/bin/skc .stash/skc$#))
111  (organ (%stash)
112  (:build () (with-sbcl (:noinform t :quit t)
113  (ql:quickload :bin/organ)
114  (asdf:make :bin/organ))
115  #$mv lisp/bin/organ .stash/organ$#))
116  (homer (%stash)
117  (:build () (with-sbcl (:noinform t :quit t)
118  (ql:quickload :bin/homer)
119  (asdf:make :bin/homer))
120  #$mv lisp/bin/homer .stash/homer$#))
121  (packy (%stash)
122  (:build () (with-sbcl (:noinform t :quit t)
123  (ql:quickload :bin/packy)
124  (asdf:make :bin/packy))
125  #$mv lisp/bin/packy .stash/packy$#))
126  (std () (:save () (with-sbcl (:noinform t :quit t)
127  (ql:quickload :std)
128  (in-package :std-user)
129  (compile-lisp :std :save ".stash/std.core"))))
130  (prelude ()
131  (:save () (with-sbcl (:noinform t :quit t)
132  (ql:quickload :prelude)
133  (in-package :std-user)
134  (compile-lisp :prelude :save ".stash/prelude.core")))
135  (:compile () (compile-lisp :prelude :force t :verbose t)))
136  (user ()
137  (:save () (with-sbcl (:noinform t :quit t)
138  (ql:quickload :user)
139  (in-package :user)
140  (compile-lisp :user :save ".stash/user.core")))
141  (:compile () (compile-lisp :user :force t :verbose t)))
142  (infra () (:save () (with-sbcl (:noinform t :quit t)
143  (ql:quickload :user)
144  (in-package :user)
145  (compile-lisp :user :save ".stash/infra.core" :compression 22))))
146  (core ()
147  (:build () (with-sbcl (:noinform t :quit t)
148  (ql:quickload :bin/core)
149  (asdf:make :bin/core))
150  #$mv lisp/bin/core .stash/core$#)
151  (:save () (with-sbcl (:noinform t :quit t)
152  (ql:quickload (list :std :core))
153  (in-package :std-user)
154  (compile-lisp :core :save ".stash/core.core")))
155  (:compile () (compile-lisp :core :force t :verbose t))
156  (:install () #$install -C -m 755 .stash/core /usr/local/bin/core
157  echo "core -> /usr/local/bin/"
158  links="skel homer packy rdb organ"
159  for i in $links; do
160  ln -sf /usr/local/bin/core /usr/local/bin/$i
161  echo "$i -> core -> /usr/local/bin/"
162  done$#))
163  (tests ()
164  (:save () (with-sbcl (:noinform t :quit t)
165  (ql:quickload :core/tests)
166  (in-package :core/tests)
167  (compile-lisp :core/tests :save ".stash/tests.core")))
168  (:compile ()
169  (compile-lisp :core/tests :force t :verbose t)))
170  (bench () (:compile () (compile-lisp :core/bench :force t :verbose t)))
171  (fasls (compile-core #+nil compile-tests compile-bench compile-user compile-prelude))
172  ;; rust
173  (mailman () #$cd rust && cargo build -Z unstable-options --bin mailman --artifact-dir ../.stash/$#)
174  (alik () #$cd rust && cargo build -Z unstable-options --bin alik --artifact-dir ../.stash/$#)
175  (rust-bin (mailman alik))
176  (alik-ui () #$trunk build --config rust/ui/alik/Trunk.toml$#)
177  ;; install
178  (install (install-core)
179  #$d=/usr/local/share/lisp/
180  cd .stash
181  if [ -d $d ];
182  then
183  for f in $(find . -type f -name "*.core")
184  do echo "$(basename $f) -> $d"
185  install -C -m 755 $f $d
186  done fi$#)
187  (emacs () #$make -C emacs$#)
188  ;; TODO 2024-09-15:
189  (core-syms.sxp () (with-open-file (f ".stash/symbols.sxp" :direction :output)))
190  (dist () #$mkdir -pv .stash/tmp/core/bin/ .stash/tmp/core/share/lisp/fasl/ .stash/tmp/core/lib/
191  cd .stash
192  mv *.core tmp/core/share/lisp/
193  mv *.fasl tmp/core/share/lisp/fasl/
194  mv *.so tmp/core/lib/
195  mv $(find -maxdepth 1 -type f ! -name "*.*") tmp/core/bin/
196  cd tmp && tar -I 'zstd' -cf core.tar.zst core/* && mv core.tar.zst ../$#)
197  (dist-clean (clean) #$cd .. && tar -I 'zstd' -cf core/core-source.tar.zst core/* && cd core
198  mkdir -pv .stash
199  mv core-source.tar.zst .stash/$#))