changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 60: 325908595770
parent: 8d8da0d4d52f
child: e1061716787e
author: ellis <ellis@rwest.io>
date: Wed, 03 Jan 2024 18:59:49 -0500
permissions: -rw-r--r--
description: dont need deploy script
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 all:dist/cdn dist/comp dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs
28 clean:;rm -rf $(B) $(D)
29 $(B):;mkdir -pv $@/src
30 $(D):;mkdir -pv $@
31 $(DESTINATION):$(D);cp -rf $</* $@
32 deploy:$(DESTINATION)
33 ### Linux
34 LINUX_TARGET:=linux-$(LINUX_VERSION)
35 linux:$(LINUX_TARGET) linux-config;
36  mv build/$< dist/$<
37 $(LINUX_TARGET):scripts/get-linux.sh;
38  mkdir -pv build/$@
39  gpg --export autosigner@ torvalds@ gregkh@ > build/$@/keyring.gpg
40  $< $(LINUX_VERSION) build build/$@/keyring.gpg
41  cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
42 linux-config:$(LINUX_TARGET);
43  cd build/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
44 clean-linux::;rm -rf build/$(LINUX_TARGET)
45 
46 ### Emacs
47 EMACS_TARGET:=build/src/emacs
48 EMACS_DIST:=$(D)/src/emacs
49 $(EMACS_TARGET):scripts/get-emacs.sh $(B);
50  $<
51 emacs:$(EMACS_TARGET)
52 emacs-build:emacs scripts/build-emacs.sh;
53  cd $(EMACS_TARGET) && ./autogen.sh
54  scripts/build-emacs.sh $(EMACS_TARGET)
55 emacs-install:emacs-build;
56  cd $(EMACS_TARGET) && make install
57 
58 ### RocksDB
59 ROCKSDB_TARGET:=build/src/rocksdb
60 $(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
61  $<
62  cd $(ROCKSDB_TARGET) && \
63  make shared_lib DISABLE_JEMALLOC=1
64 rocksdb:$(ROCKSDB_TARGET)
65 
66 rocksdb-install:$(ROCKSDB_TARGET)
67  cp -rf $(ROCKSDB_TARGET)/include/* /usr/local/include/
68  cp -f $(ROCKSDB_TARGET)/librocksdb.* /usr/local/lib/
69 
70 # TODO: separate params
71 # --without-gencgc \
72 # --with-mark-region-gc \
73 ### SBCL
74 SBCL_TARGET:=build/src/sbcl
75 $(SBCL_TARGET):scripts/get-sbcl.sh $(B);
76  $<
77  cd $(SBCL_TARGET) && \
78  echo '"2.4.1+main"' > version.lisp-expr && \
79  sh make.sh \
80  --with-sb-xref-for-internals \
81  --with-core-compression \
82  --dynamic-space-size=8Gb \
83  --fancy
84 sbcl:$(SBCL_TARGET)
85 sbcl-docs:sbcl;## REQUIRES TEXLIVE
86  cd $(SBCL_TARGET)/doc/manual && make
87 sbcl-install:sbcl;cd $(SBCL_TARGET) && ./install.sh
88 clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
89 
90 build/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
91 quicklisp-install:scripts/quicklisp-install.sh build/quicklisp.lisp;$<
92 
93 ### Rust
94 RUST_TARGET:=build/src/rust
95 $(RUST_TARGET):scripts/get-rust.sh $(B);$<
96 rust:$(RUST_TARGET)
97 rust-install-x:rust;
98  cargo install --path $(RUST_TARGET)/src/tools/x
99 rust-build:rust rust-install-x;
100  cd $(RUST_TARGET) && x build library
101 rust-doc:rust rust-install-x;
102  cd $(RUST_TARGET) && x doc
103 rust-build-full:rust-build;
104  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
105 rust-install:rust-build;
106  cd $(RUST_TARGET) && x install
107 
108 ### Tree-sitter Langs
109 TS_LANGS_TARGET:=build/src/ts-langs
110 ts-langs-install:scripts/ts-install-langs.sh
111  $<
112 ### Comp
113 COMP_TARGET:=build/src/$(SRC)
114 comp:scripts/get-comp.sh $(B)
115  $< $(SRC)
116 
117 clean-comp::;rm -rf $(COMP_TARGET)
118 
119 ### Virt
120 dev-pod:virt/build-pod.sh
121  $<
122 archlinux:virt/build-archlinux-base.sh
123  $<
124 fedora:virt/build-fedora-base.sh
125  $<
126 box:virt/build-box-base.sh
127  $<
128 bbdb:virt/build-bbdb-base.sh
129  $<
130 heptapod:virt/build-heptapod.sh
131  $<
132 heptapod-runner:virt/build-heptapod-runner.sh
133  $<
134 
135 vc-pod:heptapod heptapod-runner
136 
137 virt:pod box bbdb vc
138 
139 ### Dist
140 dist/bundle:scripts/bundle-dir.sh comp
141  mkdir -pv $@
142  $<
143 
144 dist/cdn:cdn $(D)
145  mkdir -pv $@
146  cp -r $</* $@
147 
148 dist/sbcl:sbcl $(D);
149  mkdir -pv $@
150  cp $(SBCL_TARGET)/src/runtime/sbcl $@
151  cp $(SBCL_TARGET)/output/sbcl.core $@
152  cp -r $(SBCL_TARGET)/contrib $@
153  cd $(SBCL_TARGET) && ./clean.sh
154  tar -I 'zstd' -cf $@/sbcl-source.tar.zst --exclude .git $(SBCL_TARGET)
155 
156 dist/linux:linux $(D);
157 
158 dist/rocksdb:rocksdb $(D);
159  mkdir -pv $@
160  cp -rf $(ROCKSDB_TARGET)/include/* $@
161  cp -f $(ROCKSDB_TARGET)/librocksdb.* $@
162 
163 dist/rust:rust-build $(D);
164  cd $(RUST_TARGET) && x dist
165 dist/rust/bin:scripts/cargo-install.sh comp
166  mkdir -pv $@
167  $< "$(COMP_TARGET)/core/rust/app/cli/alik" "dist/rust"
168  $< "$(COMP_TARGET)/core/rust/app/cli/krypt" "dist/rust"
169  $< "$(COMP_TARGET)/core/rust/app/cli/tz" "dist/rust"
170  $< "$(COMP_TARGET)/core/rust/app/cli/cc-init" "dist/rust"
171  $< "$(COMP_TARGET)/core/rust/app/cli/mailman" "dist/rust"
172 
173 dist/emacs:emacs-build $(D);
174 
175 # requires quicklisp loaded in .skelrc
176 dist/lisp/fasl:scripts/sbcl-save-core.sh # quicklisp-install
177  mkdir -pv $@
178  $< "$@/std.core"
179  $< "$@/prelude.core" "(mapc #'ql:quickload \
180  (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc :rt))"
181 
182 dist/lisp/bin:scripts/sbcl-make-bin.sh comp
183  $< bin/skel
184  cp $(COMP_TARGET)/core/lisp/app/bin/skel $@
185  rm -f $(COMP_TARGET)/core/lisp/app/bin/skel.fasl
186  $< bin/organ
187  cp $(COMP_TARGET)/core/lisp/app/bin/organ $@
188  rm -f $(COMP_TARGET)/core/lisp/app/bin/organ.fasl
189  $< bin/homer
190  cp $(COMP_TARGET)/core/lisp/app/bin/homer $@
191  rm -f $(COMP_TARGET)/core/lisp/app/bin/homer.fasl
192  $< bin/packy
193  cp $(COMP_TARGET)/core/lisp/app/bin/packy $@
194  rm -f $(COMP_TARGET)/core/lisp/app/bin/packy.fasl
195  $< bin/rdb
196  cp $(COMP_TARGET)/core/lisp/app/bin/rdb $@
197  rm -f $(COMP_TARGET)/core/lisp/app/bin/rdb.fasl
198 
199 dist/comp:comp
200  mkdir -pv $@
201  cp -r $(COMP_TARGET)/{org,core,infra,demo,nas-t} $@
202 clean-dist:;rm -rf $(D)
203 clean-build:;rm -rf $(B)
204 
205 ### Quickstart
206 quick:comp