turn expand and makeit into dedicated scripts

This commit is contained in:
Connor Olding 2023-06-18 04:25:40 -07:00
parent 804122de5c
commit 7f7999e9eb
6 changed files with 27 additions and 28 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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 $?

View File

@ -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

11
notwa-util/expand Executable file
View File

@ -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
"$@"

2
notwa-util/makeit Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env sh
build/bootstrap/make.com -j2 MODE="$mode" "$@"