Compare commits
31 commits
Author | SHA1 | Date | |
---|---|---|---|
699ec32255 | |||
d997986122 | |||
48bbcfdd85 | |||
7676cc7d58 | |||
84cac9866f | |||
5b860be3ed | |||
37c14c6ecd | |||
5ac08545ce | |||
6002ae1419 | |||
4fda9c2767 | |||
22f0ec9fa9 | |||
102738a937 | |||
86f511becf | |||
fed2d76c02 | |||
8da9cbd0fc | |||
690355395c | |||
0c589233b9 | |||
624e05b247 | |||
558dd00561 | |||
3a0538a6cc | |||
faccc07bbf | |||
23637a4e37 | |||
a025a1a64f | |||
883cf1214e | |||
9623c952dc | |||
4b4c37df77 | |||
f5f657d3ed | |||
ec1a1a0d26 | |||
78e05832fa | |||
3bc614c9d0 | |||
8356e07b42 |
38 changed files with 431 additions and 75 deletions
104
README.md
104
README.md
|
@ -10,9 +10,111 @@ Linux, Mac, Windows, FreeBSD, OpenBSD, and NetBSD.
|
||||||
not every feature is available on every platform.
|
not every feature is available on every platform.
|
||||||
cosmopolitan already does a tremendous job at
|
cosmopolitan already does a tremendous job at
|
||||||
polyfilling missing features across platforms,
|
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.
|
patching before becoming fully functional.
|
||||||
|
|
||||||
|
## procedures
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
<!--
|
||||||
|
the base cosmopolitan library and binaries,
|
||||||
|
with some minor patches and a custom distrib.
|
||||||
|
-->
|
||||||
|
|
||||||
|
* **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 (not sure which commit this is forked from)
|
||||||
|
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) binaries and libraries.
|
||||||
|
|
||||||
|
* **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
|
## building
|
||||||
|
|
||||||
on most Linux distros with podman properly installed and configured,
|
on most Linux distros with podman properly installed and configured,
|
||||||
|
|
8
absurdism
Executable file
8
absurdism
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
: \
|
||||||
|
&& [ -s build-all ] \
|
||||||
|
&& { [ -d out ] || mkdir out || exit ;} \
|
||||||
|
&& podman run -v="$(readlink -f .)":/stargazing -e="TERM=$TERM" -it --rm \
|
||||||
|
--privileged --user root quay.io/podman/stable /stargazing/build-all \
|
||||||
|
|| { e=$?; echo absurdism died; exit $e ;} \
|
||||||
|
;
|
99
build-all
99
build-all
|
@ -1,10 +1,17 @@
|
||||||
#!/usr/bin/env sh
|
#!/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() { : \
|
yes_retrieve() { : \
|
||||||
&& local ok=1 out= g= image="${1?missing argument}" && shift \
|
&& local ok=1 out= g= image="${1?missing argument}" && shift \
|
||||||
&& [ -d out ] && out="$(realpath out)" \
|
&& [ -d out ] && out="$(realpath out)" \
|
||||||
&& for f in "$@" \
|
&& 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 \
|
;done \
|
||||||
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
|
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
|
||||||
cp -- "$@" "/out/" \
|
cp -- "$@" "/out/" \
|
||||||
|
@ -24,22 +31,92 @@ dbg_retrieve() { : \
|
||||||
&& yes_retrieve "$container" "$@" \
|
&& 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 \
|
||||||
|
;}
|
||||||
|
|
||||||
|
prep() { : \
|
||||||
|
&& [ "$(whoami)" != podman ] \
|
||||||
|
|| { : \
|
||||||
|
&& [ ! -s ~/.config/containers/storage.conf ] \
|
||||||
|
&& { [ -d ~/.config ] || mkdir ~/.config ;} \
|
||||||
|
&& { [ -d ~/.config/containers ] || mkdir ~/.config/containers ;} \
|
||||||
|
&& { [ -d ~/junk ] || mkdir ~/junk ;} \
|
||||||
|
&& printf '%s\n' >~/.config/containers/storage.conf \
|
||||||
|
'[storage]' 'driver = "overlay"' 'runroot = "$HOME/junk"' \
|
||||||
|
'graphroot = "$HOME/junk"' 'rootless_storage_path = "$HOME/junk"' \
|
||||||
|
'[storage.options]' 'additionalimagestores = [' ']' \
|
||||||
|
'[storage.options.overlay]' 'mountopt = "nodev"' \
|
||||||
|
'[storage.options.thinpool]' \
|
||||||
|
;} \
|
||||||
|
;}
|
||||||
|
|
||||||
: \
|
: \
|
||||||
&& me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \
|
&& me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \
|
||||||
|
&& prep \
|
||||||
\
|
\
|
||||||
&& podman build -t notwa-util notwa-util \
|
`# phase 1` \
|
||||||
&& podman build -t cosmo cosmo \
|
&& build notwa-util \
|
||||||
&& podman build -t cosmo-kuroko cosmo-kuroko \
|
`# phase 2` \
|
||||||
&& podman build -t cosmo-muon cosmo-muon \
|
&& build cosmo-bootstrap \
|
||||||
&& podman build -t cosmo-perl cosmo-perl \
|
`# phase 3` \
|
||||||
&& podman build -t cosmo-yices cosmo-yices \
|
&& build cosmo-all \
|
||||||
|
&& build cosmo-dist \
|
||||||
|
&& build rescue \
|
||||||
|
`# phase 4` \
|
||||||
|
&& build cosmo-base \
|
||||||
|
&& build_simple \
|
||||||
|
`# phase 5` \
|
||||||
|
&& build cosmo-kuroko \
|
||||||
|
&& build cosmo-muon \
|
||||||
|
&& build cosmo-perl \
|
||||||
|
&& build cosmo-yices \
|
||||||
|
`# other stuff` \
|
||||||
|
&& { [ ! -e cosmo-mini ] || build cosmo-mini ;} \
|
||||||
|
&& { [ ! -e cosmo-python311 ] || build cosmo-python311 ;} \
|
||||||
\
|
\
|
||||||
&& bin=/cosmopolitan/bin \
|
&& yes_retrieve cosmo-base /cosmopolitan/bin/ape \
|
||||||
&& 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-kuroko /bin/kuroko.com \
|
||||||
&& dbg_retrieve cosmo-muon /bin/muon.com \
|
&& dbg_retrieve cosmo-muon /bin/muon.com \
|
||||||
&& dbg_retrieve cosmo-perl /bin/perl.com \
|
&& dbg_retrieve cosmo-perl /bin/perl.com \
|
||||||
&& dbg_retrieve cosmo-yices /bin/kissat.com /bin/yices-sat.com \
|
&& dbg_retrieve cosmo-yices /bin/kissat.com /bin/yices-sat.com \
|
||||||
/bin/yices-smt.com /bin/yices-smt2.com /bin/yices.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 \
|
||||||
;
|
;
|
||||||
|
|
45
cosmo-all/Dockerfile
Normal file
45
cosmo-all/Dockerfile
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
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" \
|
||||||
|
;
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=cosmo-build-all,target=/cosmopolitan/o,sharing=locked \
|
||||||
|
--mount=type=tmpfs,target=/tmp : \
|
||||||
|
&& . ./env \
|
||||||
|
&& if [ -e o.old ] \
|
||||||
|
;then : \
|
||||||
|
&& cp o.old/* o/ \
|
||||||
|
&& rm -r o.old \
|
||||||
|
;fi \
|
||||||
|
\
|
||||||
|
# skip some checks that are currently failing: \
|
||||||
|
&& skip() { mkdir -p "${1%/*}" && touch -d @2222222222 "$1" ;} \
|
||||||
|
&& skip "o/$mode/test/libc/calls/getgroups_test.com.runs" \
|
||||||
|
&& skip "o/$mode/test/libc/calls/getpriority_test.com.runs" \
|
||||||
|
# these can fail in nested podman: \
|
||||||
|
&& skip "o/$mode/test/libc/stdio/tmpfile_test.com.runs" \
|
||||||
|
# FIXME: SIGSEGV: \
|
||||||
|
&& skip "o/$mode/third_party/python/Lib/test/test_ioctl.py.runs" \
|
||||||
|
\
|
||||||
|
&& ./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 {} \
|
||||||
|
+ \
|
||||||
|
;
|
4
cosmo-base/Dockerfile
Normal file
4
cosmo-base/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
FROM cosmo-dist AS runner
|
||||||
|
COPY --chmod=0755 --from=localhost/cosmo-assimilate /bin/assimilate.com /cosmopolitan/bin/
|
||||||
|
COPY --chmod=0755 --from=localhost/cosmo-awk /bin/awk.com /cosmopolitan/bin/
|
||||||
|
COPY --chmod=0755 --from=localhost/cosmo-sed /bin/sed.com /cosmopolitan/bin/
|
|
@ -3,6 +3,7 @@
|
||||||
ARG COSMO_FLAVOR=def
|
ARG COSMO_FLAVOR=def
|
||||||
ARG COSMO_COMMIT=f52f65b2e351085250b743a5319dab418f2d48be
|
ARG COSMO_COMMIT=f52f65b2e351085250b743a5319dab418f2d48be
|
||||||
ARG COSMO_SHA256=8a13f4be3d689b8895af6e1178d455db2f82a69e33ce5848e2f2f14f96760d4c
|
ARG COSMO_SHA256=8a13f4be3d689b8895af6e1178d455db2f82a69e33ce5848e2f2f14f96760d4c
|
||||||
|
ARG COSMO_REBUILD=0
|
||||||
|
|
||||||
FROM localhost/notwa-util AS downloader
|
FROM localhost/notwa-util AS downloader
|
||||||
ARG COSMO_COMMIT COSMO_SHA256
|
ARG COSMO_COMMIT COSMO_SHA256
|
||||||
|
@ -20,12 +21,13 @@ WORKDIR /cosmopolitan
|
||||||
ENV V=0 COLUMNS=80 TMPDIR=/tmp
|
ENV V=0 COLUMNS=80 TMPDIR=/tmp
|
||||||
|
|
||||||
COPY --chmod=0755 make.com build/bootstrap/make.com
|
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 : \
|
RUN : \
|
||||||
# allow optimized builds to be more portable, so the container is too. \
|
# 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/' \
|
&& shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \
|
||||||
# fix execution on alpine (although installing the loader mitigates this) \
|
# fix execution on alpine (although installing the loader mitigates this) \
|
||||||
&& sed -i 's/skip=" 76" count=" 128"/skip=76 count=128 /' build/bootstrap/*.com \
|
&& sed -i 's/skip=" 76" count=" 128"/skip=76 count=128 /' build/bootstrap/*.com \
|
||||||
|
\
|
||||||
&& install -m0755 build/bootstrap/ape.elf /usr/bin/ape \
|
&& install -m0755 build/bootstrap/ape.elf /usr/bin/ape \
|
||||||
&& shed Makefile \
|
&& shed Makefile \
|
||||||
# TODO: apply changes to COSMOPOLITAN_HEADERS as to include them in cosmopolitan.h \
|
# TODO: apply changes to COSMOPOLITAN_HEADERS as to include them in cosmopolitan.h \
|
||||||
|
@ -59,7 +61,7 @@ RUN : \
|
||||||
'(T//*) f="third_party/$g";;' \
|
'(T//*) f="third_party/$g";;' \
|
||||||
'esac; $once && set -- "$@" "$f" || set -- "$f"; once=true; done' \
|
'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 \
|
&& chmod +x makeit expand \
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -79,63 +81,34 @@ RUN --mount=type=tmpfs,target=/tmp : \
|
||||||
b//mkdir.com b//package.com b//pwd.com \
|
b//mkdir.com b//package.com b//pwd.com \
|
||||||
b//rm.com b//touch.com b//unbundle.com \
|
b//rm.com b//touch.com b//unbundle.com \
|
||||||
b//zipobj.com \
|
b//zipobj.com \
|
||||||
# these are essential too! \
|
# install the newly-built ape loader, just in case it has changed: \
|
||||||
&& ./expand ./makeit \
|
&& ./expand install -m0755 a//ape.elf /usr/bin/ape \
|
||||||
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)
|
# optionally use the newly-built bootstrapped binaries to build themselves again.
|
||||||
RUN : \
|
ARG COSMO_REBUILD
|
||||||
&& . ./env \
|
RUN --mount=type=tmpfs,target=/tmp : \
|
||||||
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
|
&& { [ "$COSMO_REBUILD" = 1 ] || exit 0 ;} \
|
||||||
&& echo /dist >>.gitignore \
|
&& rm -r o \
|
||||||
&& ./expand cp -t "dist/$flavor" \
|
\
|
||||||
|
&& ./expand ./makeit \
|
||||||
a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \
|
a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \
|
||||||
a//ape.lds a//ape.macho a//ape.o \
|
a//ape.lds a//ape.macho a//ape.o \
|
||||||
o//cosmopolitan.a o//libc/crt/crt.o o/cosmopolitan.h \
|
a//public/ape.lds o//cosmopolitan.a o//libc/crt/crt.o \
|
||||||
&& cp -t "dist/$flavor/public" "o/$mode/ape/public/ape.lds" \
|
o/cosmopolitan.h \
|
||||||
\
|
# build some extra tools for other containers to stem off of: \
|
||||||
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
|
&& rebuild() { ./expand ./makeit "$@" && ./expand cp -t build/bootstrap "$@" ;} \
|
||||||
&& find libc -name '*.h' >headers.txt \
|
&& rebuild \
|
||||||
&& ./expand tar zcf dist/headers.tar.gz -T headers.txt \
|
t//make/make.com b//ar.com b//cocmd.com \
|
||||||
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 \
|
|
||||||
b//compile.com b//cp.com b//echo.com \
|
b//compile.com b//cp.com b//echo.com \
|
||||||
b//fixupobj.com b//gzip.com b//mkdeps.com \
|
b//fixupobj.com b//gzip.com b//mkdeps.com \
|
||||||
b//mkdir.com b//package.com b//pwd.com \
|
b//mkdir.com b//package.com b//pwd.com \
|
||||||
b//rm.com b//rollup.com b//symtab.com \
|
b//rm.com b//touch.com b//unbundle.com \
|
||||||
b//touch.com b//unbundle.com b//zipobj.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 alpine:3.16 AS runner
|
# these are essential too! \
|
||||||
COPY --from=distrib /distrib /cosmopolitan
|
RUN --mount=type=tmpfs,target=/tmp : \
|
||||||
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
|
&& ./expand ./makeit \
|
||||||
ARG COSMO_FLAVOR
|
t//unzip/unzip.com t//zip/zip.com \
|
||||||
ENV COSMO_DIST="/cosmopolitan/dist/$COSMO_FLAVOR"
|
;
|
57
cosmo-dist/Dockerfile
Normal file
57
cosmo-dist/Dockerfile
Normal 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 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"
|
|
@ -11,7 +11,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||||
&& acquire from=github repo=kuroko-lang/kuroko dest=/kuroko env=KUROKO \
|
&& 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
|
COPY --from=downloader /kuroko /kuroko
|
||||||
WORKDIR /kuroko
|
WORKDIR /kuroko
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||||
&& acquire from=sourcehut repo=lattis/muon dest=/muon env=MUON \
|
&& 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
|
RUN apk add --no-cache ninja
|
||||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/cosmocc /usr/bin/
|
COPY --chmod=0755 --from=localhost/notwa-util /nu/cosmocc /usr/bin/
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
|
FROM localhost/notwa-util AS downloader
|
||||||
|
|
||||||
# MAIN: https://www.perl.org/
|
# MAIN: https://www.perl.org/
|
||||||
# REPO: https://github.com/Perl/perl5
|
# REPO: https://github.com/Perl/perl5
|
||||||
# FORK: https://github.com/G4Vi/perl5/tree/cosmo
|
# FORK: https://github.com/G4Vi/perl5/tree/cosmo
|
||||||
FROM localhost/notwa-util AS downloader
|
|
||||||
|
|
||||||
ARG PERL_COMMIT=66baebd8320a90ddf2c90de14b83f7eee4f6b143
|
ARG PERL_COMMIT=66baebd8320a90ddf2c90de14b83f7eee4f6b143
|
||||||
ARG PERL_SHA256=0e6731efb5f25589116340b4e861abd43fb47520669fe903569b1489339dcddb
|
ARG PERL_SHA256=0e6731efb5f25589116340b4e861abd43fb47520669fe903569b1489339dcddb
|
||||||
|
# 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_VERSION=20220613
|
||||||
ARG PERLTIDY_SHA256=50496a6952904ef28f495919fc0a67801a63c87779c61308ce1ca5b32467c5d4
|
ARG PERLTIDY_SHA256=50496a6952904ef28f495919fc0a67801a63c87779c61308ce1ca5b32467c5d4
|
||||||
|
|
||||||
|
@ -22,7 +26,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||||
&& acquire \
|
&& acquire \
|
||||||
;
|
;
|
||||||
|
|
||||||
FROM localhost/cosmo AS builder
|
FROM localhost/cosmo-base AS builder
|
||||||
|
|
||||||
COPY --from=downloader /perl /perl
|
COPY --from=downloader /perl /perl
|
||||||
RUN : \
|
RUN : \
|
||||||
|
|
|
@ -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 \
|
&& 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
|
RUN apk add --no-cache autoconf gperf
|
||||||
|
|
||||||
|
|
4
rescue/Dockerfile
Normal file
4
rescue/Dockerfile
Normal 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"]
|
3
simple/assimilate.Dockerfile
Normal file
3
simple/assimilate.Dockerfile
Normal 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
3
simple/bd.Dockerfile
Normal 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
4
simple/bing.Dockerfile
Normal 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"]
|
3
simple/blinkenlights.Dockerfile
Normal file
3
simple/blinkenlights.Dockerfile
Normal 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"]
|
3
simple/cosmo-awk.Dockerfile
Normal file
3
simple/cosmo-awk.Dockerfile
Normal 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"]
|
3
simple/cosmo-chibicc.Dockerfile
Normal file
3
simple/cosmo-chibicc.Dockerfile
Normal 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"]
|
4
simple/cosmo-lua.Dockerfile
Normal file
4
simple/cosmo-lua.Dockerfile
Normal 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"]
|
3
simple/cosmo-make.Dockerfile
Normal file
3
simple/cosmo-make.Dockerfile
Normal 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"]
|
3
simple/cosmo-python.Dockerfile
Normal file
3
simple/cosmo-python.Dockerfile
Normal 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"]
|
4
simple/cosmo-quickjs.Dockerfile
Normal file
4
simple/cosmo-quickjs.Dockerfile
Normal 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"]
|
3
simple/cosmo-sed.Dockerfile
Normal file
3
simple/cosmo-sed.Dockerfile
Normal 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"]
|
3
simple/cosmo-sqlite.Dockerfile
Normal file
3
simple/cosmo-sqlite.Dockerfile
Normal 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
3
simple/fold.Dockerfile
Normal 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"]
|
3
simple/greenbean.Dockerfile
Normal file
3
simple/greenbean.Dockerfile
Normal 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
3
simple/hello.Dockerfile
Normal 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
3
simple/life.Dockerfile
Normal 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"]
|
3
simple/memzoom.Dockerfile
Normal file
3
simple/memzoom.Dockerfile
Normal 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
3
simple/mkdeps.Dockerfile
Normal 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
3
simple/pledge.Dockerfile
Normal 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"]
|
3
simple/printimage.Dockerfile
Normal file
3
simple/printimage.Dockerfile
Normal 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"]
|
3
simple/printvideo.Dockerfile
Normal file
3
simple/printvideo.Dockerfile
Normal 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"]
|
7
simple/redbean.Dockerfile
Normal file
7
simple/redbean.Dockerfile
Normal 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"]
|
3
simple/tinyemu.Dockerfile
Normal file
3
simple/tinyemu.Dockerfile
Normal 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"]
|
3
simple/unbourne.Dockerfile
Normal file
3
simple/unbourne.Dockerfile
Normal 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
3
simple/unveil.Dockerfile
Normal 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"]
|
Loading…
Add table
Reference in a new issue