Compare commits
78 Commits
Author | SHA1 | Date |
---|---|---|
Connor Olding | df3a34f31e | |
Connor Olding | 346880ece3 | |
Connor Olding | 627138ad99 | |
Connor Olding | c0449a095f | |
Connor Olding | fe34d59c43 | |
Connor Olding | 3dd598b9ea | |
Connor Olding | 97848badd7 | |
Connor Olding | 130e9fb619 | |
Connor Olding | 16dce00004 | |
Connor Olding | 7c1a64f204 | |
Connor Olding | 6f521f866e | |
Connor Olding | 0685b39da3 | |
Connor Olding | 7f7999e9eb | |
Connor Olding | 804122de5c | |
Connor Olding | 62eec2bdd0 | |
Connor Olding | aa1df1d660 | |
Connor Olding | d8e71a6b2d | |
Connor Olding | aff3b7a91c | |
Connor Olding | 4700a87c56 | |
Connor Olding | 6099b56a95 | |
Connor Olding | b44f8f2feb | |
Connor Olding | c82b8ad1d0 | |
Connor Olding | f24af56772 | |
Connor Olding | 48a94cf064 | |
Connor Olding | 1ae5e60208 | |
Connor Olding | ffd7592ab3 | |
Connor Olding | 363b86ba84 | |
Connor Olding | 5653fb14e4 | |
Connor Olding | edd88ab5e3 | |
Connor Olding | f5fefd06a8 | |
Connor Olding | 356c394d66 | |
Connor Olding | b046e6e808 | |
Connor Olding | 44e6b7d13e | |
Connor Olding | 86022a405a | |
Connor Olding | 1bef468398 | |
Connor Olding | 5d721c561a | |
Connor Olding | 0af3a894a8 | |
Connor Olding | 55b4cafc4a | |
Connor Olding | 6a7ec732a2 | |
Connor Olding | 4e46bbba02 | |
Connor Olding | 63bb721eac | |
Connor Olding | 5b3c452cd0 | |
Connor Olding | f58e9733d6 | |
Connor Olding | e90fd3780e | |
Connor Olding | cb3a6fe938 | |
Connor Olding | 5e46b2bb1a | |
Connor Olding | 04c85609a5 | |
Connor Olding | 303012ca43 | |
Connor Olding | 3dad8c6f15 | |
Connor Olding | cb357392fb | |
Connor Olding | 2d4fde876c | |
Connor Olding | 7d12280bd6 | |
Connor Olding | 0048bd4c8a | |
Connor Olding | 0e770f334d | |
Connor Olding | 5b6d366c53 | |
Connor Olding | eecd592bc9 | |
Connor Olding | 85ed00508a | |
Connor Olding | 6fb6fea4fc | |
Connor Olding | b4164cdcf9 | |
Connor Olding | ec3061b6ea | |
Connor Olding | 837ce0011f | |
Connor Olding | 11c98627a7 | |
Connor Olding | a34a4b9562 | |
Connor Olding | 841d52e923 | |
Connor Olding | 65364e66ff | |
Connor Olding | 6508db0ba2 | |
Connor Olding | 79343c8540 | |
Connor Olding | 22f0ee42d1 | |
Connor Olding | f583cd46c3 | |
Connor Olding | 4f5122aca0 | |
Connor Olding | acc650f65b | |
Connor Olding | 29567f663a | |
Connor Olding | 3dce18a225 | |
Connor Olding | 9d6a58f03c | |
Connor Olding | 56be1983e5 | |
Connor Olding | b88694e0ae | |
Connor Olding | 0b05dd665a | |
Connor Olding | 96dcbab49c |
1
TODO.md
1
TODO.md
|
@ -14,7 +14,6 @@ remove elements from this list as you see fit.
|
|||
* for source being built
|
||||
* for exposed containers
|
||||
* for `install-cosmo` (kinda a subset of the previous point)
|
||||
* cosmo: allow non-default builds (`rel`, `dbg`, etc.)
|
||||
* kuroko: test more vigorously
|
||||
* do tests pass on a Windows host?
|
||||
* kuroko: use cosmopolitan readline functionality instead of built-in?
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Vagrant.configure("2") do |config|
|
||||
config.ssh.insert_key = true
|
||||
|
||||
config.vm.box = "boxomatic/alpine-3.18"
|
||||
config.ssh.username = "root"
|
||||
config.ssh.password = "vagrant"
|
||||
|
||||
config.vm.provision "shell", name: "motd", inline: "echo them do be stars tho > /etc/motd"
|
||||
config.vm.provision "shell", name: "update", inline: "apk update && apk upgrade"
|
||||
config.vm.provision "shell", name: "install", inline: "apk add autoconf gcc gperf linux-headers make musl-dev ninja patch pkgconf ripgrep xz zip"
|
||||
config.vm.provision "shell", name: "build", inline: "exec sh /vagrant/notwa-util/doit11"
|
||||
end
|
55
build-all
55
build-all
|
@ -1,60 +1,7 @@
|
|||
#!/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 "localhost/$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" "$@" \
|
||||
;}
|
||||
|
||||
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 \
|
||||
;}
|
||||
|
||||
build_base() { : \
|
||||
&& sed 's/\bcosmo-bootstrap\b/cosmo-all/g' \
|
||||
<cosmo-dist/Dockerfile >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 ;} \
|
||||
&& . ./lib.sh \
|
||||
&& : \
|
||||
\
|
||||
`# phase 1` \
|
||||
|
|
|
@ -18,7 +18,7 @@ RUN : \
|
|||
COSMO "$PWD" \
|
||||
COSMO_DIST "$PWD/dist/$COSMO_FLAVOR" \
|
||||
\
|
||||
&& shed expand "s_o='o/[^']*'_o='o/$mode'_g" \
|
||||
&& shed expand "s_o='o/[^']*'_o='o/$mode' _g" \
|
||||
;
|
||||
|
||||
RUN --mount=type=tmpfs,target=/tmp : \
|
||||
|
@ -29,17 +29,21 @@ RUN --mount=type=tmpfs,target=/tmp : \
|
|||
&& rm -r o.old \
|
||||
;fi \
|
||||
\
|
||||
# skip some checks that are currently failing: \
|
||||
&& { ./makeit MODE="$mode" depend || find o -name '*.o' -delete ;} \
|
||||
# start by building something simple, and then start using it as well: \
|
||||
&& ./makeit MODE="$mode" "o/$mode/third_party/make/make.com" \
|
||||
&& cp -t build/bootstrap "o/$mode/third_party/make/make.com" \
|
||||
;
|
||||
|
||||
RUN --mount=type=tmpfs,target=/tmp : \
|
||||
&& . ./env \
|
||||
&& skip() { mkdir -p "${1%/*}" && touch -d @2222222222 "$1" ;} \
|
||||
&& skip "o/$mode/test/libc/calls/ftruncate_test.com.runs" \
|
||||
# skip some checks that fail under podman: \
|
||||
&& skip "o/$mode/test/libc/calls/getgroups_test.com.runs" \
|
||||
&& skip "o/$mode/test/libc/calls/getpriority_test.com.runs" \
|
||||
# these can fail in nested podman: \
|
||||
&& skip "o/$mode/test/libc/stdio/tmpfile_test.com.runs" \
|
||||
# FIXME: SIGSEGV: \
|
||||
&& skip "o/$mode/third_party/python/Lib/test/test_ioctl.py.runs" \
|
||||
\
|
||||
&& { ./makeit MODE="$mode" depend || find o -name '*.o' -delete ;} \
|
||||
&& skip "o/$mode/third_party/python/Lib/test/test_tarfile.py.runs" \
|
||||
# just do it! \
|
||||
&& ./makeit MODE="$mode" all \
|
||||
\
|
||||
# install the binaries somewhere so we can retrieve them without mounting cache: \
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# MAIN: https://justine.lol/cosmopolitan/
|
||||
# REPO: https://github.com/jart/cosmopolitan
|
||||
ARG COSMO_FLAVOR=def
|
||||
ARG COSMO_COMMIT=648bf6555c06a3655cab1a9ae078d329c192d39a
|
||||
ARG COSMO_SHA256=5310a718494420cda5895cb67d56413f8b051fce37eb83c463a756a13dbef30d
|
||||
ARG COSMO_COMMIT=6881a2ecea351f42d0b55fa1cba0e1fe548fef9a
|
||||
ARG COSMO_SHA256=d737cfd9dca250e25684d75e099699a7c2572f9ebb3ee3750c5eae01ae71c3b5
|
||||
ARG COSMO_REBUILD=0
|
||||
|
||||
FROM localhost/notwa-util AS downloader
|
||||
|
@ -12,7 +12,7 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
|||
&& acquire from=github repo=jart/cosmopolitan dest=/cosmopolitan env=COSMO \
|
||||
;
|
||||
|
||||
FROM alpine:3.16 AS builder
|
||||
FROM docker.io/library/alpine:3.18 AS builder
|
||||
ARG COSMO_FLAVOR COSMO_COMMIT
|
||||
COPY --from=downloader /cosmopolitan /cosmopolitan
|
||||
WORKDIR /cosmopolitan
|
||||
|
@ -20,7 +20,6 @@ WORKDIR /cosmopolitan
|
|||
# tell makefiles to be less noisy, also use /tmp:
|
||||
ENV V=0 COLUMNS=80 TMPDIR=/tmp
|
||||
|
||||
COPY --chmod=0755 make.com build/bootstrap/make.com
|
||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/shed /usr/bin/
|
||||
RUN : \
|
||||
# allow optimized builds to be more portable, so the container is too. \
|
||||
|
@ -40,6 +39,12 @@ RUN : \
|
|||
&& shed libc/elf/elf.h '/"libc\/elf\/struct\/ehdr.h"/i\\#include "libc/elf/struct/dyn.h"' \
|
||||
# awk's pledge isn't working for me for whatever reason \
|
||||
&& shed third_party/awk/main.c '/pledge.*{/,/}/d' \
|
||||
# this feature detection is slightly broken (for now) \
|
||||
&& shed libc/calls/unveil.c \
|
||||
'/^ if (landlock_abi_version == -1) {/i\\
|
||||
landlock_abi_version = landlock_create_ruleset(0, 0, LANDLOCK_CREATE_RULESET_VERSION);' \
|
||||
# that's not how comments work! delete any "commented out" lines entirely. \
|
||||
&& sed -i '/#\t/d' third_party/third_party.mk \
|
||||
# create a mapping from flavor to mode (possibly an empty string) \
|
||||
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
|
||||
&& printf '%s="%s"\n' >env \
|
||||
|
|
Binary file not shown.
|
@ -27,6 +27,7 @@ FROM builder AS distrib
|
|||
RUN --mount=type=tmpfs,target=/tmp : \
|
||||
&& . ./env \
|
||||
&& find o -name '*.sym' -delete \
|
||||
&& find o -name 'aarch64-linux-musl*' -exec rm -r '{}' + \
|
||||
&& dedupe o/third_party/gcc /distrib/gcc/ \
|
||||
bin/x86_64-linux-musl-gcc \
|
||||
bin/x86_64-linux-musl-g++ \
|
||||
|
@ -34,7 +35,7 @@ RUN --mount=type=tmpfs,target=/tmp : \
|
|||
&& 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 \
|
||||
#&& find o -name '*.com' ! -type d -exec printf 'cp -t /tmp/bin %s\n' {} + | sort && exit 1 \
|
||||
&& ./expand cp -t /tmp/bin \
|
||||
t//make/make.com t//unzip/unzip.com t//zip/zip.com \
|
||||
b//ar.com b//cocmd.com b//compile.com \
|
||||
|
@ -49,7 +50,7 @@ RUN --mount=type=tmpfs,target=/tmp : \
|
|||
&& cp /cosmopolitan/env /distrib/env \
|
||||
;
|
||||
|
||||
FROM alpine:3.16 AS runner
|
||||
FROM docker.io/library/alpine:3.18 AS runner
|
||||
COPY --from=distrib /distrib /cosmopolitan
|
||||
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
|
||||
# FIXME:
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# TODO: add /zip/ support by default and include dist modules.
|
||||
|
||||
FROM localhost/notwa-util AS downloader
|
||||
ARG KUROKO_COMMIT=3f35d89fff2343ddb9f0de5c87bbdefa86ee34f5
|
||||
ARG KUROKO_SHA256=b1d38c48afdc06633d848dc27cb5d37bebbb7c99c59d3649c155350f06cd93a7
|
||||
ARG KUROKO_COMMIT=cd28d829397dcec9b12a15169e39933260dc9a65
|
||||
ARG KUROKO_SHA256=de842898157b18d8b33ca03847242247e485dc5be9e5fb5271ac8144ca18511c
|
||||
|
||||
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||
--mount=type=tmpfs,target=/tmp : \
|
||||
|
@ -21,10 +21,6 @@ RUN : \
|
|||
\
|
||||
&& shed src/os.c \
|
||||
's@.*char \*\* environ.*@#ifndef COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_\n&\n#endif@' \
|
||||
\
|
||||
&& shed src/vm.c \
|
||||
'/FUNC_SIG(list,append)/d' \
|
||||
'/void _callSetName/i\\extern FUNC_SIG(list,append);' \
|
||||
\
|
||||
&& shed src/vm.c \
|
||||
'/static.*cache/c\\static KrkClassCacheEntry * cache = 0;' \
|
||||
|
@ -94,6 +90,7 @@ $'/CFLAGS += -DKRK_DISABLE_THREADS/a\\\
|
|||
else\\\n\
|
||||
CFLAGS += -DKRK_MEDIOCRE_TLS\
|
||||
' \
|
||||
'/shell tools\/can-floor-without-libm\.sh/,/endif/d' \
|
||||
\
|
||||
&& { diff -NrU3 /kuroko.orig/ /kuroko/ > /kuroko.patch; [ $? -le 1 ]; }
|
||||
# diff exit status is normally 0 or 1, anything greater is an error.
|
||||
|
@ -112,6 +109,7 @@ int main(int argc, char * argv[]) {\n\
|
|||
}\n\
|
||||
'
|
||||
|
||||
# FIXME?: https://github.com/kuroko-lang/kuroko/commit/e26391bc2f84d81d5d1982e20977ca33e7748651
|
||||
RUN tar zxf /cosmopolitan/dist/headers.tar.gz -C /cosmopolitan
|
||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/cosmocc /usr/bin/
|
||||
RUN : \
|
||||
|
@ -121,7 +119,12 @@ RUN : \
|
|||
&& cp kuroko kuroko.com.dbg \
|
||||
&& objcopy -S -O binary kuroko.com.dbg kuroko.com \
|
||||
;
|
||||
RUN make.com test
|
||||
|
||||
RUN : \
|
||||
&& rm test/day23.krk \
|
||||
&& rm test/testAnnotations.krk \
|
||||
&& rm test/testSubclassPropertySuperCall.krk \
|
||||
&& make.com test
|
||||
|
||||
FROM localhost/rescue AS runner
|
||||
COPY --chmod=0755 --from=builder /kuroko/kuroko.com /kuroko/kuroko.com.dbg /bin/
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
ARG CC=cosmocc CFLAGS="-fdiagnostics-color=always -Os -g -Wall -Wextra -Wwrite-strings -Wno-unused"
|
||||
FROM localhost/notwa-util AS downloader
|
||||
|
||||
# MAIN: https://nullprogram.com/blog/2019/03/22/
|
||||
# REPO: https://github.com/skeeto/endlessh
|
||||
ARG ENDLESSH_COMMIT=dfe44eb2c5b6fc3c48a39ed826fe0e4459cdf6ef
|
||||
ARG ENDLESSH_SHA256=c8989988af0a8c848d1a4979962f008c504a12ed6fe6a12e032c37feaa0ae5f8
|
||||
|
||||
# MAIN: n/a
|
||||
# REPO: https://github.com/leahneukirchen/lr
|
||||
ARG LR_COMMIT=5af9b79e4ecd07a600ded1a801023536cde97f95
|
||||
ARG LR_SHA256=3901287cdcf09d0d8f77f8aaa19ca24e9a873d904e201ab8e7bf102426607dcc
|
||||
|
||||
# MAIN: n/a
|
||||
# REPO: https://github.com/leahneukirchen/xe
|
||||
ARG XE_COMMIT=8a2a4899769335bc14c62aef12cdf26f2f487f2a
|
||||
ARG XE_SHA256=f1ac997912c9be92a74a67a766dde74d1f9b6b20e48d7c7e71598ad4b787b37d
|
||||
|
||||
# MAIN: http://selfie.cs.uni-salzburg.at/
|
||||
# REPO: https://github.com/cksystemsteaching/selfie
|
||||
ARG SELFIE_COMMIT=9d5cf9caac9b00ac48b96c527ddda6c550f652fa
|
||||
ARG SELFIE_SHA256=5ea9e9cd7df6e6e67e3757cd8483e8e653fa4d7469275f3fdf89483c2744d4a9
|
||||
|
||||
# MAIN: n/a
|
||||
# REPO: https://github.com/atomicobject/heatshrink
|
||||
ARG HEATSHRINK_COMMIT=7d419e1fa4830d0b919b9b6a91fe2fb786cf3280
|
||||
ARG HEATSHRINK_SHA256=b18a1b7ad6f51eac7ac1a81ca072703bd21d6d8727c05cd505843643705af65d
|
||||
|
||||
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||
--mount=type=tmpfs,target=/tmp : \
|
||||
&& acquire from=github repo=skeeto/endlessh dest=/endlessh env=ENDLESSH \
|
||||
&& acquire from=github repo=leahneukirchen/lr dest=/lr env=LR \
|
||||
&& acquire from=github repo=leahneukirchen/xe dest=/xe env=XE \
|
||||
&& acquire from=github repo=cksystemsteaching/selfie dest=/selfie env=SELFIE \
|
||||
&& acquire from=github repo=atomicobject/heatshrink dest=/heatshrink env=HEATSHRINK \
|
||||
;
|
||||
|
||||
FROM localhost/cosmo-base AS mini
|
||||
RUN tar zxf /cosmopolitan/dist/headers.tar.gz -C /cosmopolitan
|
||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/ /usr/bin/
|
||||
WORKDIR /o
|
||||
|
||||
FROM mini AS mini_endlessh
|
||||
COPY --from=downloader /endlessh /o
|
||||
ARG CC CFLAGS
|
||||
RUN : \
|
||||
&& shed endlessh.c \
|
||||
's/\bINET6_ADDRSTRLEN\b/65/g' \
|
||||
'/\bswitch (errno) {/,/default:/s/\bcase \([A-Z]\+\):/} else if (errno == \1) {/g' \
|
||||
'/\bswitch (errno) {/,/default:/s/default\:/} else {/' \
|
||||
's/\bswitch (errno) {/if (0) {/' \
|
||||
'/ENDLESSH_VERSION/i\static const struct in6_addr in6addr_any = {0};' \
|
||||
's/int fd = accept(server, 0, 0);/struct sockaddr_in dummy1; unsigned int dummy2 = sizeof(dummy1); int fd = accept(server, (struct sockaddr *)\&dummy1, \&dummy2);/' \
|
||||
&& ofc endlessh.c \
|
||||
;
|
||||
|
||||
FROM mini AS mini_lr
|
||||
COPY --from=downloader /lr /o
|
||||
COPY lr.patch /o/
|
||||
ARG CC CFLAGS
|
||||
RUN : \
|
||||
&& /usr/bin/busybox patch -p1 -i lr.patch \
|
||||
&& shed lr.c \
|
||||
'/_GNU_SOURCE/a\\#include "libc/dce.h"' \
|
||||
's/\bnlink_t\b/uint32_t/g' \
|
||||
's/\bdefined(__/&sometimes_/g' \
|
||||
's/\b__linux__\b/__sometimes_linux__/g' \
|
||||
'/#warning fstype/d' \
|
||||
&& ofc lr.c \
|
||||
;
|
||||
|
||||
FROM mini AS mini_xe
|
||||
COPY --from=downloader /xe /o
|
||||
ARG CC CFLAGS
|
||||
RUN ofc xe.c
|
||||
|
||||
FROM mini AS mini_selfie
|
||||
COPY --from=downloader /selfie /o
|
||||
ARG CC CFLAGS
|
||||
RUN shed selfie.c '/\bPAGESIZE\b/i\\#undef PAGESIZE' && ofc selfie.c
|
||||
|
||||
FROM mini AS mini_heatshrink
|
||||
COPY --from=downloader /heatshrink /o
|
||||
ARG CC CFLAGS
|
||||
RUN : \
|
||||
&& shed heatshrink.c '/encoder\.h/a\\#include "heatshrink_encoder.c"' \
|
||||
&& shed heatshrink.c '/decoder\.h/a\\#include "heatshrink_decoder.c"' \
|
||||
&& shed heatshrink_encoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_e/g' \
|
||||
&& shed heatshrink_decoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_d/g' \
|
||||
&& CFLAGS="$CFLAGS -Wno-implicit-fallthrough" ofc heatshrink.c \
|
||||
;
|
||||
|
||||
FROM localhost/rescue AS runner
|
||||
COPY --chmod=0755 --from=mini_endlessh /o/*.com /o/*.com.dbg /bin/
|
||||
COPY --chmod=0755 --from=mini_heatshrink /o/*.com /o/*.com.dbg /bin/
|
||||
COPY --chmod=0755 --from=mini_lr /o/*.com /o/*.com.dbg /bin/
|
||||
COPY --chmod=0755 --from=mini_selfie /o/*.com /o/*.com.dbg /bin/
|
||||
COPY --chmod=0755 --from=mini_xe /o/*.com /o/*.com.dbg /bin/
|
||||
ENTRYPOINT ["/bin/busybox", "sh"]
|
|
@ -0,0 +1,64 @@
|
|||
--- lr/lr.c.old
|
||||
+++ lr/lr.c
|
||||
@@ -934,6 +910,25 @@
|
||||
}
|
||||
|
||||
static const char *
|
||||
+xextnam(const char *s)
|
||||
+{
|
||||
+ /* does not treat extensionless dotfiles as file extensions */
|
||||
+ char *r = strrchr(s, '/');
|
||||
+ char *e = strrchr(s, '.');
|
||||
+ if (!r || r + 1 < e)
|
||||
+ return e && e != s ? e + 1 : "";
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+static char
|
||||
+dotted(const char *s)
|
||||
+{
|
||||
+ char *r = strrchr(s, '/');
|
||||
+ char *e = strchr(r ? r : s, '.');
|
||||
+ return (r && r + 1 == e || s == e) ? '.' : '\0';
|
||||
+}
|
||||
+
|
||||
+static const char *
|
||||
readlin(const char *p, const char *alt)
|
||||
{
|
||||
static char b[PATH_MAX];
|
||||
@@ -1453,6 +1447,8 @@
|
||||
case 'I': CMP(fb->sb.st_ino, fa->sb.st_ino);
|
||||
case 'd': CMP(fa->depth, fb->depth);
|
||||
case 'D': CMP(fb->depth, fa->depth);
|
||||
+ case 'u': CMP(!dotted(fa->fpath), !dotted(fb->fpath));
|
||||
+ case 'U': CMP(!dotted(fb->fpath), !dotted(fa->fpath));
|
||||
case 't': CMP("ZZZZAZZZZZZZZZZZ"[(fa->sb.st_mode >> 12) & 0x0f],
|
||||
"ZZZZAZZZZZZZZZZZ"[(fb->sb.st_mode >> 12) & 0x0f]);
|
||||
case 'T': CMP("ZZZZAZZZZZZZZZZZ"[(fb->sb.st_mode >> 12) & 0x0f],
|
||||
@@ -1461,8 +1457,8 @@
|
||||
case 'N': STRCMP(fb->fpath, fa->fpath);
|
||||
case 'f': STRCMP(basenam(fa->fpath), basenam(fb->fpath));
|
||||
case 'F': STRCMP(basenam(fb->fpath), basenam(fa->fpath));
|
||||
- case 'e': STRCMP(extnam(fa->fpath), extnam(fb->fpath));
|
||||
- case 'E': STRCMP(extnam(fb->fpath), extnam(fa->fpath));
|
||||
+ case 'e': STRCMP(xextnam(fa->fpath), xextnam(fb->fpath));
|
||||
+ case 'E': STRCMP(xextnam(fb->fpath), xextnam(fa->fpath));
|
||||
case 'p': DIRCMP(fa->fpath, fb->fpath);
|
||||
case 'P': DIRCMP(fb->fpath, fa->fpath);
|
||||
case 'v': VERCMP(fa->fpath, fb->fpath);
|
||||
@@ -2156,6 +2152,15 @@
|
||||
fi->color = current_color;
|
||||
memcpy((char *)&fi->sb, (char *)sb, sizeof (struct stat));
|
||||
|
||||
+ if (IsWindows() && !S_ISDIR(fi->sb.st_mode)) {
|
||||
+ /* pretend that only .exe and .com files are executable */
|
||||
+ char *ext = extnam(fi->fpath);
|
||||
+ if (strcasecmp(ext, "exe") && strcasecmp(ext, "com"))
|
||||
+ fi->sb.st_mode &= ~0111;
|
||||
+ /* MSYS also reads the first two bytes of the file and compares
|
||||
+ * them to "MZ" and "#!", but let's avoid doing that for now. */
|
||||
+ }
|
||||
+
|
||||
prune = 0;
|
||||
if (expr && !eval(expr, fi)) {
|
||||
if (Bflag && S_ISDIR(fi->sb.st_mode) && !prune) {
|
|
@ -1,8 +1,8 @@
|
|||
# MAIN: https://muon.build/
|
||||
# REPO: https://git.sr.ht/~lattis/muon
|
||||
FROM localhost/notwa-util AS downloader
|
||||
ARG MUON_COMMIT=40bf3553f49a784639b06867acff20b702d7956d
|
||||
ARG MUON_SHA256=baef4d22d29807023883c843825a6e514aba54256a8727fadfbabcf983385416
|
||||
ARG MUON_COMMIT=fa0cd001b1ed68c75a2f5700032733fd31bd7148
|
||||
ARG MUON_SHA256=c82686bdd2d07d5707c239f01b1e150054ee5c85d684c7edcc35399cdd0c67c2
|
||||
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||
--mount=type=tmpfs,target=/tmp : \
|
||||
&& acquire from=sourcehut repo=lattis/muon dest=/muon env=MUON \
|
||||
|
|
|
@ -3,15 +3,15 @@ FROM localhost/notwa-util AS downloader
|
|||
# MAIN: https://www.perl.org/
|
||||
# REPO: https://github.com/Perl/perl5
|
||||
# FORK: https://github.com/G4Vi/perl5/tree/cosmo
|
||||
ARG PERL_COMMIT=2fb034ffb02db2b3ac09706c954704930c620c0b
|
||||
ARG PERL_SHA256=03bf2d1eefb8610e1ad5594ddf7cc5eb5aa11c25f499f3233ecaa3088d55579a
|
||||
ARG PERL_COMMIT=833c3ec29e192fc4dde6901a30c39eee4513a2eb
|
||||
ARG PERL_SHA256=35fde7c9f8162f9722f155b57f3030d845161ae0cf8f315f24c87121ebd9d3d6
|
||||
# MAIN: https://computoid.com/APPerl/
|
||||
# REPO: https://github.com/G4Vi/Perl-Dist-APPerl
|
||||
|
||||
# MAIN: https://metacpan.org/pod/perltidy
|
||||
# REPO: https://github.com/perltidy/perltidy
|
||||
ARG PERLTIDY_VERSION=20220613
|
||||
ARG PERLTIDY_SHA256=50496a6952904ef28f495919fc0a67801a63c87779c61308ce1ca5b32467c5d4
|
||||
ARG PERLTIDY_VERSION=20230309
|
||||
ARG PERLTIDY_SHA256=e22949a208c618d671a18c5829b451abbe9da0da2cddd78fdbfcb036c7361c18
|
||||
|
||||
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||
--mount=type=tmpfs,target=/tmp : \
|
||||
|
@ -138,6 +138,6 @@ RUN : \
|
|||
|
||||
FROM localhost/rescue AS runner
|
||||
COPY --chmod=0755 --from=builder /perl/cosmo/o/perl.com /bin/perl.com
|
||||
COPY --chmod=0755 --from=builder /perl/perl.elf /bin/perl.com.dbg
|
||||
COPY --chmod=0755 --from=builder /perl/perl.com.dbg /bin/perl.com.dbg
|
||||
COPY --from=builder /perl/minitest_results.txt /minitest_results.txt
|
||||
ENTRYPOINT ["/bin/ape", "/bin/perl.com"]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# MAIN: https://yices.csl.sri.com/
|
||||
# REPO: https://github.com/SRI-CSL/yices2/
|
||||
FROM localhost/notwa-util AS downloader
|
||||
ARG YICES_COMMIT=316ab8c2ba723231c12efec9948090718bbc8ce5
|
||||
ARG YICES_SHA256=c2e0a85069ce8eb5029830190d6d282dab36cc28ca872682f9a619c089deff2e
|
||||
ARG YICES_COMMIT=3bd35801938e815c431aa1306af8049fa068a5ba
|
||||
ARG YICES_SHA256=4f1c781ce053da370f1fb67f3f32bc253224f52044f0552dc32c33336fcb77c5
|
||||
# MAIN: https://gmplib.org/
|
||||
# REPO: https://gmplib.org/repo/
|
||||
ARG GMP_VERSION=6.2.1
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
&& { [ -w . ] || "$super" chown root:wheel . ;} \
|
||||
&& { [ -w . ] || "$super" chmod 0775 . ;} \
|
||||
&& now="$(date -u +%s)" \
|
||||
&& podman run -v="$out":/out --rm localhost/cosmo \
|
||||
&& podman run -v="$out":/out --rm localhost/cosmo-dist \
|
||||
tar zcf "/out/cosmopolitan-$now.tar.gz" /cosmopolitan \
|
||||
&& if [ -L cosmopolitan ] \
|
||||
;then : \
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/false
|
||||
|
||||
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 "localhost/$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" "$@" \
|
||||
;}
|
||||
|
||||
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 \
|
||||
;}
|
||||
|
||||
build_base() { : \
|
||||
&& sed 's/\bcosmo-bootstrap\b/cosmo-all/g' \
|
||||
<cosmo-dist/Dockerfile >cosmo-dist/all.Dockerfile \
|
||||
&& `# sed -i 's/#&& find o/ \&\& find o/' cosmo-dist/all.Dockerfile` \
|
||||
&& build cosmo-dist -f cosmo-dist/all.Dockerfile \
|
||||
&& build cosmo-base \
|
||||
;}
|
|
@ -1,6 +1,6 @@
|
|||
# MAIN: https://eaguru.guru/git/notwa/stargazing
|
||||
# REPO: https://eaguru.guru/git/notwa/stargazing
|
||||
FROM alpine:3.16 as partial
|
||||
FROM docker.io/library/alpine:3.18 as partial
|
||||
# need this for acquire (.tar.xz files):
|
||||
RUN apk add --no-cache xz
|
||||
COPY --chmod=0755 acquire cosmocc dedupe ofc quickconf shed \
|
||||
|
@ -10,8 +10,9 @@ WORKDIR /media/common
|
|||
|
||||
FROM partial as downloader
|
||||
# this demonstrates how to use the `acquire` script.
|
||||
ARG BUSYBOX_VERSION=1.35.0
|
||||
ARG BUSYBOX_SHA256=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694
|
||||
ARG BUSYBOX_VERSION=1.36.0
|
||||
ARG BUSYBOX_SHA256=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5
|
||||
# https://git.alpinelinux.org/aports/tree/main/busybox/APKBUILD
|
||||
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
||||
--mount=type=tmpfs,target=/tmp : \
|
||||
&& name=busybox \
|
||||
|
@ -23,14 +24,13 @@ RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
|||
&& acquire \
|
||||
;
|
||||
|
||||
FROM alpine:3.16 as builder
|
||||
FROM docker.io/library/alpine:3.18 as builder
|
||||
RUN apk add --no-cache gcc linux-headers make musl-dev
|
||||
# configure and build a rescue shell and some utilities,
|
||||
# i.e. one better suited for images built "FROM scratch".
|
||||
# this can greatly differ from Alpine's build of busybox.
|
||||
# for one thing, this build is half the size of Alpine's.
|
||||
# this binary is *not* an APE; it's only for Linux hosts.
|
||||
# TODO: inherit security patches from Alpine.
|
||||
COPY --from=downloader /root /root
|
||||
WORKDIR /root/busybox
|
||||
COPY busybox.config .config
|
||||
|
|
|
@ -89,7 +89,7 @@ ok=1 from= repo= commit= checksum= env= \
|
|||
&& { [ -d "$dest" ] || mkdir "$dest" ;} \
|
||||
&& if [ "$(wc -l </tmp/files)" = 1 ] && [ "$(wc -l </tmp/dirs)" = 1 ] \
|
||||
;then : \
|
||||
&& find "$temp" -mindepth 2 -maxdepth 2 -exec cp -rp {} "$dest" + \
|
||||
&& find "$temp" -mindepth 2 -maxdepth 2 -exec cp -rpt "$dest" {} + \
|
||||
;else : \
|
||||
&& cp -rp "$temp" "$dest" \
|
||||
;fi \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Busybox version: 1.35.0
|
||||
# Fri Aug 26 10:43:25 2022
|
||||
# Busybox version: 1.36.0
|
||||
# Fri Apr 28 16:02:12 2023
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
|
||||
|
@ -93,6 +93,9 @@ CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
|
|||
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
|
||||
CONFIG_PASSWORD_MINLEN=6
|
||||
CONFIG_MD5_SMALL=2
|
||||
CONFIG_SHA1_SMALL=3
|
||||
# CONFIG_SHA1_HWACCEL is not set
|
||||
# CONFIG_SHA256_HWACCEL is not set
|
||||
CONFIG_SHA3_SMALL=1
|
||||
CONFIG_FEATURE_NON_POSIX_CP=y
|
||||
# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
|
||||
|
@ -123,6 +126,9 @@ CONFIG_LAST_SUPPORTED_WCHAR=0
|
|||
# CONFIG_UNICODE_BIDI_SUPPORT is not set
|
||||
# CONFIG_UNICODE_NEUTRAL_TABLE is not set
|
||||
# CONFIG_UNICODE_PRESERVE_BROKEN is not set
|
||||
# CONFIG_LOOP_CONFIGURE is not set
|
||||
# CONFIG_NO_LOOP_CONFIGURE is not set
|
||||
CONFIG_TRY_LOOP_CONFIGURE=y
|
||||
|
||||
#
|
||||
# Applets
|
||||
|
@ -338,6 +344,7 @@ CONFIG_FEATURE_TEST_64=y
|
|||
# CONFIG_FEATURE_TR_EQUIV is not set
|
||||
CONFIG_TRUE=y
|
||||
CONFIG_TRUNCATE=y
|
||||
# CONFIG_TSORT is not set
|
||||
# CONFIG_TTY is not set
|
||||
# CONFIG_UNAME is not set
|
||||
CONFIG_UNAME_OSNAME=""
|
||||
|
@ -823,10 +830,12 @@ CONFIG_READAHEAD=y
|
|||
# CONFIG_RFKILL is not set
|
||||
# CONFIG_RUNLEVEL is not set
|
||||
# CONFIG_RX is not set
|
||||
# CONFIG_SEEDRNG is not set
|
||||
CONFIG_SETFATTR=y
|
||||
# CONFIG_SETSERIAL is not set
|
||||
# CONFIG_STRINGS is not set
|
||||
CONFIG_TIME=y
|
||||
# CONFIG_TREE is not set
|
||||
# CONFIG_TS is not set
|
||||
CONFIG_TTYSIZE=y
|
||||
# CONFIG_UBIATTACH is not set
|
||||
|
@ -999,6 +1008,7 @@ CONFIG_DHCPD_LEASES_FILE=""
|
|||
# CONFIG_FEATURE_UDHCPC_ARPING is not set
|
||||
# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
|
||||
CONFIG_UDHCPC_DEFAULT_SCRIPT=""
|
||||
CONFIG_UDHCPC6_DEFAULT_SCRIPT=""
|
||||
# CONFIG_UDHCPC6 is not set
|
||||
# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
|
||||
# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
|
||||
|
@ -1129,6 +1139,7 @@ CONFIG_ASH_EXPAND_PRMT=y
|
|||
CONFIG_ASH_ECHO=y
|
||||
CONFIG_ASH_PRINTF=y
|
||||
CONFIG_ASH_TEST=y
|
||||
CONFIG_ASH_SLEEP=y
|
||||
# CONFIG_ASH_HELP is not set
|
||||
CONFIG_ASH_GETOPTS=y
|
||||
CONFIG_ASH_CMDCMD=y
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-kuroko.done ]; then
|
||||
: \
|
||||
&& cd /root \
|
||||
&& acquire from=github repo=kuroko-lang/kuroko dest=/root/kuroko env=KUROKO \
|
||||
&& cd /root/kuroko \
|
||||
&& cp -r . ../kuroko.orig \
|
||||
&& patch -p1 -i /vagrant/notwa-util/kuroko.patch \
|
||||
&& shed src/kuroko.c 's/int main/dontinline int _main/' \
|
||||
&& printf %s >>src/kuroko.c $'
|
||||
__static_yoink("__die");
|
||||
void ShowCrashReports(void);
|
||||
int LoadZipArgs(int *, char ***);
|
||||
int main(int argc, char * argv[]) {
|
||||
\tShowCrashReports();
|
||||
\tLoadZipArgs(&argc, &argv);
|
||||
\treturn _main(argc, argv);
|
||||
}
|
||||
' \
|
||||
&& CC=cosmocc CFLAGS="-Os -g" AR=ar.com ARFLAGS=rcsD \
|
||||
make.com kuroko modules/codecs/sbencs.krk modules/codecs/dbdata.krk \
|
||||
-j2 KRK_DISABLE_RLINE=1 KRK_DISABLE_DYNAMIC=1 \
|
||||
&& apecopy kuroko kuroko.com \
|
||||
\
|
||||
&& rm test/day23.krk \
|
||||
&& rm test/testAnnotations.krk \
|
||||
&& rm test/testSubclassPropertySuperCall.krk \
|
||||
&& make.com test \
|
||||
&& touch /cosmo-kuroko.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,117 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-kuroko.done ]; then
|
||||
: \
|
||||
&& cd /root \
|
||||
&& acquire from=github repo=kuroko-lang/kuroko dest=/root/kuroko env=KUROKO \
|
||||
&& cd /root/kuroko \
|
||||
&& cp -r . ../kuroko.orig \
|
||||
&& shed src/os.c \
|
||||
's@.*char \*\* environ.*@#ifndef COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_\n&\n#endif@' \
|
||||
\
|
||||
&& shed src/vm.c \
|
||||
'/static.*cache/c\\static KrkClassCacheEntry * cache = 0;' \
|
||||
$'/define CACHE_SIZE/,/nextCount/{N;w /temp\nd}' \
|
||||
$'/void krk_initVM/{r /temp\nN}' \
|
||||
$'/Reset current thread/i\\\tcache = calloc(CACHE_SIZE, sizeof(KrkClassCacheEntry));' \
|
||||
$'/krk_freeMemoryDebugger();/a\\\tcache = (free(cache), NULL);' \
|
||||
\
|
||||
&& shed src/threads.c '/define gettid/d' \
|
||||
&& shed src/vm.c '/"initial-exec"/d' \
|
||||
\
|
||||
&& shed src/vm.c \
|
||||
$'/Ensure we don\'t have a macro/i\\
|
||||
\\#ifdef KRK_DISABLE_DYNAMIC\\
|
||||
KrkValue krk_module_onload_math(void);\\
|
||||
KrkValue krk_module_onload_random(void);\\
|
||||
KrkValue krk_module_onload_socket(void);\\
|
||||
KrkValue krk_module_onload_timeit(void);\\
|
||||
KrkValue krk_module_onload_wcwidth(void);\\
|
||||
\\#endif\\
|
||||
\\
|
||||
\\#define BUILTIN_MODULE(name, init) { \\\\\\
|
||||
\tKrkInstance * module = (KrkInstance*)AS_OBJECT(init()); \\\\\\
|
||||
\tkrk_attachNamedObject(&vm.modules, name, (KrkObj*)module); \\\\\\
|
||||
\tkrk_attachNamedObject(&module->fields, "__name__", (KrkObj*)S(name)); \\\\\\
|
||||
\tkrk_attachNamedValue(&module->fields, "__file__", NONE_VAL()); \\\\\\
|
||||
}\\
|
||||
' \
|
||||
$'/krk_module_init_dis/a\\
|
||||
\\#endif\\
|
||||
\\#ifdef KRK_DISABLE_DYNAMIC\\
|
||||
\t\tBUILTIN_MODULE("math", krk_module_onload_math)\\
|
||||
\t\tBUILTIN_MODULE("random", krk_module_onload_random)\\
|
||||
\t\tBUILTIN_MODULE("socket", krk_module_onload_socket)\\
|
||||
\t\tBUILTIN_MODULE("timeit", krk_module_onload_timeit)\\
|
||||
\t\tBUILTIN_MODULE("wcwidth", krk_module_onload_wcwidth)\\
|
||||
' \
|
||||
\
|
||||
&& shed src/modules/module_socket.c \
|
||||
'/netdb\.h/a\#include <netinet/in.h>' \
|
||||
$'/switch (afval)/{i\\
|
||||
\tif (afval == AF_INET) return "AF_INET";\\
|
||||
\tif (afval == AF_INET6) return "AF_INET6";\\
|
||||
\tif (afval == AF_UNIX) return "AF_UNIX";\\
|
||||
\tsnprintf(tmp,30,"%d",afval);\\
|
||||
\treturn tmp;
|
||||
}
|
||||
/switch (afval)/,/}/d' \
|
||||
\
|
||||
&& shed src/kuroko.c \
|
||||
$'/strlen(buf)-1/{
|
||||
s/if .*/if (buf[buflen-1] == \'\\\\n\') {/
|
||||
i\\
|
||||
\t\t\t\tsize_t buflen = strlen(buf);
|
||||
a\\
|
||||
\t\t\t\t\t\\if (buflen >= 2 && buf[buflen-2] == \'\\\\r\') buf[buflen-2] = \'\\\\n\', buf[buflen-1] = \'\\0\';\\
|
||||
\t\t\t\t} else {
|
||||
}' \
|
||||
\
|
||||
&& shed Makefile \
|
||||
$'/ifdef KRK_DISABLE_THREADS/i\\
|
||||
ifdef KRK_DISABLE_DYNAMIC\\
|
||||
BIN_OBJS += src/modules/module_math.o src/modules/module_random.o src/modules/module_socket.o src/modules/module_timeit.o src/modules/module_wcwidth.o\\
|
||||
CFLAGS += -DKRK_DISABLE_DYNAMIC -DSTATIC_ONLY\\
|
||||
endif\\
|
||||
' \
|
||||
$'/CFLAGS += -DKRK_DISABLE_THREADS/a\\
|
||||
else\\
|
||||
CFLAGS += -DKRK_MEDIOCRE_TLS\\
|
||||
' \
|
||||
'/shell tools\/can-floor-without-libm\.sh/,/endif/d' \
|
||||
\
|
||||
&& cd /root \
|
||||
&& { diff -NrU3 kuroko.orig/ kuroko/ > kuroko.patch; [ $? -le 1 ]; } \
|
||||
|| exit $?
|
||||
# diff exit status is normally 0 or 1, anything greater is an error.
|
||||
|
||||
# this isn't included in the patch because it's super specific to cosmopolitan. \
|
||||
: \
|
||||
&& cd /root/kuroko \
|
||||
&& shed src/kuroko.c 's/int main/dontinline int _main/' \
|
||||
&& printf %s >>src/kuroko.c $'
|
||||
STATIC_YOINK("__die");
|
||||
void ShowCrashReports(void);
|
||||
int LoadZipArgs(int *, char ***);
|
||||
int main(int argc, char * argv[]) {
|
||||
\tShowCrashReports();
|
||||
\tLoadZipArgs(&argc, &argv);
|
||||
\treturn _main(argc, argv);
|
||||
}
|
||||
' \
|
||||
|| exit $?
|
||||
|
||||
: \
|
||||
&& cd /root/kuroko \
|
||||
&& CC=cosmocc CFLAGS="-Os -g" AR=ar.com ARFLAGS=rcsD \
|
||||
make.com kuroko modules/codecs/sbencs.krk modules/codecs/dbdata.krk \
|
||||
-j2 KRK_DISABLE_RLINE=1 KRK_DISABLE_DYNAMIC=1 \
|
||||
&& cp kuroko kuroko.com.dbg \
|
||||
&& objcopy -S -O binary kuroko.com.dbg kuroko.com \
|
||||
\
|
||||
&& rm test/day23.krk \
|
||||
&& rm test/testAnnotations.krk \
|
||||
&& rm test/testSubclassPropertySuperCall.krk \
|
||||
&& make.com test \
|
||||
&& touch /cosmo-kuroko.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-mini.done ]; then
|
||||
: \
|
||||
&& export CC=cosmocc CFLAGS="-fdiagnostics-color=always -Os -g -Wall -Wextra -Wwrite-strings -Wno-unused" \
|
||||
&& acquire from=github repo=skeeto/endlessh dest=/root/endlessh env=ENDLESSH \
|
||||
&& acquire from=github repo=leahneukirchen/lr dest=/root/lr env=LR \
|
||||
&& acquire from=github repo=leahneukirchen/xe dest=/root/xe env=XE \
|
||||
&& acquire from=github repo=cksystemsteaching/selfie dest=/root/selfie env=SELFIE \
|
||||
&& acquire from=github repo=atomicobject/heatshrink dest=/root/heatshrink env=HEATSHRINK \
|
||||
\
|
||||
&& cd /root/endlessh \
|
||||
&& shed endlessh.c \
|
||||
's/\bINET6_ADDRSTRLEN\b/65/g' \
|
||||
'/\bswitch (errno) {/,/default:/s/\bcase \([A-Z]\+\):/} else if (errno == \1) {/g' \
|
||||
'/\bswitch (errno) {/,/default:/s/default\:/} else {/' \
|
||||
's/\bswitch (errno) {/if (0) {/' \
|
||||
'/ENDLESSH_VERSION/i\static const struct in6_addr in6addr_any = {0};' \
|
||||
's/int fd = accept(server, 0, 0);/struct sockaddr_in dummy1; unsigned int dummy2 = sizeof(dummy1); int fd = accept(server, (struct sockaddr *)\&dummy1, \&dummy2);/' \
|
||||
&& ofc endlessh.c \
|
||||
\
|
||||
&& cd /root/lr \
|
||||
&& patch -p1 -i /vagrant/cosmo-mini/lr.patch \
|
||||
&& shed lr.c \
|
||||
'/_GNU_SOURCE/a\\#include "libc/dce.h"' \
|
||||
's/\bnlink_t\b/uint32_t/g' \
|
||||
's/\bdefined(__/&sometimes_/g' \
|
||||
's/\b__linux__\b/__sometimes_linux__/g' \
|
||||
'/#warning fstype/d' \
|
||||
&& ofc lr.c \
|
||||
\
|
||||
&& cd /root/xe \
|
||||
&& ofc xe.c \
|
||||
\
|
||||
&& cd /root/selfie \
|
||||
&& shed selfie.c '/\bPAGESIZE\b/i\\#undef PAGESIZE' \
|
||||
&& ofc selfie.c \
|
||||
\
|
||||
&& cd /root/heatshrink \
|
||||
&& shed heatshrink.c '/encoder\.h/a\\#include "heatshrink_encoder.c"' \
|
||||
&& shed heatshrink.c '/decoder\.h/a\\#include "heatshrink_decoder.c"' \
|
||||
&& shed heatshrink_encoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_e/g' \
|
||||
&& shed heatshrink_decoder.c 's/\b\(output_info\|st_yield_literal\)\b/&_d/g' \
|
||||
&& CFLAGS="$CFLAGS -Wno-implicit-fallthrough" ofc heatshrink.c \
|
||||
\
|
||||
&& cd /root \
|
||||
&& mkdir -p /opt/mini \
|
||||
&& install -p -m 0755 -t /opt/mini/ */*.com.dbg */*.com \
|
||||
&& touch /cosmo-mini.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-muon.done ]; then
|
||||
: \
|
||||
&& export CC=cosmocc CFLAGS="-Os -g -fdiagnostics-color=always" \
|
||||
&& acquire from=sourcehut repo=lattis/muon dest=/root/muon env=MUON \
|
||||
\
|
||||
&& cd /root/muon \
|
||||
&& ./bootstrap.sh build \
|
||||
\
|
||||
&& shed src/platform/posix/rpath_fixer.c \
|
||||
'/\bcase ELFCLASS32:/,/\bbreak;/d' \
|
||||
's@.*Elf32.*@/* & */@' \
|
||||
&& echo >subprojects/bestline/bestline.c \
|
||||
&& printf '%s\n' >subprojects/bestline/bestline.h \
|
||||
'#include "third_party/linenoise/linenoise.h"' \
|
||||
'#define bestlineHistoryAdd linenoiseHistoryAdd' \
|
||||
'#define bestlineHistoryFree linenoiseHistoryFree' \
|
||||
'#define bestlineWithHistory linenoiseWithHistory' \
|
||||
\
|
||||
&& build/muon setup -Dstatic=true build \
|
||||
&& ninja -j2 -C build \
|
||||
&& cd build \
|
||||
&& mv muon muon.com.dbg \
|
||||
&& objcopy -S -O binary muon.com.dbg muon.com \
|
||||
&& touch /cosmo-muon.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-yices.done ]; then
|
||||
: \
|
||||
&& acquire from=github repo=SRI-CSL/yices2 dest=/root/yices env=YICES \
|
||||
\
|
||||
&& remote_fn="gmp-$GMP_VERSION.tar.xz" \
|
||||
&& export local_fn="$remote_fn" \
|
||||
&& export remote_url="https://gmplib.org/download/gmp/$remote_fn" \
|
||||
&& export dest=/root/gmp \
|
||||
&& export sha256="$GMP_SHA256" \
|
||||
&& acquire \
|
||||
&& unset local_fn remote_url dest sha256 \
|
||||
\
|
||||
&& acquire from=github repo=arminbiere/kissat dest=/root/kissat env=KISSAT \
|
||||
\
|
||||
&& cd /root/kissat \
|
||||
&& shed src/application.c '/#include <unistd.h>/i\\#include <time.h>' \
|
||||
&& shed configure '/passtocompiler -fpic/i\\CFLAGS=" -O2 -g -Wall"' \
|
||||
&& CC=cosmocc ./configure \
|
||||
&& make -j2 \
|
||||
&& install -m 0644 -D -t /usr/local/lib build/libkissat.a \
|
||||
&& install -m 0644 -D -t /usr/local/include -m644 src/kissat.h \
|
||||
\
|
||||
&& cd /root/gmp \
|
||||
&& rm -r printf \
|
||||
&& shed configure 's_ printf/Makefile _ _g' '/printf\/Makefile/d' \
|
||||
&& shed Makefile.in 's_ printf _ _g' 's/$(PRINTF_OBJECTS) //g' \
|
||||
&& CC=cosmocc CFLAGS="-O2 -g" \
|
||||
ac_cv_build='core2-pc-linux-gnu' \
|
||||
ac_cv_host='core2-pc-linux-gnu' \
|
||||
gmp_cv_c_double_format='IEEE little endian' \
|
||||
./configure --disable-shared \
|
||||
&& make -j2 \
|
||||
&& make install \
|
||||
\
|
||||
&& cd /root/yices \
|
||||
&& shed src/context/context.c 's/\bdonothing\b/&_/g' \
|
||||
&& shed src/terms/bv_constants.c 's/\bhextoint\b/&_/g' \
|
||||
&& shed src/terms/bv64_constants.c 's/\bhextoint\b/&_/g' \
|
||||
&& shed src/utils/timeout.c '/#include <unistd.h>/i\\#include <time.h>' \
|
||||
&& shed src/Makefile 's/ $(static_libyices_dynamic)//g' \
|
||||
&& shed src/Makefile '/^\t$(STRIP)/d' \
|
||||
&& shed src/Makefile '/\*\.dll/d' \
|
||||
&& autoconf \
|
||||
&& CC=cosmocc \
|
||||
CFLAGS="-O2 -g" \
|
||||
CPPFLAGS="-I/usr/local/include -DHAVE_KISSAT" \
|
||||
LDFLAGS="-L/usr/local/lib" \
|
||||
LIBS="-lkissat" \
|
||||
./configure --prefix= \
|
||||
&& make -j2 static-dist \
|
||||
\
|
||||
&& mkdir -p dist \
|
||||
&& cp -r build/x86_64-pc-linux-gnu-release/static_dist/bin dist \
|
||||
&& cd dist/bin \
|
||||
&& for bin in yices yices-sat yices-smt yices-smt2 \
|
||||
;do : \
|
||||
&& apecopy "$bin" "$bin.com" \
|
||||
;done \
|
||||
&& cd /root/kissat/build \
|
||||
&& apecopy kissat kissat.com \
|
||||
\
|
||||
&& touch /cosmo-yices.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmo-yices.done ]; then
|
||||
: \
|
||||
&& acquire from=github repo=SRI-CSL/yices2 dest=/root/yices env=YICES \
|
||||
\
|
||||
&& remote_fn="gmp-$GMP_VERSION.tar.xz" \
|
||||
&& export local_fn="$remote_fn" \
|
||||
&& export remote_url="https://gmplib.org/download/gmp/$remote_fn" \
|
||||
&& export dest=/root/gmp \
|
||||
&& export sha256="$GMP_SHA256" \
|
||||
&& acquire \
|
||||
\
|
||||
&& acquire from=github repo=arminbiere/kissat dest=/root/kissat env=KISSAT \
|
||||
\
|
||||
&& cd /root/kissat \
|
||||
&& shed src/application.c '/#include <unistd.h>/i\\#include <time.h>' \
|
||||
&& shed configure '/passtocompiler -fpic/i\\CFLAGS=" -O2 -g -Wall"' \
|
||||
&& CC=cosmocc ./configure \
|
||||
&& make -j2 \
|
||||
&& install -m 0644 -D -t /usr/local/lib build/libkissat.a \
|
||||
&& install -m 0644 -D -t /usr/local/include -m644 src/kissat.h \
|
||||
\
|
||||
&& cd /root/gmp \
|
||||
&& rm -r printf \
|
||||
&& shed configure 's_ printf/Makefile _ _g' '/printf\/Makefile/d' \
|
||||
&& shed Makefile.in 's_ printf _ _g' 's/$(PRINTF_OBJECTS) //g' \
|
||||
&& CC=cosmocc CFLAGS="-O2 -g" \
|
||||
ac_cv_build='core2-pc-linux-gnu' \
|
||||
ac_cv_host='core2-pc-linux-gnu' \
|
||||
gmp_cv_c_double_format='IEEE little endian' \
|
||||
quickconf --disable-shared \
|
||||
&& make -j2 \
|
||||
&& make install \
|
||||
\
|
||||
&& cd /root/yices \
|
||||
&& shed src/context/context.c 's/\bdonothing\b/&_/g' \
|
||||
&& shed src/terms/bv_constants.c 's/\bhextoint\b/&_/g' \
|
||||
&& shed src/terms/bv64_constants.c 's/\bhextoint\b/&_/g' \
|
||||
&& shed src/utils/timeout.c '/#include <unistd.h>/i\\#include <time.h>' \
|
||||
&& shed src/Makefile 's/ $(static_libyices_dynamic)//g' \
|
||||
&& shed src/Makefile '/^\t$(STRIP)/d' \
|
||||
&& shed src/Makefile '/\*\.dll/d' \
|
||||
&& autoconf \
|
||||
&& CC=cosmocc \
|
||||
CFLAGS="-O2 -g" \
|
||||
CPPFLAGS="-I/usr/local/include -DHAVE_KISSAT" \
|
||||
LDFLAGS="-L/usr/local/lib" \
|
||||
LIBS="-lkissat" \
|
||||
quickconf --prefix= \
|
||||
&& make -j2 static-dist \
|
||||
&& mv build/x86_64-pc-linux-gnu-release/static_dist dist \
|
||||
&& cd dist/bin \
|
||||
&& for bin in yices yices-sat yices-smt yices-smt2 \
|
||||
;do : \
|
||||
&& mv "$bin" "$bin.com.dbg" \
|
||||
&& objcopy -S -O binary "$bin.com.dbg" "$bin.com" \
|
||||
;done \
|
||||
&& cd /root/kissat/build \
|
||||
&& mv "kissat" "kissat.com.dbg" \
|
||||
&& objcopy -S -O binary "kissat.com.dbg" "kissat.com" \
|
||||
\
|
||||
&& touch /cosmo-yices.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmopolitan-bootstrap.done ]; then
|
||||
: \
|
||||
&& cd /root \
|
||||
&& acquire from=github repo=jart/cosmopolitan dest=/root/cosmopolitan env=COSMO \
|
||||
&& printf '%s\n' /tmp/tmp.*/cosmopolitan-* \
|
||||
| while read -r d; do [ ! -d "$d" ] || rm -r "$d"; done \
|
||||
&& cd /root/cosmopolitan \
|
||||
&& export V=0 COLUMNS=80 TMPDIR=/tmp \
|
||||
&& install -m0755 build/bootstrap/ape.elf /usr/bin/ape \
|
||||
\
|
||||
&& shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \
|
||||
&& shed Makefile \
|
||||
'/\bNET_HTTP\b/i\\tTHIRD_PARTY_LINENOISE\t\t\\' \
|
||||
'/\bNET_HTTP\b/i\\tTOOL_ARGS\t\t\\' \
|
||||
&& shed libc/elf/elf.h '/"libc\/elf\/struct\/ehdr.h"/i\\#include "libc/elf/struct/dyn.h"' \
|
||||
&& shed third_party/awk/main.c '/pledge.*{/,/}/d' \
|
||||
\
|
||||
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
|
||||
&& printf '%s="%s"\n' >env \
|
||||
commit "$COSMO_COMMIT" \
|
||||
flavor "$COSMO_FLAVOR" \
|
||||
mode "$mode" \
|
||||
&& export mode \
|
||||
&& expand makeit a//ape.elf \
|
||||
&& rebuild() { expand makeit "$@" && expand cp -int build/bootstrap "$@" ;} \
|
||||
&& rebuild \
|
||||
t//make/make.com b//ar.com b//chmod.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//zipcopy.com b//zipobj.com \
|
||||
&& expand install -m0755 a//ape.elf /usr/bin/ape \
|
||||
&& touch /cosmopolitan-bootstrap.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmopolitan-bootstrap.done ]; then
|
||||
: \
|
||||
&& cd /root \
|
||||
&& acquire from=github repo=jart/cosmopolitan dest=/root/cosmopolitan env=COSMO \
|
||||
&& cd /root/cosmopolitan \
|
||||
&& export V=0 COLUMNS=80 TMPDIR=/tmp \
|
||||
&& shed build/config.mk 's/-march=native/-march=haswell -mno-pclmul -mtune=generic/' \
|
||||
&& sed -i 's/skip=" 76" count=" 128"/skip=76 count=128 /' build/bootstrap/*.com \
|
||||
&& install -m0755 build/bootstrap/ape.elf /usr/bin/ape \
|
||||
&& shed Makefile \
|
||||
'/\bNET_HTTP\b/i\\tTHIRD_PARTY_LINENOISE\t\t\\' \
|
||||
'/\bNET_HTTP\b/i\\tTOOL_ARGS\t\t\\' \
|
||||
&& shed libc/elf/elf.h '/"libc\/elf\/struct\/ehdr.h"/i\\#include "libc/elf/struct/dyn.h"' \
|
||||
&& shed third_party/awk/main.c '/pledge.*{/,/}/d' \
|
||||
&& shed libc/calls/unveil.c \
|
||||
'/^ if (landlock_abi_version == -1) {/i\
|
||||
landlock_abi_version = landlock_create_ruleset(0, 0, LANDLOCK_CREATE_RULESET_VERSION);' \
|
||||
&& sed -i '/#\t/d' third_party/third_party.mk \
|
||||
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
|
||||
&& printf '%s="%s"\n' >env \
|
||||
commit "$COSMO_COMMIT" \
|
||||
flavor "$COSMO_FLAVOR" \
|
||||
mode "$mode" \
|
||||
&& printf '%s\n' >makeit '#!/usr/bin/env sh' \
|
||||
"build/bootstrap/make.com -j2 MODE='$mode'"' "$@"' \
|
||||
&& printf '%s\n' >expand '#!/usr/bin/env sh' \
|
||||
"o='o/$mode' once=false" \
|
||||
'for f; do g="${f#?//}"; case "$f" in' \
|
||||
'(a//*) f="$o/ape/$g";;' \
|
||||
'(b//*) f="$o/tool/build/$g";;' \
|
||||
'(e//*) f="$o/examples/$g";;' \
|
||||
'(o//*) f="$o/$g";;' \
|
||||
'(t//*) f="$o/third_party/$g";;' \
|
||||
'(T//*) f="third_party/$g";;' \
|
||||
'esac; $once && set -- "$@" "$f" || set -- "$f"; once=true; done' \
|
||||
'"$@"' \
|
||||
&& chmod +x makeit expand \
|
||||
&& ./expand ./makeit \
|
||||
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 \
|
||||
&& rebuild() { ./expand ./makeit "$@" && ./expand cp -int build/bootstrap "$@" ;} \
|
||||
&& rebuild \
|
||||
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 \
|
||||
&& ./expand install -m0755 a//ape.elf /usr/bin/ape \
|
||||
&& ./expand ./makeit \
|
||||
t//unzip/unzip.com t//zip/zip.com \
|
||||
&& touch /cosmopolitan-bootstrap.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/false
|
||||
# TODO: include these headers? https://0x0.st/Hcdi.c
|
||||
if [ ! -e /cosmopolitan-install.done ]; then
|
||||
: \
|
||||
&& cd /root/cosmopolitan \
|
||||
&& . ./env \
|
||||
&& export mode \
|
||||
\
|
||||
&& { [ ! -d dist ] || rm -r dist ;} \
|
||||
&& mkdir -p "dist/$flavor" \
|
||||
&& 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 \
|
||||
\
|
||||
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
|
||||
&& install -m0755 -t /usr/bin bin/apecopy bin/cosmocc bin/cosmoc++ \
|
||||
&& find libc -name '*.h' >headers.txt \
|
||||
&& expand tar zcf /tmp/headers.tar.gz -T headers.txt \
|
||||
libc/integral T//gdtoa/gdtoa.h T//getopt/long1.h \
|
||||
T//getopt/long2.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//chmod.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//zipcopy.com \
|
||||
b//zipobj.com \
|
||||
&& dedupe /tmp/bin "$COSMO/bin/" \
|
||||
&& cp "dist/$flavor/ape.elf" "$COSMO/bin/ape" \
|
||||
&& cp /root/cosmopolitan/env "$COSMO/env" \
|
||||
\
|
||||
&& mkdir -p "$COSMO/lib" \
|
||||
&& for lib in c dl gcc_s m pthread resolv rt dl z stdc++ \
|
||||
;do : \
|
||||
&& printf '\041\074\141\162\143\150\076\012' >"$COSMO/lib/lib$lib.a" \
|
||||
;done \
|
||||
\
|
||||
&& rm -r /root/cosmopolitan/dist \
|
||||
&& tar zxf "/tmp/headers.tar.gz" -C "$COSMO" \
|
||||
&& touch /cosmopolitan-install.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,55 @@
|
|||
#!/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
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmopolitan.done ]; then
|
||||
: \
|
||||
&& cd /root/cosmopolitan \
|
||||
&& export V=0 COLUMNS=80 TMPDIR=/tmp \
|
||||
&& . ./env \
|
||||
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
|
||||
&& printf '%s="%s"\n' >env \
|
||||
commit "$commit" \
|
||||
flavor "$COSMO_FLAVOR" \
|
||||
mode "$mode" \
|
||||
COSMO "/opt/cosmo" \
|
||||
COSMO_DIST "/opt/cosmo/dist/$COSMO_FLAVOR" \
|
||||
\
|
||||
&& . ./env \
|
||||
&& export mode \
|
||||
&& { makeit depend || find o -name '*.o' -delete ;} \
|
||||
&& makeit "o/$mode/third_party/make/make.com" \
|
||||
&& cp -int build/bootstrap "o/$mode/third_party/make/make.com" \
|
||||
\
|
||||
&& skip() { mkdir -p "${1%/*}" && touch -d @2222222222 "$1" ;} \
|
||||
&& skip "o/$mode/test/libc/calls/getgroups_test.com.runs" \
|
||||
&& `#skip "o/$mode/test/libc/calls/getpriority_test.com.runs"` \
|
||||
&& skip "o/$mode/test/libc/calls/open_test.com.runs" \
|
||||
&& `#skip "o/$mode/test/libc/stdio/tmpfile_test.com.runs"` \
|
||||
&& `#skip "o/$mode/third_party/python/Lib/test/test_ioctl.py.runs"` `# SIGSEGV` \
|
||||
&& skip "o/$mode/third_party/python/Lib/test/test_tarfile.py.runs" \
|
||||
&& if [ "$COSMO_FLAVOR" = dbg ] \
|
||||
;then : \
|
||||
&& expand makeit \
|
||||
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 b//ar.com b//chmod.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//zipcopy.com b//zipobj.com o//cosmopolitan.a \
|
||||
o//libc/crt/crt.o o/cosmopolitan.h t//make/make.com \
|
||||
t//unzip/unzip.com t//zip/zip.com \
|
||||
;else : \
|
||||
&& makeit all \
|
||||
;fi \
|
||||
&& touch /cosmopolitan.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/false
|
||||
if [ ! -e /cosmopolitan.done ]; then
|
||||
: \
|
||||
&& cd /root/cosmopolitan \
|
||||
&& export V=0 COLUMNS=80 TMPDIR=/tmp \
|
||||
&& export COSMO_FLAVOR=opt \
|
||||
&& . ./env \
|
||||
&& { [ "$COSMO_FLAVOR" != def ] && mode="$COSMO_FLAVOR" || mode= ;} \
|
||||
&& printf '%s="%s"\n' >env \
|
||||
commit "$commit" \
|
||||
flavor "$COSMO_FLAVOR" \
|
||||
mode "$mode" \
|
||||
COSMO "/opt/cosmo" \
|
||||
COSMO_DIST "/opt/cosmo/dist/$COSMO_FLAVOR" \
|
||||
\
|
||||
&& shed expand "s_o='o/[^']*'_o='o/$mode' _g" \
|
||||
\
|
||||
&& . ./env \
|
||||
&& { ./makeit MODE="$mode" depend || find o -name '*.o' -delete ;} \
|
||||
&& ./makeit MODE="$mode" "o/$mode/third_party/make/make.com" \
|
||||
&& cp -int build/bootstrap "o/$mode/third_party/make/make.com" \
|
||||
\
|
||||
&& skip() { mkdir -p "${1%/*}" && touch -d @2222222222 "$1" ;} \
|
||||
&& skip "o/$mode/test/libc/calls/getgroups_test.com.runs" \
|
||||
&& `#skip "o/$mode/test/libc/calls/getpriority_test.com.runs"` \
|
||||
&& `#skip "o/$mode/test/libc/stdio/tmpfile_test.com.runs"` \
|
||||
&& skip "o/$mode/third_party/python/Lib/test/test_ioctl.py.runs" `# SIGSEGV` \
|
||||
&& skip "o/$mode/third_party/python/Lib/test/test_tarfile.py.runs" \
|
||||
&& ./makeit MODE="$mode" all \
|
||||
&& touch /cosmopolitan.done \
|
||||
|| exit $?
|
||||
fi
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env sh
|
||||
if ! [ -d /vagrant ]; then
|
||||
printf '%s\n' 'THIS FILE IS ONLY MEANT TO BE RUN BY VAGRANT.' >&2
|
||||
exit 78 # EX_CONFIG
|
||||
fi
|
||||
|
||||
# don't leak local IPs (i'm sure it's fine though)
|
||||
unset SSH_CLIENT SSH_CONNECTION
|
||||
|
||||
export \
|
||||
BUSYBOX_SHA256=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314 \
|
||||
BUSYBOX_VERSION=1.36.1 \
|
||||
COSMO_COMMIT=032b1f3449f0103d5f58ac43a9479a2fd850fa49 \
|
||||
COSMO_SHA256=fbedf752603f03b3eb2efc5e7d221ad60e8e0ac7281ab6f4a34eefa255c29d33 \
|
||||
ENDLESSH_COMMIT=dfe44eb2c5b6fc3c48a39ed826fe0e4459cdf6ef \
|
||||
ENDLESSH_SHA256=c8989988af0a8c848d1a4979962f008c504a12ed6fe6a12e032c37feaa0ae5f8 \
|
||||
GMP_SHA256=a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 \
|
||||
GMP_VERSION=6.3.0 \
|
||||
HEATSHRINK_COMMIT=7d419e1fa4830d0b919b9b6a91fe2fb786cf3280 \
|
||||
HEATSHRINK_SHA256=b18a1b7ad6f51eac7ac1a81ca072703bd21d6d8727c05cd505843643705af65d \
|
||||
KISSAT_COMMIT=0865f474689b4e38a1c327ee03da8a0051c44b9e \
|
||||
KISSAT_SHA256=e0cfaa89710cd8b4d49b70b786a871331f483db78bbfbf329a7b826b8093c8cf \
|
||||
KUROKO_COMMIT=d6486b590a075911abf18c854d57c2c3a71d2ca3 \
|
||||
KUROKO_SHA256=4064a1eba35935011b4bc43639e4330b7903b56a11015b3556a30e0d0fb5ad1f \
|
||||
LR_COMMIT=5af9b79e4ecd07a600ded1a801023536cde97f95 \
|
||||
LR_SHA256=3901287cdcf09d0d8f77f8aaa19ca24e9a873d904e201ab8e7bf102426607dcc \
|
||||
MUON_COMMIT=e9af35467ffea9edf567a71cc6c31787327de994 \
|
||||
MUON_SHA256=2e342d912558564bbdf4ce5f7a88e099b28d59576d1a65eff9ae15cef4c73450 \
|
||||
SELFIE_COMMIT=22ed35605d46b95f23c8ceb6ec2e1b2fee93525d \
|
||||
SELFIE_SHA256=8e73d7770fc9217e98f85685780d6a487c7896baf9a174982f00acec3615a6bf \
|
||||
XE_COMMIT=8a2a4899769335bc14c62aef12cdf26f2f487f2a \
|
||||
XE_SHA256=f1ac997912c9be92a74a67a766dde74d1f9b6b20e48d7c7e71598ad4b787b37d \
|
||||
YICES_COMMIT=6903281942d9ea67f09a1dd493167ce2bc466b87 \
|
||||
YICES_SHA256=32a38b1c22adc4df7030e039f43bd5c51486136fcb41665554cace6525265114 \
|
||||
;
|
||||
|
||||
if [ ! -e /notwa-util.done ]; then
|
||||
: \
|
||||
&& cd /vagrant/notwa-util \
|
||||
&& install -p -m 0755 -t /usr/local/bin/ \
|
||||
acquire dedupe expand makeit ofc quickconf shed \
|
||||
&& touch /notwa-util.done \
|
||||
|| exit $?
|
||||
fi
|
||||
|
||||
export COSMO_FLAVOR=fastbuild || exit $?
|
||||
. /vagrant/notwa-util/cosmopolitan-bootstrap11 || exit $?
|
||||
export COSMO_FLAVOR=opt || exit $?
|
||||
. /vagrant/notwa-util/cosmopolitan11 || exit $?
|
||||
cd /root/cosmopolitan && . ./env || exit $?
|
||||
export COSMO COSMO_DIST
|
||||
export COSMOS="$COSMO" MODE="$mode"
|
||||
. /vagrant/notwa-util/cosmopolitan-install11 || exit $?
|
||||
|
||||
# TODO: make this less of a hot mess:
|
||||
sed \
|
||||
-e 's,/o/third_party/gcc/,/gcc/,g' \
|
||||
-e 's,/o/$MODE/tool/build/,/bin/,g' \
|
||||
-e 's,/o/$MODE/cosmopolitan.a,/dist/$MODE/cosmopolitan.a,g' \
|
||||
-e 's,/libc/crt/,/dist/$MODE/,g' \
|
||||
-e 's,/o/$MODE/,/,g' \
|
||||
-e 's,/ape/,/dist/$MODE/,g' \
|
||||
-e "s,\$MODE\\b,$MODE,g" \
|
||||
-e "s,/opt/cosmos\\b,/opt/cosmo,g" \
|
||||
-e "s,/o//tool/build/,/bin/,g" \
|
||||
-e "s,.* must not contain hyphens .*,:," \
|
||||
-i /usr/bin/apecopy /usr/bin/cosmocc /usr/bin/cosmoc++
|
||||
|
||||
cd /root && export PATH="$COSMO/bin:$COSMO/gcc/bin:$PATH" || exit $?
|
||||
unset V COLUMNS TMPDIR
|
||||
. /vagrant/notwa-util/cosmo-kuroko11 || exit $?
|
||||
# . /vagrant/notwa-util/cosmo-mini11 || exit $?
|
||||
# . /vagrant/notwa-util/cosmo-muon11 || exit $?
|
||||
unset CC CFLAGS MODE mode
|
||||
. /vagrant/notwa-util/cosmo-yices11 || exit $?
|
||||
|
||||
: \
|
||||
&& cd /root \
|
||||
&& . ./cosmopolitan/env \
|
||||
&& export \
|
||||
&& echo \
|
||||
&& mkdir -p /vagrant/out/vagrant \
|
||||
&& for com in \
|
||||
`# endlessh/endlessh.com` \
|
||||
`# heatshrink/heatshrink.com` \
|
||||
kissat/build/kissat.com \
|
||||
kuroko/kuroko.com \
|
||||
`#lr/lr.com` \
|
||||
`#muon/build/muon.com` \
|
||||
`#selfie/selfie.com` \
|
||||
`#xe/xe.com` \
|
||||
yices/dist/bin/yices-sat.com \
|
||||
yices/dist/bin/yices-smt.com \
|
||||
yices/dist/bin/yices-smt2.com \
|
||||
yices/dist/bin/yices.com \
|
||||
;do : \
|
||||
&& du -k "$com" \
|
||||
&& install -p -m 0755 -t /vagrant/out/vagrant "$com" \
|
||||
;done \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/examples \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/examples" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/third_party \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/third_party" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/tool \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/tool" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& find -type f -name '*.com' | sort \
|
||||
&& echo \
|
||||
&& ls -1 /*.done \
|
||||
|| exit $?
|
|
@ -0,0 +1,128 @@
|
|||
#!/usr/bin/env sh
|
||||
if ! [ -d /vagrant ]; then
|
||||
printf '%s\n' 'THIS FILE IS ONLY MEANT TO BE RUN BY VAGRANT.' >&2
|
||||
exit 78 # EX_CONFIG
|
||||
fi
|
||||
|
||||
# NOTE: Please consider this post documenting some pitfalls of set -e:
|
||||
# https://gist.github.com/notwa/5b8dda28e571b27638fb33e08dc1ba21
|
||||
# set -e
|
||||
|
||||
# don't leak local IPs (i'm sure it's fine though)
|
||||
unset SSH_CLIENT SSH_CONNECTION
|
||||
|
||||
# NOTE: this is the last version based around gcc 9.2:
|
||||
# COSMO_COMMIT=682b74ed883d1d6f9aa23179af841d9971c23e4d \
|
||||
# COSMO_SHA256=71dace03135ac2b97384021a37df5871572cf34524efb5a21812e115dca15b1b \
|
||||
# versions thereafter are based around gcc 11.2 or later.
|
||||
|
||||
export \
|
||||
BUSYBOX_SHA256=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314 \
|
||||
BUSYBOX_VERSION=1.36.1 \
|
||||
COSMO_COMMIT=682b74ed883d1d6f9aa23179af841d9971c23e4d \
|
||||
COSMO_FLAVOR=fastbuild \
|
||||
COSMO_SHA256=71dace03135ac2b97384021a37df5871572cf34524efb5a21812e115dca15b1b \
|
||||
ENDLESSH_COMMIT=dfe44eb2c5b6fc3c48a39ed826fe0e4459cdf6ef \
|
||||
ENDLESSH_SHA256=c8989988af0a8c848d1a4979962f008c504a12ed6fe6a12e032c37feaa0ae5f8 \
|
||||
GMP_SHA256=fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2 \
|
||||
GMP_VERSION=6.2.1 \
|
||||
HEATSHRINK_COMMIT=7d419e1fa4830d0b919b9b6a91fe2fb786cf3280 \
|
||||
HEATSHRINK_SHA256=b18a1b7ad6f51eac7ac1a81ca072703bd21d6d8727c05cd505843643705af65d \
|
||||
KISSAT_COMMIT=315cd3227fd2321d29d10f7d8572011bf00174a5 \
|
||||
KISSAT_SHA256=031fca7efcb17c6f1921dd056052bd373de724e445fc2ed37bfdd5954148119f \
|
||||
KUROKO_COMMIT=b88267c8289c4eeea3d0219d43193a9a5fd9982b \
|
||||
KUROKO_SHA256=52e22c2e701f58cef635f0df3faaa0734ae85dd656417aaaae01226a3a7725d3 \
|
||||
LR_COMMIT=5af9b79e4ecd07a600ded1a801023536cde97f95 \
|
||||
LR_SHA256=3901287cdcf09d0d8f77f8aaa19ca24e9a873d904e201ab8e7bf102426607dcc \
|
||||
MUON_COMMIT=6cdf084804fb8262a7f29ac9e9b614472b62b8a3 \
|
||||
MUON_SHA256=60b37463fbeb757dd595f50d03116a7f9fe1e727d2852369de0052008e696e2b \
|
||||
SELFIE_COMMIT=9d5cf9caac9b00ac48b96c527ddda6c550f652fa \
|
||||
SELFIE_SHA256=5ea9e9cd7df6e6e67e3757cd8483e8e653fa4d7469275f3fdf89483c2744d4a9 \
|
||||
XE_COMMIT=8a2a4899769335bc14c62aef12cdf26f2f487f2a \
|
||||
XE_SHA256=f1ac997912c9be92a74a67a766dde74d1f9b6b20e48d7c7e71598ad4b787b37d \
|
||||
YICES_COMMIT=36cee66d04de90da35fab6131bebdc45b6d74342 \
|
||||
YICES_SHA256=f6bbfa30c38c17401fb651a06d935bec87af732ffeea3fa0db7dd22b1916e374 \
|
||||
;
|
||||
|
||||
if [ ! -e /notwa-util.done ]; then
|
||||
: \
|
||||
&& cd /vagrant/notwa-util \
|
||||
&& install -p -m 0755 -t /usr/local/bin/ acquire cosmocc dedupe ofc quickconf shed \
|
||||
&& touch /notwa-util.done \
|
||||
|| exit $?
|
||||
fi
|
||||
|
||||
. /vagrant/notwa-util/cosmopolitan-bootstrap9 || exit $?
|
||||
. /vagrant/notwa-util/cosmopolitan9 || exit $?
|
||||
cd /root/cosmopolitan && . ./env || exit $?
|
||||
export COSMO COSMO_DIST
|
||||
. /vagrant/notwa-util/cosmopolitan-install9 || exit $?
|
||||
cd /root && export PATH="$COSMO/bin:$COSMO/gcc/bin:$PATH" || exit $?
|
||||
unset V COLUMNS TMPDIR
|
||||
. /vagrant/notwa-util/cosmo-kuroko9 || exit $?
|
||||
. /vagrant/notwa-util/cosmo-mini9 || exit $?
|
||||
. /vagrant/notwa-util/cosmo-muon9 || exit $?
|
||||
unset CC CFLAGS
|
||||
. /vagrant/notwa-util/cosmo-yices9 || exit $?
|
||||
unset local_fn remote_url dest sha256
|
||||
|
||||
# kuroko.orig/kuroko.com # wtf?
|
||||
|
||||
# NOTE: different programs with the same names:
|
||||
# NOTE: (we actually ignore the ones in the /test/ directory)
|
||||
# ar.com cosmopolitan/o/opt/tool/build/ar.com
|
||||
# ar.com cosmopolitan/o/opt/tool/decode/ar.com
|
||||
# hello.com cosmopolitan/o/opt/examples/hello.com
|
||||
# hello.com cosmopolitan/o/opt/third_party/python/hello.com
|
||||
# hello.com cosmopolitan/o/opt/tool/hello/hello.com
|
||||
# life.com cosmopolitan/o/opt/examples/life.com
|
||||
# life.com cosmopolitan/o/opt/test/libc/mem/prog/life.com
|
||||
# life.com cosmopolitan/o/opt/tool/viz/life.com
|
||||
# symtab.com cosmopolitan/o/opt/examples/symtab.com
|
||||
# symtab.com cosmopolitan/o/opt/tool/build/symtab.com
|
||||
# zip.com cosmopolitan/o/opt/third_party/zip/zip.com
|
||||
# zip.com cosmopolitan/o/opt/tool/decode/zip.com
|
||||
|
||||
: \
|
||||
&& cd /root \
|
||||
&& . ./cosmopolitan/env \
|
||||
&& export \
|
||||
&& echo \
|
||||
&& mkdir -p /vagrant/out/vagrant \
|
||||
&& for com in \
|
||||
endlessh/endlessh.com \
|
||||
heatshrink/heatshrink.com \
|
||||
kissat/build/kissat.com \
|
||||
kuroko/kuroko.com \
|
||||
lr/lr.com \
|
||||
muon/build/muon.com \
|
||||
selfie/selfie.com \
|
||||
xe/xe.com \
|
||||
yices/dist/bin/yices-sat.com \
|
||||
yices/dist/bin/yices-smt.com \
|
||||
yices/dist/bin/yices-smt2.com \
|
||||
yices/dist/bin/yices.com \
|
||||
;do : \
|
||||
&& du -k "$com" \
|
||||
&& install -p -m 0755 -t /vagrant/out/vagrant "$com" \
|
||||
;done \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/examples \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/examples" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/third_party \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/third_party" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& d=/vagrant/out/vagrant/tool \
|
||||
&& mkdir -p "$d" \
|
||||
&& find "cosmopolitan/o/$mode/tool" -type f -name '*.com' \
|
||||
-exec install -p -m 0755 -t "$d" {} + \
|
||||
&& echo \
|
||||
&& find -type f -name '*.com' | sort \
|
||||
&& echo \
|
||||
&& ls -1 /*.done \
|
||||
|| exit $?
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
o=o/"$mode" once=false
|
||||
for f; do g="${f#?//}"; case "$f" in
|
||||
(a//*) f="$o/ape/$g";;
|
||||
(b//*) f="$o/tool/build/$g";;
|
||||
(e//*) f="$o/examples/$g";;
|
||||
(o//*) f="$o/$g";;
|
||||
(t//*) f="$o/third_party/$g";;
|
||||
(T//*) f="third_party/$g";;
|
||||
esac; $once && set -- "$@" "$f" || set -- "$f"; once=true; done
|
||||
"$@"
|
|
@ -0,0 +1,176 @@
|
|||
--- kuroko.orig/Makefile
|
||||
+++ kuroko/Makefile
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
all: ${TARGET} ${MODULES} ${TOOLS} ${GENMODS}
|
||||
|
||||
-ifneq ($(shell tools/can-floor-without-libm.sh $(CC)),yes)
|
||||
- LDLIBS += -lm
|
||||
-endif
|
||||
|
||||
ifeq (,$(findstring mingw,$(CC)))
|
||||
CFLAGS += -pthread
|
||||
@@ -60,8 +57,15 @@
|
||||
CFLAGS += -DKRK_DISABLE_DEBUG
|
||||
endif
|
||||
|
||||
+ifdef KRK_DISABLE_DYNAMIC
|
||||
+ BIN_OBJS += src/modules/module_math.o src/modules/module_random.o src/modules/module_socket.o src/modules/module_timeit.o src/modules/module_wcwidth.o
|
||||
+ CFLAGS += -DKRK_DISABLE_DYNAMIC -DSTATIC_ONLY
|
||||
+endif
|
||||
+
|
||||
ifdef KRK_DISABLE_THREADS
|
||||
CFLAGS += -DKRK_DISABLE_THREADS
|
||||
+else
|
||||
+ CFLAGS += -DKRK_MEDIOCRE_TLS
|
||||
endif
|
||||
|
||||
ifdef KRK_NO_DISASSEMBLY
|
||||
--- kuroko.orig/src/kuroko.c
|
||||
+++ kuroko/src/kuroko.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -1081,7 +1082,10 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- if (buf[strlen(buf)-1] != '\n') {
|
||||
+ size_t buflen = strlen(buf);
|
||||
+ if (buf[buflen-1] == '\n') {
|
||||
+ if (buflen >= 2 && buf[buflen-2] == '\r') buf[buflen-2] = '\n', buf[buflen-1] = '0';
|
||||
+ } else {
|
||||
/* rline shouldn't allow this as it doesn't accept ^D to submit input
|
||||
* unless the line is empty, but just in case... */
|
||||
fprintf(stderr, "Expected end of line in repl input. Did you ^D early?\n");
|
||||
--- kuroko.orig/src/modules/module_socket.c
|
||||
+++ kuroko/src/modules/module_socket.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
+#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef AF_UNIX
|
||||
#include <sys/un.h>
|
||||
@@ -191,7 +192,7 @@
|
||||
*sock_size = sizeof(struct sockaddr_in6);
|
||||
sin->sin6_family = AF_INET6;
|
||||
sin->sin6_port = htons(AS_int(addr->values.values[1]));
|
||||
- sin->sin6_addr = in6addr_any;
|
||||
+ sin->sin6_addr = (struct in6_addr){0};
|
||||
return 0;
|
||||
} else {
|
||||
struct addrinfo *result;
|
||||
--- kuroko.orig/src/threads.c
|
||||
+++ kuroko/src/threads.c
|
||||
@@ -77,7 +77,7 @@
|
||||
/* Get our run function */
|
||||
struct Thread * self = _threadObj;
|
||||
self->threadState = &krk_currentThread;
|
||||
- self->tid = gettid();
|
||||
+ self->tid = pthread_getthreadid_np();
|
||||
|
||||
KrkValue runMethod = NONE_VAL();
|
||||
KrkClass * ourType = self->inst._class;
|
||||
--- kuroko.orig/src/vm.c
|
||||
+++ kuroko/src/vm.c
|
||||
@@ -17,6 +17,21 @@
|
||||
#include "private.h"
|
||||
#include "opcode_enum.h"
|
||||
|
||||
+#ifdef KRK_DISABLE_DYNAMIC
|
||||
+KrkValue krk_module_onload_math(void);
|
||||
+KrkValue krk_module_onload_random(void);
|
||||
+KrkValue krk_module_onload_socket(void);
|
||||
+KrkValue krk_module_onload_timeit(void);
|
||||
+KrkValue krk_module_onload_wcwidth(void);
|
||||
+#endif
|
||||
+
|
||||
+#define BUILTIN_MODULE(name, init) { \
|
||||
+ KrkInstance * module = (KrkInstance*)AS_OBJECT(init()); \
|
||||
+ krk_attachNamedObject(&vm.modules, name, (KrkObj*)module); \
|
||||
+ krk_attachNamedObject(&module->fields, "__name__", (KrkObj*)S(name)); \
|
||||
+ krk_attachNamedValue(&module->fields, "__file__", NONE_VAL()); \
|
||||
+}
|
||||
+
|
||||
/* Ensure we don't have a macro for this so we can reference a local version. */
|
||||
#undef krk_currentThread
|
||||
|
||||
@@ -34,7 +49,6 @@
|
||||
* can generally be allocated even with dlopen, but this is
|
||||
* not guaranteed.
|
||||
*/
|
||||
-__attribute__((tls_model("initial-exec")))
|
||||
__thread KrkThreadState krk_currentThread;
|
||||
#else
|
||||
/* There is only one thread, so don't store it as TLS... */
|
||||
@@ -901,6 +915,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#define CACHE_SIZE 4096
|
||||
+typedef struct {
|
||||
+ KrkString * name;
|
||||
+ struct KrkClass * owner;
|
||||
+ KrkValue value;
|
||||
+ size_t index;
|
||||
+} KrkClassCacheEntry;
|
||||
+static KrkClassCacheEntry * cache = 0;
|
||||
+static size_t nextCount = 1;
|
||||
+
|
||||
void krk_initVM(int flags) {
|
||||
#if !defined(KRK_DISABLE_THREADS) && defined(__APPLE__) && defined(__aarch64__)
|
||||
krk_forceThreadData();
|
||||
@@ -909,6 +933,7 @@
|
||||
vm.globalFlags = flags & 0xFF00;
|
||||
vm.maximumCallDepth = KRK_CALL_FRAMES_MAX;
|
||||
|
||||
+ cache = calloc(CACHE_SIZE, sizeof(KrkClassCacheEntry));
|
||||
/* Reset current thread */
|
||||
krk_resetStack();
|
||||
krk_currentThread.frames = calloc(vm.maximumCallDepth,sizeof(KrkCallFrame));
|
||||
@@ -976,6 +1001,13 @@
|
||||
#ifndef KRK_DISABLE_DEBUG
|
||||
krk_module_init_dis();
|
||||
#endif
|
||||
+#ifdef KRK_DISABLE_DYNAMIC
|
||||
+ BUILTIN_MODULE("math", krk_module_onload_math)
|
||||
+ BUILTIN_MODULE("random", krk_module_onload_random)
|
||||
+ BUILTIN_MODULE("socket", krk_module_onload_socket)
|
||||
+ BUILTIN_MODULE("timeit", krk_module_onload_timeit)
|
||||
+ BUILTIN_MODULE("wcwidth", krk_module_onload_wcwidth)
|
||||
+#endif
|
||||
#ifndef KRK_DISABLE_THREADS
|
||||
krk_module_init_threading();
|
||||
#endif
|
||||
@@ -1014,6 +1046,7 @@
|
||||
|
||||
extern void krk_freeMemoryDebugger(void);
|
||||
krk_freeMemoryDebugger();
|
||||
+ cache = (free(cache), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1608,16 +1641,6 @@
|
||||
int krk_doRecursiveModuleLoad(KrkString * name) {
|
||||
return krk_importModule(name,name);
|
||||
}
|
||||
-
|
||||
-#define CACHE_SIZE 4096
|
||||
-typedef struct {
|
||||
- KrkString * name;
|
||||
- struct KrkClass * owner;
|
||||
- KrkValue value;
|
||||
- size_t index;
|
||||
-} KrkClassCacheEntry;
|
||||
-static KrkClassCacheEntry cache[CACHE_SIZE] = {0};
|
||||
-static size_t nextCount = 1;
|
||||
|
||||
static KrkClass * checkCache(KrkClass * type, KrkString * name, KrkValue * method) {
|
||||
size_t index = (name->obj.hash ^ (type->obj.hash << 4)) & (CACHE_SIZE-1);
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
build/bootstrap/make.com -j2 MODE="$mode" "$@"
|
|
@ -0,0 +1,61 @@
|
|||
diff -rU3 a/third_party/sqlite3/zipfile.c b/third_party/sqlite3/zipfile.c
|
||||
--- a/third_party/sqlite3/zipfile.c 2023-06-13 01:39:06.538998700 +0200
|
||||
+++ b/third_party/sqlite3/zipfile.c 2023-06-13 01:40:24.578767300 +0200
|
||||
@@ -338,7 +338,7 @@
|
||||
|
||||
if( argc>3 ){
|
||||
zFile = argv[3];
|
||||
- nFile = (int)strlen(zFile)+1;
|
||||
+ nFile = (int)strnlen(zFile,0x7FFFFFFF)+1;
|
||||
}
|
||||
|
||||
rc = sqlite3_declare_vtab(db, ZIPFILE_SCHEMA);
|
||||
@@ -1421,10 +1421,10 @@
|
||||
** nB is the value of strlen(zB). This function returns 0 if the strings are
|
||||
** identical, ignoring any trailing '/' character in either path. */
|
||||
static int zipfileComparePath(const char *zA, const char *zB, int nB){
|
||||
- int nA = (int)strlen(zA);
|
||||
+ int nA = (int)strnlen(zA,0x7FFFFFFF);
|
||||
if( nA>0 && zA[nA-1]=='/' ) nA--;
|
||||
if( nB>0 && zB[nB-1]=='/' ) nB--;
|
||||
- if( nA==nB && memcmp(zA, zB, nA)==0 ) return 0;
|
||||
+ if( nA==nB && memcmp(zA, zB, (unsigned int)nA)==0 ) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1544,7 +1544,7 @@
|
||||
/* If this is a DELETE or UPDATE, find the archive entry to delete. */
|
||||
if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
|
||||
const char *zDelete = (const char*)sqlite3_value_text(apVal[0]);
|
||||
- int nDelete = (int)strlen(zDelete);
|
||||
+ int nDelete = (int)strnlen(zDelete,0x7FFFFFFF);
|
||||
if( nVal>1 ){
|
||||
const char *zUpdate = (const char*)sqlite3_value_text(apVal[1]);
|
||||
if( zUpdate && zipfileComparePath(zUpdate, zDelete, nDelete)!=0 ){
|
||||
@@ -1612,7 +1612,7 @@
|
||||
if( rc==SQLITE_OK ){
|
||||
zPath = (const char*)sqlite3_value_text(apVal[2]);
|
||||
if( zPath==0 ) zPath = "";
|
||||
- nPath = (int)strlen(zPath);
|
||||
+ nPath = (int)strnlen(zPath,0x7FFFFFFF);
|
||||
mTime = zipfileGetTime(apVal[4]);
|
||||
}
|
||||
|
||||
@@ -1628,7 +1628,7 @@
|
||||
rc = SQLITE_NOMEM;
|
||||
nPath = 0;
|
||||
}else{
|
||||
- nPath = (int)strlen(zPath);
|
||||
+ nPath = (int)strnlen(zPath,0x7FFFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2034,7 +2034,7 @@
|
||||
rc = SQLITE_NOMEM;
|
||||
goto zipfile_step_out;
|
||||
}
|
||||
- nName = (int)strlen(zName);
|
||||
+ nName = (int)strnlen(zName,0x7FFFFFFF);
|
||||
}else{
|
||||
while( nName>1 && zName[nName-2]=='/' ) nName--;
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/assimilate.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/assimilate.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/bd.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/bd.com"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/bing.* /bin/
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unbing.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/bing.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/blinkenlights.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/blinkenlights.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/awk.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/awk.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/chibicc.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/chibicc.com"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/lua.* /bin/
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/luac.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/lua.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/make.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/make.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/python.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/python.com"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/qjs.* /bin/
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/qjsc.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/qjs.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/sed.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/sed.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/sqlite3.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/sqlite3.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/fold.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/fold.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/greenbean.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/greenbean.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/hello.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/hello.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/life.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/life.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/memzoom.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/memzoom.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/mkdeps.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/mkdeps.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/pledge.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/pledge.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/printimage.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/printimage.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/printvideo.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/printvideo.com"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-demo.* /bin/
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-original.* /bin/
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/redbean-static.* /bin/
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/tinyemu.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/tinyemu.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unbourne.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/unbourne.com"]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
FROM rescue
|
||||
FROM localhost/rescue
|
||||
COPY --chmod=0755 --from=localhost/cosmo-all /usr/local/bin/unveil.* /bin/
|
||||
ENTRYPOINT ["/bin/ape", "/bin/unveil.com"]
|
||||
|
|
Loading…
Reference in New Issue