2022-09-23 13:21:45 -07:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2022-10-05 02:07:29 -07:00
|
|
|
yes_retrieve() { : \
|
|
|
|
&& local ok=1 out= g= image="${1?missing argument}" && shift \
|
|
|
|
&& [ -d out ] && out="$(realpath out)" \
|
2022-09-23 15:55:45 -07:00
|
|
|
&& for f in "$@" \
|
2022-10-05 02:07:29 -07:00
|
|
|
;do g="out/${f##*/}" && { ! [ -e "$g" ] || mv "$g" "$g~" ;} || return \
|
2022-09-23 15:55:45 -07:00
|
|
|
;done \
|
|
|
|
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
|
|
|
|
cp -- "$@" "/out/" \
|
|
|
|
&& for f in "$@" \
|
2022-10-05 02:07:29 -07:00
|
|
|
;do if g="out/${f##*/}" && [ -e "$g" ] \
|
|
|
|
;then ! [ -e "$g~" ] || rm "$g~" || return \
|
|
|
|
;else printf 'yes_retrieve: %s\n' "failed to copy file $f to $g"; ok=0 \
|
|
|
|
;fi ;done \
|
2022-09-23 15:55:45 -07:00
|
|
|
&& [ $ok = 1 ] \
|
2022-10-04 21:41:16 -07:00
|
|
|
;}
|
2022-09-23 13:21:45 -07:00
|
|
|
|
2022-10-05 02:59:01 -07:00
|
|
|
dbg_retrieve() { : \
|
|
|
|
&& local o=0 container="${1?missing argument}" && shift \
|
|
|
|
&& for f in "$@" \
|
|
|
|
;do [ $o = 0 ] && o=1 && set -- "$f" "$f.dbg" || set -- "$f" "$f.dbg" "$@" \
|
|
|
|
;done \
|
|
|
|
&& yes_retrieve "$container" "$@" \
|
|
|
|
;}
|
2022-09-23 13:21:45 -07:00
|
|
|
|
2022-10-14 18:13:33 -07:00
|
|
|
announce() { : \
|
2022-10-14 16:35:09 -07:00
|
|
|
&& printf >&2 ' \033[1m\033[7m <-- \033[0m\033[1m ' \
|
2022-10-14 18:13:33 -07:00
|
|
|
&& printf >&2 ' %30s %-30s ' "$1" "$2" \
|
2022-10-14 16:35:09 -07:00
|
|
|
&& printf >&2 ' \033[1m\033[7m --> \033[0m\n' \
|
2022-10-14 18:13:33 -07:00
|
|
|
;}
|
|
|
|
|
|
|
|
build() { : \
|
|
|
|
&& local t="${1?missing argument}" && shift \
|
|
|
|
&& announce building "$t" \
|
2022-10-14 16:35:09 -07:00
|
|
|
&& podman build -t "$t" "$t" "$@" \
|
|
|
|
;}
|
|
|
|
|
2022-10-14 18:38:42 -07:00
|
|
|
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 \
|
|
|
|
;}
|
|
|
|
|
2022-09-23 13:21:45 -07:00
|
|
|
: \
|
2022-10-05 02:07:29 -07:00
|
|
|
&& me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \
|
2022-10-14 16:35:09 -07:00
|
|
|
;: \
|
|
|
|
`# phase 1` \
|
|
|
|
&& build notwa-util \
|
|
|
|
`# phase 2` \
|
2022-10-14 16:44:57 -07:00
|
|
|
&& build cosmo-bootstrap \
|
2022-10-14 16:35:09 -07:00
|
|
|
`# phase 3` \
|
2022-10-14 16:44:57 -07:00
|
|
|
&& build cosmo-all \
|
2022-10-14 16:35:09 -07:00
|
|
|
&& build cosmo-assimilate \
|
|
|
|
&& build cosmo-awk \
|
|
|
|
&& build cosmo-dist \
|
|
|
|
&& build cosmo-sed \
|
|
|
|
`# phase 4` \
|
|
|
|
&& build cosmo-base \
|
2022-10-14 18:38:42 -07:00
|
|
|
&& build_simple \
|
2022-10-14 16:35:09 -07:00
|
|
|
`# phase 5` \
|
|
|
|
&& build cosmo-kuroko \
|
|
|
|
&& build cosmo-muon \
|
|
|
|
&& build cosmo-perl \
|
|
|
|
&& build cosmo-yices \
|
2022-10-14 17:07:53 -07:00
|
|
|
`# other stuff` \
|
|
|
|
&& { [ ! -e cosmo-mini ] || build cosmo-mini ;} \
|
|
|
|
&& { [ ! -e cosmo-python311 ] || build cosmo-python311 ;} \
|
2022-09-23 13:21:45 -07:00
|
|
|
\
|
2022-10-05 02:59:01 -07:00
|
|
|
&& bin=/cosmopolitan/bin \
|
2022-10-14 16:37:45 -07:00
|
|
|
&& yes_retrieve cosmo-base $bin/ape $bin/assimilate.com $bin/awk.com \
|
|
|
|
$bin/gzip.com $bin/make.com $bin/sed.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 \
|
2022-10-14 18:38:42 -07:00
|
|
|
\
|
|
|
|
&& dbg_retrieve blinkenlights /bin/blinkenlights.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-sqlite /bin/sqlite3.com \
|
|
|
|
&& dbg_retrieve memzoom /bin/memzoom.com \
|
|
|
|
&& dbg_retrieve pledge /bin/pledge.com \
|
|
|
|
&& dbg_retrieve unbourne /bin/unbourne.com \
|
|
|
|
&& dbg_retrieve unveil /bin/unveil.com \
|
2022-09-23 13:21:45 -07:00
|
|
|
;
|