From 03de7618902b41a13c2b30013f1bcbded950f012 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 28 Nov 2023 20:04:15 -0800 Subject: [PATCH] Update cosmocc to use superconfigure z0.0.23 --- Makefile | 6 ++-- tool/cosmocc/README.md | 2 +- tool/cosmocc/fetch.sh | 64 +++++++++++++++++++++++++++++++++++++++++ tool/cosmocc/package.sh | 4 +-- 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100755 tool/cosmocc/fetch.sh diff --git a/Makefile b/Makefile index dd303d37f..203c0461e 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ endif ifeq ($(TOOLCHAIN),) # if TOOLCHAIN isn't defined ifeq ("$(wildcard o/third_party/gcc/bin/x86_64-linux-cosmo-*)","") # if our gcc isn't unbundled ifneq ($(UNAME_M)-$(UNAME_S), x86_64-Linux) # if this is not amd64 linux -$(error you need to download https://cosmo.zip/pub/cosmocc/cosmocc-0.0.18.zip and unzip it inside the cosmo directory) +$(error please run tool/cosmocc/fetch.sh) endif endif endif @@ -123,7 +123,9 @@ o/$(MODE): \ o/$(MODE)/examples \ o/$(MODE)/third_party -.PHONY: o/$(MODE)/. +# TODO(jart): Make Emacs `C-c C-c` shortcut not need this. +.PHONY: o/$(MODE)/ o/$(MODE)/. +o/$(MODE)/: o/$(MODE) o/$(MODE)/.: o/$(MODE) # check if we're using o//third_party/make/make.com diff --git a/tool/cosmocc/README.md b/tool/cosmocc/README.md index a247a1a57..7e9736296 100644 --- a/tool/cosmocc/README.md +++ b/tool/cosmocc/README.md @@ -273,7 +273,7 @@ statements instead, so that Cosmopolitan Libc's system constants will work as expected. Our modifications to GNU GCC are published under the ISC license at . The binaries you see here were first published at - which + which is regularly updated. ## Legal diff --git a/tool/cosmocc/fetch.sh b/tool/cosmocc/fetch.sh new file mode 100755 index 000000000..167ccdc57 --- /dev/null +++ b/tool/cosmocc/fetch.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# tool/cosmocc/fetch.sh +# sets up mono repo to use latest cosmocc toolchain + +URL=https://cosmo.zip/pub/cosmocc/cosmocc.zip + +echo creating o/third_party/gcc... >&2 +rm -rf o/third_party/gcc || exit +mkdir -p o/third_party/gcc || exit +cd o/third_party/gcc + +echo downloading $URL... >&2 +if command -v wget >/dev/null; then + wget $URL || exit +else + curl -Lo cosmocc.zip $URL || exit +fi + +echo extracting cosmocc.zip... >&2 +unzip cosmocc.zip || exit +rm -f cosmocc.zip + +# report success and give tips +cat <<'EOF' >&2 + +SUCCESS + + the cosmo mono repo will now build using cosmocc + +WARNING + + if you run `make clean` then you'll have to download it again + +CONSIDER + + you can install the cosmocc toolchain you just downloaded as follows + + sudo chmod 01777 /opt + rm -rf /opt/cosmocc + mv o/third_party/gcc /opt/cosmocc + ln -sf /opt/cosmocc o/third_party/gcc + echo 'export PATH="/opt/cosmocc/bin:$PATH"' >>~/.profile + + then just recreate the symlink after cleaning. please note that you + should NEVER need to use make clean with the cosmo mono repo, since + our Makefile is flawless. if make clean actually helps, file a bug. + +EOF + +# give tip to linux users +if [ x"$(uname -s)" = x"Linux" ]; then + cat <<'EOF' >&2 +PROTIP + + running these commands + + rm -rf o + sudo mount -t tmpfs -o size=10G,noatime,nodiratime /dev/shm o + ln -sf /opt/cosmocc o/third_party/gcc + + makes the mono repo build faster + +EOF +fi diff --git a/tool/cosmocc/package.sh b/tool/cosmocc/package.sh index 911940f3d..70b1a79ac 100755 --- a/tool/cosmocc/package.sh +++ b/tool/cosmocc/package.sh @@ -71,10 +71,10 @@ done OLD=$PWD cd "$OUTDIR/" if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then - wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.19/aarch64-gcc.zip + wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.23/aarch64-gcc.zip unzip aarch64-gcc.zip rm -f aarch64-gcc.zip - wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.19/x86_64-gcc.zip + wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.23/x86_64-gcc.zip unzip x86_64-gcc.zip rm -f x86_64-gcc.zip fi