changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

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