changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 68: 4905e93756d7
parent: 28ed81f2d290
child: 4260b565dfb3
author: ellis <ellis@rwest.io>
date: Wed, 03 Jan 2024 23:35:39 -0500
permissions: -rw-r--r--
description: bin sniping
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:=comp
20 HG_COMMIT:=$(shell hg id -i)
21 DESTINATION:=/mnt/y/data/packy
22 # requires emacs-build-minimal
23 worker:rocksdb-install sbcl-install ts-langs-install quicklisp-install
24 # artifacts can deploy to dist/TARGET - need target triple first
25 # init:sbcl rust emacs rocksdb comp virt;
26 # dist/linux dist/rust dist/bundle
27 quick:comp
28 operator:core-install emacs-build-mini emacs-install
29 all:dist/cdn dist/comp dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs
30 clean:;rm -rf $(B) $(D)
31 $(B):;mkdir -pv $@/src
32 $(D):;mkdir -pv $@
33 $(DESTINATION):$(D);cd $< && cp -rf ./* $@
34 deploy:$(DESTINATION)
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 emcas;
55  cd $(EMACS_TARGET) && ./autogen.sh
56  $< $(EMACS_TARGET)
57 emacs-build-mini:scripts/build-emacs-mini.sh
58  cd $(EMACS_TARGET) && ./autogen.sh
59  $< $(EMACS_TARGET)
60 emacs-install:emacs-build;
61  cd $(EMACS_TARGET) && make install
62 
63 ### RocksDB
64 ROCKSDB_TARGET:=build/src/rocksdb
65 $(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
66  $<
67  cd $(ROCKSDB_TARGET) && \
68  make shared_lib DISABLE_JEMALLOC=1
69 rocksdb:$(ROCKSDB_TARGET)
70 
71 rocksdb-install:$(ROCKSDB_TARGET)
72  cp -rf $(ROCKSDB_TARGET)/include/* /usr/local/include/
73  cp -f $(ROCKSDB_TARGET)/librocksdb.* /usr/local/lib/
74 
75 # TODO: separate params
76 # --without-gencgc \
77 # --with-mark-region-gc \
78 ### SBCL
79 SBCL_TARGET:=build/src/sbcl
80 $(SBCL_TARGET):scripts/get-sbcl.sh $(B);
81  $<
82  cd $(SBCL_TARGET) && \
83  echo '"2.4.1+main"' > version.lisp-expr && \
84  sh make.sh \
85  --with-sb-xref-for-internals \
86  --with-core-compression \
87  --dynamic-space-size=8Gb \
88  --fancy
89 sbcl:$(SBCL_TARGET)
90 sbcl-docs:sbcl;## REQUIRES TEXLIVE
91  cd $(SBCL_TARGET)/doc/manual && make
92 sbcl-install:sbcl;cd $(SBCL_TARGET) && ./install.sh
93 clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
94 
95 build/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
96 quicklisp-install:scripts/quicklisp-install.sh build/quicklisp.lisp;$<
97 
98 ### Rust
99 RUST_TARGET:=build/src/rust
100 $(RUST_TARGET):scripts/get-rust.sh $(B);$<
101 rust:$(RUST_TARGET)
102 rust-install-x:rust;
103  cargo install --path $(RUST_TARGET)/src/tools/x
104 rust-build:rust rust-install-x;
105  cd $(RUST_TARGET) && x build library
106 rust-doc:rust rust-install-x;
107  cd $(RUST_TARGET) && x doc
108 rust-build-full:rust-build;
109  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
110 rust-install:rust-build;
111  cd $(RUST_TARGET) && x install
112 
113 ### Tree-sitter Langs
114 TS_LANGS_TARGET:=build/src/ts-langs
115 ts-langs-install:scripts/ts-install-langs.sh
116  $<
117 ### Comp
118 COMP_TARGET:=build/src/$(SRC)
119 comp:scripts/get-comp.sh $(B)
120  $< $(SRC)
121 
122 clean-comp::;rm -rf $(COMP_TARGET)
123 
124 ### Virt
125 dev-pod:virt/build-pod.sh
126  $<
127 archlinux:virt/build-archlinux-base.sh
128  $<
129 fedora:virt/build-fedora-base.sh
130  $<
131 box:virt/build-box-base.sh
132  $<
133 bbdb:virt/build-bbdb-base.sh
134  $<
135 heptapod:virt/build-heptapod.sh
136  $<
137 heptapod-runner:virt/build-heptapod-runner.sh
138  $<
139 
140 vc-pod:heptapod heptapod-runner
141 
142 virt:pod box bbdb vc
143 
144 ### Dist
145 dist/bundle:scripts/bundle-dir.sh comp
146  mkdir -pv $@
147  $<
148 
149 dist/cdn:cdn $(D)
150  mkdir -pv $@
151  cp -r $</* $@
152 
153 dist/sbcl:sbcl $(D);
154  mkdir -pv $@
155  cp $(SBCL_TARGET)/src/runtime/sbcl $@
156  cp $(SBCL_TARGET)/output/sbcl.core $@
157  cp -r $(SBCL_TARGET)/contrib $@
158  cd $(SBCL_TARGET) && ./clean.sh
159  tar -I 'zstd' -cf $@/sbcl-source.tar.zst --exclude .git $(SBCL_TARGET)
160 
161 dist/linux:linux $(D);
162 
163 dist/rocksdb:rocksdb $(D);
164  mkdir -pv $@
165  cp -rf $(ROCKSDB_TARGET)/include/* $@
166  cp -f $(ROCKSDB_TARGET)/librocksdb.* $@
167 
168 dist/rust:rust-build $(D);
169  cd $(RUST_TARGET) && x dist
170 dist/rust/bin:scripts/cargo-install.sh comp
171  mkdir -pv $@
172  $< "$(COMP_TARGET)/core/rust/app/cli/alik" "dist/rust"
173  $< "$(COMP_TARGET)/core/rust/app/cli/krypt" "dist/rust"
174  $< "$(COMP_TARGET)/core/rust/app/cli/tz" "dist/rust"
175  $< "$(COMP_TARGET)/core/rust/app/cli/cc-init" "dist/rust"
176  $< "$(COMP_TARGET)/core/rust/app/cli/mailman" "dist/rust"
177 
178 dist/emacs:emacs-build $(D);
179 
180 # requires quicklisp loaded in .skelrc
181 dist/lisp/fasl:scripts/sbcl-save-core.sh # quicklisp-install
182  mkdir -pv $@
183  $< "$@/std.core"
184  $< "$@/prelude.core" "(mapc #'ql:quickload \
185  (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc :rt))"
186 
187 CORE_SRC=/usr/local/share/lisp/core
188 dist/lisp/bin:scripts/sbcl-make-bin.sh
189  $< bin/skel
190  cp $(CORE_SRC)/lisp/app/bin/skel $@
191  rm -f $(CORE_SRC)/lisp/app/bin/skel.fasl
192  $< bin/organ
193  cp $(CORE_SRC)/lisp/app/bin/organ $@
194  rm -f $(CORE_SRC)/lisp/app/bin/organ.fasl
195  $< bin/homer
196  cp $(CORE_SRC)/lisp/app/bin/homer $@
197  rm -f $(CORE_SRC)/lisp/app/bin/homer.fasl
198  $< bin/packy
199  cp $(CORE_SRC)/lisp/app/bin/packy $@
200  rm -f $(CORE_SRC)/lisp/app/bin/packy.fasl
201  $< bin/rdb
202  cp $(CORE_SRC)/lisp/app/bin/rdb $@
203  rm -f $(CORE_SRC)/lisp/app/bin/rdb.fasl
204 
205 dist/lisp:dist/lisp/fasl dist/lisp/bin
206 
207 core-install:dist/lisp
208  install -m 755 $</bin/* /usr/local/bin/
209  install -m 755 $</fasl/* /usr/local/lib/sbcl/
210 
211 dist/comp:comp
212  mkdir -pv $@
213  cp -r $(COMP_TARGET)/{org,core,infra,demo,nas-t} $@
214 clean-dist:;rm -rf $(D)
215 clean-build:;rm -rf $(B)