kuroko: improve patch a little

overhaul
Connor Olding 2 months ago
parent b1c09ae02f
commit fba46c47db

@ -24,10 +24,12 @@ COPY --from=downloader /kuroko /kuroko
WORKDIR /kuroko
RUN : \
&& cp -r . ../kuroko.orig \
\
&& sed -i '/bind(gamma)/{N;N;d;}' src/modules/module_math.c \
&& sed -i '/MATH_ONE(gamma)/d' src/modules/module_math.c \
\
&& sed -i 's_.*char \*\* environ.*_/* & */_' src/os.c \
&& sed -i 's@.*char \*\* environ.*@#ifndef COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_\n&\n#endif@' src/os.c \
\
&& sed -i '/FUNC_SIG(list,append)/d' src/vm.c \
&& sed -i '/void _callSetName/i\\extern FUNC_SIG(list,append);' src/vm.c \
@ -35,11 +37,11 @@ RUN : \
&& sed -i '/static.*cache/c\\static KrkClassCacheEntry * cache = 0;' src/vm.c \
&& sed -i $'/define CACHE_SIZE/,/nextCount/{N;w /temp\nd}' src/vm.c \
&& sed -i $'/void krk_initVM/{r /temp\nN}' src/vm.c \
&& sed -i '/Reset current thread/i\\cache = calloc(CACHE_SIZE, sizeof(KrkClassCacheEntry));' src/vm.c \
&& sed -i '/krk_freeMemoryDebugger/a\\cache = (free(cache), NULL);' src/vm.c \
&& sed -i $'/Reset current thread/i\\\tcache = calloc(CACHE_SIZE, sizeof(KrkClassCacheEntry));' src/vm.c \
&& sed -i $'/krk_freeMemoryDebugger();/a\\\tcache = (free(cache), NULL);' src/vm.c \
\
&& sed -i '/define gettid/d' src/threads.c \
&& sed -i '/initial-exec/d' src/vm.c \
&& sed -i '/"initial-exec"/d' src/vm.c \
\
&& sed -i $'/Ensure we don\'t have a macro/{\ni\\\
\#ifdef KRK_DISABLE_DYNAMIC\\\n\
@ -94,12 +96,10 @@ ifdef KRK_DISABLE_DYNAMIC\\\n\
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\\\n\
CFLAGS += -DKRK_DISABLE_DYNAMIC -DSTATIC_ONLY\\\n\
endif\\\n\
\\\n\
' Makefile \
&& sed -i $'/CFLAGS += -DKRK_DISABLE_THREADS/a\\\
else\\\n\
CFLAGS += -DKRK_MEDIOCRE_TLS\\\n\
\\\n\
CFLAGS += -DKRK_MEDIOCRE_TLS\
' Makefile \
\
&& { diff -NrU3 /kuroko.orig/ /kuroko/ > /kuroko.patch; [ $? -le 1 ]; }
@ -108,7 +108,7 @@ else\\\n\
RUN : \
# this isn't included in the patch because it's super specific to cosmopolitan. \
&& sed -i 's/int main/dontinline int _main/' src/kuroko.c \
&& printf %s $'\n\
&& printf %s >>src/kuroko.c $'\n\
STATIC_YOINK("__die");\n\
void ShowCrashReports(void);\n\
int LoadZipArgs(int *, char ***);\n\
@ -117,7 +117,7 @@ int main(int argc, char * argv[]) {\n\
\tLoadZipArgs(&argc, &argv);\n\
\treturn _main(argc, argv);\n\
}\n\
' >> src/kuroko.c
'
RUN tar zxf /cosmopolitan/dist/headers.tar.gz -C /cosmopolitan
COPY --chmod=0755 --from=localhost/notwa-util /usr/local/bin/cosmocc /usr/bin/

Loading…
Cancel
Save