diff --git a/build-all b/build-all index cac2775..d5873e6 100755 --- a/build-all +++ b/build-all @@ -46,6 +46,13 @@ build_simple() { : \ ;done \ ;} +build_base() { : \ + && sed 's/\bcosmo-bootstrap\b/cosmo-all/g' \ + cosmo-dist/all.Dockerfile \ + && build cosmo-dist -f cosmo-dist/all.Dockerfile \ + && build cosmo-base \ + ;} + : \ && me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \ && : \ @@ -62,7 +69,7 @@ build_simple() { : \ && build rescue \ \ `# phase 4` \ - && build cosmo-base \ + && build_base \ && build_simple \ \ `# phase 5` \ diff --git a/cosmo-all/Dockerfile b/cosmo-all/Dockerfile index 035c621..d2ef3c3 100644 --- a/cosmo-all/Dockerfile +++ b/cosmo-all/Dockerfile @@ -15,6 +15,10 @@ RUN : \ commit "$commit" \ flavor "$COSMO_FLAVOR" \ mode "$mode" \ + COSMO "$PWD" \ + COSMO_DIST "$PWD/dist/$COSMO_FLAVOR" \ +\ + && shed expand "s_o='o/[^']*'_o='o/$mode'_g" \ ; RUN --mount=type=tmpfs,target=/tmp : \ @@ -44,5 +48,5 @@ RUN --mount=type=tmpfs,target=/tmp : \ install -m0755 -t /usr/local/bin {} \ + \ # save some space: \ - && find o '(' -name '*.com.dbg' -o -name '*_test.*' -o -name 'test_*' ')' -delete \ + && find o -type f '(' -name '*.com.dbg' -o -name '*_test.*' -o -name 'test_*' ')' -delete \ ; diff --git a/notwa-util/cosmocc b/notwa-util/cosmocc index b579d0e..98aab5b 100755 --- a/notwa-util/cosmocc +++ b/notwa-util/cosmocc @@ -1,6 +1,8 @@ #!/usr/bin/env sh cosmo="${COSMO:-"/cosmopolitan"}" -dist="${COSMO_DIST:-"$cosmo/dist/def"}" +unset flavor +[ ! -s "$cosmo/env" ] || . "$cosmo/env" +dist="${COSMO_DIST:-"$cosmo/dist/${flavor:-def}"}" _CFLAGS="-fno-omit-frame-pointer -fdata-sections -ffunction-sections -fno-pie -pg -mnop-mcount -mno-tls-direct-seg-refs" _CPPFLAGS="-DNDEBUG -nostdinc -iquote $cosmo -isystem $cosmo/libc/isystem -include $cosmo/libc/integral/normalize.inc"