diff --git a/notwa-util/cosmopolitan-bootstrap11 b/notwa-util/cosmopolitan-bootstrap11 index 0dc4324..3defec8 100755 --- a/notwa-util/cosmopolitan-bootstrap11 +++ b/notwa-util/cosmopolitan-bootstrap11 @@ -25,22 +25,9 @@ if [ ! -e /cosmopolitan-bootstrap.done ]; then 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.elf \ - && rebuild() { ./expand ./makeit "$@" && ./expand cp -int build/bootstrap "$@" ;} \ + && 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 \ @@ -48,7 +35,7 @@ if [ ! -e /cosmopolitan-bootstrap.done ]; then 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 \ + && expand install -m0755 a//ape.elf /usr/bin/ape \ && touch /cosmopolitan-bootstrap.done \ || exit $? fi diff --git a/notwa-util/cosmopolitan-install11 b/notwa-util/cosmopolitan-install11 index f910709..4d743e8 100755 --- a/notwa-util/cosmopolitan-install11 +++ b/notwa-util/cosmopolitan-install11 @@ -4,10 +4,11 @@ if [ ! -e /cosmopolitan-install.done ]; then : \ && cd /root/cosmopolitan \ && . ./env \ + && export mode \ \ && { [ ! -d dist ] || rm -r dist ;} \ && mkdir -p "dist/$flavor/public" \ - && ./expand cp -int "dist/$flavor" \ + && expand cp -int "dist/$flavor" \ a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \ a//ape.lds a//ape.macho a//ape.o \ o//cosmopolitan.a o//libc/crt/crt.o o/cosmopolitan.h \ @@ -16,7 +17,7 @@ if [ ! -e /cosmopolitan-install.done ]; then && install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \ && install -m0755 -t /usr/bin tool/scripts/cosmocc tool/scripts/cosmoc++ \ && find libc -name '*.h' >headers.txt \ - && ./expand tar zcf /tmp/headers.tar.gz -T headers.txt \ + && expand tar zcf /tmp/headers.tar.gz -T headers.txt \ libc/integral T//gdtoa/gdtoa.h T//getopt/getopt.h \ T//linenoise/linenoise.h T//musl/crypt.h T//musl/fnmatch.h \ T//musl/lockf.h T//musl/passwd.h T//musl/rand48.h \ @@ -31,7 +32,7 @@ if [ ! -e /cosmopolitan-install.done ]; then bin/x86_64-linux-musl-g++ \ bin/x86_64-linux-musl-ld.bfd \ && dedupe dist "$COSMO/dist/" "$flavor/cosmopolitan.h" \ - && ./expand cp -int /tmp/bin \ + && expand cp -int /tmp/bin \ t//make/make.com t//unzip/unzip.com t//zip/zip.com \ b//ar.com b//chmod.com b//cocmd.com \ b//compile.com b//cp.com b//echo.com \ diff --git a/notwa-util/cosmopolitan11 b/notwa-util/cosmopolitan11 index 275fae4..e2a8e77 100755 --- a/notwa-util/cosmopolitan11 +++ b/notwa-util/cosmopolitan11 @@ -13,16 +13,14 @@ if [ ! -e /cosmopolitan.done ]; then COSMO_DIST "/opt/cosmo/dist/$COSMO_FLAVOR" \ \ && . ./env \ - && sed -i -e "s_MODE='[^']*'_MODE='$mode'_g" makeit \ - && sed -i -e "s_o='o/[^']*'_o='o/$mode'_g" expand \ -\ - && { ./makeit depend || find o -name '*.o' -delete ;} \ - && ./makeit "o/$mode/third_party/make/make.com" \ + && export mode \ + && { makeit depend || find o -name '*.o' -delete ;} \ + && makeit "o/$mode/third_party/make/make.com" \ && cp -int build/bootstrap "o/$mode/third_party/make/make.com" \ \ && if [ "$COSMO_FLAVOR" = dbg ] \ ;then : \ - && ./expand ./makeit \ + && 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 b//ar.com b//chmod.com \ @@ -35,7 +33,7 @@ if [ ! -e /cosmopolitan.done ]; then o//libc/crt/crt.o o/cosmopolitan.h t//make/make.com \ t//unzip/unzip.com t//zip/zip.com \ ;else : \ - && ./makeit all \ + && makeit all \ ;fi \ && touch /cosmopolitan.done \ || exit $? diff --git a/notwa-util/doit11 b/notwa-util/doit11 index 598d655..ffa3999 100755 --- a/notwa-util/doit11 +++ b/notwa-util/doit11 @@ -37,7 +37,7 @@ YICES_SHA256=d4aa3bedbc143516f8db57f189f96e09a1771f31215c16b4c13bcdca38f592e3 \ if [ ! -e /notwa-util.done ]; then : \ && cd /vagrant/notwa-util \ - && install -p -m 0755 -t /usr/local/bin/ acquire dedupe ofc quickconf shed \ + && install -p -m 0755 -t /usr/local/bin/ acquire dedupe expand makeit ofc quickconf shed \ && touch /notwa-util.done \ || exit $? fi diff --git a/notwa-util/expand b/notwa-util/expand new file mode 100755 index 0000000..5c28896 --- /dev/null +++ b/notwa-util/expand @@ -0,0 +1,11 @@ +#!/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 +"$@" diff --git a/notwa-util/makeit b/notwa-util/makeit new file mode 100755 index 0000000..4dd718e --- /dev/null +++ b/notwa-util/makeit @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +build/bootstrap/make.com -j2 MODE="$mode" "$@"