stargazing/notwa-util/cosmopolitan-bootstrap11

38 lines
1.6 KiB
Plaintext
Executable File

#!/usr/bin/false
if [ ! -e /cosmopolitan-bootstrap.done ]; then
: \
&& cd /root \
&& acquire from=github repo=jart/cosmopolitan dest=/root/cosmopolitan env=COSMO \
&& printf '%s\n' /tmp/tmp.*/cosmopolitan-* \
| while read -r d; do [ ! -d "$d" ] || rm -r "$d"; done \
&& cd /root/cosmopolitan \
&& export V=0 COLUMNS=80 TMPDIR=/tmp \
&& install -m0755 build/bootstrap/ape.elf /usr/bin/ape \
\
&& shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \
&& shed Makefile \
'/\bNET_HTTP\b/i\\tTHIRD_PARTY_LINENOISE\t\t\\' \
'/\bNET_HTTP\b/i\\tTOOL_ARGS\t\t\\' \
&& shed libc/elf/elf.h '/"libc\/elf\/struct\/ehdr.h"/i\\#include "libc/elf/struct/dyn.h"' \
&& shed third_party/awk/main.c '/pledge.*{/,/}/d' \
\
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
&& printf '%s="%s"\n' >env \
commit "$COSMO_COMMIT" \
flavor "$COSMO_FLAVOR" \
mode "$mode" \
&& export mode \
&& expand makeit a//ape.elf \
&& rebuild() { expand makeit "$@" && expand cp -int build/bootstrap "$@" ;} \
&& rebuild \
t//make/make.com b//ar.com b//chmod.com \
b//cocmd.com b//compile.com b//cp.com \
b//echo.com b//fixupobj.com b//gzip.com \
b//mkdeps.com b//mkdir.com b//package.com \
b//pwd.com b//rm.com b//touch.com \
b//unbundle.com b//zipcopy.com b//zipobj.com \
&& expand install -m0755 a//ape.elf /usr/bin/ape \
&& touch /cosmopolitan-bootstrap.done \
|| exit $?
fi