From f5a0bee80e69c25b8477250971bbff8e865dd091 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 7 Oct 2022 08:34:00 -0700 Subject: [PATCH] cosmo: squeeze lines --- cosmo/Dockerfile | 124 ++++++++++++++--------------------------------- 1 file changed, 36 insertions(+), 88 deletions(-) diff --git a/cosmo/Dockerfile b/cosmo/Dockerfile index 49c4d0c..473bb41 100644 --- a/cosmo/Dockerfile +++ b/cosmo/Dockerfile @@ -53,121 +53,69 @@ RUN : \ # finally start building RUN --mount=type=tmpfs,target=/tmp : \ - && . ./env \ + && . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \ && ./make -j2 MODE="$mode" \ - "o/$mode/ape/ape-copy-self.o" \ - "o/$mode/ape/ape-no-modify-self.o" \ - "o/$mode/ape/ape.elf" \ - "o/$mode/ape/ape.lds" \ - "o/$mode/ape/ape.macho" \ - "o/$mode/ape/ape.o" \ - "o/$mode/ape/public/ape.lds" \ - "o/$mode/cosmopolitan.a" \ - "o/$mode/libc/crt/crt.o" \ - "o/cosmopolitan.h" \ + "$a/ape-copy-self.o" "$a/ape-no-modify-self.o" "$a/ape.elf" \ + "$a/ape.lds" "$a/ape.macho" "$a/ape.o" \ + "$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() \ - { : \ - && ./make -j2 MODE="$mode" "$@" \ - && cp -t build/bootstrap "$@" \ - ;} \ + && rebuild() { ./make -j2 MODE="$mode" "$@" && cp -t build/bootstrap "$@" ;} \ && rebuild \ - "o/$mode/third_party/make/make.com" \ - "o/$mode/tool/build/ar.com" \ - "o/$mode/tool/build/cocmd.com" \ - "o/$mode/tool/build/compile.com" \ - "o/$mode/tool/build/cp.com" \ - "o/$mode/tool/build/echo.com" \ - "o/$mode/tool/build/fixupobj.com" \ - "o/$mode/tool/build/gzip.com" \ - "o/$mode/tool/build/mkdeps.com" \ - "o/$mode/tool/build/mkdir.com" \ - "o/$mode/tool/build/package.com" \ - "o/$mode/tool/build/pwd.com" \ - "o/$mode/tool/build/rm.com" \ - "o/$mode/tool/build/touch.com" \ - "o/$mode/tool/build/unbundle.com" \ - "o/$mode/tool/build/zipobj.com" \ + "$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/touch.com" "$b/unbundle.com" \ + "$b/zipobj.com" \ # these are essential too! \ && ./make -j2 MODE="$mode" "$@" \ - "o/$mode/third_party/awk/awk.com" \ - "o/$mode/third_party/sed/sed.com" \ - "o/$mode/third_party/unzip/unzip.com" \ - "o/$mode/third_party/zip/zip.com" \ - "o/$mode/tool/build/assimilate.com" \ + "$t/awk/awk.com" "$t/sed/sed.com" "$t/unzip/unzip.com" \ + "$t/zip/zip.com" "$b/assimilate.com" \ ; -RUN . ./env \ +RUN : \ + && . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \ && mkdir dist "dist/$flavor" "dist/$flavor/public" \ && echo /dist >>.gitignore \ && cp -t "dist/$flavor" \ - "o/$mode/ape/ape-copy-self.o" \ - "o/$mode/ape/ape-no-modify-self.o" \ - "o/$mode/ape/ape.elf" \ - "o/$mode/ape/ape.lds" \ - "o/$mode/ape/ape.macho" \ - "o/$mode/ape/ape.o" \ - "o/$mode/cosmopolitan.a" \ - "o/$mode/libc/crt/crt.o" \ - "o/cosmopolitan.h" \ - && cp -t "dist/$flavor/public" \ - "o/$mode/ape/public/ape.lds" \ + "$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" "$a/public/ape.lds" \ \ && install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \ && find libc -name '*.h' >headers.txt \ - && tar zcf "dist/headers.tar.gz" \ - -T "headers.txt" \ - "ape/config.h" \ - "libc/integral" \ - "third_party/gdtoa/gdtoa.h" \ - "third_party/getopt/getopt.h" \ - "third_party/linenoise/linenoise.h" \ - "third_party/musl/crypt.h" \ - "third_party/musl/fnmatch.h" \ - "third_party/musl/passwd.h" \ - "third_party/regex/regex.h" \ - "third_party/zlib/zconf.h" \ - "third_party/zlib/zlib.h" \ + && t=third_party ln=linenoise \ + && tar zcf "dist/headers.tar.gz" -T "headers.txt" \ + "ape/config.h" "libc/integral" "$t/gdtoa/gdtoa.h" \ + "$t/getopt/getopt.h" "$t/$ln/$ln.h" "$t/musl/crypt.h" \ + "$t/musl/fnmatch.h" "$t/musl/passwd.h" "$t/regex/regex.h" \ + "$t/zlib/zconf.h" "$t/zlib/zlib.h" \ ; FROM builder AS distrib COPY --chmod=0755 --from=localhost/notwa-util /nu/dedupe /usr/bin/ RUN --mount=type=tmpfs,target=/tmp : \ - && . ./env \ + && . ./env && o="o/$mode" a="$o/ape" b="$o/tool/build" t="$o/third_party" \ && 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" \ + && 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 \ && cp -t /tmp/bin \ - "o/$mode/third_party/awk/awk.com" \ - "o/$mode/third_party/make/make.com" \ - "o/$mode/third_party/sed/sed.com" \ - "o/$mode/third_party/unzip/unzip.com" \ - "o/$mode/third_party/zip/zip.com" \ - "o/$mode/tool/build/ar.com" \ - "o/$mode/tool/build/assimilate.com" \ - "o/$mode/tool/build/cocmd.com" \ - "o/$mode/tool/build/compile.com" \ - "o/$mode/tool/build/cp.com" \ - "o/$mode/tool/build/echo.com" \ - "o/$mode/tool/build/fixupobj.com" \ - "o/$mode/tool/build/gzip.com" \ - "o/$mode/tool/build/mkdeps.com" \ - "o/$mode/tool/build/mkdir.com" \ - "o/$mode/tool/build/package.com" \ - "o/$mode/tool/build/pwd.com" \ - "o/$mode/tool/build/rm.com" \ - "o/$mode/tool/build/rollup.com" \ - "o/$mode/tool/build/symtab.com" \ - "o/$mode/tool/build/touch.com" \ - "o/$mode/tool/build/unbundle.com" \ - "o/$mode/tool/build/zipobj.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/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 \