1.1--- a/makefile Sun Jun 16 05:02:27 2024 +0000
1.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3@@ -1,277 +0,0 @@
1.4-### infra/makefile --- The Compiler Company Infrastructure
1.5-
1.6-# this makefile is used to build all of our source code, package it,
1.7-# and ship it to various locations. It is for internal-use only.
1.8-
1.9-# If possible, use the packy (packy.compiler.company) to find and
1.10-# download a prepared bundle that suits your project needs.
1.11-
1.12-# You probably don't want to install all targets unless you have lots
1.13-# of time and a powerful machine, although it is possible. Instead,
1.14-# just run the targets for the components you are missing in your
1.15-# local environment (compatible compiler versions, shared libraries,
1.16-# etc)
1.17-
1.18-VERSION="0.1.0"
1.19-LINUX_VERSION:=$(shell uname -r | cut -d- -f1)
1.20-B:=build
1.21-D:=dist
1.22-SRC:=code
1.23-CONTAINERS:=containers
1.24-HG_COMMIT:=$(shell hg id -i)
1.25-DESTINATION:=/mnt/y/data/packy
1.26-# requires emacs-build-minimal
1.27-# artifacts can deploy to dist/TARGET - need target triple first
1.28-# init:sbcl rust emacs rocksdb code
1.29-# dist/linux dist/rust dist/bundle
1.30-archlinux:$(CONTAINERS)/Containerfile.archlinux;podman build -f $< -t archlinux
1.31-box:$(CONTAINERS)/Containerfile.box archlinux;podman build -f $< -t box
1.32-alpine:$(CONTAINERS)/Containerfile.alpine;podman build -f $< -t alpine
1.33-ubuntu:$(CONTAINERS)/Containerfile.ubuntu;podman build -f $< -t ubuntu
1.34-worker:$(CONTAINERS)/Containerfile.worker alpine;podman build -f $< -t worker
1.35-operator:$(CONTAINERS)/Containerfile.operator box;podman build -f $< -t operator
1.36-pods:archlinux alpine ubuntu box worker operator
1.37-quick:code
1.38-all:dist/code dist/lisp dist/rust dist/sbcl dist/rocksdb dist/emacs dist/pods
1.39-clean:;rm -rf $(B) $(D)
1.40-$(B):;mkdir -pv $@/src
1.41-$(D):;mkdir -pv $@/bin $@/lib $@/include $@/bundle $@/share
1.42-$(DESTINATION):$(D);cd $< && cp -rf ./* $@
1.43-### Linux
1.44-LINUX_TARGET:=linux-$(LINUX_VERSION)
1.45-linux:$(LINUX_TARGET) linux-config;
1.46-$(LINUX_TARGET):scripts/get-linux.sh;
1.47- mkdir -pv .stash/$@
1.48- gpg --export autosigner@ torvalds@ gregkh@ > .stash/$@/keyring.gpg
1.49- $< $(LINUX_VERSION) build .stash/$@/keyring.gpg
1.50- cd build && unxz $@.tar.xz && tar -xvf $@.tar $(LINUX_TARGET)
1.51-linux-config:$(LINUX_TARGET);
1.52- cd .stash/$< && make mrproper -j && zcat /proc/config.gz > .config && yes N | make localmodconfig
1.53-clean-linux::;rm -rf .stash/$(LINUX_TARGET)
1.54-
1.55-### Emacs
1.56-EMACS_TARGET:=.stash/src/emacs
1.57-EMACS_DIST:=$(D)/src/emacs
1.58-$(EMACS_TARGET):scripts/get-emacs.sh $(B);
1.59- $<
1.60-emacs:$(EMACS_TARGET)
1.61-emacs-build:scripts/build-emacs.sh $(EMACS_TARGET)
1.62- cd $(EMACS_TARGET) && ./autogen.sh
1.63- $<
1.64-emacs-build-mini:scripts/build-emacs-mini.sh emacs
1.65- cd $(EMACS_TARGET) && ./autogen.sh
1.66- $< $(EMACS_TARGET)
1.67-emacs-install:$(EMACS_TARGET);
1.68- cd $< && make install
1.69-
1.70-### RocksDB
1.71-ROCKSDB_TARGET:=.stash/src/rocksdb
1.72-$(ROCKSDB_TARGET):scripts/get-rocksdb.sh $(B)
1.73- $<
1.74-rocksdb:$(ROCKSDB_TARGET)
1.75-
1.76-rocksdb-build-shared:$(ROCKSDB_TARGET)
1.77- cd $< && make shared_lib DISABLE_JEMALLOC=1
1.78-
1.79-rocksdb-build-static:$(ROCKSDB_TARGET)
1.80- cd $< && make static_lib DISABLE_JEMALLOC=1
1.81-
1.82-rocksdb-install:$(ROCKSDB_TARGET)
1.83- cd $< && make install-shared && cp -r include/* /usr/local/include/
1.84-
1.85-### Nushell
1.86-NUSHELL_TARGET:=.stash/src/nushell
1.87-$(NUSHELL_TARGET):scripts/get-nushell.sh;$<
1.88-nushell:$(NUSHELL_TARGET)
1.89-# build without clipboard to avoid errors at runtime in container env
1.90-nushell-build:$(NUSHELL_TARGET)
1.91- cd $< && cargo build --workspace --release --no-default-features --features=default-no-clipboard,dataframe,extra --locked
1.92-nushell-install:$(NUSHELL_TARGET) nushell-build
1.93- cd $< && ./scripts/install-all.sh
1.94-### SBCL
1.95-SBCL_TARGET:=.stash/src/sbcl
1.96-SBCL_VERSION:=2.4.5
1.97-$(SBCL_TARGET):scripts/get-sbcl.sh $(B)
1.98- $<
1.99- cd $(SBCL_TARGET) && \
1.100- echo '"$(SBCL_VERSION)"' > version.lisp-expr
1.101-sbcl:$(SBCL_TARGET)
1.102-#### --with-sb-fasteval --without-sb-eval < broken
1.103-sbcl-build:$(SBCL_TARGET)
1.104- cd $< && \
1.105- ./make.sh \
1.106- --without-gencgc \
1.107- --with-mark-region-gc \
1.108- --dynamic-space-size=8Gb \
1.109- --fancy
1.110-sbcl-build-shared:$(SBCL_TARGET) sbcl-build
1.111- cd $< && \
1.112- ./make-shared-library.sh
1.113-sbcl-build-gencgc:$(SBCL_TARGET)
1.114- cd $< && \
1.115- ./make.sh \
1.116- --dynamic-space-size=8Gb \
1.117- --fancy
1.118-sbcl-docs:sbcl-build;## REQUIRES TEXLIVE
1.119- cd $(SBCL_TARGET)/doc/manual && make
1.120-sbcl-install:sbcl-build;cd $(SBCL_TARGET) && INSTALL_ROOT=/usr/local sh install.sh
1.121-sbcl-install-gencgc:sbcl-build-gencgc;cd $(SBCL_TARGET) && INSTALL_ROOT=/usr/local sh install.sh
1.122-clean-sbcl:$(SBCL_TARGET);cd $(SBCL_TARGET) && ./clean.sh
1.123-
1.124-.stash/quicklisp.lisp:$(B);cd $< && curl -O https://beta.quicklisp.org/quicklisp.lisp
1.125-quicklisp-install:scripts/quicklisp-install.sh .stash/quicklisp.lisp;$<
1.126-
1.127-STUMPWM_TARGET:=.stash/src/stumpwm
1.128-$(STUMPWM_TARGET):scripts/get-stumpwm.sh $(B);$<
1.129-stumpwm:$(STUMPWM_TARGET);
1.130-stumpwm-build:stumpwm;
1.131- cd $(STUMPWM_TARGET) && ./autogen.sh && ./configure && make
1.132-stumpwm-install:stumpwm-build;
1.133- cd $(STUMPWM_TARGET) && make install
1.134-### Rust
1.135-RUST_TARGET:=.stash/src/rust
1.136-$(RUST_TARGET):scripts/get-rust.sh $(B);$<
1.137-rust:$(RUST_TARGET)
1.138-rust-install-x:rust;
1.139- cargo install --path $(RUST_TARGET)/src/tools/x
1.140-rust-build:rust rust-install-x;
1.141- cd $(RUST_TARGET) && x build library
1.142-rust-doc:rust rust-install-x;
1.143- cd $(RUST_TARGET) && x doc
1.144-rust-build-full:rust-build;
1.145- cd $(RUST_TARGET) && x build --stage 2 compiler/rustc
1.146-rust-install:rust-build;
1.147- cd $(RUST_TARGET) && x install
1.148-rustup-install:;curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
1.149-cargo-tools-install:scripts/install-cargo-tools.sh
1.150- $<
1.151-### Tree-sitter
1.152-TREE_SITTER_TARGET:=.stash/src/tree-sitter
1.153-$(TREE_SITTER_TARGET):scripts/get-tree-sitter.sh
1.154- $<
1.155-tree-sitter:$(TREE_SITTER_TARGET)
1.156-tree-sitter-build:$(TREE_SITTER_TARGET)
1.157-tree-sitter-install:$(TREE_SITTER_TARGET) tree-sitter-build
1.158-
1.159-### Tree-sitter Langs
1.160-TREE_SITTER_LANGS_TARGET:=.stash/src/tree-sitter-langs
1.161-tree-sitter-langs-install:scripts/tree-sitter-install-langs.sh
1.162- $<
1.163-### Etc
1.164-ETC_TARGET:=.stash/etc
1.165-$(ETC_TARGET):scripts/get-etc.sh
1.166- $<
1.167-etc:$(ETC_TARGET)
1.168-
1.169-### Code
1.170-CODE_TARGET:=.stash/src/$(SRC)
1.171-$(CODE_TARGET):scripts/get-code.sh $(B)
1.172- $< $(SRC)
1.173-code:$(CODE_TARGET)
1.174-clean-code::;rm -rf $(CODE_TARGET)
1.175-
1.176-### Dist
1.177-dist/bundle:scripts/bundle-code.sh $(CODE_TARGET)
1.178- mkdir -pv $@
1.179- $<
1.180-
1.181-dist/sbcl:$(D);
1.182- scripts/dist-sbcl-binary.sh $(SBCL_TARGET) $(D)
1.183- cd $(SBCL_TARGET) && sh ./clean.sh
1.184- scripts/dist-sbcl-source.sh $(SBCL_TARGET) $(D)
1.185-
1.186-dist/linux:linux $(D);
1.187-
1.188-dist/rocksdb:$(D) rocksdb;
1.189- cd .stash/src && \
1.190- tar -I 'zstd' -cf ../../$</rocksdb.tar.zst rocksdb/include/* rocksdb/librocksdb.*
1.191-
1.192-CORE_SRC?=/usr/local/src/core
1.193-
1.194-dist/rust:rust-build $(D);
1.195- cd $(RUST_TARGET) && x dist
1.196-
1.197-dist/rust/bin:scripts/cargo-install.sh
1.198- mkdir -pv $@
1.199- $< "$(CORE_SRC)/rust/app/cli/alik" dist/rust
1.200- $< "$(CORE_SRC)/rust/app/cli/krypt" dist/rust
1.201- $< "$(CORE_SRC)/rust/app/cli/tz" dist/rust
1.202- $< "$(CORE_SRC)/rust/app/cli/cc-install" dist/rust
1.203- $< "$(CORE_SRC)/rust/app/cli/mailman" dist/rust
1.204-
1.205-dist/emacs:emacs-build $(D);
1.206- cd $(EMACS_TARGET) && ./make-dist --no-info --no-changelog && \
1.207- mv emacs-*.*.* emacs && \
1.208- tar -I 'zstd' -cf ../../../dist/emacs-binary.tar.zst emacs
1.209-
1.210-dist/emacs-mini:emacs-build-mini $(D);
1.211- cd $(EMACS_TARGET) && ./make-dist --no-info --no-changelog && \
1.212- mv emacs-*.*.* emacs && \
1.213- tar -I 'zstd' -cf ../../../dist/emacs-mini-binary.tar.zst emacs
1.214-
1.215-dist/nushell:$(D) nushell-build
1.216- cd $(NUSHELL_TARGET)/target/release/ && \
1.217- tar -I 'zstd' -cf ../../../../../$</nushell.tar.zst \
1.218- nu nu_plugin_custom_values nu_plugin_formats nu_plugin_gstat \
1.219- nu_plugin_inc nu_plugin_query
1.220-
1.221-dist/tree-sitter:scripts/tree-sitter-install-langs.sh $(D)
1.222- PREFIX=$(D) $<
1.223-
1.224-# requires quicklisp loaded in .skelrc
1.225-dist/lisp/fasl:scripts/sbcl-save-core.sh
1.226- mkdir -pv $@
1.227- $< "$@/std.core"
1.228- $< "$@/prelude.core" "(mapc #'ql:quickload \
1.229- (list :nlp :rdb :organ :packy :skel :obj :net :parse :pod :dat :log :packy :rt :syn :xdb :doc :vc))"
1.230-
1.231-dist/lisp/bin:scripts/sbcl-make-bin.sh
1.232- mkdir -pv $@
1.233- $< bin/skel
1.234- mv $(CORE_SRC)/lisp/app/bin/skel $@
1.235- rm -f $(CORE_SRC)/lisp/app/bin/skel.fasl
1.236- $< bin/organ
1.237- cp $(CORE_SRC)/lisp/app/bin/organ $@
1.238- rm -f $(CORE_SRC)/lisp/app/bin/organ.fasl
1.239- $< bin/homer
1.240- cp $(CORE_SRC)/lisp/app/bin/homer $@
1.241- rm -f $(CORE_SRC)/lisp/app/bin/homer.fasl
1.242- $< bin/packy
1.243- cp $(CORE_SRC)/lisp/app/bin/packy $@
1.244- rm -f $(CORE_SRC)/lisp/app/bin/packy.fasl
1.245- $< bin/rdb
1.246- cp $(CORE_SRC)/lisp/app/bin/rdb $@
1.247- rm -f $(CORE_SRC)/lisp/app/bin/rdb.fasl
1.248-
1.249-dist/lisp:dist/lisp/fasl dist/lisp/bin
1.250-
1.251-core-lisp-install:dist/lisp
1.252- install -m 755 $</bin/* /usr/local/bin/
1.253- install -m 755 $</fasl/* /usr/local/lib/sbcl/
1.254-
1.255-core-rust-install:dist/rust/bin
1.256- install -m 755 $</* /usr/local/bin/
1.257-
1.258-core-install:core-lisp-install core-rust-install
1.259-
1.260-dist/core:dist/rust/bin dist/lisp
1.261- mkdir -pv $(D)/core
1.262- cp -rf $(D)/lisp/fasl $(D)/lisp/bin $(D)/core
1.263- cp -rf $< $(D)/core
1.264- cd $(D) && tar -I 'zstd' -cf core.tar.zst core
1.265-
1.266-ETC:=$(USER)
1.267-
1.268-dist/etc:$(ETC_TARGET)
1.269- cd $(ETC_TARGET) && hg up $(ETC)
1.270- cp -rf $(ETC_TARGET) $(D)/etc
1.271-
1.272-dist/code:code
1.273- mkdir -pv $@
1.274- cp -r $(CODE_TARGET)/{org,core,infra,demo,etc} $@
1.275-dist/pods:pods
1.276- mkdir -pv $@
1.277- podman image save -o $@/all.tar archlinux alpine ubuntu box worker operator
1.278- cd $@ && zstd --ultra -T4 --rm all.tar -o all.tar.zst
1.279-clean-dist:;rm -rf $(D)
1.280-clean-build:;rm -rf $(B)