Restore zip.com and .symtab files

This change restores the .symtab symbol table files in our flagship
programs (e.g. redbean.com, python.com) needed to show backtraces. This
also rolls back earlier changes to zip.com w.r.t. temp directories since
the right way to do it turned out to be the -b DIR flag.

This change also improves the performance of zip.com. It turned out
mmap() wasn't being used, because zip.com was assuming a 4096-byte
granularity, but cosmo requires 65536. There was also a chance to speed
up stdio scanning using the unlocked functions.
This commit is contained in:
Justine Tunney 2022-08-21 00:17:20 -07:00
parent 35203c0551
commit 73845be1f0
27 changed files with 256 additions and 246 deletions

Binary file not shown.

View file

@ -65,7 +65,6 @@ ZIPOBJ = build/bootstrap/zipobj.com
FIXUPOBJ = build/bootstrap/fixupobj.com FIXUPOBJ = build/bootstrap/fixupobj.com
MKDIR = build/bootstrap/mkdir.com -p MKDIR = build/bootstrap/mkdir.com -p
COMPILE = build/bootstrap/compile.com -V9 -P4096 $(QUOTA) COMPILE = build/bootstrap/compile.com -V9 -P4096 $(QUOTA)
SYMTAB = $(TMPDIR)/$(subst /,_,$@).symtab
COMMA := , COMMA := ,
PWD := $(shell build/bootstrap/pwd.com) PWD := $(shell build/bootstrap/pwd.com)
@ -108,6 +107,12 @@ export MODE
export SOURCE_DATE_EPOCH export SOURCE_DATE_EPOCH
export TMPDIR export TMPDIR
ifeq ($(LANDLOCKMAKE_VERSION),)
TMPSAFE = $(TMPDIR)/$(subst /,_,$@)
else
TMPSAFE = $(TMPDIR)/
endif
FTRACE = \ FTRACE = \
-pg -pg

View file

@ -75,12 +75,12 @@ o/%.a:
@$(COMPILE) -AARCHIVE -wT$@ $(AR) $(ARFLAGS) $@ @$(TMPDIR)/$(subst /,_,$@) @$(COMPILE) -AARCHIVE -wT$@ $(AR) $(ARFLAGS) $@ @$(TMPDIR)/$(subst /,_,$@)
o/%.pkg: o/%.pkg:
$(file >$(TMPDIR)/$(subst /,_,$@).args,$(filter %.o,$^)) $(file >$(TMPSAFE).args,$(filter %.o,$^))
@$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPDIR)/$(subst /,_,$@) @$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPSAFE).args
o/$(MODE)/%.pkg: o/$(MODE)/%.pkg:
$(file >$(TMPDIR)/$(subst /,_,$@),$(filter %.o,$^)) $(file >$(TMPSAFE).args,$(filter %.o,$^))
@$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPDIR)/$(subst /,_,$@) @$(COMPILE) -APACKAGE -wT$@ $(PKG) $(OUTPUT_OPTION) $(addprefix -d,$(filter %.pkg,$^)) @$(TMPSAFE).args
o/$(MODE)/%.o: %.py o/$(MODE)/third_party/python/pyobj.com o/$(MODE)/%.o: %.py o/$(MODE)/third_party/python/pyobj.com
@$(COMPILE) -wAPYOBJ o/$(MODE)/third_party/python/pyobj.com $(PYFLAGS) -o $@ $< @$(COMPILE) -wAPYOBJ o/$(MODE)/third_party/python/pyobj.com $(PYFLAGS) -o $@ $<
@ -148,3 +148,24 @@ o/%.okk: %
o/$(MODE)/%.okk: .UNSANDBOXED = 1 o/$(MODE)/%.okk: .UNSANDBOXED = 1
o/$(MODE)/%.okk: % o/$(MODE)/%.okk: %
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $< @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
################################################################################
# executable helpers
MAKE_OBJCOPY = \
$(COMPILE) -AOBJCOPY -T$@ \
$(OBJCOPY) -S -O binary $< $@
MAKE_SYMTAB_CREATE = \
$(COMPILE) -wASYMTAB \
o/$(MODE)/tool/build/symtab.com \
-o $(TMPSAFE)/.symtab \
$<
MAKE_SYMTAB_ZIP = \
$(COMPILE) -AZIP -T$@ \
o/$(MODE)/third_party/zip/zip.com \
-b$(TMPDIR) \
-9qj \
$@ \
$(TMPSAFE)/.symtab

View file

@ -22,6 +22,7 @@
#include "libc/calls/syscall-nt.internal.h" #include "libc/calls/syscall-nt.internal.h"
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/log/backtrace.internal.h" #include "libc/log/backtrace.internal.h"
#include "libc/zipos/zipos.internal.h" #include "libc/zipos/zipos.internal.h"
@ -47,6 +48,7 @@ int64_t lseek(int fd, int64_t offset, unsigned whence) {
} else { } else {
rc = sys_lseek_nt(fd, offset, whence); rc = sys_lseek_nt(fd, offset, whence);
} }
STRACE("lseek(%d, %'ld, %d) → %'ld% m", fd, offset, whence, rc); STRACE("lseek(%d, %'ld, %s) → %'ld% m", fd, offset, DescribeWhence(whence),
rc);
return rc; return rc;
} }

View file

@ -51,14 +51,15 @@ const char *DescribeSockOptname(char[32], int, int);
const char *DescribeSocketFamily(char[12], int); const char *DescribeSocketFamily(char[12], int);
const char *DescribeSocketProtocol(char[12], int); const char *DescribeSocketProtocol(char[12], int);
const char *DescribeSocketType(char[64], int); const char *DescribeSocketType(char[64], int);
const char *DescribeWhence(char[12], int);
#define DescribeCapability(x) DescribeCapability(alloca(20), x) #define DescribeCapability(x) DescribeCapability(alloca(20), x)
#define DescribeClockName(x) DescribeClockName(alloca(32), x) #define DescribeClockName(x) DescribeClockName(alloca(32), x)
#define DescribeDirfd(dirfd) DescribeDirfd(alloca(12), dirfd) #define DescribeDirfd(x) DescribeDirfd(alloca(12), x)
#define DescribeFrame(x) DescribeFrame(alloca(32), x) #define DescribeFrame(x) DescribeFrame(alloca(32), x)
#define DescribeFutexResult(x) DescribeFutexResult(alloca(12), x) #define DescribeFutexResult(x) DescribeFutexResult(alloca(12), x)
#define DescribeHow(x) DescribeHow(alloca(12), x) #define DescribeHow(x) DescribeHow(alloca(12), x)
#define DescribeMapFlags(dirfd) DescribeMapFlags(alloca(64), dirfd) #define DescribeMapFlags(x) DescribeMapFlags(alloca(64), x)
#define DescribeMapping(x, y) DescribeMapping(alloca(8), x, y) #define DescribeMapping(x, y) DescribeMapping(alloca(8), x, y)
#define DescribeNtConsoleInFlags(x) DescribeNtConsoleInFlags(alloca(256), x) #define DescribeNtConsoleInFlags(x) DescribeNtConsoleInFlags(alloca(256), x)
#define DescribeNtConsoleOutFlags(x) DescribeNtConsoleOutFlags(alloca(128), x) #define DescribeNtConsoleOutFlags(x) DescribeNtConsoleOutFlags(alloca(128), x)
@ -77,10 +78,10 @@ const char *DescribeSocketType(char[64], int);
#define DescribeOpenFlags(x) DescribeOpenFlags(alloca(128), x) #define DescribeOpenFlags(x) DescribeOpenFlags(alloca(128), x)
#define DescribePersonalityFlags(p) DescribePersonalityFlags(alloca(128), p) #define DescribePersonalityFlags(p) DescribePersonalityFlags(alloca(128), p)
#define DescribePollFlags(p) DescribePollFlags(alloca(64), p) #define DescribePollFlags(p) DescribePollFlags(alloca(64), p)
#define DescribeProtFlags(dirfd) DescribeProtFlags(alloca(48), dirfd) #define DescribeProtFlags(x) DescribeProtFlags(alloca(48), x)
#define DescribePtrace(i) DescribePtrace(alloca(12), i) #define DescribePtrace(i) DescribePtrace(alloca(12), i)
#define DescribePtraceEvent(x) DescribePtraceEvent(alloca(32), x) #define DescribePtraceEvent(x) DescribePtraceEvent(alloca(32), x)
#define DescribeRemapFlags(dirfd) DescribeRemapFlags(alloca(48), dirfd) #define DescribeRemapFlags(x) DescribeRemapFlags(alloca(48), x)
#define DescribeRlimitName(rl) DescribeRlimitName(alloca(20), rl) #define DescribeRlimitName(rl) DescribeRlimitName(alloca(20), rl)
#define DescribeSchedPolicy(x) DescribeSchedPolicy(alloca(48), x) #define DescribeSchedPolicy(x) DescribeSchedPolicy(alloca(48), x)
#define DescribeSockLevel(x) DescribeSockLevel(alloca(12), x) #define DescribeSockLevel(x) DescribeSockLevel(alloca(12), x)
@ -88,6 +89,7 @@ const char *DescribeSocketType(char[64], int);
#define DescribeSocketFamily(x) DescribeSocketFamily(alloca(12), x) #define DescribeSocketFamily(x) DescribeSocketFamily(alloca(12), x)
#define DescribeSocketProtocol(x) DescribeSocketProtocol(alloca(12), x) #define DescribeSocketProtocol(x) DescribeSocketProtocol(alloca(12), x)
#define DescribeSocketType(x) DescribeSocketType(alloca(64), x) #define DescribeSocketType(x) DescribeSocketType(alloca(64), x)
#define DescribeWhence(x) DescribeWhence(alloca(12), x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -0,0 +1,29 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/describeflags.internal.h"
const char *(DescribeWhence)(char buf[12], int whence) {
if (whence == SEEK_SET) return "SEEK_SET";
if (whence == SEEK_CUR) return "SEEK_CUR";
if (whence == SEEK_END) return "SEEK_END";
FormatInt32(buf, whence);
return buf;
}

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
@ -68,6 +67,5 @@ FILE *fopen(const char *pathname, const char *mode) {
close(fd); close(fd);
} }
} }
STRACE("fopen(%#s, %#s) → %p% m", pathname, mode, f);
return f; return f;
} }

View file

@ -0,0 +1,37 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/stdio/stdio.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
char testlib_enable_tmp_setup_teardown;
TEST(fseeko, test) {
FILE *f;
EXPECT_SYS(0, 0, xbarf("foo", "hello!", 6));
EXPECT_NE(NULL, (f = fopen("foo", "r")));
EXPECT_EQ(0, fseeko(f, -3, SEEK_END));
EXPECT_EQ('l', fgetc(f));
EXPECT_EQ('o', fgetc(f));
EXPECT_EQ(0, fseeko(f, 3, SEEK_SET));
EXPECT_EQ('l', fgetc(f));
EXPECT_EQ('o', fgetc(f));
EXPECT_EQ(0, fclose(f));
}

View file

@ -83,6 +83,14 @@ o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \
$(THIRD_PARTY_CHIBICC_A).pkg $(THIRD_PARTY_CHIBICC_A).pkg
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/chibicc/chibicc.com: \
o/$(MODE)/third_party/chibicc/chibicc.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/third_party/chibicc/as.com.dbg: \ o/$(MODE)/third_party/chibicc/as.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \ $(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC_A) \ $(THIRD_PARTY_CHIBICC_A) \

View file

@ -248,6 +248,14 @@ o/$(MODE)/third_party/lua/lua.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/lua/lua.com: \
o/$(MODE)/third_party/lua/lua.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
################################################################################ ################################################################################
# luac.com # luac.com

View file

@ -2,6 +2,8 @@
/* src/config.h.in. Generated from configure.ac by autoheader. */ /* src/config.h.in. Generated from configure.ac by autoheader. */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#define LANDLOCKMAKE_VERSION "1.4"
/* Define to the number of bits in type 'ptrdiff_t'. */ /* Define to the number of bits in type 'ptrdiff_t'. */
#define BITSIZEOF_PTRDIFF_T 64 #define BITSIZEOF_PTRDIFF_T 64

View file

@ -2975,7 +2975,8 @@ print_version (void)
/* Do it only once. */ /* Do it only once. */
return; return;
printf ("%sLandlock Make 1.3 (GNU Make %s)\n", precede, version_string); printf ("%sLandlock Make " LANDLOCKMAKE_VERSION " (GNU Make %s)\n",
precede, version_string);
if (!remote_description || *remote_description == '\0') if (!remote_description || *remote_description == '\0')
printf (_("%sBuilt for %s\n"), precede, make_host); printf (_("%sBuilt for %s\n"), precede, make_host);

View file

@ -150,6 +150,14 @@ o/$(MODE)/third_party/make/make.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/make/make.com: \
o/$(MODE)/third_party/make/make.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/third_party/make/strcache.o \ o/$(MODE)/third_party/make/strcache.o \
o/$(MODE)/third_party/make/expand.o \ o/$(MODE)/third_party/make/expand.o \
o/$(MODE)/third_party/make/read.o: private \ o/$(MODE)/third_party/make/read.o: private \

View file

@ -750,6 +750,8 @@ define_automatic_variables (void)
? "" : "-", ? "" : "-",
(remote_description == 0 || remote_description[0] == '\0') (remote_description == 0 || remote_description[0] == '\0')
? "" : remote_description); ? "" : remote_description);
define_variable_cname ("LANDLOCKMAKE_VERSION",
LANDLOCKMAKE_VERSION, o_default, 0);
define_variable_cname ("MAKE_VERSION", buf, o_default, 0); define_variable_cname ("MAKE_VERSION", buf, o_default, 0);
define_variable_cname ("MAKE_HOST", make_host, o_default, 0); define_variable_cname ("MAKE_HOST", make_host, o_default, 0);
@ -757,11 +759,6 @@ define_automatic_variables (void)
isn't one there. */ isn't one there. */
v = define_variable_cname ("SHELL", default_shell, o_default, 0); v = define_variable_cname ("SHELL", default_shell, o_default, 0);
/* On MSDOS we do use SHELL from environment, since it isn't a standard
environment variable on MSDOS, so whoever sets it, does that on purpose.
On OS/2 we do not use SHELL from environment but we have already handled
that problem above. */
#if !defined(__MSDOS__) && !defined(__EMX__)
/* Don't let SHELL come from the environment. */ /* Don't let SHELL come from the environment. */
if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override) if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override)
{ {
@ -769,7 +766,6 @@ define_automatic_variables (void)
v->origin = o_file; v->origin = o_file;
v->value = xstrdup (default_shell); v->value = xstrdup (default_shell);
} }
#endif
/* Make sure MAKEFILES gets exported if it is set. */ /* Make sure MAKEFILES gets exported if it is set. */
v = define_variable_cname ("MAKEFILES", "", o_default, 0); v = define_variable_cname ("MAKEFILES", "", o_default, 0);
@ -777,24 +773,6 @@ define_automatic_variables (void)
/* Define the magic D and F variables in terms of /* Define the magic D and F variables in terms of
the automatic variables they are variations of. */ the automatic variables they are variations of. */
#if defined(__MSDOS__) || defined(WINDOWS32)
/* For consistency, remove the trailing backslash as well as slash. */
define_variable_cname ("@D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $@)))",
o_automatic, 1);
define_variable_cname ("%D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $%)))",
o_automatic, 1);
define_variable_cname ("*D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $*)))",
o_automatic, 1);
define_variable_cname ("<D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $<)))",
o_automatic, 1);
define_variable_cname ("?D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $?)))",
o_automatic, 1);
define_variable_cname ("^D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $^)))",
o_automatic, 1);
define_variable_cname ("+D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $+)))",
o_automatic, 1);
#else /* not __MSDOS__, not WINDOWS32 */
define_variable_cname ("@D", "$(patsubst %/,%,$(dir $@))", o_automatic, 1); define_variable_cname ("@D", "$(patsubst %/,%,$(dir $@))", o_automatic, 1);
define_variable_cname ("%D", "$(patsubst %/,%,$(dir $%))", o_automatic, 1); define_variable_cname ("%D", "$(patsubst %/,%,$(dir $%))", o_automatic, 1);
define_variable_cname ("*D", "$(patsubst %/,%,$(dir $*))", o_automatic, 1); define_variable_cname ("*D", "$(patsubst %/,%,$(dir $*))", o_automatic, 1);
@ -802,7 +780,6 @@ define_automatic_variables (void)
define_variable_cname ("?D", "$(patsubst %/,%,$(dir $?))", o_automatic, 1); define_variable_cname ("?D", "$(patsubst %/,%,$(dir $?))", o_automatic, 1);
define_variable_cname ("^D", "$(patsubst %/,%,$(dir $^))", o_automatic, 1); define_variable_cname ("^D", "$(patsubst %/,%,$(dir $^))", o_automatic, 1);
define_variable_cname ("+D", "$(patsubst %/,%,$(dir $+))", o_automatic, 1); define_variable_cname ("+D", "$(patsubst %/,%,$(dir $+))", o_automatic, 1);
#endif
define_variable_cname ("@F", "$(notdir $@)", o_automatic, 1); define_variable_cname ("@F", "$(notdir $@)", o_automatic, 1);
define_variable_cname ("%F", "$(notdir $%)", o_automatic, 1); define_variable_cname ("%F", "$(notdir $%)", o_automatic, 1);
define_variable_cname ("*F", "$(notdir $*)", o_automatic, 1); define_variable_cname ("*F", "$(notdir $*)", o_automatic, 1);
@ -929,21 +906,11 @@ target_environment (struct file *file)
&& v->origin != o_env && v->origin != o_env_override) && v->origin != o_env && v->origin != o_env_override)
{ {
char *value = recursively_expand_for_file (v, file); char *value = recursively_expand_for_file (v, file);
#ifdef WINDOWS32
if (strcmp (v->name, "Path") == 0 ||
strcmp (v->name, "PATH") == 0)
convert_Path_to_windows32 (value, ';');
#endif
*result++ = xstrdup (concat (3, v->name, "=", value)); *result++ = xstrdup (concat (3, v->name, "=", value));
free (value); free (value);
} }
else else
{ {
#ifdef WINDOWS32
if (strcmp (v->name, "Path") == 0 ||
strcmp (v->name, "PATH") == 0)
convert_Path_to_windows32 (v->value, ';');
#endif
*result++ = xstrdup (concat (3, v->name, "=", v->value)); *result++ = xstrdup (concat (3, v->name, "=", v->value));
} }
} }

View file

@ -131,9 +131,6 @@ o/$(MODE)/third_party/mbedtls/test/%.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/mbedtls/test/%.com: o/$(MODE)/third_party/mbedtls/test/%.com.dbg
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
o/$(MODE)/third_party/mbedtls/test/%.com.runs: o/$(MODE)/third_party/mbedtls/test/%.com o/$(MODE)/third_party/mbedtls/test/%.com.runs: o/$(MODE)/third_party/mbedtls/test/%.com
@$(COMPILE) -ACHECK -wtT$@ $< $(TESTARGS) @$(COMPILE) -ACHECK -wtT$@ $< $(TESTARGS)

View file

@ -4332,6 +4332,14 @@ o/$(MODE)/third_party/python/python.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/python/python.com: \
o/$(MODE)/third_party/python/python.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
################################################################################ ################################################################################
# FREEZE.COM # FREEZE.COM

View file

@ -154,6 +154,14 @@ o/$(MODE)/third_party/quickjs/qjs.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/quickjs/qjs.com: \
o/$(MODE)/third_party/quickjs/qjs.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/third_party/quickjs/qjsc.com.dbg: \ o/$(MODE)/third_party/quickjs/qjsc.com.dbg: \
$(THIRD_PARTY_QUICKJS) \ $(THIRD_PARTY_QUICKJS) \
o/$(MODE)/third_party/quickjs/qjsc.o \ o/$(MODE)/third_party/quickjs/qjsc.o \

View file

@ -74,6 +74,14 @@ o/$(MODE)/third_party/sqlite3/sqlite3.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/sqlite3/sqlite3.com: \
o/$(MODE)/third_party/sqlite3/sqlite3.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
$(THIRD_PARTY_SQLITE3_A): \ $(THIRD_PARTY_SQLITE3_A): \
third_party/sqlite3/ \ third_party/sqlite3/ \
$(THIRD_PARTY_SQLITE3_A).pkg \ $(THIRD_PARTY_SQLITE3_A).pkg \

View file

@ -53,6 +53,14 @@ o/$(MODE)/third_party/tidy/tidy.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/tidy/tidy.com: \
o/$(MODE)/third_party/tidy/tidy.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/third_party/tidy/.tidyrc.zip.o: private ZIPOBJ_FLAGS += -B o/$(MODE)/third_party/tidy/.tidyrc.zip.o: private ZIPOBJ_FLAGS += -B
THIRD_PARTY_TIDY_COMS = \ THIRD_PARTY_TIDY_COMS = \

View file

@ -22,10 +22,7 @@
#include "libc/stdio/temp.h" #include "libc/stdio/temp.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "libc/time/struct/tm.h" #include "libc/time/struct/tm.h"
#include "libc/fmt/fmt.h" #include "libc/sysv/consts/s.h"
#include "libc/x/x.h"
#include "libc/x/x.h"
#include "libc/runtime/gc.internal.h"
#include "libc/limits.h" #include "libc/limits.h"
#ifdef NO_MKTIME #ifdef NO_MKTIME
@ -1178,7 +1175,6 @@ ulg dostime; /* DOS time to convert */
#endif /* ZP_NEED_GEN_D2U_TIME */ #endif /* ZP_NEED_GEN_D2U_TIME */
#ifndef MACOS
int destroy(f) int destroy(f)
char *f; /* file to delete */ char *f; /* file to delete */
/* Delete the file *f, returning non-zero on failure. */ /* Delete the file *f, returning non-zero on failure. */
@ -1195,69 +1191,32 @@ char *d, *s; /* destination and source file names */
*/ */
{ {
z_stat t; /* results of stat() */ z_stat t; /* results of stat() */
#if defined(CMS_MVS)
/* cmsmvs.h defines FOPW_TEMP as memory(hiperspace). Since memory is
* lost at end of run, always do copy instead of rename.
*/
int copy = 1;
#else
int copy = 0; int copy = 0;
#endif
int d_exists; int d_exists;
#if defined(VMS) || defined(CMS_MVS)
/* stat() is broken on VMS remote files (accessed through Decnet).
* This patch allows creation of remote zip files, but is not sufficient
* to update them or compress remote files */
unlink(d);
#else /* !(VMS || CMS_MVS) */
d_exists = (LSTAT(d, &t) == 0); d_exists = (LSTAT(d, &t) == 0);
if (d_exists) if (d_exists)
{ {
/* /*
* respect existing soft and hard links! * respect existing soft and hard links!
*/ */
if (t.st_nlink > 1 if (t.st_nlink > 1 || (t.st_mode & S_IFMT) == S_IFLNK)
# ifdef S_IFLNK
|| (t.st_mode & S_IFMT) == S_IFLNK
# endif
)
copy = 1; copy = 1;
else if (unlink(d)) else if (unlink(d))
return ZE_CREAT; /* Can't erase zip file--give up */ return ZE_CREAT; /* Can't erase zip file--give up */
} }
#endif /* ?(VMS || CMS_MVS) */
#ifndef CMS_MVS
if (!copy) { if (!copy) {
if (rename(s, d)) { /* Just move s on top of d */ if (rename(s, d)) { /* Just move s on top of d */
copy = 1; /* failed ? */ copy = 1; /* failed ? */
#if !defined(VMS) && !defined(ATARI) && !defined(AZTEC_C) if (errno != EXDEV)
#if !defined(CMS_MVS) && !defined(RISCOS) && !defined(QDOS) return ZE_CREAT;
/* For VMS, ATARI, AMIGA Aztec, VM_CMS, MVS, RISCOS,
always assume that failure is EXDEV */
if (errno != EXDEV
# ifdef THEOS
&& errno != EEXIST
# else
# ifdef ENOTSAM
&& errno != ENOTSAM /* Used at least on Turbo C */
# endif
# endif
) return ZE_CREAT;
#endif /* !CMS_MVS && !RISCOS */
#endif /* !VMS && !ATARI && !AZTEC_C */
} }
} }
#endif /* !CMS_MVS */
if (copy) { if (copy) {
FILE *f, *g; /* source and destination files */ FILE *f, *g; /* source and destination files */
int r; /* temporary variable */ int r; /* temporary variable */
#ifdef RISCOS
if (SWI_OS_FSControl_26(s,d,0xA1)!=NULL) {
#endif
/* Use zfopen for almost all opens where fopen is used. For /* Use zfopen for almost all opens where fopen is used. For
most OS that support large files we use the 64-bit file most OS that support large files we use the 64-bit file
environment and zfopen maps to fopen, but this allows environment and zfopen maps to fopen, but this allows
@ -1280,13 +1239,9 @@ char *d, *s; /* destination and source file names */
return r ? (r == ZE_TEMP ? ZE_WRITE : r) : ZE_WRITE; return r ? (r == ZE_TEMP ? ZE_WRITE : r) : ZE_WRITE;
} }
unlink(s); unlink(s);
#ifdef RISCOS
}
#endif
} }
return ZE_OK; return ZE_OK;
} }
#endif /* !MACOS */
int getfileattr(f) int getfileattr(f)
@ -1326,11 +1281,6 @@ int a; /* attributes returned by getfileattr() */
#ifndef VMS /* VMS-specific function is in VMS.C. */ #ifndef VMS /* VMS-specific function is in VMS.C. */
static char *EnsureDirs(char *path) {
makedirs(gc(xdirname(path)), 0755);
return path;
}
char *tempname(zip) char *tempname(zip)
char *zip; /* path name of zip file to generate temp name for */ char *zip; /* path name of zip file to generate temp name for */
@ -1338,13 +1288,6 @@ char *tempname(zip)
{ {
char *t = zip; /* malloc'ed space for name (use zip to avoid warning) */ char *t = zip; /* malloc'ed space for name (use zip to avoid warning) */
#ifdef __COSMOPOLITAN__
t = malloc(PATH_MAX);
snprintf(t, PATH_MAX, "%szip.XXXXXX", kTmpPath);
mkstemp(EnsureDirs(t));
return t;
#endif
# ifdef CMS_MVS # ifdef CMS_MVS
if ((t = malloc(strlen(tempath) + L_tmpnam + 2)) == NULL) if ((t = malloc(strlen(tempath) + L_tmpnam + 2)) == NULL)
return NULL; return NULL;

44
third_party/zip/zip.c vendored
View file

@ -35,17 +35,10 @@
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/stdio/temp.h" #include "libc/stdio/temp.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/gc.internal.h"
#include "libc/x/x.h"
#include "third_party/bzip2/bzlib.h" #include "third_party/bzip2/bzlib.h"
#define MAXCOM 256 /* Maximum one-line comment size */ #define MAXCOM 256 /* Maximum one-line comment size */
static char *EnsureDirs(char *path) {
makedirs(gc(xdirname(path)), 0755);
return path;
}
/* Local option flags */ /* Local option flags */
#ifndef DELETE #ifndef DELETE
#define DELETE 0 #define DELETE 0
@ -2204,15 +2197,6 @@ char **argv; /* command line tokens */
} }
#endif #endif
#ifdef RISCOS
set_prefix();
#endif
#ifdef __human68k__
fflush(stderr);
setbuf(stderr, NULL);
#endif
/* Re-initialize global variables to make the zip dll re-entrant. It is /* Re-initialize global variables to make the zip dll re-entrant. It is
* possible that we could get away with not re-initializing all of these * possible that we could get away with not re-initializing all of these
* but better safe than sorry. * but better safe than sorry.
@ -2591,25 +2575,6 @@ char **argv; /* command line tokens */
{ {
switch (option) switch (option)
{ {
#ifdef EBCDIC
case 'a':
aflag = ASCII;
printf("Translating to ASCII...\n");
break;
#endif /* EBCDIC */
#ifdef CMS_MVS
case 'B':
bflag = 1;
printf("Using binary mode...\n");
break;
#endif /* CMS_MVS */
#ifdef TANDEM
case 'B':
nskformatopt(value);
free(value);
break;
#endif
case '0': case '0':
method = STORE; level = 0; break; method = STORE; level = 0; break;
case '1': case '2': case '3': case '4': case '1': case '2': case '3': case '4':
@ -2645,11 +2610,6 @@ char **argv; /* command line tokens */
} }
action = DELETE; action = DELETE;
break; break;
#ifdef MACOS
case o_df:
MacZip.DataForkOnly = true;
break;
#endif /* MACOS */
case o_db: case o_db:
if (negated) if (negated)
display_bytes = 0; display_bytes = 0;
@ -3835,7 +3795,7 @@ char **argv; /* command line tokens */
} }
strcat(tempzip, "ziXXXXXX"); strcat(tempzip, "ziXXXXXX");
if ((yd = mkstemp(EnsureDirs(gc(xjoinpaths(kTmpPath, tempzip))))) == EOF) { if ((yd = mkstemp(tempzip)) == EOF) {
ZIPERR(ZE_TEMP, tempzip); ZIPERR(ZE_TEMP, tempzip);
} }
if ((y = fdopen(yd, FOPW_TMP)) == NULL) { if ((y = fdopen(yd, FOPW_TMP)) == NULL) {
@ -4838,7 +4798,7 @@ char **argv; /* command line tokens */
} }
strcat(tempzip, "ziXXXXXX"); strcat(tempzip, "ziXXXXXX");
if ((yd = mkstemp(EnsureDirs(gc(xjoinpaths(kTmpPath, tempzip))))) == EOF) { if ((yd = mkstemp(tempzip)) == EOF) {
ZIPERR(ZE_TEMP, tempzip); ZIPERR(ZE_TEMP, tempzip);
} }
if ((y = fdopen(yd, FOPW_TMP)) == NULL) { if ((y = fdopen(yd, FOPW_TMP)) == NULL) {

View file

@ -17,6 +17,7 @@
#include "third_party/zip/zip.h" #include "third_party/zip/zip.h"
#include "third_party/zip/revision.h" #include "third_party/zip/revision.h"
#ifdef UNICODE_SUPPORT #ifdef UNICODE_SUPPORT
#include "libc/stdio/lock.h"
#include "third_party/zip/crc32.h" #include "third_party/zip/crc32.h"
#endif #endif
@ -2957,7 +2958,8 @@ local int find_next_signature(f)
/* look for P K ? ? signature */ /* look for P K ? ? signature */
m = getc(f); flockfile(f);
m = getc_unlocked(f);
/* /*
here = zftello(f); here = zftello(f);
@ -2969,20 +2971,20 @@ local int find_next_signature(f)
/* found a P */ /* found a P */
sigbuf[0] = (char) m; sigbuf[0] = (char) m;
if ((m = getc(f)) == EOF) if ((m = getc_unlocked(f)) == EOF)
break; break;
if (m != 0x4b /*'K' except EBCDIC*/) { if (m != 0x4b /*'K' except EBCDIC*/) {
/* not a signature */ /* not a signature */
ungetc(m, f); ungetc_unlocked(m, f);
} else { } else {
/* found P K */ /* found P K */
sigbuf[1] = (char) m; sigbuf[1] = (char) m;
if ((m = getc(f)) == EOF) if ((m = getc_unlocked(f)) == EOF)
break; break;
if (m == 0x50 /*'P' except EBCDIC*/) { if (m == 0x50 /*'P' except EBCDIC*/) {
/* not a signature but maybe start of new one */ /* not a signature but maybe start of new one */
ungetc(m, f); ungetc_unlocked(m, f);
continue; continue;
} else if (m >= 16) { } else if (m >= 16) {
/* last 2 chars expect < 16 for signature */ /* last 2 chars expect < 16 for signature */
@ -2990,11 +2992,11 @@ local int find_next_signature(f)
} }
sigbuf[2] = (char) m; sigbuf[2] = (char) m;
if ((m = getc(f)) == EOF) if ((m = getc_unlocked(f)) == EOF)
break; break;
if (m == 0x50 /*'P' except EBCDIC*/) { if (m == 0x50 /*'P' except EBCDIC*/) {
/* not a signature but maybe start of new one */ /* not a signature but maybe start of new one */
ungetc(m, f); ungetc_unlocked(m, f);
continue; continue;
} else if (m >= 16) { } else if (m >= 16) {
/* last 2 chars expect < 16 */ /* last 2 chars expect < 16 */
@ -3003,16 +3005,15 @@ local int find_next_signature(f)
sigbuf[3] = (char) m; sigbuf[3] = (char) m;
/* found possible signature */ /* found possible signature */
funlockfile(f);
return 1; return 1;
} }
} }
m = getc(f); m = getc_unlocked(f);
}
if (ferror(f)) {
return 0;
} }
/* found nothing */ /* found nothing */
funlockfile(f);
return 0; return 0;
} }
@ -4069,6 +4070,7 @@ local int scanzipf_regnew()
bytes (=65557 bytes) from the end of the file. bytes (=65557 bytes) from the end of the file.
We back up 128k, to allow some junk being appended to a Zip file. We back up 128k, to allow some junk being appended to a Zip file.
*/ */
int e = errno;
if ((zfseeko(in_file, -0x20000L, SEEK_END) != 0) || if ((zfseeko(in_file, -0x20000L, SEEK_END) != 0) ||
/* Some fseek() implementations (e.g. MSC 8.0 16-bit) fail to signal /* Some fseek() implementations (e.g. MSC 8.0 16-bit) fail to signal
an error when seeking before the beginning of the file. an error when seeking before the beginning of the file.
@ -4076,6 +4078,7 @@ local int scanzipf_regnew()
for the error value -1. for the error value -1.
*/ */
(zftello(in_file) == (zoff_t)-1L)) { (zftello(in_file) == (zoff_t)-1L)) {
errno = e;
/* file is less than 128 KB so back up to beginning */ /* file is less than 128 KB so back up to beginning */
if (zfseeko(in_file, 0L, SEEK_SET) != 0) { if (zfseeko(in_file, 0L, SEEK_SET) != 0) {
fclose(in_file); fclose(in_file);
@ -5119,28 +5122,12 @@ int readzipfile()
zipfile_exists = 0; zipfile_exists = 0;
/* If zip file exists, read headers and check structure */ /* If zip file exists, read headers and check structure */
#ifdef VMS
if (zipfile == NULL || !(*zipfile) || !strcmp(zipfile, "-"))
return ZE_OK;
{
int rtype;
if ((VMSmunch(zipfile, GET_RTYPE, (char *)&rtype) == RMS$_NORMAL) &&
(rtype == FAT$C_VARIABLE)) {
fprintf(mesg,
"\n Error: zipfile is in variable-length record format. Please\n\
run \"bilf b %s\" to convert the zipfile to fixed-length\n\
record format.\n\n", zipfile);
return ZE_FORM;
}
}
readable = ((f = zfopen(zipfile, FOPR)) != NULL);
#else /* !VMS */
readable = (zipfile != NULL && *zipfile && strcmp(zipfile, "-")); readable = (zipfile != NULL && *zipfile && strcmp(zipfile, "-"));
if (readable) { if (readable) {
int e = errno;
readable = ((f = zfopen(zipfile, FOPR)) != NULL); readable = ((f = zfopen(zipfile, FOPR)) != NULL);
errno = e;
} }
#endif /* ?VMS */
/* skip check if streaming */ /* skip check if streaming */
if (!readable) { if (!readable) {
@ -5155,63 +5142,9 @@ int readzipfile()
zipfile_exists = 1; zipfile_exists = 1;
} }
#ifdef MVS
/* Very nasty special case for MVS. Just because the zipfile has been
* opened for reading does not mean that we can actually read the data.
* Typical JCL to create a zipfile is
*
* //ZIPFILE DD DISP=(NEW,CATLG),DSN=prefix.ZIP,
* // SPACE=(CYL,(10,10))
*
* That creates a VTOC entry with an end of file marker (DS1LSTAR) of zero.
* Alas the VTOC end of file marker is only used when the file is opened in
* append mode. When a file is opened in read mode, the "other" end of file
* marker is used, a zero length data block signals end of file when reading.
* With a brand new file which has not been written to yet, it is undefined
* what you read off the disk. In fact you read whatever data was in the same
* disk tracks before the zipfile was allocated. You would be amazed at the
* number of application programmers who still do not understand this. Makes
* for interesting and semi-random errors, GIGO.
*
* Newer versions of SMS will automatically write a zero length block when a
* file is allocated. However not all sites run SMS or they run older levels
* so we cannot rely on that. The only safe thing to do is close the file,
* open in append mode (we already know that the file exists), close it again,
* reopen in read mode and try to read a data block. Opening and closing in
* append mode will write a zero length block where DS1LSTAR points, making
* sure that the VTOC and internal end of file markers are in sync. Then it
* is safe to read data. If we cannot read one byte of data after all that,
* it is a brand new zipfile and must not be read.
*/
if (readable)
{
char c;
fclose(f);
/* append mode */
if ((f = zfopen(zipfile, "ab")) == NULL) {
ZIPERR(ZE_OPEN, zipfile);
}
fclose(f);
/* read mode again */
if ((f = zfopen(zipfile, FOPR)) == NULL) {
ZIPERR(ZE_OPEN, zipfile);
}
if (fread(&c, 1, 1, f) != 1) {
/* no actual data */
readable = 0;
fclose(f);
}
else{
fseek(f, 0, SEEK_SET); /* at least one byte in zipfile, back to the start */
}
}
#endif /* MVS */
/* ------------------------ */ /* ------------------------ */
/* new file read */ /* new file read */
#ifndef UTIL #ifndef UTIL
if (fix == 2) { if (fix == 2) {
scanzipf_fixnew(); scanzipf_fixnew();

View file

@ -537,14 +537,14 @@ struct zlist far *z; /* zip entry to compress */
if (window != NULL) if (window != NULL)
free(window); /* window can't be a mapped file here */ free(window); /* window can't be a mapped file here */
window_size = (ulg)q + MIN_LOOKAHEAD; window_size = (ulg)q + MIN_LOOKAHEAD;
remain = window_size & (PAGESIZE-1); remain = window_size & (FRAMESIZE-1);
/* If we can't touch the page beyond the end of file, we must /* If we can't touch the page beyond the end of file, we must
* allocate an extra page. * allocate an extra page.
*/ */
if (remain > MIN_LOOKAHEAD) { if (remain > MIN_LOOKAHEAD) {
window = (uch*)mmap(0, window_size, PROT_READ, MAP_PRIVATE, ifile, 0); window = (uch*)mmap(0, window_size, PROT_READ, MAP_PRIVATE, ifile, 0);
} else { } else {
window = (uch*)valloc(window_size - remain + PAGESIZE); window = (uch*)valloc(window_size - remain + FRAMESIZE);
if (window != NULL) { if (window != NULL) {
window = (uch*)mmap((char*)window, window_size - remain, PROT_READ, window = (uch*)mmap((char*)window, window_size - remain, PROT_READ,
MAP_PRIVATE | MAP_FIXED, ifile, 0); MAP_PRIVATE | MAP_FIXED, ifile, 0);

View file

@ -93,6 +93,14 @@ o/$(MODE)/tool/build/%.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/build/blinkenlights.com: \
o/$(MODE)/tool/build/blinkenlights.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/tool/build/emulator.o: private \ o/$(MODE)/tool/build/emulator.o: private \
OVERRIDE_COPTS += \ OVERRIDE_COPTS += \
-fno-sanitize=pointer-overflow -fno-sanitize=pointer-overflow

View file

@ -110,10 +110,11 @@ o/$(MODE)/tool/net/redbean.com.dbg: \
o/$(MODE)/tool/net/redbean.com: \ o/$(MODE)/tool/net/redbean.com: \
o/$(MODE)/tool/net/redbean.com.dbg \ o/$(MODE)/tool/net/redbean.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com o/$(MODE)/tool/build/symtab.com
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@ @$(MAKE_OBJCOPY)
@$(COMPILE) -wASYMTAB o/$(MODE)/tool/build/symtab.com -o $(SYMTAB) $< @$(MAKE_SYMTAB_CREATE)
@$(COMPILE) -wAZIP -T$@ $@ -A $(SYMTAB) @$(MAKE_SYMTAB_ZIP)
# REDBEAN-DEMO.COM # REDBEAN-DEMO.COM
# #
@ -223,10 +224,11 @@ o/$(MODE)/tool/net/redbean-demo.com.dbg: \
o/$(MODE)/tool/net/redbean-demo.com: \ o/$(MODE)/tool/net/redbean-demo.com: \
o/$(MODE)/tool/net/redbean-demo.com.dbg \ o/$(MODE)/tool/net/redbean-demo.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com o/$(MODE)/tool/build/symtab.com
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@ @$(MAKE_OBJCOPY)
@$(COMPILE) -wASYMTAB o/$(MODE)/tool/build/symtab.com -o $(SYMTAB) $< @$(MAKE_SYMTAB_CREATE)
@$(COMPILE) -wAZIP -T$@ $@ -A $(SYMTAB) @$(MAKE_SYMTAB_ZIP)
# REDBEAN-STATIC.COM # REDBEAN-STATIC.COM
# #
@ -244,6 +246,14 @@ o/$(MODE)/tool/net/redbean-static.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/net/redbean-static.com: \
o/$(MODE)/tool/net/redbean-static.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
# REDBEAN-UNSECURE.COM # REDBEAN-UNSECURE.COM
# #
# Passing the -DUNSECURE will cause the TLS security code to be removed. # Passing the -DUNSECURE will cause the TLS security code to be removed.
@ -269,6 +279,14 @@ o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/net/redbean-unsecure.com: \
o/$(MODE)/tool/net/redbean-unsecure.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
# REDBEAN-ORIGINAL.COM # REDBEAN-ORIGINAL.COM
# #
# Passing the -DSTATIC and -DUNSECURE flags together w/ MODE=tiny will # Passing the -DSTATIC and -DUNSECURE flags together w/ MODE=tiny will
@ -286,6 +304,14 @@ o/$(MODE)/tool/net/redbean-original.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/net/redbean-original.com: \
o/$(MODE)/tool/net/redbean-original.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/tool/net/demo/.lua/.zip.o: \ o/$(MODE)/tool/net/demo/.lua/.zip.o: \
tool/net/demo/.lua tool/net/demo/.lua
o/$(MODE)/tool/net/demo/.zip.o: \ o/$(MODE)/tool/net/demo/.zip.o: \

View file

@ -45,6 +45,14 @@ o/$(MODE)/tool/plinko/%.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/plinko/plinko.com: \
o/$(MODE)/tool/plinko/plinko.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/tool/plinko/plinko.com.zip.o: \ o/$(MODE)/tool/plinko/plinko.com.zip.o: \
o/$(MODE)/tool/plinko/plinko.com o/$(MODE)/tool/plinko/plinko.com

View file

@ -38,7 +38,6 @@ TOOL_VIZ_DIRECTDEPS = \
LIBC_STUBS \ LIBC_STUBS \
LIBC_SYSV \ LIBC_SYSV \
LIBC_SYSV_CALLS \ LIBC_SYSV_CALLS \
LIBC_TESTLIB \
LIBC_TIME \ LIBC_TIME \
LIBC_TINYMATH \ LIBC_TINYMATH \
LIBC_X \ LIBC_X \
@ -79,6 +78,22 @@ o/$(MODE)/tool/viz/printimage.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/tool/viz/printimage.com: \
o/$(MODE)/tool/viz/printimage.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/tool/viz/printvideo.com: \
o/$(MODE)/tool/viz/printvideo.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
o/$(MODE)/tool/viz/derasterize.o: private \ o/$(MODE)/tool/viz/derasterize.o: private \
OVERRIDE_CFLAGS += \ OVERRIDE_CFLAGS += \
-DSTACK_FRAME_UNLIMITED \ -DSTACK_FRAME_UNLIMITED \