cosmo: merge upstream dash into unbourne shell and distribute it

This commit is contained in:
Connor Olding 2022-10-09 12:39:27 -07:00
parent 2fda6048c1
commit fb551d7220
3 changed files with 1692 additions and 17 deletions

View File

@ -35,8 +35,8 @@ dbg_retrieve() { : \
&& podman build -t cosmo-yices cosmo-yices \
\
&& bin=/cosmopolitan/bin \
&& yes_retrieve cosmo $bin/ape $bin/awk.com $bin/gzip.com \
$bin/make.com $bin/sed.com $bin/unzip.com $bin/zip.com \
&& yes_retrieve cosmo $bin/ape $bin/awk.com $bin/gzip.com $bin/make.com \
$bin/sed.com $bin/unbourne.com $bin/unzip.com $bin/zip.com \
&& dbg_retrieve cosmo-kuroko /bin/kuroko.com \
&& dbg_retrieve cosmo-muon /bin/muon.com \
&& dbg_retrieve cosmo-perl /bin/perl.com \

View File

@ -20,7 +20,8 @@ WORKDIR /cosmopolitan
# tell makefiles to be less noisy, also use /tmp:
ENV V=0 COLUMNS=80 TMPDIR=/tmp
COPY --chmod=0755 --from=localhost/notwa-util /nu/shed /usr/bin/
COPY unbourne-backports.patch /cosmopolitan/
COPY --chmod=0755 --from=localhost/notwa-util /nu/ /usr/bin/
RUN : \
# allow optimized builds to be more portable, so the container is too. \
&& shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \
@ -46,14 +47,15 @@ RUN : \
commit "$COSMO_COMMIT" \
flavor "$COSMO_FLAVOR" \
mode "$mode" \
# apply patches from dash to unbourne shell \
&& /usr/bin/busybox patch -p1 -i unbourne-backports.patch \
# make calling make a little shorter (don't put this in distrib!) \
&& ln -s build/bootstrap/make.com make \
;
# finally start building
RUN --mount=type=tmpfs,target=/tmp : \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" e="$o/examples" \
&& ./make -j2 MODE="$mode" \
"$a/ape-copy-self.o" "$a/ape-no-modify-self.o" "$a/ape.elf" \
"$a/ape.lds" "$a/ape.macho" "$a/ape.o" \
@ -70,12 +72,13 @@ RUN --mount=type=tmpfs,target=/tmp : \
"$b/zipobj.com" \
# these are essential too! \
&& ./make -j2 MODE="$mode" "$@" \
"$t/awk/awk.com" "$t/sed/sed.com" "$t/unzip/unzip.com" \
"$t/zip/zip.com" "$b/assimilate.com" \
"$e/unbourne.com" "$t/awk/awk.com" "$t/sed/sed.com" \
"$t/unzip/unzip.com" "$t/zip/zip.com" "$b/assimilate.com" \
;
# install the basics (no executable binaries besides ape.elf)
RUN : \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" e="$o/examples" \
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
&& echo /dist >>.gitignore \
&& cp -t "dist/$flavor" \
@ -94,10 +97,11 @@ RUN : \
"$t/zlib/zconf.h" "$t/zlib/zlib.h" \
;
# install the rest
FROM builder AS distrib
COPY --chmod=0755 --from=localhost/notwa-util /nu/dedupe /usr/bin/
RUN --mount=type=tmpfs,target=/tmp : \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \
&& . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" e="$o/examples" \
&& find o -name '*.sym' -delete \
&& dedupe o/third_party/gcc /distrib/gcc/ \
bin/x86_64-linux-musl-gcc \
@ -108,14 +112,14 @@ RUN --mount=type=tmpfs,target=/tmp : \
# discover .com files by uncommenting this command: \
#&& find o -name '*.com' ! -type d -exec printf '%s\n' cp -t /tmp/bin {} + | sort && exit 1 \
&& cp -t /tmp/bin \
"$t/awk/awk.com" "$t/make/make.com" "$t/sed/sed.com" \
"$t/unzip/unzip.com" "$t/zip/zip.com" "$b/ar.com" \
"$b/assimilate.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/rollup.com" "$b/symtab.com" "$b/touch.com" \
"$b/unbundle.com" "$b/zipobj.com" \
"$e/unbourne.com" "$t/awk/awk.com" "$t/make/make.com" \
"$t/sed/sed.com" "$t/unzip/unzip.com" "$t/zip/zip.com" \
"$b/ar.com" "$b/assimilate.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/rollup.com" "$b/symtab.com" \
"$b/touch.com" "$b/unbundle.com" "$b/zipobj.com" \
&& dedupe /tmp/bin /distrib/bin/ \
#&& ln -s "../dist/$flavor/ape.elf" /distrib/bin/ape \
&& cp "dist/$flavor/ape.elf" /distrib/bin/ape \

File diff suppressed because it is too large Load Diff