70 lines
2.2 KiB
Bash
Executable file
70 lines
2.2 KiB
Bash
Executable file
#!/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 announce retrieving "$f" \
|
|
&& g="out/${f##*/}" && { ! [ -e "$g" ] || mv "$g" "$g~" ;} || return \
|
|
;done \
|
|
&& podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
|
|
cp -- "$@" "/out/" \
|
|
&& for f in "$@" \
|
|
;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 \
|
|
&& [ $ok = 1 ] \
|
|
;}
|
|
|
|
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" "$@" \
|
|
;}
|
|
|
|
build() { : \
|
|
&& local t="${1?missing argument}" && shift \
|
|
&& announce building "$t" \
|
|
&& podman build -t "$t" "$t" "$@" \
|
|
;}
|
|
|
|
: \
|
|
&& me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \
|
|
&& : \
|
|
`# phase 1` \
|
|
&& build notwa-util \
|
|
`# phase 2` \
|
|
&& build cosmo-bootstrap \
|
|
`# phase 3` \
|
|
&& build cosmo-all \
|
|
&& build cosmo-dist \
|
|
&& build rescue \
|
|
`# phase 4` \
|
|
&& build cosmo-base \
|
|
`# phase 5` \
|
|
&& build cosmo-kuroko \
|
|
&& build cosmo-muon \
|
|
&& build cosmo-perl \
|
|
&& build cosmo-yices \
|
|
\
|
|
&& bin=/usr/local/bin \
|
|
&& yes_retrieve cosmo-base /cosmopolitan/bin/ape \
|
|
&& dbg_retrieve cosmo-all $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 \
|
|
;
|