Compare commits

...

46 Commits

Author SHA1 Message Date
Connor Olding 6b91f1ae1c meta: remove completed TODO 2022-10-25 20:56:24 -07:00
Connor Olding 47c18a97d5 muon: update version 2022-10-25 19:42:16 -07:00
Connor Olding 74ddf3ee4f kuroko: update version 2022-10-25 19:42:10 -07:00
Connor Olding 11c9578382 bootstrap: update version 2022-10-25 19:42:03 -07:00
Connor Olding 882cb4e80f meta: update installer for new image names 2022-10-25 19:39:52 -07:00
Connor Olding b2f2f13943 all: work around shed not detecting a match 2022-10-25 19:39:28 -07:00
Connor Olding 16ce669c8e use an unambiguous URL for pulling alpine 2022-10-20 12:59:10 -07:00
Connor Olding 1c0dffa857 all: only patch the portion of the ftruncate test that's failing 2022-10-20 12:59:07 -07:00
Connor Olding 4b9b114c89 all: skip more tests 2022-10-19 12:29:27 -07:00
Connor Olding f4f6bc7b84 bootstrap: update version and remove make.com workaround 2022-10-19 12:26:50 -07:00
Connor Olding e09790470e all: properly use the right cosmopolitan libraries 2022-10-18 20:37:27 -07:00
Connor Olding 53bcb46c1c all: don't use cache, save some space 2022-10-18 19:02:19 -07:00
Connor Olding 46feeb23c8 all: skip ftruncate test 2022-10-18 15:03:07 -07:00
Connor Olding d4fcaadc65 meta: check for a file since git leaves behind empty directories 2022-10-18 13:55:24 -07:00
Connor Olding ad9aa9fa70 yices: rewrite comment 2022-10-18 13:47:18 -07:00
Connor Olding efd9608d42 bootstrap: update version 2022-10-18 13:42:12 -07:00
Connor Olding 6147d6a35a perl: workaround strange segfault 2022-10-18 13:42:12 -07:00
Connor Olding 45bdb84af5 yices: don't strip symbols, also reduce build noise 2022-10-18 13:42:12 -07:00
Connor Olding 956e96725a meta: allow passing of flavors by arguments 2022-10-18 13:42:12 -07:00
Connor Olding b5e9017414 meta: superficial whitespace 2022-10-18 13:42:12 -07:00
Connor Olding 9e316d777b meta: remove absurdism (integrated into my local script) 2022-10-18 13:42:11 -07:00
Connor Olding 9c800550d0 meta: prevent asking how to disambiguate a failed build 2022-10-18 13:41:58 -07:00
Connor Olding 97c27ffa16 perl: update version 2022-10-18 13:38:46 -07:00
Connor Olding 9cdf8f9435 muon: update version 2022-10-15 15:51:51 -07:00
Connor Olding d6998f3dcc all: remove object files when make depend fails, as a fallback 2022-10-15 09:43:04 -07:00
Connor Olding c22a02e219 bootstrap: update version 2022-10-15 02:01:46 -07:00
Connor Olding 84695887cf meta: fix auto-update 2022-10-15 02:00:50 -07:00
Connor Olding ec422d6dcd meta: build a couple local things 2022-10-15 01:40:56 -07:00
Connor Olding 174778e8af meta: update readme 2022-10-15 01:39:55 -07:00
Connor Olding d4ee9c0853 meta: add absurdism script for layered insanity 2022-10-15 01:39:55 -07:00
Connor Olding 54f99c91d9 all: add another skipped test 2022-10-15 01:39:55 -07:00
Connor Olding a32a28d7c2 add 'simple' containers and distribute way more programs 2022-10-15 01:39:55 -07:00
Connor Olding 76456e8ea2 kuroko, muon, perl, yices: use rescue container 2022-10-15 01:28:37 -07:00
Connor Olding e4af8b909f add rescue container to simplify runners 2022-10-15 01:24:20 -07:00
Connor Olding a9a883a5b4 split building into phases (superficial) 2022-10-15 01:22:35 -07:00
Connor Olding 019a09689f meta: superficial changes 2022-10-15 01:15:13 -07:00
Connor Olding d44528a346 defer building assimilate, awk, sed, and unbourne to cosmo-all 2022-10-15 01:12:58 -07:00
Connor Olding 5cb78a7eb8 add cosmo-all to make all 2022-10-15 01:02:02 -07:00
Connor Olding 3256db8386 base: split into base and dist
this will make more sense later!
2022-10-15 00:44:43 -07:00
Connor Olding 324c6cabe7 bootstrap: add optional rebuild feature (COSMO_REBUILD=1) 2022-10-15 00:32:45 -07:00
Connor Olding f9d7c4398d bootstrap, base: only copy the necessary utilities 2022-10-15 00:32:00 -07:00
Connor Olding 6d8247bd0e bootstrap: superficial changes 2022-10-15 00:30:32 -07:00
Connor Olding 3dfea15904 meta: add noisy messages to build script 2022-10-15 00:24:06 -07:00
Connor Olding 67ec821336 meta: reduce repetition in build script 2022-10-15 00:21:48 -07:00
Connor Olding 78c1cda400 cosmo: split into cosmo-bootstrap and cosmo-base 2022-10-15 00:21:43 -07:00
Connor Olding 0fa24ccc22 perl: superficial changes 2022-10-14 23:19:57 -07:00
42 changed files with 461 additions and 104 deletions

View File

@ -10,9 +10,106 @@ Linux, Mac, Windows, FreeBSD, OpenBSD, and NetBSD.
not every feature is available on every platform.
cosmopolitan already does a tremendous job at
polyfilling missing features across platforms,
but pre-existing software still takes a lot of
but pre-existing software may take a lot of
patching before becoming fully functional.
## containers
in order of dependence, then alphabetical order.
### Phase 1
* **notwa-util:** convenient shell scripts for
augmenting common tasks relating to building.
this also builds a busybox rescue shell,
configured specifically for containers.
### Phase 2
* **cosmo-bootstrap:** builds the basic libraries (i.e.
cosmopolitan libc) and binaries to bootstrap itself
and build other software against.
### Phase 3
* **cosmo-all:** builds almost everything else from
the cosmopolitan repository (i.e. first-class third-party support)
the "flavor" used can be different than that of cosmo-bootstrap.
* **cosmo-dist:** only contains the essentials from cosmo-bootstrap.
* **rescue:** a minimal container used as a base
for many of the simple containers in phase 4.
### Phase 4
* **assimilate:** converts Actually Portable Executables
into native binaries. typically unnecessary, but sometimes nice.
* **bd:** (TODO)
* **bing:** (TODO)
* **blinkenlights:** (TODO)
* **cosmo-awk:** Actually Portable awk (fork of One True Awk)
* **cosmo-base:** used to build other containers in phase 5.
* **cosmo-chibicc:** chibicc (TODO: version?)
with many extensions.
* **cosmo-lua:** Actually Portable Lua
* **cosmo-make:** Landlocked Make (fork of GNU Make)
* **cosmo-python:** Actually Portable Python 3.6.14
* **cosmo-quickjs:** quickjs (2021-03-27)
* **cosmo-sed:** Actually Portable sed (fork of NetBSD sed)
* **cosmo-sqlite:** sqlite3 (3350500)
* **fold:** (TODO)
* **greenbean:** (TODO)
* **hello:** (TODO)
* **life:** (TODO)
* **memzoom:** (TODO)
* **mkdeps:** (TODO)
* **pledge:** (TODO)
* **printimage:** (TODO)
* **printvideo:** (TODO)
* **redbean:** (TODO)
* **tinyemu:** (TODO)
* **unbourne:** a fork of dash (v0.5.11.5) with extended interactivity.
* **unveil:** (TODO)
### Phase 5
* **cosmo-kuroko**: kuroko (bleeding edge), a dialect of Python 3.
kuroko combines Python's syntax with Lua's level of embeddability,
and it can be used standalone as well.
* **cosmo-muon**: muon (bleeding edge), a reimplementation of mesen, written in C.
* **cosmo-perl**: Actually Portable Perl, thanks to Gavin Hayes
* **cosmo-yices**: yices (bleeding edge), SAT + SMT (SMTLIB, SMTLIB2) solvers.
also includes **cosmo-kissat** (bleeding edge), one of the best SAT solvers.
## building
on most Linux distros with podman properly installed and configured,

View File

@ -14,7 +14,6 @@ remove elements from this list as you see fit.
* for source being built
* for exposed containers
* for `install-cosmo` (kinda a subset of the previous point)
* cosmo: allow non-default builds (`rel`, `dbg`, etc.)
* kuroko: test more vigorously
* do tests pass on a Windows host?
* kuroko: use cosmopolitan readline functionality instead of built-in?

View File

@ -13,7 +13,7 @@ latest() { : \
any=0 flags="-L --no-progress-meter" n="$(printf '\n.')" n="${n%.}" \
df=Dockerfile gh='https://github.com/' sr='https://git.sr.ht/~' \
&& set -- \
cosmo COSMO_COMMIT ${gh}jart/cosmopolitan \
cosmo-bootstrap COSMO_COMMIT ${gh}jart/cosmopolitan \
cosmo-kuroko KUROKO_COMMIT ${gh}kuroko-lang/kuroko \
cosmo-muon MUON_COMMIT ${sr}lattis/muon \
cosmo-perl PERL_COMMIT ${gh}G4Vi/perl5/tree/cosmo \

104
build-all
View File

@ -1,12 +1,19 @@
#!/usr/bin/env sh
announce() { : \
&& printf >&2 ' \033[1m\033[7m <-- \033[0m\033[1m ' \
&& printf >&2 ' %30s %-30s ' "$1" "$2" \
&& printf >&2 ' \033[1m\033[7m --> \033[0m\n' \
;}
yes_retrieve() { : \
&& local ok=1 out= g= image="${1?missing argument}" && shift \
&& [ -d out ] && out="$(realpath out)" \
&& for f in "$@" \
;do g="out/${f##*/}" && { ! [ -e "$g" ] || mv "$g" "$g~" ;} || return \
;do announce retrieving "$f" \
&& g="out/${f##*/}" && { ! [ -e "$g" ] || mv "$g" "$g~" ;} || return \
;done \
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "localhost/$image" \
cp -- "$@" "/out/" \
&& for f in "$@" \
;do if g="out/${f##*/}" && [ -e "$g" ] \
@ -24,22 +31,87 @@ dbg_retrieve() { : \
&& yes_retrieve "$container" "$@" \
;}
build() { : \
&& local t="${1?missing argument}" && shift \
&& announce building "$t" \
&& podman build -t "$t" "./$t" "$@" \
;}
build_simple() { : \
&& for f in simple/*.Dockerfile \
;do t="${f%.*}" t=${t##*/} \
&& announce '(simple) packaging' "$t" \
&& podman build -t "$t" -f "$f" simple \
|| return \
;done \
;}
build_base() { : \
&& sed 's/\bcosmo-bootstrap\b/cosmo-all/g' \
<cosmo-dist/Dockerfile >cosmo-dist/all.Dockerfile \
&& build cosmo-dist -f cosmo-dist/all.Dockerfile \
&& build cosmo-base \
;}
: \
&& me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \
&& : \
\
&& podman build -t notwa-util notwa-util \
&& podman build -t cosmo cosmo \
&& podman build -t cosmo-kuroko cosmo-kuroko \
&& podman build -t cosmo-muon cosmo-muon \
&& podman build -t cosmo-perl cosmo-perl \
&& podman build -t cosmo-yices cosmo-yices \
`# phase 1` \
&& build notwa-util \
\
&& bin=/cosmopolitan/bin \
&& 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 \
&& dbg_retrieve cosmo-yices /bin/kissat.com /bin/yices-sat.com \
/bin/yices-smt.com /bin/yices-smt2.com /bin/yices.com \
`# phase 2` \
&& build cosmo-bootstrap --build-arg=COSMO_FLAVOR="${1:-def}" \
\
`# phase 3` \
&& build cosmo-all --build-arg=COSMO_FLAVOR="${2:-def}" \
&& build cosmo-dist \
&& build rescue \
\
`# phase 4` \
&& build_base \
&& build_simple \
\
`# phase 5` \
&& build cosmo-kuroko \
&& build cosmo-muon \
&& build cosmo-perl \
&& build cosmo-yices \
\
`# other stuff` \
&& { [ ! -s cosmo-mini/Dockerfile ] || build cosmo-mini ;} \
\
&& yes_retrieve cosmo-base /cosmopolitan/bin/ape \
&& dbg_retrieve cosmo-kuroko /bin/kuroko.com \
&& dbg_retrieve cosmo-muon /bin/muon.com \
&& dbg_retrieve cosmo-perl /bin/perl.com \
&& dbg_retrieve cosmo-yices /bin/kissat.com /bin/yices-sat.com \
/bin/yices-smt.com /bin/yices-smt2.com \
/bin/yices.com \
\
&& dbg_retrieve assimilate /bin/assimilate.com \
&& dbg_retrieve bd /bin/bd.com \
&& dbg_retrieve bing /bin/bing.com /bin/unbing.com \
&& dbg_retrieve blinkenlights /bin/blinkenlights.com \
&& dbg_retrieve cosmo-awk /bin/awk.com \
&& dbg_retrieve cosmo-chibicc /bin/chibicc.com \
&& dbg_retrieve cosmo-lua /bin/lua.com /bin/luac.com \
&& dbg_retrieve cosmo-make /bin/make.com \
&& dbg_retrieve cosmo-python /bin/python.com \
&& dbg_retrieve cosmo-quickjs /bin/qjs.com /bin/qjsc.com \
&& dbg_retrieve cosmo-sed /bin/sed.com \
&& dbg_retrieve cosmo-sqlite /bin/sqlite3.com \
&& dbg_retrieve fold /bin/fold.com \
&& dbg_retrieve greenbean /bin/greenbean.com \
&& dbg_retrieve hello /bin/hello.com \
&& dbg_retrieve life /bin/life.com \
&& dbg_retrieve memzoom /bin/memzoom.com \
&& dbg_retrieve mkdeps /bin/mkdeps.com \
&& dbg_retrieve pledge /bin/pledge.com \
&& dbg_retrieve printimage /bin/printimage.com \
&& dbg_retrieve printvideo /bin/printvideo.com \
&& dbg_retrieve redbean /bin/redbean.com \
&& dbg_retrieve tinyemu /bin/tinyemu.com \
&& dbg_retrieve unbourne /bin/unbourne.com \
&& dbg_retrieve unveil /bin/unveil.com \
;

54
cosmo-all/Dockerfile Normal file
View File

@ -0,0 +1,54 @@
FROM localhost/cosmo-bootstrap AS builder
ARG COSMO_FLAVOR=def
ARG COSMO_REBUILD=1
RUN : \
&& . ./env \
&& if [ "$COSMO_REBUILD" = 1 ] || [ "$flavor" != "$COSMO_FLAVOR" ] \
;then : \
&& rm -r o \
;else : \
&& mv o o.old \
;fi \
# create a mapping from flavor to mode (possibly an empty string) \
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
&& printf '%s="%s"\n' >env \
commit "$commit" \
flavor "$COSMO_FLAVOR" \
mode "$mode" \
COSMO "$PWD" \
COSMO_DIST "$PWD/dist/$COSMO_FLAVOR" \
\
&& shed expand "s_o='o/[^']*'_o='o/$mode' _g" \
;
RUN --mount=type=tmpfs,target=/tmp : \
&& . ./env \
&& if [ -e o.old ] \
;then : \
&& cp o.old/* o/ \
&& rm -r o.old \
;fi \
\
&& skip() { mkdir -p "${1%/*}" && touch -d @2222222222 "$1" ;} \
# skip some checks that fail under podman: \
&& skip "o/$mode/test/libc/calls/getgroups_test.com.runs" \
&& skip "o/$mode/test/libc/calls/getpriority_test.com.runs" \
# these can fail when nesting podman: \
&& shed test/libc/calls/ftruncate_test.c '/\.st_blocks/d' \
&& skip "o/$mode/test/libc/stdio/tmpfile_test.com.runs" \
&& skip "o/$mode/test/tool/net/lunix_test.lua.runs" \
&& skip "o/$mode/third_party/python/Lib/test/test_selectors.py.runs" \
# FIXME: SIGSEGV: \
&& skip "o/$mode/third_party/python/Lib/test/test_ioctl.py.runs" \
\
&& { ./makeit MODE="$mode" depend || find o -name '*.o' -delete ;} \
&& ./makeit MODE="$mode" all \
\
# install the binaries somewhere so we can retrieve them without mounting cache: \
&& find o '(' -name '*.com' -o -name '*.com.dbg' ')' \
'!' -name '*_test.*' '!' -name 'test_*' -exec \
install -m0755 -t /usr/local/bin {} \
+ \
# save some space: \
&& find o -type f '(' -name '*.com.dbg' -o -name '*_test.*' -o -name 'test_*' ')' -delete \
;

4
cosmo-base/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM cosmo-dist
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/assimilate.com /cosmopolitan/bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/awk.com /cosmopolitan/bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/sed.com /cosmopolitan/bin/

View File

@ -1,8 +1,9 @@
# MAIN: https://justine.lol/cosmopolitan/
# REPO: https://github.com/jart/cosmopolitan
ARG COSMO_FLAVOR=def
ARG COSMO_COMMIT=f52f65b2e351085250b743a5319dab418f2d48be
ARG COSMO_SHA256=8a13f4be3d689b8895af6e1178d455db2f82a69e33ce5848e2f2f14f96760d4c
ARG COSMO_COMMIT=ef9776755ee3646029624fe30de5d58a3c03f6f6
ARG COSMO_SHA256=f5efa2daf12f0536a4d57b4da5f7402398bb93ae2d5e602c2401b3a6227af1c4
ARG COSMO_REBUILD=0
FROM localhost/notwa-util AS downloader
ARG COSMO_COMMIT COSMO_SHA256
@ -11,7 +12,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
&& acquire from=github repo=jart/cosmopolitan dest=/cosmopolitan env=COSMO \
;
FROM alpine:3.16 AS builder
FROM docker.io/library/alpine:3.16 AS builder
ARG COSMO_FLAVOR COSMO_COMMIT
COPY --from=downloader /cosmopolitan /cosmopolitan
WORKDIR /cosmopolitan
@ -19,13 +20,13 @@ WORKDIR /cosmopolitan
# tell makefiles to be less noisy, also use /tmp:
ENV V=0 COLUMNS=80 TMPDIR=/tmp
COPY --chmod=0755 make.com build/bootstrap/make.com
COPY --chmod=0755 --from=localhost/notwa-util /nu/ /usr/bin/
COPY --chmod=0755 --from=localhost/notwa-util /nu/shed /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/' \
# fix execution on alpine (although installing the loader mitigates this) \
&& 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 \
# TODO: apply changes to COSMOPOLITAN_HEADERS as to include them in cosmopolitan.h \
@ -59,7 +60,7 @@ RUN : \
'(T//*) f="third_party/$g";;' \
'esac; $once && set -- "$@" "$f" || set -- "$f"; once=true; done' \
'"$@"' \
# don't forget to do this \
# i always forget to do this \
&& chmod +x makeit expand \
;
@ -79,63 +80,34 @@ RUN --mount=type=tmpfs,target=/tmp : \
b//mkdir.com b//package.com b//pwd.com \
b//rm.com b//touch.com b//unbundle.com \
b//zipobj.com \
# these are essential too! \
&& ./expand ./makeit \
e//unbourne.com t//awk/awk.com t//sed/sed.com \
t//unzip/unzip.com t//zip/zip.com b//assimilate.com \
# install the newly-built ape loader, just in case it has changed: \
&& ./expand install -m0755 a//ape.elf /usr/bin/ape \
;
# install the basics (no executable binaries besides ape.elf)
RUN : \
&& . ./env \
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
&& echo /dist >>.gitignore \
&& ./expand cp -t "dist/$flavor" \
# optionally use the newly-built bootstrapped binaries to build themselves again.
ARG COSMO_REBUILD
RUN --mount=type=tmpfs,target=/tmp : \
&& { [ "$COSMO_REBUILD" = 1 ] || exit 0 ;} \
&& rm -r o \
\
&& ./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 \
o//cosmopolitan.a o//libc/crt/crt.o o/cosmopolitan.h \
&& cp -t "dist/$flavor/public" "o/$mode/ape/public/ape.lds" \
\
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
&& find libc -name '*.h' >headers.txt \
&& ./expand tar zcf dist/headers.tar.gz -T headers.txt \
ape/config.h 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 T//musl/tempnam.h T//regex/regex.h \
T//zlib/zconf.h T//zlib/zlib.h \
;
# install the rest
FROM builder AS distrib
RUN --mount=type=tmpfs,target=/tmp : \
&& . ./env \
&& find o -name '*.sym' -delete \
&& dedupe o/third_party/gcc /distrib/gcc/ \
bin/x86_64-linux-musl-gcc \
bin/x86_64-linux-musl-g++ \
bin/x86_64-linux-musl-ld.bfd \
&& dedupe dist /distrib/dist/ "$flavor/cosmopolitan.h" \
&& mkdir /tmp/bin \
# discover .com files by uncommenting this command: \
#&& find o -name '*.com' ! -type d -exec printf '%s\n' cp -t /tmp/bin {} + | sort && exit 1 \
&& ./expand cp -t /tmp/bin \
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 \
a//public/ape.lds o//cosmopolitan.a o//libc/crt/crt.o \
o/cosmopolitan.h \
# build some extra tools for other containers to stem off of: \
&& rebuild() { ./expand ./makeit "$@" && ./expand cp -t 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//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 \
&& cp /cosmopolitan/env /distrib/env \
b//rm.com b//touch.com b//unbundle.com \
b//zipobj.com \
;
FROM alpine:3.16 AS runner
COPY --from=distrib /distrib /cosmopolitan
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
ARG COSMO_FLAVOR
ENV COSMO_DIST="/cosmopolitan/dist/$COSMO_FLAVOR"
# these are essential too! \
RUN --mount=type=tmpfs,target=/tmp : \
&& ./expand ./makeit \
t//unzip/unzip.com t//zip/zip.com \
;

57
cosmo-dist/Dockerfile Normal file
View File

@ -0,0 +1,57 @@
FROM localhost/cosmo-bootstrap AS builder
# install the basics (no executable binaries besides ape.elf)
RUN : \
&& . ./env \
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
&& echo /dist >>.gitignore \
&& ./expand cp -t "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 \
&& cp -t "dist/$flavor/public" "o/$mode/ape/public/ape.lds" \
\
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
&& find libc -name '*.h' >headers.txt \
&& ./expand tar zcf dist/headers.tar.gz -T headers.txt \
ape/config.h 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 T//musl/tempnam.h T//regex/regex.h \
T//zlib/zconf.h T//zlib/zlib.h \
;
# install the rest
COPY --chmod=0755 --from=localhost/notwa-util /nu/dedupe /usr/bin/
FROM builder AS distrib
RUN --mount=type=tmpfs,target=/tmp : \
&& . ./env \
&& find o -name '*.sym' -delete \
&& dedupe o/third_party/gcc /distrib/gcc/ \
bin/x86_64-linux-musl-gcc \
bin/x86_64-linux-musl-g++ \
bin/x86_64-linux-musl-ld.bfd \
&& dedupe dist /distrib/dist/ "$flavor/cosmopolitan.h" \
&& mkdir /tmp/bin \
# discover .com files by uncommenting this command: \
#&& find o -name '*.com' ! -type d -exec printf '%s\n' cp -t /tmp/bin {} + | sort && exit 1 \
&& ./expand cp -t /tmp/bin \
t//make/make.com t//unzip/unzip.com t//zip/zip.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//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 \
&& cp /cosmopolitan/env /distrib/env \
;
FROM docker.io/library/alpine:3.16 AS runner
COPY --from=distrib /distrib /cosmopolitan
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
# FIXME:
#ARG COSMO_FLAVOR
#ENV COSMO_DIST="/cosmopolitan/dist/$COSMO_FLAVOR"

View File

@ -3,15 +3,15 @@
# TODO: add /zip/ support by default and include dist modules.
FROM localhost/notwa-util AS downloader
ARG KUROKO_COMMIT=3f35d89fff2343ddb9f0de5c87bbdefa86ee34f5
ARG KUROKO_SHA256=b1d38c48afdc06633d848dc27cb5d37bebbb7c99c59d3649c155350f06cd93a7
ARG KUROKO_COMMIT=f4b40b1b7015c0d421edb508144b4a22b2321d46
ARG KUROKO_SHA256=d72e1b3bb7400d7c2e47dd97120b64890998c90ccb13cb3f7cd16429a584f41c
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
--mount=type=tmpfs,target=/tmp : \
&& acquire from=github repo=kuroko-lang/kuroko dest=/kuroko env=KUROKO \
;
FROM localhost/cosmo AS builder
FROM localhost/cosmo-base AS builder
COPY --from=downloader /kuroko /kuroko
WORKDIR /kuroko
@ -123,9 +123,7 @@ RUN : \
;
RUN make.com test
FROM scratch AS runner
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
COPY --chmod=0755 --from=builder /cosmopolitan/bin/ape /bin/ape
FROM localhost/rescue AS runner
COPY --chmod=0755 --from=builder /kuroko/kuroko.com /kuroko/kuroko.com.dbg /bin/
COPY --from=builder /kuroko.patch /var/local/kuroko.patch
ENTRYPOINT ["/bin/ape", "/bin/kuroko.com"]

View File

@ -1,14 +1,14 @@
# MAIN: https://muon.build/
# REPO: https://git.sr.ht/~lattis/muon
FROM localhost/notwa-util AS downloader
ARG MUON_COMMIT=ab1e044c93c9c87e496ff7c4028ddf4218b91445
ARG MUON_SHA256=006425edf914444b87108ee062c9f56ee57804a2726f757c44c329f213465182
ARG MUON_COMMIT=cdb84257b50ebdeddd1ea696fe433e4a3316c8a9
ARG MUON_SHA256=c8104d857ccaea09ddb6e9a83c73b4a061550c1257f7673c904a137d8a716f04
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
--mount=type=tmpfs,target=/tmp : \
&& acquire from=sourcehut repo=lattis/muon dest=/muon env=MUON \
;
FROM localhost/cosmo AS builder
FROM localhost/cosmo-base AS builder
RUN apk add --no-cache ninja
COPY --chmod=0755 --from=localhost/notwa-util /nu/cosmocc /usr/bin/
@ -45,8 +45,6 @@ RUN : \
&& objcopy -S -O binary muon.com.dbg muon.com \
;
FROM scratch AS runner
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
COPY --chmod=0755 --from=builder /cosmopolitan/bin/ape /bin/ape
FROM localhost/rescue AS runner
COPY --chmod=0755 --from=builder /muon/build/muon.com /muon/build/muon.com.dbg /bin/
ENTRYPOINT ["/bin/ape", "/bin/muon.com"]

View File

@ -1,11 +1,15 @@
FROM localhost/notwa-util AS downloader
# MAIN: https://www.perl.org/
# REPO: https://github.com/Perl/perl5
# FORK: https://github.com/G4Vi/perl5/tree/cosmo
FROM localhost/notwa-util AS downloader
ARG PERL_COMMIT=66baebd8320a90ddf2c90de14b83f7eee4f6b143
ARG PERL_SHA256=0e6731efb5f25589116340b4e861abd43fb47520669fe903569b1489339dcddb
ARG PERL_COMMIT=2fb034ffb02db2b3ac09706c954704930c620c0b
ARG PERL_SHA256=03bf2d1eefb8610e1ad5594ddf7cc5eb5aa11c25f499f3233ecaa3088d55579a
# MAIN: https://computoid.com/APPerl/
# REPO: https://github.com/G4Vi/Perl-Dist-APPerl
# MAIN: https://metacpan.org/pod/perltidy
# REPO: https://github.com/perltidy/perltidy
ARG PERLTIDY_VERSION=20220613
ARG PERLTIDY_SHA256=50496a6952904ef28f495919fc0a67801a63c87779c61308ce1ca5b32467c5d4
@ -22,7 +26,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
&& acquire \
;
FROM localhost/cosmo AS builder
FROM localhost/cosmo-base AS builder
COPY --from=downloader /perl /perl
RUN : \
@ -87,6 +91,13 @@ RUN make -j2
RUN make -j2 minitest devtty=/dev/zero | tee minitest_results.txt
# temporary workaround for segfault. oddly enough,
# it's not a segfault in the zip executable! alas, \
RUN : \
&& rm /usr/bin/zip \
&& apk add --no-cache zip \
;
RUN : \
&& mkdir /perl/cosmo \
&& mkdir /perl/cosmo/o \
@ -125,9 +136,7 @@ RUN : \
&& mv ../perl.com ../../perl.com \
;
FROM scratch AS runner
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
COPY --chmod=0755 --from=builder /cosmopolitan/bin/ape /bin/ape
FROM localhost/rescue AS runner
COPY --chmod=0755 --from=builder /perl/cosmo/o/perl.com /bin/perl.com
COPY --chmod=0755 --from=builder /perl/perl.elf /bin/perl.com.dbg
COPY --from=builder /perl/minitest_results.txt /minitest_results.txt

View File

@ -28,7 +28,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
&& acquire from=github repo=arminbiere/kissat dest=/kissat env=KISSAT \
;
FROM localhost/cosmo AS builder
FROM localhost/cosmo-base AS builder
RUN apk add --no-cache autoconf gperf
@ -60,6 +60,13 @@ RUN : \
COPY --from=downloader /gmp /gmp
WORKDIR /gmp
RUN : \
# don't build this crap; our printf is fine. \
# (i suppose the missing symbols could cause linking errors further \
# down the line, but this does not seem to be an issue for yices.) \
&& rm -r printf \
&& shed configure 's_ printf/Makefile _ _g' '/printf\/Makefile/d' \
&& shed Makefile.in 's_ printf _ _g' 's/$(PRINTF_OBJECTS) //g' \
\
&& CC=cosmocc CFLAGS="-O2 -g" \
# specify some generic old CPU for best compatibility/reproduciblity. \
# core2 introduced SSSE3, which cosmopolitan depends on, so use that: \
@ -85,6 +92,10 @@ RUN : \
&& shed src/utils/timeout.c '/#include <unistd.h>/i\\#include <time.h>' \
# the static-lib target attempts to build a dynamic library. don't do that. \
&& shed src/Makefile 's/ $(static_libyices_dynamic)//g' \
# don't strip binaries; we'll do it ourselves later. \
&& shed src/Makefile '/^\t$(STRIP)/d' \
# silence this irrelevant error. \
&& shed src/Makefile '/\*\.dll/d' \
\
&& autoconf \
&& CC=cosmocc \
@ -110,9 +121,7 @@ RUN : \
&& objcopy -S -O binary "kissat.com.dbg" "kissat.com" \
;
FROM scratch AS runner
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
COPY --chmod=0755 --from=builder /cosmopolitan/bin/ape /bin/ape
FROM localhost/rescue AS runner
COPY --from=builder /yices/config.cache /yices/config.log /yices/config.status /var/local/
COPY --from=builder /yices/dist/bin /bin
COPY --chmod=0755 --from=builder /kissat/build/kissat.com /kissat/build/kissat.com.dbg /bin/

Binary file not shown.

View File

@ -24,7 +24,7 @@
&& { [ -w . ] || "$super" chown root:wheel . ;} \
&& { [ -w . ] || "$super" chmod 0775 . ;} \
&& now="$(date -u +%s)" \
&& podman run -v="$out":/out --rm localhost/cosmo \
&& podman run -v="$out":/out --rm localhost/cosmo-dist \
tar zcf "/out/cosmopolitan-$now.tar.gz" /cosmopolitan \
&& if [ -L cosmopolitan ] \
;then : \

View File

@ -1,6 +1,6 @@
# MAIN: https://eaguru.guru/git/notwa/stargazing
# REPO: https://eaguru.guru/git/notwa/stargazing
FROM alpine:3.16 as partial
FROM docker.io/library/alpine:3.16 as partial
# need this for acquire (.tar.xz files):
RUN apk add --no-cache xz
COPY --chmod=0755 acquire cosmocc dedupe ofc quickconf shed \
@ -23,7 +23,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
&& acquire \
;
FROM alpine:3.16 as builder
FROM docker.io/library/alpine:3.16 as builder
RUN apk add --no-cache gcc linux-headers make musl-dev
# configure and build a rescue shell and some utilities,
# i.e. one better suited for images built "FROM scratch".

View File

@ -1,6 +1,8 @@
#!/usr/bin/env sh
cosmo="${COSMO:-"/cosmopolitan"}"
dist="${COSMO_DIST:-"$cosmo/dist/def"}"
unset flavor
[ ! -s "$cosmo/env" ] || . "$cosmo/env"
dist="${COSMO_DIST:-"$cosmo/dist/${flavor:-def}"}"
_CFLAGS="-fno-omit-frame-pointer -fdata-sections -ffunction-sections -fno-pie -pg -mnop-mcount -mno-tls-direct-seg-refs"
_CPPFLAGS="-DNDEBUG -nostdinc -iquote $cosmo -isystem $cosmo/libc/isystem -include $cosmo/libc/integral/normalize.inc"

4
rescue/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM scratch
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
COPY --chmod=0755 --from=localhost/cosmo-bootstrap /usr/bin/ape /bin/ape
ENTRYPOINT ["/bin/busybox"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/assimilate.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/assimilate.com"]

3
simple/bd.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/bd.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/bd.com"]

4
simple/bing.Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/bing.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unbing.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/bing.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/blinkenlights.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/blinkenlights.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/awk.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/awk.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/chibicc.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/chibicc.com"]

View File

@ -0,0 +1,4 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/lua.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/luac.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/lua.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/make.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/make.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/python.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/python.com"]

View File

@ -0,0 +1,4 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/qjs.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/qjsc.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/qjs.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/sed.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/sed.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/sqlite3.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/sqlite3.com"]

3
simple/fold.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/fold.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/fold.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/greenbean.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/greenbean.com"]

3
simple/hello.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/hello.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/hello.com"]

3
simple/life.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/life.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/life.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/memzoom.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/memzoom.com"]

3
simple/mkdeps.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/mkdeps.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/mkdeps.com"]

3
simple/pledge.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/pledge.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/pledge.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/printimage.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/printimage.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/printvideo.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/printvideo.com"]

View File

@ -0,0 +1,7 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-demo.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-original.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-static.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-unsecure.* /bin/
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/redbean-demo.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/tinyemu.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/tinyemu.com"]

View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unbourne.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/unbourne.com"]

3
simple/unveil.Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM rescue
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unveil.* /bin/
ENTRYPOINT ["/bin/ape", "/bin/unveil.com"]