changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 147: 6b01a0f442bc
parent: 70bc6f20adcf
child: f96ab32de161
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 21 Jan 2024 21:01:13 -0500
permissions: -rw-r--r--
description: nushell fixes (ty Antoine)
1 ### infra/makefile --- The Compiler Company Infrastructure
2 
3 # this makefile is used to build all of our source code, package it,
4 # and ship it to various locations. It is for internal-use only.
5 
6 # If possible, use the packy (packy.compiler.company) to find and
7 # download a prepared bundle that suits your project needs.
8 
9 # You probably don't want to install all targets unless you have lots
10 # of time and a powerful machine, although it is possible. Instead,
11 # just run the targets for the components you are missing in your
12 # local environment (compatible compiler versions, shared libraries,
13 # etc)
14 
15 VERSION="0.1.0"
16 LINUX_VERSION:=$(shell uname -r | cut -d- -f1)
17 B:=build
18 D:=dist
19 SRC:=code
20 HG_COMMIT:=$(shell hg id -i)
21 DESTINATION:=/mnt/y/data/packy
22 # requires emacs-build-minimal
23 # artifacts can deploy to dist/TARGET - need target triple first
24 # init:sbcl rust emacs rocksdb code
25 # dist/linux dist/rust dist/bundle
26 box:Containerfile.box;podman build -f $< -t localhost/infra/box
27 worker:Containerfile.worker;podman build -f $< -t localhost/infra/worker
28 operator:Containerfile.operator;podman build -f $< -t localhost/infra/operator
29 quick:code
30 operator:core-lisp-install core-rust-install
31 all:dist/cdn dist/code dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs
32 clean:;rm -rf $(B) $(D)
33 $(B):;mkdir -pv $@/src
34 $(D):;mkdir -pv $@/bin $@/lib $@/include $@/bundle $@/share
35 $(DESTINATION):$(D);cd $< && cp -rf ./* $@
36 ### Linux
37 LINUX_TARGET:=linux-$(LINUX_VERSION)
38 linux:$(LINUX_TARGET) linux-config;
39  mv build/$< dist/$<
40 $(LINUX_TARGET):scripts/get-linux.sh;
41  mkdir -pv build/$@
42  gpg --export autosigner@ torvalds@ gregkh@ > build/$@/keyring.gpg
43  $< $(LINUX_VERSION) build build/$@/keyring.gpg
44  cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
45 linux-config:$(LINUX_TARGET);
46  cd build/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
47 clean-linux::;rm -rf build/$(LINUX_TARGET)
48 
49 ### Emacs
50 EMACS_TARGET:=build/src/emacs
51 EMACS_DIST:=$(D)/src/emacs
52 $(EMACS_TARGET):scripts/get-emacs.sh $(B);
53  $<
54 emacs:$(EMACS_TARGET)
55 emacs-build:scripts/build-emacs.sh $(EMACS_TARGET)
56  cd $(EMACS_TARGET) && ./autogen.sh
57  $<
58 emacs-build-mini:scripts/build-emacs-mini.sh emacs
59  cd $(EMACS_TARGET) && ./autogen.sh
60  $< $(EMACS_TARGET)
61 emacs-install:$(EMACS_TARGET);
62  cd $< && make install
63 
64 ### RocksDB
65 ROCKSDB_TARGET:=build/src/rocksdb
66 $(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
67  $<
68 rocksdb:$(ROCKSDB_TARGET)
69 
70 rocksdb-build-shared:$(ROCKSDB_TARGET)
71  cd $< && make shared_lib DISABLE_JEMALLOC=1
72 
73 rocksdb-build-static:$(ROCKSDB_TARGET)
74  cd $< && make static_lib DISABLE_JEMALLOC=1
75 
76 rocksdb-install:$(ROCKSDB_TARGET)
77  cd $< && make install
78 
79 ### Nushell
80 NUSHELL_TARGET:=build/src/nushell
81 $(NUSHELL_TARGET):scripts/get-nushell.sh;$<
82 nushell:$(NUSHELL_TARGET)
83 # build without clipboard to avoid errors at runtime in container env
84 nushell-build:$(NUSHELL_TARGET)
85  cd $< && cargo build --workspace --release --no-default-features --features=default-no-clipboard,dataframe,extra --locked
86 nushell-install:$(NUSHELL_TARGET) nushell-build
87  cd $< && ./scripts/install-all.sh
88 ### SBCL
89 SBCL_TARGET:=build/src/sbcl
90 $(SBCL_TARGET):scripts/get-sbcl.sh $(B)
91  $<
92  cd $(SBCL_TARGET) && \
93  echo '"2.4.1+main"' > version.lisp-expr
94 sbcl:$(SBCL_TARGET)
95 sbcl-build:$(SBCL_TARGET)
96  cd $< && \
97  ./make.sh \
98  --without-gencgc \
99  --with-mark-region-gc \
100  --with-core-compression \
101  --dynamic-space-size=8Gb \
102  --fancy
103 
104 sbcl-build-gencgc:$(SBCL_TARGET)
105  cd $< && \
106  ./make.sh \
107  --with-core-compression \
108  --dynamic-space-size=8Gb \
109  --fancy
110 sbcl-docs:sbcl-build;## REQUIRES TEXLIVE
111  cd $(SBCL_TARGET)/doc/manual && make
112 sbcl-install:sbcl-build;cd $(SBCL_TARGET) && INSTALL_ROOT=/usr/local sh install.sh
113 clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
114 
115 build/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
116 quicklisp-install:scripts/quicklisp-install.sh build/quicklisp.lisp;$<
117 
118 ### Rust
119 RUST_TARGET:=build/src/rust
120 $(RUST_TARGET):scripts/get-rust.sh $(B);$<
121 rust:$(RUST_TARGET)
122 rust-install-x:rust;
123  cargo install --path $(RUST_TARGET)/src/tools/x
124 rust-build:rust rust-install-x;
125  cd $(RUST_TARGET) && x build library
126 rust-doc:rust rust-install-x;
127  cd $(RUST_TARGET) && x doc
128 rust-build-full:rust-build;
129  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
130 rust-install:rust-build;
131  cd $(RUST_TARGET) && x install
132 rustup-install:;curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
133 cargo-tools-install:scripts/install-cargo-tools.sh
134  $<
135 ### Tree-sitter
136 TREE_SITTER_TARGET:=build/src/tree-sitter
137 $(TREE_SITTER_TARGET):scripts/get-tree-sitter.sh
138  $<
139 tree-sitter:$(TREE_SITTER_TARGET)
140 tree-sitter-build:$(TREE_SITTER_TARGET)
141 tree-sitter-install:$(TREE_SITTER_TARGET) tree-sitter-build
142 
143 ### Tree-sitter Langs
144 TREE_SITTER_LANGS_TARGET:=build/src/tree-sitter-langs
145 tree-sitter-langs-install:scripts/tree-sitter-install-langs.sh
146  $<
147 ### Code
148 CODE_TARGET:=build/src/$(SRC)
149 $(CODE_TARGET):scripts/get-code.sh $(B)
150  $< $(SRC)
151 code:$(CODE_TARGET)
152 clean-code::;rm -rf $(CODE_TARGET)
153 
154 ### Dist
155 dist/bundle:scripts/bundle-code.sh $(CODE_TARGET)
156  mkdir -pv $@
157  $<
158 
159 dist/cdn:cdn $(D)
160  mkdir -pv $@
161  cp -r $</* $@
162 
163 dist/sbcl:$(D);
164  scripts/dist-sbcl-binary.sh $(SBCL_TARGET) $(D)
165  cd $(SBCL_TARGET) && sh ./clean.sh
166  scripts/dist-sbcl-source.sh $(SBCL_TARGET) $(D)
167 
168 dist/linux:linux $(D);
169 
170 dist/rocksdb:$(D) rocksdb;
171  cd build/src && \
172  tar -I 'zstd' -cf ../../$</rocksdb-binary.tar.zst rocksdb/include/* rocksdb/librocksdb.*
173 
174 CORE_SRC=/usr/local/src/core
175 
176 dist/rust:rust-build $(D);
177  cd $(RUST_TARGET) && x dist
178 dist/rust/bin:scripts/cargo-install.sh
179  mkdir -pv $@
180  $< "$(CORE_SRC)/rust/app/cli/alik" dist/rust
181  $< "$(CORE_SRC)/rust/app/cli/krypt" dist/rust
182  $< "$(CORE_SRC)/rust/app/cli/tz" dist/rust
183  $< "$(CORE_SRC)/rust/app/cli/cc-init" dist/rust
184  $< "$(CORE_SRC)/rust/app/cli/mailman" dist/rust
185 
186 dist/emacs:emacs-build $(D);
187  cd $(EMACS_TARGET) && ./make-dist --no-info --no-changelog && \
188  mv emacs-*.*.* emacs && \
189  tar -I 'zstd' -cf ../../../dist/emacs-binary.tar.zst emacs
190 
191 dist/nushell:$(D) nushell-build
192  cd $(NUSHELL_TARGET)/target/release/ && \
193  tar -I 'zstd' -cf ../../../../../$</nushell.tar.zst \
194  nu nu_plugin_custom_values nu_plugin_formats nu_plugin_gstat \
195  nu_plugin_inc nu_plugin_query
196 
197 dist/tree-sitter:scripts/tree-sitter-install-langs.sh $(D)
198  PREFIX=$(D) $<
199 
200 # requires quicklisp loaded in .skelrc
201 dist/lisp/fasl:scripts/sbcl-save-core.sh
202  mkdir -pv $@
203  $< "$@/std.core"
204  $< "$@/prelude.core" "(mapc #'ql:quickload \
205  (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc :rt))"
206 
207 dist/lisp/bin:scripts/sbcl-make-bin.sh
208  mkdir -pv $@
209  $< bin/skel
210  mv $(CORE_SRC)/lisp/app/bin/skel $@
211  rm -f $(CORE_SRC)/lisp/app/bin/skel.fasl
212  $< bin/organ
213  cp $(CORE_SRC)/lisp/app/bin/organ $@
214  rm -f $(CORE_SRC)/lisp/app/bin/organ.fasl
215  $< bin/homer
216  cp $(CORE_SRC)/lisp/app/bin/homer $@
217  rm -f $(CORE_SRC)/lisp/app/bin/homer.fasl
218  $< bin/packy
219  cp $(CORE_SRC)/lisp/app/bin/packy $@
220  rm -f $(CORE_SRC)/lisp/app/bin/packy.fasl
221  $< bin/rdb
222  cp $(CORE_SRC)/lisp/app/bin/rdb $@
223  rm -f $(CORE_SRC)/lisp/app/bin/rdb.fasl
224 
225 dist/lisp:dist/lisp/fasl dist/lisp/bin
226 
227 core-lisp-install:dist/lisp
228  install -m 755 $</bin/* /usr/local/bin/
229  install -m 755 $</fasl/* /usr/local/lib/sbcl/
230 
231 core-rust-install:dist/rust/bin
232  install -m 755 $</* /usr/local/bin/
233 
234 core-install:core-lisp-install core-rust-install
235 
236 dist/code:code
237  mkdir -pv $@
238  cp -r $(CODE_TARGET)/{org,core,infra,demo} $@
239 clean-dist:;rm -rf $(D)
240 clean-build:;rm -rf $(B)