stargazing/notwa-util/cosmopolitan-install9

56 lines
2.6 KiB
Plaintext
Executable File

#!/usr/bin/false
if [ ! -e /cosmopolitan-install.done ]; then
#&& find o -name '*.com' ! -type d -exec printf 'cp -int /tmp/bin %s\n' {} + | sort && exit 1 \
: \
&& cd /root/cosmopolitan \
&& . ./env \
\
&& find o '(' -name '*.com' -o -name '*.com.dbg' ')' \
'!' -name '*_test.*' '!' -name 'test_*' -exec \
install -m0755 -t /usr/local/bin {} \
+ \
&& find o -type f '(' -name '*.com.dbg' -o -name '*_test.*' -o -name 'test_*' ')' -delete \
\
&& { [ ! -d dist ] || rm -r dist ;} \
&& mkdir -p "dist/$flavor/public" \
&& ./expand cp -int "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 -int "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 \
&& { ! [ -d "$COSMO" ] || rm -r "$COSMO" ;} \
&& mkdir -p "$COSMO" /tmp/bin \
&& find o -name '*.sym' -delete \
&& find o -name 'aarch64-linux-musl*' -exec rm -r '{}' + \
&& dedupe o/third_party/gcc "$COSMO/gcc/" \
bin/x86_64-linux-musl-gcc \
bin/x86_64-linux-musl-g++ \
bin/x86_64-linux-musl-ld.bfd \
&& dedupe dist "$COSMO/dist/" "$flavor/cosmopolitan.h" \
&& ./expand cp -int /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 "$COSMO/bin/" \
&& cp "dist/$flavor/ape.elf" "$COSMO/bin/ape" \
&& cp /root/cosmopolitan/env "$COSMO/env" \
\
&& rm -r /root/cosmopolitan/dist \
&& tar zxf "$COSMO/dist/headers.tar.gz" -C "$COSMO" \
&& touch /cosmopolitan-install.done \
|| exit $?
fi