changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 197: 1ebb2ba98e88
parent: 813fff1d2096
child: 3b84ce879498
author: Richard Westhaver <ellis@rwest.io>
date: Tue, 19 Mar 2024 23:24:13 -0400
permissions: -rw-r--r--
description: get stumpwm
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 all:dist/cdn dist/code dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs
31 clean:;rm -rf $(B) $(D)
32 $(B):;mkdir -pv $@/src
33 $(D):;mkdir -pv $@/bin $@/lib $@/include $@/bundle $@/share
34 $(DESTINATION):$(D);cd $< && cp -rf ./* $@
35 ### Linux
36 LINUX_TARGET:=linux-$(LINUX_VERSION)
37 linux:$(LINUX_TARGET) linux-config;
38  mv build/$< dist/$<
39 $(LINUX_TARGET):scripts/get-linux.sh;
40  mkdir -pv build/$@
41  gpg --export autosigner@ torvalds@ gregkh@ > build/$@/keyring.gpg
42  $< $(LINUX_VERSION) build build/$@/keyring.gpg
43  cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
44 linux-config:$(LINUX_TARGET);
45  cd build/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
46 clean-linux::;rm -rf build/$(LINUX_TARGET)
47 
48 ### Emacs
49 EMACS_TARGET:=build/src/emacs
50 EMACS_DIST:=$(D)/src/emacs
51 $(EMACS_TARGET):scripts/get-emacs.sh $(B);
52  $<
53 emacs:$(EMACS_TARGET)
54 emacs-build:scripts/build-emacs.sh $(EMACS_TARGET)
55  cd $(EMACS_TARGET) && ./autogen.sh
56  $<
57 emacs-build-mini:scripts/build-emacs-mini.sh emacs
58  cd $(EMACS_TARGET) && ./autogen.sh
59  $< $(EMACS_TARGET)
60 emacs-install:$(EMACS_TARGET);
61  cd $< && make install
62 
63 ### RocksDB
64 ROCKSDB_TARGET:=build/src/rocksdb
65 $(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
66  $<
67 rocksdb:$(ROCKSDB_TARGET)
68 
69 rocksdb-build-shared:$(ROCKSDB_TARGET)
70  cd $< && make shared_lib DISABLE_JEMALLOC=1
71 
72 rocksdb-build-static:$(ROCKSDB_TARGET)
73  cd $< && make static_lib DISABLE_JEMALLOC=1
74 
75 rocksdb-install:$(ROCKSDB_TARGET)
76  cd $< && make install
77 
78 ### Nushell
79 NUSHELL_TARGET:=build/src/nushell
80 $(NUSHELL_TARGET):scripts/get-nushell.sh;$<
81 nushell:$(NUSHELL_TARGET)
82 # build without clipboard to avoid errors at runtime in container env
83 nushell-build:$(NUSHELL_TARGET)
84  cd $< && cargo build --workspace --release --no-default-features --features=default-no-clipboard,dataframe,extra --locked
85 nushell-install:$(NUSHELL_TARGET) nushell-build
86  cd $< && ./scripts/install-all.sh
87 ### SBCL
88 SBCL_TARGET:=build/src/sbcl
89 SBCL_VERSION:=2.4.2+
90 $(SBCL_TARGET):scripts/get-sbcl.sh $(B)
91  $<
92  cd $(SBCL_TARGET) && \
93  echo '"$(SBCL_VERSION)"' > version.lisp-expr
94 sbcl:$(SBCL_TARGET)
95 #### --with-sb-fasteval --without-sb-eval < broken
96 sbcl-build:$(SBCL_TARGET)
97  cd $< && \
98  ./make.sh \
99  --without-gencgc \
100  --with-mark-region-gc \
101  --dynamic-space-size=8Gb \
102  --fancy
103 sbcl-build-shared:$(SBCL_TARGET) sbcl-build
104  cd $< && \
105  ./make-shared-library.sh \
106 sbcl-build-gencgc:$(SBCL_TARGET)
107  cd $< && \
108  ./make.sh \
109  --dynamic-space-size=8Gb \
110  --fancy
111 sbcl-docs:sbcl-build;## REQUIRES TEXLIVE
112  cd $(SBCL_TARGET)/doc/manual && make
113 sbcl-install:sbcl-build;cd $(SBCL_TARGET) && INSTALL_ROOT=/usr/local sh install.sh
114 clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
115 
116 build/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
117 quicklisp-install:scripts/quicklisp-install.sh build/quicklisp.lisp;$<
118 STUMPWM_TARGET:=build/src/stumpwm
119 
120 $(STUMPWM_TARGET):scripts/get-stumpwm.sh $(B);$<
121 stumpwm:$(STUMPWM_TARGET);
122 stumpwm-build:stumpwm;
123  cd $(STUMPWM_TARGET) && ./autogen.sh && ./configure && make
124 stumpwm-install:stumpwm-build;
125  cd $(STUMPWM_TARGET) && make install
126 ### Rust
127 RUST_TARGET:=build/src/rust
128 $(RUST_TARGET):scripts/get-rust.sh $(B);$<
129 rust:$(RUST_TARGET)
130 rust-install-x:rust;
131  cargo install --path $(RUST_TARGET)/src/tools/x
132 rust-build:rust rust-install-x;
133  cd $(RUST_TARGET) && x build library
134 rust-doc:rust rust-install-x;
135  cd $(RUST_TARGET) && x doc
136 rust-build-full:rust-build;
137  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
138 rust-install:rust-build;
139  cd $(RUST_TARGET) && x install
140 rustup-install:;curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
141 cargo-tools-install:scripts/install-cargo-tools.sh
142  $<
143 ### Tree-sitter
144 TREE_SITTER_TARGET:=build/src/tree-sitter
145 $(TREE_SITTER_TARGET):scripts/get-tree-sitter.sh
146  $<
147 tree-sitter:$(TREE_SITTER_TARGET)
148 tree-sitter-build:$(TREE_SITTER_TARGET)
149 tree-sitter-install:$(TREE_SITTER_TARGET) tree-sitter-build
150 
151 ### Tree-sitter Langs
152 TREE_SITTER_LANGS_TARGET:=build/src/tree-sitter-langs
153 tree-sitter-langs-install:scripts/tree-sitter-install-langs.sh
154  $<
155 ### Code
156 CODE_TARGET:=build/src/$(SRC)
157 $(CODE_TARGET):scripts/get-code.sh $(B)
158  $< $(SRC)
159 code:$(CODE_TARGET)
160 clean-code::;rm -rf $(CODE_TARGET)
161 
162 ### Dist
163 dist/bundle:scripts/bundle-code.sh $(CODE_TARGET)
164  mkdir -pv $@
165  $<
166 
167 dist/cdn:cdn $(D)
168  mkdir -pv $@
169  cp -r $</* $@
170 
171 dist/sbcl:$(D);
172  scripts/dist-sbcl-binary.sh $(SBCL_TARGET) $(D)
173  cd $(SBCL_TARGET) && sh ./clean.sh
174  scripts/dist-sbcl-source.sh $(SBCL_TARGET) $(D)
175 
176 dist/linux:linux $(D);
177 
178 dist/rocksdb:$(D) rocksdb;
179  cd build/src && \
180  tar -I 'zstd' -cf ../../$</rocksdb-binary.tar.zst rocksdb/include/* rocksdb/librocksdb.*
181 
182 CORE_SRC?=/usr/local/src/core
183 
184 dist/rust:rust-build $(D);
185  cd $(RUST_TARGET) && x dist
186 dist/rust/bin:scripts/cargo-install.sh
187  mkdir -pv $@
188  $< "$(CORE_SRC)/rust/app/cli/alik" dist/rust
189  $< "$(CORE_SRC)/rust/app/cli/krypt" dist/rust
190  $< "$(CORE_SRC)/rust/app/cli/tz" dist/rust
191  $< "$(CORE_SRC)/rust/app/cli/cc-install" dist/rust
192  $< "$(CORE_SRC)/rust/app/cli/mailman" dist/rust
193 
194 dist/emacs:emacs-build $(D);
195  cd $(EMACS_TARGET) && ./make-dist --no-info --no-changelog && \
196  mv emacs-*.*.* emacs && \
197  tar -I 'zstd' -cf ../../../dist/emacs-binary.tar.zst emacs
198 
199 dist/emacs-mini:emacs-build-mini $(D);
200  cd $(EMACS_TARGET) && ./make-dist --no-info --no-changelog && \
201  mv emacs-*.*.* emacs && \
202  tar -I 'zstd' -cf ../../../dist/emacs-mini-binary.tar.zst emacs
203 
204 dist/nushell:$(D) nushell-build
205  cd $(NUSHELL_TARGET)/target/release/ && \
206  tar -I 'zstd' -cf ../../../../../$</nushell.tar.zst \
207  nu nu_plugin_custom_values nu_plugin_formats nu_plugin_gstat \
208  nu_plugin_inc nu_plugin_query
209 
210 dist/tree-sitter:scripts/tree-sitter-install-langs.sh $(D)
211  PREFIX=$(D) $<
212 
213 # requires quicklisp loaded in .skelrc
214 dist/lisp/fasl:scripts/sbcl-save-core.sh
215  mkdir -pv $@
216  $< "$@/std.core"
217  $< "$@/prelude.core" "(mapc #'ql:quickload \
218  (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc))"
219 
220 dist/lisp/bin:scripts/sbcl-make-bin.sh
221  mkdir -pv $@
222  $< bin/skel
223  mv $(CORE_SRC)/lisp/app/bin/skel $@
224  rm -f $(CORE_SRC)/lisp/app/bin/skel.fasl
225  $< bin/organ
226  cp $(CORE_SRC)/lisp/app/bin/organ $@
227  rm -f $(CORE_SRC)/lisp/app/bin/organ.fasl
228  $< bin/homer
229  cp $(CORE_SRC)/lisp/app/bin/homer $@
230  rm -f $(CORE_SRC)/lisp/app/bin/homer.fasl
231  $< bin/packy
232  cp $(CORE_SRC)/lisp/app/bin/packy $@
233  rm -f $(CORE_SRC)/lisp/app/bin/packy.fasl
234  $< bin/rdb
235  cp $(CORE_SRC)/lisp/app/bin/rdb $@
236  rm -f $(CORE_SRC)/lisp/app/bin/rdb.fasl
237 
238 dist/lisp:dist/lisp/fasl dist/lisp/bin
239 
240 core-lisp-install:dist/lisp
241  install -m 755 $</bin/* /usr/local/bin/
242  install -m 755 $</fasl/* /usr/local/lib/sbcl/
243 
244 core-rust-install:dist/rust/bin
245  install -m 755 $</* /usr/local/bin/
246 
247 core-install:core-lisp-install core-rust-install
248 
249 dist/core:dist/rust/bin dist/lisp
250  mkdir -pv $@
251  cp -rf dist/lisp/fasl dist/lisp/bin $@
252  cp -rf $< $@
253  cd dist && tar -I 'zstd' -cf core.tar.zst core
254 dist/code:code
255  mkdir -pv $@
256  cp -r $(CODE_TARGET)/{org,core,infra,demo} $@
257 clean-dist:;rm -rf $(D)
258 clean-build:;rm -rf $(B)