#!/usr/bin/false if [ ! -e /cosmopolitan-bootstrap.done ]; then : \ && cd /root \ && acquire from=github repo=jart/cosmopolitan dest=/root/cosmopolitan env=COSMO \ && cd /root/cosmopolitan \ && export V=0 COLUMNS=80 TMPDIR=/tmp \ && shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \ && sed -i 's/skip=" 76" count=" 128"/skip=76 count=128 /' build/bootstrap/*.com \ && install -m0755 build/bootstrap/ape.elf /usr/bin/ape \ && 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' \ && shed libc/calls/unveil.c \ '/^ if (landlock_abi_version == -1) {/i\ landlock_abi_version = landlock_create_ruleset(0, 0, LANDLOCK_CREATE_RULESET_VERSION);' \ && sed -i '/#\t/d' third_party/third_party.mk \ && { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \ && printf '%s="%s"\n' >env \ commit "$COSMO_COMMIT" \ flavor "$COSMO_FLAVOR" \ mode "$mode" \ && printf '%s\n' >makeit '#!/usr/bin/env sh' \ "build/bootstrap/make.com -j2 MODE='$mode'"' "$@"' \ && printf '%s\n' >expand '#!/usr/bin/env sh' \ "o='o/$mode' once=false" \ 'for f; do g="${f#?//}"; case "$f" in' \ '(a//*) f="$o/ape/$g";;' \ '(b//*) f="$o/tool/build/$g";;' \ '(e//*) f="$o/examples/$g";;' \ '(o//*) f="$o/$g";;' \ '(t//*) f="$o/third_party/$g";;' \ '(T//*) f="third_party/$g";;' \ 'esac; $once && set -- "$@" "$f" || set -- "$f"; once=true; done' \ '"$@"' \ && chmod +x makeit expand \ && ./expand ./makeit \ a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \ a//ape.lds a//ape.macho a//ape.o \ a//public/ape.lds o//cosmopolitan.a o//libc/crt/crt.o \ o/cosmopolitan.h \ && rebuild() { ./expand ./makeit "$@" && ./expand cp -int build/bootstrap "$@" ;} \ && rebuild \ t//make/make.com b//ar.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//zipobj.com \ && ./expand install -m0755 a//ape.elf /usr/bin/ape \ && ./expand ./makeit \ t//unzip/unzip.com t//zip/zip.com \ && touch /cosmopolitan-bootstrap.done \ || exit $? fi