-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
216 lines (189 loc) · 6.11 KB
/
makefile
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
### infra/makefile --- The Compiler Company Infrastructure
# this makefile is used to build all of our source code, package it,
# and ship it to various locations. It is for internal-use only.
# If possible, use the packy (packy.compiler.company) to find and
# download a prepared bundle that suits your project needs.
# You probably don't want to install all targets unless you have lots
# of time and a powerful machine, although it is possible. Instead,
# just run the targets for the components you are missing in your
# local environment (compatible compiler versions, shared libraries,
# etc)
VERSION="0.1.0"
LINUX_VERSION:=$(shell uname -r | cut -d- -f1)
B:=build
D:=dist
SRC:=comp
HG_COMMIT:=$(shell hg id -i)
DESTINATION:=/mnt/y/data/packy
# requires emacs-build-minimal
worker:rocksdb-install sbcl-install ts-langs-install quicklisp-install
# artifacts can deploy to dist/TARGET - need target triple first
# init:sbcl rust emacs rocksdb comp virt;
# dist/linux dist/rust dist/bundle
quick:comp
operator:core-install emacs-build-mini emacs-install
all:dist/cdn dist/comp dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs
clean:;rm -rf $(B) $(D)
$(B):;mkdir -pv $@/src
$(D):;mkdir -pv $@
$(DESTINATION):$(D);cd $< && cp -rf ./* $@
deploy:$(DESTINATION)
### Linux
LINUX_TARGET:=linux-$(LINUX_VERSION)
linux:$(LINUX_TARGET) linux-config;
mv build/$< dist/$<
$(LINUX_TARGET):scripts/get-linux.sh;
mkdir -pv build/$@
gpg --export autosigner@ torvalds@ gregkh@ > build/$@/keyring.gpg
$< $(LINUX_VERSION) build build/$@/keyring.gpg
cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
linux-config:$(LINUX_TARGET);
cd build/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
clean-linux::;rm -rf build/$(LINUX_TARGET)
### Emacs
EMACS_TARGET:=build/src/emacs
EMACS_DIST:=$(D)/src/emacs
$(EMACS_TARGET):scripts/get-emacs.sh $(B);
$<
emacs:$(EMACS_TARGET)
emacs-build:scripts/build-emacs.sh emacs;
cd $(EMACS_TARGET) && ./autogen.sh
$< $(EMACS_TARGET)
emacs-build-mini:scripts/build-emacs-mini.sh emacs
cd $(EMACS_TARGET) && ./autogen.sh
$< $(EMACS_TARGET)
emacs-install:$(EMACS_TARGET);
cd $< && make install
### RocksDB
ROCKSDB_TARGET:=build/src/rocksdb
$(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
$<
cd $(ROCKSDB_TARGET) && \
make shared_lib DISABLE_JEMALLOC=1
rocksdb:$(ROCKSDB_TARGET)
rocksdb-install:$(ROCKSDB_TARGET)
cp -rf $(ROCKSDB_TARGET)/include/* /usr/local/include/
cp -f $(ROCKSDB_TARGET)/librocksdb.* /usr/local/lib/
# TODO: separate params
# --without-gencgc \
# --with-mark-region-gc \
### SBCL
SBCL_TARGET:=build/src/sbcl
$(SBCL_TARGET):scripts/get-sbcl.sh $(B);
$<
cd $(SBCL_TARGET) && \
echo '"2.4.1+main"' > version.lisp-expr && \
sh make.sh \
--with-sb-xref-for-internals \
--with-core-compression \
--dynamic-space-size=8Gb \
--fancy
sbcl:$(SBCL_TARGET)
sbcl-docs:sbcl;## REQUIRES TEXLIVE
cd $(SBCL_TARGET)/doc/manual && make
sbcl-install:sbcl;cd $(SBCL_TARGET) && ./install.sh
clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
build/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
quicklisp-install:scripts/quicklisp-install.sh build/quicklisp.lisp;$<
### Rust
RUST_TARGET:=build/src/rust
$(RUST_TARGET):scripts/get-rust.sh $(B);$<
rust:$(RUST_TARGET)
rust-install-x:rust;
cargo install --path $(RUST_TARGET)/src/tools/x
rust-build:rust rust-install-x;
cd $(RUST_TARGET) && x build library
rust-doc:rust rust-install-x;
cd $(RUST_TARGET) && x doc
rust-build-full:rust-build;
cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
rust-install:rust-build;
cd $(RUST_TARGET) && x install
### Tree-sitter Langs
TS_LANGS_TARGET:=build/src/ts-langs
ts-langs-install:scripts/ts-install-langs.sh
$<
### Comp
COMP_TARGET:=build/src/$(SRC)
comp:scripts/get-comp.sh $(B)
$< $(SRC)
clean-comp::;rm -rf $(COMP_TARGET)
### Virt
dev-pod:virt/build-pod.sh
$<
archlinux:virt/build-archlinux-base.sh
$<
fedora:virt/build-fedora-base.sh
$<
box:virt/build-box-base.sh
$<
bbdb:virt/build-bbdb-base.sh
$<
heptapod:virt/build-heptapod.sh
$<
heptapod-runner:virt/build-heptapod-runner.sh
$<
vc-pod:heptapod heptapod-runner
virt:pod box bbdb vc
### Dist
dist/bundle:scripts/bundle-dir.sh comp
mkdir -pv $@
$<
dist/cdn:cdn $(D)
mkdir -pv $@
cp -r $</* $@
dist/sbcl:sbcl $(D);
mkdir -pv $@
cp $(SBCL_TARGET)/src/runtime/sbcl $@
cp $(SBCL_TARGET)/output/sbcl.core $@
cp -r $(SBCL_TARGET)/contrib $@
cd $(SBCL_TARGET) && ./clean.sh
tar -I 'zstd' -cf $@/sbcl-source.tar.zst --exclude .git $(SBCL_TARGET)
dist/linux:linux $(D);
dist/rocksdb:rocksdb $(D);
mkdir -pv $@
cp -rf $(ROCKSDB_TARGET)/include/* $@
cp -f $(ROCKSDB_TARGET)/librocksdb.* $@
dist/rust:rust-build $(D);
cd $(RUST_TARGET) && x dist
dist/rust/bin:scripts/cargo-install.sh comp
mkdir -pv $@
$< "$(COMP_TARGET)/core/rust/app/cli/alik" "dist/rust"
$< "$(COMP_TARGET)/core/rust/app/cli/krypt" "dist/rust"
$< "$(COMP_TARGET)/core/rust/app/cli/tz" "dist/rust"
$< "$(COMP_TARGET)/core/rust/app/cli/cc-init" "dist/rust"
$< "$(COMP_TARGET)/core/rust/app/cli/mailman" "dist/rust"
dist/emacs:emacs-build $(D);
# requires quicklisp loaded in .skelrc
dist/lisp/fasl:scripts/sbcl-save-core.sh # quicklisp-install
mkdir -pv $@
$< "$@/std.core"
$< "$@/prelude.core" "(mapc #'ql:quickload \
(list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc :rt))"
CORE_SRC=/usr/local/share/lisp/core
dist/lisp/bin:scripts/sbcl-make-bin.sh
mkdir -pv $@
$< bin/skel
mv $(CORE_SRC)/lisp/app/bin/skel $@
rm -f $(CORE_SRC)/lisp/app/bin/skel.fasl
$< bin/organ
cp $(CORE_SRC)/lisp/app/bin/organ $@
rm -f $(CORE_SRC)/lisp/app/bin/organ.fasl
$< bin/homer
cp $(CORE_SRC)/lisp/app/bin/homer $@
rm -f $(CORE_SRC)/lisp/app/bin/homer.fasl
$< bin/packy
cp $(CORE_SRC)/lisp/app/bin/packy $@
rm -f $(CORE_SRC)/lisp/app/bin/packy.fasl
$< bin/rdb
cp $(CORE_SRC)/lisp/app/bin/rdb $@
rm -f $(CORE_SRC)/lisp/app/bin/rdb.fasl
dist/lisp:dist/lisp/fasl dist/lisp/bin
core-install:dist/lisp
install -m 755 $</bin/* /usr/local/bin/
install -m 755 $</fasl/* /usr/local/lib/sbcl/
dist/comp:comp
mkdir -pv $@
cp -r $(COMP_TARGET)/{org,core,infra,demo,nas-t} $@
clean-dist:;rm -rf $(D)
clean-build:;rm -rf $(B)