changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > infra / makefile

changeset 28: 0184a4fbba68
parent: 2da284269dc1
child: 0fc025be1ae0
author: ellis <ellis@rwest.io>
date: Sun, 24 Dec 2023 13:53:30 -0500
permissions: -rw-r--r--
description: fix3
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 EMACS_VERSION:=main
18 ROCKSDB_VERSION:=main
19 SBCL_VERSION:=main
20 RUST_VERSION:=main
21 B:=build
22 D:=dist
23 SRC:=comp
24 HG_COMMIT:=$(shell hg id -i)
25 
26 init:sbcl rust emacs rocksdb code virt;
27 dist:dist/bundle dist/cdn dist/sbcl dist/rocksdb # dist/linux dist/rust
28 clean:;rm -rf $(B) $(D)
29 $(B):;mkdir -pv $@/src
30 $(D):;mkdir -pv $@
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-$(EMACS_VERSION)
46 EMACS_DIST:=$(D)/src/emacs
47 $(EMACS_TARGET):scripts/get-emacs.sh $(B);
48  $< $(EMACS_VERSION)
49 emacs:$(EMACS_TARGET)
50 emacs-build:emacs scripts/build-emacs.sh;
51  cd $(EMACS_TARGET) && ./autogen.sh
52  scripts/build-emacs.sh $(EMACS_VERSION) $(EMACS_TARGET)
53 emacs-install:emacs-build;
54  cd $(EMACS_TARGET) && make install
55 
56 ### RocksDB
57 ROCKSDB_TARGET:=build/src/rocksdb-$(ROCKSDB_VERSION)
58 rocksdb:scripts/get-rocksdb.sh;
59  $< $(ROCKSDB_VERSION)
60  cd $(ROCKSDB_TARGET) && \
61  make shared_lib DISABLE_JEMALLOC=1
62 
63 ### SBCL
64 SBCL_TARGET:=build/src/sbcl-$(SBCL_VERSION)
65 
66 $(SBCL_TARGET):scripts/get-sbcl.sh $(B);
67  $< $(SBCL_VERSION)
68  cd $(SBCL_TARGET) && \
69  echo '"2.3.12+main"' > version.lisp-expr && \
70  sh make.sh \
71  --without-gencgc \
72  --with-mark-region-gc \
73  --with-core-compression \
74  --with-sb-xref-for-internals \
75  --dynamic-space-size=4Gb \
76  --fancy && \
77  cd doc/manual && make
78 sbcl:$(SBCL_TARGET)
79 sbcl-install:sbcl;cd $(SBCL_TARGET) && ./install.sh
80 clean-sbcl:;rm -rf $(SBCL_TARGET)
81 
82 ### Rust
83 RUST_TARGET:=build/src/rust-$(RUST_VERSION)
84 rust:scripts/get-rust.sh $(B);
85  $< $(RUST_VERSION)
86 rust-x:rust;
87  cargo install --path $(RUST_TARGET)/src/tools/x
88 rust-build:rust rust-install-x;
89  cd $(RUST_TARGET) && x build library
90 rust-doc:rust rust-install-x;
91  cd $(RUST_TARGET) && x doc
92 rust-build-full:rust-build;
93  cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
94 rust-install:rust-build;
95  cd $(RUST_TARGET) && x install
96 
97 ### Tree-sitter Langs
98 TS_LANGS_TARGET:=build/src/ts-langs
99 ts-langs:scripts/ts-install-langs.sh # this requires sudo for now
100 
101 ### Code
102 CODE_TARGET:=build/src/$(SRC)
103 code:scripts/get-code.sh $(B)
104  $< $(SRC)
105 
106 clean-code::;rm -rf $(CODE_TARGET)
107 
108 ### Virt
109 dev-pod:virt/build-pod.sh
110  $<
111 archlinux:virt/build-archlinux-base.sh
112  $<
113 fedora:virt/build-fedora-base.sh
114  $<
115 box:virt/build-box-base.sh
116  $<
117 bbdb:virt/build-bbdb-base.sh
118  $<
119 heptapod:virt/build-heptapod.sh
120  $<
121 heptapod-runner:virt/build-heptapod-runner.sh
122  $<
123 
124 vc-pod:heptapod heptapod-runner
125 
126 virt:pod box bbdb vc
127 
128 ### Dist
129 dist/bundle:scripts/bundle-dir.sh $(D)
130  $<
131 
132 dist/cdn:cdn $(D)
133  mkdir -pv $@
134  cp -r $^ $@
135 
136 dist/sbcl:sbcl $(D);
137  $(SBCL_TARGET)/install.sh --prefix=$(D)
138 
139 dist/linux:linux $(D);
140 
141 dist/rocksdb:rocksdb $(D);
142  cd $(ROCKSDB_TARGET)
143  cp -rf include/* $(D)
144  cp -f librocksdb.so* $(D)/lib/
145 
146 dist/rust:rust-build $(D);
147  cd $(RUST_TARGET) && x dist
148 
149 dist/emacs:emacs-build $(D);
150 
151 clean-dist:;rm -rf $(D)
152 clean-build:;rm -rf $(B)
153 
154 ### Quickstart
155 quick:init code