mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Stop using .com extension in monorepo
The WIN32 CreateProcess() function does not require an .exe or .com suffix in order to spawn an executable. Now that we have Cosmo bash we're no longer so dependent on the cmd.exe prompt.
This commit is contained in:
parent
c8383f25b4
commit
a6baba1b07
239 changed files with 2092 additions and 2244 deletions
|
@ -15,7 +15,7 @@ TOOL_BUILD_OBJS = \
|
|||
$(TOOL_BUILD_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_BUILD_COMS = \
|
||||
$(TOOL_BUILD_SRCS:%.c=o/$(MODE)/%.com)
|
||||
$(TOOL_BUILD_SRCS:%.c=o/$(MODE)/%)
|
||||
|
||||
TOOL_BUILD_CHECKS = \
|
||||
$(TOOL_BUILD).pkg \
|
||||
|
@ -69,7 +69,7 @@ o/$(MODE)/tool/build/build.pkg: \
|
|||
$(TOOL_BUILD_OBJS) \
|
||||
$(foreach x,$(TOOL_BUILD_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/build/%.com.dbg: \
|
||||
o/$(MODE)/tool/build/%.dbg: \
|
||||
$(TOOL_BUILD_DEPS) \
|
||||
o/$(MODE)/tool/build/build.pkg \
|
||||
o/$(MODE)/tool/build/%.o \
|
||||
|
@ -78,9 +78,9 @@ o/$(MODE)/tool/build/%.com.dbg: \
|
|||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/build/dso/sandbox-$(ARCH).so.zip.o \
|
||||
o/$(MODE)/tool/build/false.com.zip.o \
|
||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
||||
o/$(MODE)/tool/build/cocmd.com.zip.o: private \
|
||||
o/$(MODE)/tool/build/false.zip.o \
|
||||
o/$(MODE)/tool/build/echo.zip.o \
|
||||
o/$(MODE)/tool/build/cocmd.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B
|
||||
|
||||
|
@ -115,7 +115,7 @@ o/$(MODE)/tool/build/dso/sandbox-$(ARCH).so: \
|
|||
o/$(MODE)/libc/sysv/restorert.o \
|
||||
$(OUTPUT_OPTION)
|
||||
|
||||
o/$(MODE)/tool/build/pledge.com.dbg: \
|
||||
o/$(MODE)/tool/build/pledge.dbg: \
|
||||
$(TOOL_BUILD_DEPS) \
|
||||
o/$(MODE)/tool/build/build.pkg \
|
||||
o/$(MODE)/tool/build/dso/sandbox-$(ARCH).so.zip.o \
|
||||
|
@ -135,8 +135,8 @@ o/$(MODE)/tool/build/dso/dlopen_helper.so: \
|
|||
o/$(MODE)/tool/build/dso/dlopen_helper.o \
|
||||
$(OUTPUT_OPTION)
|
||||
|
||||
o/$(MODE)/tool/build/dlopen_test.com.runs: \
|
||||
o/$(MODE)/tool/build/dlopen_test.com \
|
||||
o/$(MODE)/tool/build/dlopen_test.runs: \
|
||||
o/$(MODE)/tool/build/dlopen_test \
|
||||
o/$(MODE)/tool/build/dso/dlopen_helper.so
|
||||
$< o/$(MODE)/tool/build/dso/dlopen_helper.so
|
||||
|
||||
|
|
|
@ -1722,7 +1722,7 @@ static unsigned char *GetZipEndOfCentralDirectory(struct Input *in) {
|
|||
}
|
||||
}
|
||||
Die(in->path, "zip eocd not found in last 64kb of elf even though a .zip "
|
||||
"section exists; you may need to run fixupobj.com");
|
||||
"section exists; you may need to run fixupobj");
|
||||
}
|
||||
|
||||
static void IndexZipAssetsFromElf(struct Input *in) {
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "libc/elf/struct/ehdr.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macho.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdckdint.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -275,7 +275,7 @@ static void GetMachoPayload(const char *image, size_t imagesize,
|
|||
//
|
||||
// - `arg=" 9293"` is how we originally had ape do it
|
||||
// - `arg=$(( 9293))` b/c busybox sh disliked quoted space
|
||||
// - `arg=9293 ` is generated by modern apelink.com program
|
||||
// - `arg=9293 ` is generated by modern apelink program
|
||||
//
|
||||
unassert(regcomp(&rx,
|
||||
"bs=" // dd block size arg
|
||||
|
@ -507,7 +507,7 @@ static void Assimilate(void) {
|
|||
case FORMAT_MACHO:
|
||||
Die(path, "can't assimilate elf to macho");
|
||||
case FORMAT_PE:
|
||||
Die(path, "can't assimilate elf to pe (try elf2pe.com)");
|
||||
Die(path, "can't assimilate elf to pe (try elf2pe)");
|
||||
default:
|
||||
unassert(false);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ __static_yoink("zipos");
|
|||
"\
|
||||
SYNOPSIS\n\
|
||||
\n\
|
||||
compile.com [FLAGS] COMMAND [ARGS...]\n\
|
||||
compile [FLAGS] COMMAND [ARGS...]\n\
|
||||
\n\
|
||||
OVERVIEW\n\
|
||||
\n\
|
||||
|
@ -83,7 +83,7 @@ DESCRIPTION\n\
|
|||
\n\
|
||||
This is a generic command wrapper, e.g.\n\
|
||||
\n\
|
||||
compile.com gcc -o program program.c\n\
|
||||
compile gcc -o program program.c\n\
|
||||
\n\
|
||||
This wrapper provides the following services:\n\
|
||||
\n\
|
||||
|
@ -681,7 +681,7 @@ int Launch(void) {
|
|||
} else {
|
||||
/* this should never happen */
|
||||
PrintRed();
|
||||
appends(&output, "error: compile.com read() failed w/ ");
|
||||
appends(&output, "error: compile read() failed w/ ");
|
||||
appendd(&output, buf, FormatInt64(buf, errno) - buf);
|
||||
PrintReset();
|
||||
appendw(&output, READ16LE(": "));
|
||||
|
@ -704,7 +704,7 @@ int Launch(void) {
|
|||
} else {
|
||||
/* this should never happen */
|
||||
PrintRed();
|
||||
appends(&output, "error: compile.com wait4() failed w/ ");
|
||||
appends(&output, "error: compile wait4() failed w/ ");
|
||||
appendd(&output, buf, FormatInt64(buf, errno) - buf);
|
||||
PrintReset();
|
||||
appendw(&output, READ16LE(": "));
|
||||
|
@ -716,13 +716,13 @@ int Launch(void) {
|
|||
if (gotchld) {
|
||||
us = GetTimespecMicros(finish) - GetTimespecMicros(signalled);
|
||||
if (us > 1000000) {
|
||||
appends(&output, "wut: compile.com needed ");
|
||||
appends(&output, "wut: compile needed ");
|
||||
appendd(&output, buf, FormatUint64Thousands(buf, us) - buf);
|
||||
appends(&output, "µs to wait() for zombie ");
|
||||
rc = -1;
|
||||
}
|
||||
if (gotchld > 1) {
|
||||
appends(&output, "wut: compile.com got multiple sigchld?! ");
|
||||
appends(&output, "wut: compile got multiple sigchld?! ");
|
||||
rc = -1;
|
||||
}
|
||||
}
|
||||
|
@ -909,9 +909,9 @@ int main(int argc, char *argv[]) {
|
|||
isgcc = true;
|
||||
} else if (strstr(s, "ld.bfd")) {
|
||||
isbfd = true;
|
||||
} else if (strstr(s, "ar.com")) {
|
||||
} else if (strstr(s, "ar")) {
|
||||
isar = true;
|
||||
} else if (strstr(s, "package.com")) {
|
||||
} else if (strstr(s, "package")) {
|
||||
ispkg = true;
|
||||
}
|
||||
|
||||
|
@ -921,7 +921,7 @@ int main(int argc, char *argv[]) {
|
|||
// replace output filename argument
|
||||
//
|
||||
// some commands (e.g. ar) don't use the `-o PATH` notation. in that
|
||||
// case we assume the output path was passed to compile.com -TTARGET
|
||||
// case we assume the output path was passed to compile -TTARGET
|
||||
// which means we can replace the appropriate command line argument.
|
||||
if (!noworkaround && //
|
||||
!movepath && //
|
||||
|
@ -1180,7 +1180,7 @@ int main(int argc, char *argv[]) {
|
|||
} else if (target) {
|
||||
outpath = target;
|
||||
} else {
|
||||
fputs("error: compile.com needs -TTARGET or -oOUTPATH\n", stderr);
|
||||
fputs("error: compile needs -TTARGET or -oOUTPATH\n", stderr);
|
||||
exit(7);
|
||||
}
|
||||
|
||||
|
@ -1514,10 +1514,10 @@ int main(int argc, char *argv[]) {
|
|||
// flush output
|
||||
if (WriteAllUntilSignalledOrError(2, output, appendz(output).i) == -1) {
|
||||
if (errno == EINTR) {
|
||||
s = "notice: compile.com output truncated\n";
|
||||
s = "notice: compile output truncated\n";
|
||||
} else {
|
||||
if (!exitcode) exitcode = 55;
|
||||
s = "error: compile.com failed to write result\n";
|
||||
s = "error: compile failed to write result\n";
|
||||
}
|
||||
write(2, s, strlen(s));
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
/**
|
||||
* Removes file system caches from RAM.
|
||||
*
|
||||
* make o//tool/build/dropcache.com
|
||||
* sudo mv o//tool/build/dropcache.com /usr/local/bin/
|
||||
* sudo chown root /usr/local/bin/dropcache.com
|
||||
* sudo chmod u+s /usr/local/bin/dropcache.com
|
||||
* make o//tool/build/dropcache
|
||||
* sudo mv o//tool/build/dropcache /usr/local/bin/
|
||||
* sudo chown root /usr/local/bin/dropcache
|
||||
* sudo chmod u+s /usr/local/bin/dropcache
|
||||
*/
|
||||
|
||||
static void Write(int fd, const char *s) {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "libc/elf/struct/shdr.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/dll.h"
|
||||
#include "libc/limits.h"
|
||||
|
@ -39,6 +38,7 @@
|
|||
#include "libc/nt/struct/imageoptionalheader.internal.h"
|
||||
#include "libc/nt/struct/imagesectionheader.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdckdint.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -48,7 +48,7 @@
|
|||
#include "third_party/getopt/getopt.internal.h"
|
||||
|
||||
// see tool/hello/hello-pe.c for an example program this can link
|
||||
// make -j8 m=tiny o/tiny/tool/hello/hello-pe.com
|
||||
// make -j8 m=tiny o/tiny/tool/hello/hello-pe
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@ TOOL_BUILD_LIB_A_SRCS = \
|
|||
$(TOOL_BUILD_LIB_A_SRCS_C)
|
||||
|
||||
TOOL_BUILD_LIB_COMS = \
|
||||
o/$(MODE)/tool/build/lib/apetest.com \
|
||||
o/$(MODE)/tool/build/lib/apetest2.com
|
||||
o/$(MODE)/tool/build/lib/apetest \
|
||||
o/$(MODE)/tool/build/lib/apetest2
|
||||
|
||||
TOOL_BUILD_LIB_A_OBJS = \
|
||||
$(TOOL_BUILD_LIB_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||
$(TOOL_BUILD_LIB_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||
o/$(MODE)/tool/build/lib/apetest.com.zip.o \
|
||||
o/$(MODE)/tool/build/lib/apetest2.com.zip.o
|
||||
o/$(MODE)/tool/build/lib/apetest.zip.o \
|
||||
o/$(MODE)/tool/build/lib/apetest2.zip.o
|
||||
|
||||
TOOL_BUILD_LIB_A_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
|
@ -74,22 +74,22 @@ o/$(MODE)/tool/build/lib/ssefloat.o: private \
|
|||
-msse3
|
||||
endif
|
||||
|
||||
o/$(MODE)/tool/build/lib/apetest.com.dbg: \
|
||||
o/$(MODE)/tool/build/lib/apetest.dbg: \
|
||||
$(TOOL_BUILD_LIB_A_DEPS) \
|
||||
o/$(MODE)/tool/build/lib/apetest.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/build/lib/apetest2.com.dbg: \
|
||||
o/$(MODE)/tool/build/lib/apetest2.dbg: \
|
||||
$(TOOL_BUILD_LIB_A_DEPS) \
|
||||
o/$(MODE)/tool/build/lib/apetest.o \
|
||||
$(CRT) \
|
||||
$(APE_COPY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/build/lib/apetest.com.zip.o \
|
||||
o/$(MODE)/tool/build/lib/apetest2.com.zip.o: private \
|
||||
o/$(MODE)/tool/build/lib/apetest.zip.o \
|
||||
o/$(MODE)/tool/build/lib/apetest2.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
* The purpose of this library is to be able to have build commands with
|
||||
* huge argument lists. The way we do that is by replacing commands like
|
||||
*
|
||||
* foo.com lots of args
|
||||
* foo lots of args
|
||||
*
|
||||
* with this
|
||||
*
|
||||
* echo of args >args
|
||||
* foo.com lots @args
|
||||
* foo lots @args
|
||||
*
|
||||
* This iterator abstracts the process of reading the special `@`
|
||||
* prefixed args. In order to do that quickly and easily, we make the
|
||||
|
@ -57,7 +57,7 @@
|
|||
* # don't do this
|
||||
* target: thousands of args
|
||||
* $(file >$@.args) $(foreach x,$^,$(file >>$@.args,$(x)))
|
||||
* tool.com -o $@ @$@.args
|
||||
* tool -o $@ @$@.args
|
||||
*
|
||||
* That is slow because it needs to open and close the args file
|
||||
* thousands of times. If we trade away filenames with spaces then the
|
||||
|
@ -66,7 +66,7 @@
|
|||
* # do this
|
||||
* target: thousands of args
|
||||
* $(file >$@.args,$^)
|
||||
* tool.com -o $@ @$@.args
|
||||
* tool -o $@ @$@.args
|
||||
*
|
||||
* We need (2) because it make the code in this file simpler and avoids
|
||||
* a malloc() dependency. Having that trailing character means argument
|
||||
|
|
|
@ -37,7 +37,7 @@ void *GetRunitPsk(void) {
|
|||
struct stat st;
|
||||
p = gc(xasprintf("%s/.runit.psk", gc(xhomedir())));
|
||||
if (stat(p, &st) == -1 || st.st_size != 32) {
|
||||
fprintf(stderr, "need o//examples/getrandom.com -bn32 >~/.runit.psk\n");
|
||||
fprintf(stderr, "need o//examples/getrandom -bn32 >~/.runit.psk\n");
|
||||
exit(1);
|
||||
}
|
||||
CHECK_NOTNULL((r = malloc(32)));
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
"-march=native flag printer v0.1\n" \
|
||||
"copyright 2023 justine alexandra roberts tunney\n"
|
||||
|
||||
#define USAGE \
|
||||
"usage: march-native.com [-hvc]\n" \
|
||||
" -h show help\n" \
|
||||
" -v show version\n" \
|
||||
#define USAGE \
|
||||
"usage: march-native [-hvc]\n" \
|
||||
" -h show help\n" \
|
||||
" -v show version\n" \
|
||||
" -c assume we're using clang (not gcc)\n"
|
||||
|
||||
static bool isclang;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/**
|
||||
* @fileoverview stronger mktemp for shell scripts, e.g.
|
||||
*
|
||||
* o//tool/build/mktemper.com ${TMPDIR:-/tmp}/fooXXXXXXXXXXXXX.o
|
||||
* o//tool/build/mktemper ${TMPDIR:-/tmp}/fooXXXXXXXXXXXXX.o
|
||||
*
|
||||
* Is a good way to name an intermediate object file.
|
||||
*/
|
||||
|
|
|
@ -52,11 +52,11 @@ __static_yoink("realloc");
|
|||
*
|
||||
* This script verifies the well-formedness of dependencies, e.g.
|
||||
*
|
||||
* o/tool/build/package.com \
|
||||
* o/tool/build/package \
|
||||
* -o o/libc/stubs/stubs.pkg \
|
||||
* o/libc/stubs/{a,b,...}.o
|
||||
*
|
||||
* o/tool/build/package.com \
|
||||
* o/tool/build/package \
|
||||
* -o o/libc/nexgen32e/nexgen32e.pkg \
|
||||
* -d o/libc/stubs/stubs.pkg \
|
||||
* o/libc/nexgen32e/{a,b,...}.o
|
||||
|
@ -358,15 +358,14 @@ static void GetOpts(struct Package *pkg, struct Packages *deps, int argc,
|
|||
}
|
||||
}
|
||||
if (pkg->path == -1) {
|
||||
tinyprint(2, "error: no packages passed to package.com\n", NULL);
|
||||
tinyprint(2, "error: no packages passed to package\n", NULL);
|
||||
exit(1);
|
||||
}
|
||||
if (optind == argc) {
|
||||
tinyprint(
|
||||
2,
|
||||
"no objects passed to package.com; is your foo.mk $(FOO_OBJS) glob "
|
||||
"broken?\n",
|
||||
NULL);
|
||||
tinyprint(2,
|
||||
"no objects passed to package; is your foo.mk $(FOO_OBJS) glob "
|
||||
"broken?\n",
|
||||
NULL);
|
||||
exit(1);
|
||||
}
|
||||
getargs_init(&ga, argv + optind);
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/promises.internal.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
|
@ -48,6 +47,7 @@
|
|||
#include "libc/nexgen32e/kcpuids.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/stack.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/sock/struct/pollfd.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -854,10 +854,10 @@ int main(int argc, char *argv[]) {
|
|||
// perform unveiling
|
||||
ApplyFilesystemPolicy(ipromises);
|
||||
|
||||
// pledge.com uses the return eperm instead of killing the process
|
||||
// model. we do this becasue it's only possible to have sigsys print
|
||||
// crash messages if we're not pledging exec, which is what this tool
|
||||
// always has to do currently.
|
||||
// pledge uses the return eperm instead of killing the process model.
|
||||
// we do this becasue it's only possible to have sigsys print crash
|
||||
// messages if we're not pledging exec, which is what this tool always
|
||||
// has to do currently.
|
||||
if (g_kflag) {
|
||||
__pledge_mode = PLEDGE_PENALTY_KILL_PROCESS;
|
||||
} else {
|
||||
|
|
|
@ -72,9 +72,9 @@
|
|||
* of certificates. It's how long it takes to connect, copy the binary,
|
||||
* and run it. The remote daemon is deployed via SSH if it's not there.
|
||||
*
|
||||
* o/default/tool/build/runit.com \
|
||||
* o/default/tool/build/runitd.com \
|
||||
* o/default/test/libc/mem/qsort_test.com \
|
||||
* o/default/tool/build/runit \
|
||||
* o/default/tool/build/runitd \
|
||||
* o/default/test/libc/mem/qsort_test \
|
||||
* freebsd.test.:31337:22
|
||||
*
|
||||
* APE binaries are hermetic and embed dependent files within their zip
|
||||
|
@ -412,10 +412,10 @@ int SpawnSubprocesses(int argc, char *argv[]) {
|
|||
// fork off 𝑛 subprocesses for each host on which we run binary.
|
||||
// what's important here is htop in tree mode will report like:
|
||||
//
|
||||
// runit.com xnu freebsd netbsd
|
||||
// ├─runit.com xnu
|
||||
// ├─runit.com freebsd
|
||||
// └─runit.com netbsd
|
||||
// runit xnu freebsd netbsd
|
||||
// ├─runit xnu
|
||||
// ├─runit freebsd
|
||||
// └─runit netbsd
|
||||
//
|
||||
// That way when one hangs, it's easy to know what o/s it is.
|
||||
argc -= 3;
|
||||
|
|
|
@ -30,19 +30,18 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/fmt/libgen.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/log/appendresourcereport.internal.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/proc/posix_spawn.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/sock/struct/pollfd.h"
|
||||
#include "libc/sock/struct/sockaddr.h"
|
||||
|
@ -489,7 +488,7 @@ void *ClientWorker(void *arg) {
|
|||
// condition can happen, where etxtbsy is raised by our execve
|
||||
// we're using o_cloexec so it's guaranteed to fix itself fast
|
||||
// thus we use an optimistic approach to avoid expensive locks
|
||||
sprintf(client->tmpexepath, "o/%s.XXXXXX.com",
|
||||
sprintf(client->tmpexepath, "o/%s.XXXXXX",
|
||||
basename(stripext(gc(strdup(origname)))));
|
||||
int exefd = openatemp(AT_FDCWD, client->tmpexepath, 4, O_CLOEXEC, 0700);
|
||||
if (exefd == -1) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define USAGE \
|
||||
"\
|
||||
Usage: unbuffer.com [FLAGS] PROG ARGS...\n\
|
||||
Usage: unbuffer [FLAGS] PROG ARGS...\n\
|
||||
-o PATH output file\n\
|
||||
"
|
||||
|
||||
|
|
|
@ -29,15 +29,12 @@
|
|||
|
||||
#define USAGE \
|
||||
"\
|
||||
usage: unveil.com [-h] PROG ARGS...\n\
|
||||
usage: unveil [-h] PROG ARGS...\n\
|
||||
-h show help\n\
|
||||
\n\
|
||||
unveil.com v1.o\n\
|
||||
unveil v1.o\n\
|
||||
copyright 2022 justine alexandra roberts tunney\n\
|
||||
https://twitter.com/justinetunney\n\
|
||||
https://linkedin.com/in/jtunney\n\
|
||||
https://justine.lol/pledge/\n\
|
||||
https://github.com/jart\n\
|
||||
licensed isc\n\
|
||||
\n\
|
||||
this program lets you launch linux commands in a filesystem sandbox\n\
|
||||
inspired by the design of openbsd's unveil() system call.\n\
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include "libc/elf/struct/shdr.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/magnumstrs.internal.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/stdio/sysparam.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -85,8 +85,8 @@ FLAGS\n\
|
|||
\n\
|
||||
EXAMPLE\n\
|
||||
\n\
|
||||
objcopy -SO binary foo.com.dbg foo.com\n\
|
||||
zipcopy foo.com.dbg foo.com\n\
|
||||
objcopy -SO binary foo.dbg foo\n\
|
||||
zipcopy foo.dbg foo\n\
|
||||
\n\
|
||||
\n\
|
||||
",
|
||||
|
@ -122,7 +122,7 @@ static void CopyZip(void) {
|
|||
//
|
||||
// if input is an elf file with sections, then the zip artifacts need
|
||||
// to have been linked into a .zip section and then later copied into
|
||||
// the file end by fixupobj.com.
|
||||
// the file end by fixupobj.
|
||||
//
|
||||
if (IsElf64Binary((ehdr = (Elf64_Ehdr *)inmap), insize) && ehdr->e_shnum &&
|
||||
(secstrs = GetElfSectionNameStringTable(ehdr, insize)) &&
|
||||
|
|
|
@ -29,7 +29,7 @@ You now have an [actually portable
|
|||
executable](https://justine.lol/ape.html) that'll run on your host
|
||||
system. If anything goes wrong, see the Gotchas and Troubleshoot
|
||||
sections below. It should have also outputted two ELF executables as
|
||||
well, named `hello.com.dbg` (x86-64 Linux ELF) and `hello.aarch64.elf`
|
||||
well, named `hello.dbg` (x86-64 Linux ELF) and `hello.aarch64.elf`
|
||||
(AARCH64 Linux ELF). On Linux systems, those files are also runnable,
|
||||
which is useful for easily running programs in GDB. On other OSes GDB
|
||||
can still debug APE programs if the ELF is loaded in a second step using
|
||||
|
@ -163,10 +163,10 @@ being passed to the freestanding Linux compiler.
|
|||
(cd /home/jart/cosmocc; bin/aarch64-linux-cosmo-gcc -o/tmp/fatcosmocc.w48k03qgw8692.o -D__COSMOPO...
|
||||
(cd /home/jart/cosmocc; bin/fixupobj /tmp/fatcosmocc.i5lugr6bc0gu0.o)
|
||||
(cd /home/jart/cosmocc; bin/fixupobj /tmp/fatcosmocc.w48k03qgw8692.o)
|
||||
(cd /home/jart/cosmocc; bin/x86_64-linux-cosmo-gcc -o/tmp/fatcosmocc.ovdo2nqvkjjg3.com.dbg c...
|
||||
(cd /home/jart/cosmocc; bin/x86_64-linux-cosmo-gcc -o/tmp/fatcosmocc.ovdo2nqvkjjg3.dbg c...
|
||||
(cd /home/jart/cosmocc; bin/aarch64-linux-cosmo-gcc -o/tmp/fatcosmocc.d3ca1smuot0k0.aarch64.elf /...
|
||||
(cd /home/jart/cosmocc; bin/fixupobj /tmp/fatcosmocc.d3ca1smuot0k0.aarch64.elf)
|
||||
(cd /home/jart/cosmocc; bin/fixupobj /tmp/fatcosmocc.ovdo2nqvkjjg3.com.dbg)
|
||||
(cd /home/jart/cosmocc; bin/fixupobj /tmp/fatcosmocc.ovdo2nqvkjjg3.dbg)
|
||||
(cd /home/jart/cosmocc; bin/apelink -l bin/ape.elf -l bin/ape.aarch64 -...
|
||||
(cd /home/jart/cosmocc; bin/pecheck hello)
|
||||
```
|
||||
|
@ -269,7 +269,7 @@ The `cosmoaddr2line` program may be used to print backtraces, based on
|
|||
DWARF data, whenever one of your programs reports a crash. It accepts as
|
||||
an argument the ELF executable produced by `cosmocc`, which is different
|
||||
from the APE executable. For example, if `cosmocc` compiles a program
|
||||
named `hello` then you'll need to pass either `hello.com.dbg` (x86-64)
|
||||
named `hello` then you'll need to pass either `hello.dbg` (x86-64)
|
||||
or `hello.aarch64.elf` to cosmoaddr2line to get the backtrace. After the
|
||||
ELf executable comes the program counter (instruction pointer) addresses
|
||||
which are easily obtained using `__builtin_frame_address(0)`. Cosmo can
|
||||
|
|
|
@ -163,13 +163,6 @@ for x; do
|
|||
# this toolchain is intended for building other people's code
|
||||
# elevating warnings into errors, should only be done by devs
|
||||
continue
|
||||
elif [ x"$x" = x"-march=native" ]; then
|
||||
if [ $CROSS -eq 0 ]; then
|
||||
set -- "$@" $("$BIN/march-native")
|
||||
else
|
||||
fatal_error "-march=native can't be used when cross compiling"
|
||||
fi
|
||||
continue
|
||||
elif [ x"$x" = x"-dumpversion" ]; then
|
||||
echo $GCC_VERSION
|
||||
exit 0
|
||||
|
|
|
@ -16,7 +16,7 @@ mode() {
|
|||
}
|
||||
|
||||
OUTDIR=${1:-cosmocc}
|
||||
APELINK=o/$(mode)/tool/build/apelink.com
|
||||
APELINK=o/$(mode)/tool/build/apelink
|
||||
AMD64=${2:-x86_64}
|
||||
ARM64=${3:-aarch64}
|
||||
GCCVER=12.3.0
|
||||
|
@ -35,17 +35,17 @@ make -j32 m=$AMD64 \
|
|||
o/$AMD64/ape/ape-no-modify-self.o \
|
||||
o/$AMD64/cosmopolitan.a \
|
||||
o/$AMD64/third_party/libcxx/libcxx.a \
|
||||
o/$AMD64/tool/build/assimilate.com.dbg \
|
||||
o/$AMD64/tool/build/march-native.com.dbg \
|
||||
o/$AMD64/tool/build/mktemper.com.dbg \
|
||||
o/$AMD64/tool/build/fixupobj.com.dbg \
|
||||
o/$AMD64/tool/build/zipcopy.com.dbg \
|
||||
o/$AMD64/tool/build/mkdeps.com.dbg \
|
||||
o/$AMD64/tool/build/zipobj.com.dbg \
|
||||
o/$AMD64/tool/build/apelink.com.dbg \
|
||||
o/$AMD64/tool/build/pecheck.com.dbg \
|
||||
o/$AMD64/third_party/make/make.com.dbg \
|
||||
o/$AMD64/third_party/ctags/ctags.com.dbg
|
||||
o/$AMD64/tool/build/assimilate.dbg \
|
||||
o/$AMD64/tool/build/march-native.dbg \
|
||||
o/$AMD64/tool/build/mktemper.dbg \
|
||||
o/$AMD64/tool/build/fixupobj.dbg \
|
||||
o/$AMD64/tool/build/zipcopy.dbg \
|
||||
o/$AMD64/tool/build/mkdeps.dbg \
|
||||
o/$AMD64/tool/build/zipobj.dbg \
|
||||
o/$AMD64/tool/build/apelink.dbg \
|
||||
o/$AMD64/tool/build/pecheck.dbg \
|
||||
o/$AMD64/third_party/make/make.dbg \
|
||||
o/$AMD64/third_party/ctags/ctags.dbg
|
||||
|
||||
make -j32 m=$ARM64 \
|
||||
o/$ARM64/ape/ape.elf \
|
||||
|
@ -55,17 +55,17 @@ make -j32 m=$ARM64 \
|
|||
o/$ARM64/ape/ape-no-modify-self.o \
|
||||
o/$ARM64/cosmopolitan.a \
|
||||
o/$ARM64/third_party/libcxx/libcxx.a \
|
||||
o/$ARM64/tool/build/assimilate.com.dbg \
|
||||
o/$ARM64/tool/build/march-native.com.dbg \
|
||||
o/$ARM64/tool/build/mktemper.com.dbg \
|
||||
o/$ARM64/tool/build/fixupobj.com.dbg \
|
||||
o/$ARM64/tool/build/zipcopy.com.dbg \
|
||||
o/$ARM64/tool/build/mkdeps.com.dbg \
|
||||
o/$ARM64/tool/build/zipobj.com.dbg \
|
||||
o/$ARM64/tool/build/apelink.com.dbg \
|
||||
o/$ARM64/tool/build/pecheck.com.dbg \
|
||||
o/$ARM64/third_party/make/make.com.dbg \
|
||||
o/$ARM64/third_party/ctags/ctags.com.dbg
|
||||
o/$ARM64/tool/build/assimilate.dbg \
|
||||
o/$ARM64/tool/build/march-native.dbg \
|
||||
o/$ARM64/tool/build/mktemper.dbg \
|
||||
o/$ARM64/tool/build/fixupobj.dbg \
|
||||
o/$ARM64/tool/build/zipcopy.dbg \
|
||||
o/$ARM64/tool/build/mkdeps.dbg \
|
||||
o/$ARM64/tool/build/zipobj.dbg \
|
||||
o/$ARM64/tool/build/apelink.dbg \
|
||||
o/$ARM64/tool/build/pecheck.dbg \
|
||||
o/$ARM64/third_party/make/make.dbg \
|
||||
o/$ARM64/third_party/ctags/ctags.dbg
|
||||
|
||||
mkdir -p "$OUTDIR/bin/"
|
||||
cp tool/cosmocc/README.md "$OUTDIR/"
|
||||
|
@ -152,8 +152,8 @@ for x in assimilate march-native mktemper fixupobj zipcopy apelink pecheck mkdep
|
|||
-l o/$ARM64/ape/ape.elf \
|
||||
-M ape/ape-m1.c \
|
||||
-o "$OUTDIR/bin/$x" \
|
||||
o/$AMD64/tool/build/$x.com.dbg \
|
||||
o/$ARM64/tool/build/$x.com.dbg
|
||||
o/$AMD64/tool/build/$x.dbg \
|
||||
o/$ARM64/tool/build/$x.dbg
|
||||
done
|
||||
for x in make ctags; do
|
||||
ape $APELINK \
|
||||
|
@ -161,6 +161,6 @@ for x in make ctags; do
|
|||
-l o/$ARM64/ape/ape.elf \
|
||||
-M ape/ape-m1.c \
|
||||
-o "$OUTDIR/bin/$x" \
|
||||
o/$AMD64/third_party/$x/$x.com.dbg \
|
||||
o/$ARM64/third_party/$x/$x.com.dbg
|
||||
o/$AMD64/third_party/$x/$x.dbg \
|
||||
o/$ARM64/third_party/$x/$x.dbg
|
||||
done
|
||||
|
|
|
@ -47,7 +47,7 @@ $(TOOL_CURL_A).pkg: \
|
|||
$(TOOL_CURL_OBJS) \
|
||||
$(foreach x,$(TOOL_CURL_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/curl/curl.com.dbg: \
|
||||
o/$(MODE)/tool/curl/curl.dbg: \
|
||||
$(TOOL_CURL) \
|
||||
o/$(MODE)/tool/curl/cmd.o \
|
||||
o/$(MODE)/tool/curl/curl.o \
|
||||
|
@ -57,7 +57,7 @@ o/$(MODE)/tool/curl/curl.com.dbg: \
|
|||
|
||||
TOOL_CURL_LIBS = $(TOOL_CURL_A)
|
||||
TOOL_CURL_BINS = $(TOOL_CURL_COMS) $(TOOL_CURL_COMS:%=%.dbg)
|
||||
TOOL_CURL_COMS = o/$(MODE)/tool/curl/curl.com
|
||||
TOOL_CURL_COMS = o/$(MODE)/tool/curl/curl
|
||||
$(TOOL_CURL_OBJS): $(BUILD_FILES) tool/curl/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/tool/curl
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
m=zero
|
||||
make -j16 m=$m o/$m/tool/curl/curl.com || exit
|
||||
make -j16 m=$m o/$m/tool/curl/curl || exit
|
||||
for t in expired \
|
||||
wrong.host \
|
||||
self-signed \
|
||||
|
@ -19,5 +19,5 @@ for t in expired \
|
|||
u=https://$t.badssl.com/
|
||||
echo
|
||||
echo $u
|
||||
o/$m/tool/curl/curl.com $u
|
||||
o/$m/tool/curl/curl $u
|
||||
done
|
||||
|
|
|
@ -11,7 +11,7 @@ TOOL_DECODE_OBJS = \
|
|||
$(TOOL_DECODE_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_DECODE_COMS = \
|
||||
$(TOOL_DECODE_SRCS:%.c=o/$(MODE)/%.com)
|
||||
$(TOOL_DECODE_SRCS:%.c=o/$(MODE)/%)
|
||||
|
||||
TOOL_DECODE_BINS = \
|
||||
$(TOOL_DECODE_COMS) \
|
||||
|
@ -48,7 +48,7 @@ o/$(MODE)/tool/decode/decode.pkg: \
|
|||
$(TOOL_DECODE_OBJS) \
|
||||
$(foreach x,$(TOOL_DECODE_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/decode/%.com.dbg: \
|
||||
o/$(MODE)/tool/decode/%.dbg: \
|
||||
$(TOOL_DECODE_DEPS) \
|
||||
o/$(MODE)/tool/decode/%.o \
|
||||
o/$(MODE)/tool/decode/decode.pkg \
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
/**
|
||||
* ar rU doge.a NOTICE # create archive and use non-deterministic stuff
|
||||
* o//tool/decode/ar.com doge.a
|
||||
* o//tool/decode/ar doge.a
|
||||
*/
|
||||
|
||||
static int fd;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Displays bytes as word, e.g.
|
||||
*
|
||||
* o//tool/word.com 6e c7 ff ff
|
||||
* o//tool/word 6e c7 ff ff
|
||||
* %d = -14482
|
||||
* %ld = 4294952814
|
||||
* %#x = 0xffffc76e
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
(defcustom cosmo-format-exts '("c" "cc" "h" "inc" ;; c/c++
|
||||
"hh" "cpp" "hpp" ;; ms c/c++
|
||||
"rl" ;; ragel
|
||||
"cu" ;; cuda
|
||||
"proto") ;; protobuf
|
||||
"List of pathname extensions that need clang-format."
|
||||
:type '(repeat string)
|
||||
|
|
|
@ -73,12 +73,23 @@
|
|||
"__gnu__"
|
||||
"_OPENMP"))
|
||||
|
||||
(cuda
|
||||
'("__NVCC__"))
|
||||
|
||||
(hip
|
||||
'("__HIP__"
|
||||
"__HIPCC__"
|
||||
"__HIP_DEVICE_COMPILE__"
|
||||
"__AMD__"
|
||||
"__AMDGCN__"
|
||||
"__AMDGPU__"))
|
||||
|
||||
(cosmo
|
||||
'("__LINKER__"))
|
||||
|
||||
)
|
||||
(concat "\\_<"
|
||||
(regexp-opt (append cpp92 gcc412 cosmo))
|
||||
(regexp-opt (append cpp92 gcc412 cuda hip cosmo))
|
||||
"\\_>")))
|
||||
|
||||
(provide 'cosmo-platform-constants)
|
||||
|
|
|
@ -212,9 +212,9 @@
|
|||
(file (file-relative-name this root)) ;; e.g. "libc/crc32c.c"
|
||||
(name (file-name-sans-extension file)) ;; e.g. "libc/crc32c"
|
||||
(buddy (format "test/%s_test.c" name))
|
||||
(runs (format "o/$m/%s.com%s V=5 TESTARGS=-b" name runsuffix))
|
||||
(buns (format "o/$m/test/%s_test.com%s V=5 TESTARGS=-b" name runsuffix)))
|
||||
(cond ((not (member ext '("c" "cc" "cpp" "s" "S" "rl" "f")))
|
||||
(runs (format "o/$m/%s%s V=5 TESTARGS=-b" name runsuffix))
|
||||
(buns (format "o/$m/test/%s_test%s V=5 TESTARGS=-b" name runsuffix)))
|
||||
(cond ((not (member ext '("c" "cc" "cpp" "s" "S" "rl" "f" "cu")))
|
||||
(format "m=%s; make -j32 MODE=$m o/$m/%s"
|
||||
mode
|
||||
(directory-file-name
|
||||
|
@ -225,18 +225,18 @@
|
|||
(format
|
||||
(cosmo-join
|
||||
" && "
|
||||
`("m=%s; f=o/$m/%s.com"
|
||||
`("m=%s; f=o/$m/%s"
|
||||
,(concat "make -j32 $f MODE=$m")
|
||||
"scp $f $f.dbg win10:; ssh win10 ./%s.com"))
|
||||
"scp $f $f.dbg win10:; ssh win10 ./%s"))
|
||||
mode name (file-name-nondirectory name)))
|
||||
((eq kind 'run-xnu)
|
||||
(format
|
||||
(cosmo-join
|
||||
" && "
|
||||
`("m=%s; f=o/$m/%s.com"
|
||||
`("m=%s; f=o/$m/%s"
|
||||
,(concat "make -j32 $f MODE=$m")
|
||||
"scp $f $f.dbg xnu:"
|
||||
"ssh xnu ./%s.com"))
|
||||
"ssh xnu ./%s"))
|
||||
mode name (file-name-nondirectory name)))
|
||||
((and (equal suffix "")
|
||||
(cosmo-contains "_test." (buffer-file-name)))
|
||||
|
@ -257,12 +257,12 @@
|
|||
(format
|
||||
(cosmo-join
|
||||
" && "
|
||||
`("m=%s; f=o/$m/%s.com"
|
||||
`("m=%s; f=o/$m/%s"
|
||||
,(concat "make -j32 $f MODE=$m")
|
||||
"build/run ./$f"))
|
||||
mode name))
|
||||
((eq kind 'test)
|
||||
(format `"m=%s; f=o/$m/%s.com.ok && make -j32 $f MODE=$m" mode name))
|
||||
(format `"m=%s; f=o/$m/%s.ok && make -j32 $f MODE=$m" mode name))
|
||||
((and (file-regular-p this)
|
||||
(file-executable-p this))
|
||||
(format "build/run ./%s" file))
|
||||
|
@ -641,14 +641,14 @@
|
|||
(compile (format "sh -c %s" file)))
|
||||
((eq major-mode 'lua-mode)
|
||||
(let* ((mode (cosmo--make-mode arg)))
|
||||
(compile (format "make -j32 MODE=%s o/%s/tool/net/redbean.com && build/run o/%s/tool/net/redbean.com -i %s" mode mode mode file))))
|
||||
(compile (format "make -j32 MODE=%s o/%s/tool/net/redbean && build/run o/%s/tool/net/redbean -i %s" mode mode mode file))))
|
||||
((and (eq major-mode 'python-mode)
|
||||
(cosmo-startswith "third_party/python/Lib/test/" file))
|
||||
(let ((mode (cosmo--make-mode arg)))
|
||||
(compile (format "make -j32 MODE=%s PYHARNESSARGS=-vv PYTESTARGS=-v o/%s/%s.py.runs"
|
||||
mode mode (file-name-sans-extension file)))))
|
||||
((eq major-mode 'python-mode)
|
||||
(compile (format "python.com %s" file)))
|
||||
(compile (format "python %s" file)))
|
||||
('t
|
||||
(error "cosmo-run: unknown major mode")))))))
|
||||
|
||||
|
@ -715,7 +715,7 @@
|
|||
(let* ((mode (cosmo--make-mode arg cosmo-dbg-mode))
|
||||
(name (file-relative-name this root))
|
||||
(next (file-name-sans-extension name))
|
||||
(exec (format "o/%s/%s.com.dbg" mode next))
|
||||
(exec (format "o/%s/%s.dbg" mode next))
|
||||
(default-directory root)
|
||||
(compile-command (cosmo--compile-command this root nil mode "" "" ".runs")))
|
||||
(compile compile-command)
|
||||
|
|
|
@ -11,87 +11,87 @@ TOOL_HELLO_SRCS = $(TOOL_HELLO_SRCS_C) $(TOOL_HELLO_SRCS_S)
|
|||
TOOL_HELLO_OBJS = $(TOOL_HELLO_SRCS_C:%.c=o/$(MODE)/%.o) $(TOOL_HELLO_SRCS_S:%.S=o/$(MODE)/%.o)
|
||||
TOOL_HELLO_BINS = $(TOOL_HELLO_COMS) $(TOOL_HELLO_COMS:%=%.dbg)
|
||||
|
||||
TOOL_HELLO_COMS = \
|
||||
o/$(MODE)/tool/hello/hello.com \
|
||||
o/$(MODE)/tool/hello/hello-pe.com \
|
||||
o/$(MODE)/tool/hello/hello-elf.com \
|
||||
o/$(MODE)/tool/hello/hello-unix.com
|
||||
TOOL_HELLO_COMS = \
|
||||
o/$(MODE)/tool/hello/hello \
|
||||
o/$(MODE)/tool/hello/hello-pe \
|
||||
o/$(MODE)/tool/hello/hello-elf \
|
||||
o/$(MODE)/tool/hello/hello-unix
|
||||
|
||||
TOOL_HELLO_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
TOOL_HELLO_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
LIBC_RUNTIME
|
||||
|
||||
TOOL_HELLO_DEPS := \
|
||||
TOOL_HELLO_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TOOL_HELLO_DIRECTDEPS),$($(x))))
|
||||
|
||||
o/$(MODE)/tool/hello/hello.pkg: \
|
||||
$(TOOL_HELLO_OBJS) \
|
||||
o/$(MODE)/tool/hello/hello.pkg: \
|
||||
$(TOOL_HELLO_OBJS) \
|
||||
$(foreach x,$(TOOL_HELLO_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
# generates debuggable executable using gcc
|
||||
o/$(MODE)/tool/hello/hello.com.dbg: \
|
||||
$(TOOL_HELLO_DEPS) \
|
||||
o/$(MODE)/tool/hello/hello.o \
|
||||
o/$(MODE)/tool/hello/hello.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/hello/hello.dbg: \
|
||||
$(TOOL_HELLO_DEPS) \
|
||||
o/$(MODE)/tool/hello/hello.o \
|
||||
o/$(MODE)/tool/hello/hello.pkg \
|
||||
$(CRT) \
|
||||
$(APE)
|
||||
@$(APELINK)
|
||||
|
||||
# uses apelink to turn it into an ape executable
|
||||
# support vector is set to all operating systems
|
||||
o/$(MODE)/tool/hello/hello.ape: \
|
||||
o/$(MODE)/tool/hello/hello.com.dbg \
|
||||
o/$(MODE)/tool/build/apelink.com \
|
||||
o/$(MODE)/tool/build/pecheck.com \
|
||||
o/$(MODE)/tool/hello/hello.ape: \
|
||||
o/$(MODE)/tool/hello/hello.dbg \
|
||||
o/$(MODE)/tool/build/apelink \
|
||||
o/$(MODE)/tool/build/pecheck \
|
||||
o/$(MODE)/ape/ape.elf
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink.com -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
@$(COMPILE) -APECHECK -wT$@ o/$(MODE)/tool/build/pecheck.com $@
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
@$(COMPILE) -APECHECK -wT$@ o/$(MODE)/tool/build/pecheck $@
|
||||
|
||||
# uses apelink to generate elf-only executable
|
||||
# support vector = linux/freebsd/openbsd/netbsd/metal
|
||||
o/$(MODE)/tool/hello/hello-elf.ape: \
|
||||
o/$(MODE)/tool/hello/hello.com.dbg \
|
||||
o/$(MODE)/tool/build/apelink.com \
|
||||
o/$(MODE)/tool/hello/hello-elf.ape: \
|
||||
o/$(MODE)/tool/hello/hello.dbg \
|
||||
o/$(MODE)/tool/build/apelink \
|
||||
o/$(MODE)/ape/ape.elf
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink.com -V elf -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink -V elf -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
|
||||
# uses apelink to generate non-pe ape executable
|
||||
# support vector = macos/linux/freebsd/openbsd/netbsd
|
||||
# - great way to avoid attention from bad virus scanners
|
||||
# - creates tinier executable by reducing alignment requirement
|
||||
o/$(MODE)/tool/hello/hello-unix.ape: \
|
||||
o/$(MODE)/tool/hello/hello.com.dbg \
|
||||
o/$(MODE)/tool/build/apelink.com \
|
||||
o/$(MODE)/tool/hello/hello-unix.ape: \
|
||||
o/$(MODE)/tool/hello/hello.dbg \
|
||||
o/$(MODE)/tool/build/apelink \
|
||||
o/$(MODE)/ape/ape.elf
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink.com -V unix -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
@$(COMPILE) -ALINK.ape o/$(MODE)/tool/build/apelink -V unix -o $@ -l o/$(MODE)/ape/ape.elf $<
|
||||
|
||||
# elf2pe generates optimal pe binaries
|
||||
# windows is the only platform supported
|
||||
# doesn't depend on ape or the cosmopolitan c library
|
||||
o/$(MODE)/tool/hello/hello-pe.com.dbg: \
|
||||
o/$(MODE)/tool/hello/hello-pe.dbg: \
|
||||
o/$(MODE)/tool/hello/hello-pe.o
|
||||
@$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain
|
||||
o/$(MODE)/tool/hello/hello-pe.ape: \
|
||||
o/$(MODE)/tool/hello/hello-pe.com.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe.com
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe.com -o $@ $<
|
||||
o/$(MODE)/tool/hello/hello-pe.ape: \
|
||||
o/$(MODE)/tool/hello/hello-pe.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe -o $@ $<
|
||||
|
||||
# elf2pe can generate binaries that don't have dll imports
|
||||
o/$(MODE)/tool/hello/life-pe.com.dbg: \
|
||||
o/$(MODE)/tool/hello/life-pe.dbg: \
|
||||
o/$(MODE)/tool/hello/life-pe.o
|
||||
@$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain
|
||||
o/$(MODE)/tool/hello/life-pe.ape: \
|
||||
o/$(MODE)/tool/hello/life-pe.com.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe.com
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe.com -o $@ $<
|
||||
o/$(MODE)/tool/hello/life-pe.ape: \
|
||||
o/$(MODE)/tool/hello/life-pe.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe -o $@ $<
|
||||
|
||||
# demonstrates in process monitor the lowest resource usage a win32 app can have
|
||||
o/$(MODE)/tool/hello/wait-pe.com.dbg: \
|
||||
o/$(MODE)/tool/hello/wait-pe.dbg: \
|
||||
o/$(MODE)/tool/hello/wait-pe.o
|
||||
@$(COMPILE) -ALINK.elf $(LINK) $(LINKARGS) $(OUTPUT_OPTION) -q -e WinMain
|
||||
o/$(MODE)/tool/hello/wait-pe.ape: \
|
||||
o/$(MODE)/tool/hello/wait-pe.com.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe.com
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe.com -R 64kb -S 4kb -o $@ $<
|
||||
o/$(MODE)/tool/hello/wait-pe.ape: \
|
||||
o/$(MODE)/tool/hello/wait-pe.dbg \
|
||||
o/$(MODE)/tool/build/elf2pe
|
||||
@$(COMPILE) -AELF2PE o/$(MODE)/tool/build/elf2pe -R 64kb -S 4kb -o $@ $<
|
||||
|
||||
$(TOOL_HELLO_OBJS): tool/hello/BUILD.mk
|
||||
|
|
|
@ -9,7 +9,7 @@ TOOL_LAMBDA_OBJS = \
|
|||
$(TOOL_LAMBDA_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_LAMBDA_COMS := \
|
||||
$(TOOL_LAMBDA_SRCS:%.c=o/$(MODE)/%.com)
|
||||
$(TOOL_LAMBDA_SRCS:%.c=o/$(MODE)/%)
|
||||
|
||||
TOOL_LAMBDA_BINS = \
|
||||
$(TOOL_LAMBDA_COMS) \
|
||||
|
@ -37,7 +37,7 @@ o/$(MODE)/tool/lambda/lambda.pkg: \
|
|||
$(TOOL_LAMBDA_OBJS) \
|
||||
$(foreach x,$(TOOL_LAMBDA_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/lambda/%.com.dbg: \
|
||||
o/$(MODE)/tool/lambda/%.dbg: \
|
||||
$(TOOL_LAMBDA_DEPS) \
|
||||
o/$(MODE)/tool/lambda/%.o \
|
||||
o/$(MODE)/tool/lambda/lambda.pkg \
|
||||
|
|
|
@ -8,322 +8,282 @@ TOOL_NET_SRCS = $(filter %.c,$(TOOL_NET_FILES))
|
|||
TOOL_NET_HDRS = $(filter %.h,$(TOOL_NET_FILES))
|
||||
TOOL_NET_INCS = $(filter %.inc,$(TOOL_NET_FILES))
|
||||
|
||||
TOOL_NET_OBJS = \
|
||||
TOOL_NET_OBJS = \
|
||||
$(TOOL_NET_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_NET_BINS = \
|
||||
$(TOOL_NET_COMS) \
|
||||
TOOL_NET_BINS = \
|
||||
$(TOOL_NET_COMS) \
|
||||
$(TOOL_NET_COMS:%=%.dbg)
|
||||
|
||||
TOOL_NET_COMS = \
|
||||
o/$(MODE)/tool/net/dig.com \
|
||||
o/$(MODE)/tool/net/winbench.com \
|
||||
o/$(MODE)/tool/net/redbean.com \
|
||||
o/$(MODE)/tool/net/redbean-demo.com \
|
||||
o/$(MODE)/tool/net/redbean-static.com \
|
||||
o/$(MODE)/tool/net/libresolv_query.com \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com \
|
||||
o/$(MODE)/tool/net/redbean-original.com
|
||||
TOOL_NET_COMS = \
|
||||
o/$(MODE)/tool/net/dig \
|
||||
o/$(MODE)/tool/net/winbench \
|
||||
o/$(MODE)/tool/net/redbean \
|
||||
o/$(MODE)/tool/net/redbean-demo \
|
||||
o/$(MODE)/tool/net/redbean-static \
|
||||
o/$(MODE)/tool/net/libresolv_query \
|
||||
o/$(MODE)/tool/net/redbean-unsecure \
|
||||
o/$(MODE)/tool/net/redbean-original
|
||||
|
||||
TOOL_NET_CHECKS = \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
TOOL_NET_CHECKS = \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(TOOL_NET_HDRS:%=o/$(MODE)/%.ok)
|
||||
|
||||
TOOL_NET_DIRECTDEPS = \
|
||||
DSP_SCALE \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_LOG \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_NT_IPHLPAPI \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_WS2_32 \
|
||||
LIBC_PROC \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_SOCK \
|
||||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_TIME \
|
||||
LIBC_THREAD \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_X \
|
||||
NET_FINGER \
|
||||
NET_HTTP \
|
||||
NET_HTTPS \
|
||||
THIRD_PARTY_ARGON2 \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_LINENOISE \
|
||||
THIRD_PARTY_LUA \
|
||||
THIRD_PARTY_LUA_UNIX \
|
||||
THIRD_PARTY_MAXMIND \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_MBEDTLS \
|
||||
THIRD_PARTY_REGEX \
|
||||
THIRD_PARTY_SQLITE3 \
|
||||
THIRD_PARTY_ZLIB \
|
||||
TOOL_ARGS \
|
||||
TOOL_BUILD_LIB \
|
||||
TOOL_DECODE_LIB \
|
||||
TOOL_NET_DIRECTDEPS = \
|
||||
DSP_SCALE \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_LOG \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_NT_IPHLPAPI \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_WS2_32 \
|
||||
LIBC_PROC \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_SOCK \
|
||||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_TIME \
|
||||
LIBC_THREAD \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_X \
|
||||
NET_FINGER \
|
||||
NET_HTTP \
|
||||
NET_HTTPS \
|
||||
THIRD_PARTY_ARGON2 \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_LINENOISE \
|
||||
THIRD_PARTY_LUA \
|
||||
THIRD_PARTY_LUA_UNIX \
|
||||
THIRD_PARTY_MAXMIND \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_MBEDTLS \
|
||||
THIRD_PARTY_REGEX \
|
||||
THIRD_PARTY_SQLITE3 \
|
||||
THIRD_PARTY_ZLIB \
|
||||
TOOL_ARGS \
|
||||
TOOL_BUILD_LIB \
|
||||
TOOL_DECODE_LIB \
|
||||
THIRD_PARTY_DOUBLECONVERSION
|
||||
|
||||
TOOL_NET_DEPS := \
|
||||
TOOL_NET_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TOOL_NET_DIRECTDEPS),$($(x))))
|
||||
|
||||
o/$(MODE)/tool/net/net.pkg: \
|
||||
$(TOOL_NET_OBJS) \
|
||||
o/$(MODE)/tool/net/net.pkg: \
|
||||
$(TOOL_NET_OBJS) \
|
||||
$(foreach x,$(TOOL_NET_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/net/%.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/%.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/%.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/%.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
# REDBEAN.COM
|
||||
# REDBEAN
|
||||
#
|
||||
# The little web server that could!
|
||||
|
||||
TOOL_NET_REDBEAN_LUA_MODULES = \
|
||||
o/$(MODE)/tool/net/lfuncs.o \
|
||||
o/$(MODE)/tool/net/lpath.o \
|
||||
o/$(MODE)/tool/net/lfinger.o \
|
||||
o/$(MODE)/tool/net/lre.o \
|
||||
o/$(MODE)/tool/net/ljson.o \
|
||||
o/$(MODE)/tool/net/lmaxmind.o \
|
||||
o/$(MODE)/tool/net/lsqlite3.o \
|
||||
o/$(MODE)/tool/net/largon2.o \
|
||||
TOOL_NET_REDBEAN_LUA_MODULES = \
|
||||
o/$(MODE)/tool/net/lfuncs.o \
|
||||
o/$(MODE)/tool/net/lpath.o \
|
||||
o/$(MODE)/tool/net/lfinger.o \
|
||||
o/$(MODE)/tool/net/lre.o \
|
||||
o/$(MODE)/tool/net/ljson.o \
|
||||
o/$(MODE)/tool/net/lmaxmind.o \
|
||||
o/$(MODE)/tool/net/lsqlite3.o \
|
||||
o/$(MODE)/tool/net/largon2.o \
|
||||
o/$(MODE)/tool/net/launch.o
|
||||
|
||||
o/$(MODE)/tool/net/redbean.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/redbean.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/net/redbean.com: \
|
||||
o/$(MODE)/tool/net/redbean.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/lsqlite3.o: private \
|
||||
CFLAGS += \
|
||||
o/$(MODE)/tool/net/lsqlite3.o: private \
|
||||
CFLAGS += \
|
||||
-DSQLITE_ENABLE_SESSION
|
||||
|
||||
# REDBEAN-DEMO.COM
|
||||
# REDBEAN-DEMO
|
||||
#
|
||||
# This redbean-demo.com program is the same as redbean.com except it
|
||||
# This redbean-demo program is the same as redbean except it
|
||||
# bundles a bunch of example code and there's a live of it available
|
||||
# online at http://redbean.justine.lol/
|
||||
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backup.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backupstore.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-unix.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-rawsocket.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-subprocess.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-webserver.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-dir.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-info.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/fetch.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/call-lua-module.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/store-asset.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/maxmind.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/opensource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/hitcounter.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/binarytrees.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/crashreport.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/closedsource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/printpayload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/gensvg.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-form.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-xhr.lua.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/demo/404.html.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backup.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backupstore.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-unix.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-rawsocket.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-subprocess.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-webserver.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-dir.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-info.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/fetch.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/call-lua-module.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/store-asset.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/maxmind.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/opensource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/hitcounter.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/binarytrees.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/crashreport.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/closedsource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/printpayload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/gensvg.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-form.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-xhr.lua.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/demo/404.html.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B
|
||||
|
||||
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-C3
|
||||
|
||||
o/$(MODE)/tool/net/demo/seekable.txt.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B \
|
||||
o/$(MODE)/tool/net/demo/seekable.txt.zip.o: private \
|
||||
ZIPOBJ_FLAGS += \
|
||||
-B \
|
||||
-0
|
||||
|
||||
o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/redbean.o \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/demo/sql.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backup.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backupstore.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-unix.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-rawsocket.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-subprocess.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-webserver.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-dir.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-info.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/fetch.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/store-asset.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/call-lua-module.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/maxmind.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/opensource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/hitcounter.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/binarytrees.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/crashreport.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/closedsource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/printpayload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/gensvg.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-form.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-xhr.lua.zip.o \
|
||||
o/$(MODE)/tool/.zip.o \
|
||||
o/$(MODE)/tool/net/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/index.html.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.css.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/demo/404.html.zip.o \
|
||||
o/$(MODE)/tool/net/demo/seekable.txt.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/redbean-demo.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
o/$(MODE)/tool/net/redbean.o \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
o/$(MODE)/tool/net/demo/sql.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backup.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/sql-backupstore.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-unix.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-rawsocket.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-subprocess.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-webserver.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-dir.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-info.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/unix-finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/fetch.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/finger.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/store-asset.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/call-lua-module.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/maxmind.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/opensource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/hitcounter.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/binarytrees.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/crashreport.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/closedsource.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/printpayload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/gensvg.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-form.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean-xhr.lua.zip.o \
|
||||
o/$(MODE)/tool/.zip.o \
|
||||
o/$(MODE)/tool/net/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/index.html.zip.o \
|
||||
o/$(MODE)/tool/net/demo/redbean.css.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/demo/404.html.zip.o \
|
||||
o/$(MODE)/tool/net/demo/seekable.txt.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.lua/mymodule.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.reload.lua.zip.o \
|
||||
o/$(MODE)/tool/net/demo/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/net/redbean-demo.com: \
|
||||
o/$(MODE)/tool/net/redbean-demo.com.dbg \
|
||||
o/$(MODE)/third_party/zip/zip.com \
|
||||
o/$(MODE)/tool/build/symtab.com
|
||||
@$(MAKE_OBJCOPY)
|
||||
@$(MAKE_SYMTAB_CREATE)
|
||||
@$(MAKE_SYMTAB_ZIP)
|
||||
|
||||
# REDBEAN-STATIC.COM
|
||||
# REDBEAN-STATIC
|
||||
#
|
||||
# Passing the -DSTATIC causes Lua and SQLite to be removed. This reduces
|
||||
# the binary size from roughly 1500 kb to 500 kb. It still supports SSL.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-static.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-static.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/redbean-static.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-static.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(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
|
||||
#
|
||||
# Passing the -DUNSECURE will cause the TLS security code to be removed.
|
||||
# That doesn't mean redbean becomes insecure. It just reduces complexity
|
||||
# in situations where you'd rather have SSL be handled in an edge proxy.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-unsecure.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(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
|
||||
#
|
||||
# Passing the -DSTATIC and -DUNSECURE flags together w/ MODE=tiny will
|
||||
# produce 200kb binary that's very similar to redbean as it existed on
|
||||
# Hacker News the day it went viral.
|
||||
|
||||
o/$(MODE)/tool/net/redbean-original.com.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-original.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/net/redbean-original.dbg: \
|
||||
$(TOOL_NET_DEPS) \
|
||||
$(TOOL_NET_REDBEAN_LUA_MODULES) \
|
||||
o/$(MODE)/tool/net/.init.lua.zip.o \
|
||||
o/$(MODE)/tool/net/favicon.ico.zip.o \
|
||||
o/$(MODE)/tool/net/redbean.png.zip.o \
|
||||
o/$(MODE)/tool/net/help.txt.zip.o \
|
||||
o/$(MODE)/tool/net/redbean-original.o \
|
||||
o/$(MODE)/tool/net/net.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(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
|
||||
o/$(MODE)/tool/net/demo/.zip.o: \
|
||||
o/$(MODE)/tool/net/demo/.zip.o: \
|
||||
tool/net/demo
|
||||
o/$(MODE)/tool/net/.zip.o: \
|
||||
o/$(MODE)/tool/net/.zip.o: \
|
||||
tool/net
|
||||
o/$(MODE)/tool/.zip.o: \
|
||||
o/$(MODE)/tool/.zip.o: \
|
||||
tool
|
||||
|
||||
.PHONY: o/$(MODE)/tool/net
|
||||
o/$(MODE)/tool/net: \
|
||||
$(TOOL_NET_BINS) \
|
||||
o/$(MODE)/tool/net: \
|
||||
$(TOOL_NET_BINS) \
|
||||
$(TOOL_NET_CHECKS)
|
||||
|
|
|
@ -6,7 +6,7 @@ error("Tried to evaluate definition file.")
|
|||
|
||||
SYNOPSIS
|
||||
|
||||
redbean.com [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...]
|
||||
redbean [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
|
@ -16,9 +16,7 @@ OVERVIEW
|
|||
|
||||
redbean makes it possible to share web applications that run offline
|
||||
as a single-file Actually Portable Executable PKZIP archive which
|
||||
contains your assets. All you need to do is download the redbean.com
|
||||
program below, change the filename to .zip, add your content in a zip
|
||||
editing tool, and then change the extension back to .com.
|
||||
contains your assets.
|
||||
|
||||
redbean can serve 1 million+ gzip encoded responses per second on a
|
||||
cheap personal computer. That performance is thanks to zip and gzip
|
||||
|
@ -145,15 +143,15 @@ USAGE
|
|||
This executable is also a ZIP file that contains static assets.
|
||||
You can run redbean interactively in your terminal as follows:
|
||||
|
||||
./redbean.com -vvvmbag # starts server verbosely
|
||||
./redbean -vvvmbag # starts server verbosely
|
||||
open http://127.0.0.1:8080/ # shows zip listing page
|
||||
CTRL-C # 1x: graceful shutdown
|
||||
CTRL-C # 2x: forceful shutdown
|
||||
|
||||
You can override the default listing page by adding:
|
||||
|
||||
zip redbean.com index.lua # lua server pages take priority
|
||||
zip redbean.com index.html # default page for directory
|
||||
zip redbean index.lua # lua server pages take priority
|
||||
zip redbean index.html # default page for directory
|
||||
|
||||
The listing page only applies to the root directory. However the
|
||||
default index page applies to subdirectories too. In order for it
|
||||
|
@ -168,7 +166,7 @@ USAGE
|
|||
--no-parent \
|
||||
--no-if-modified-since \
|
||||
http://a.example/index.html
|
||||
zip -r redbean.com a.example/ # default page for directory
|
||||
zip -r redbean a.example/ # default page for directory
|
||||
|
||||
redbean normalizes the trailing slash for you automatically:
|
||||
|
||||
|
@ -206,18 +204,18 @@ USAGE
|
|||
by default, embedded as a bas64 data uri. You can override the
|
||||
custom page for various errors by adding files to the zip root.
|
||||
|
||||
zip redbean.com 404.html # custom not found page
|
||||
zip redbean 404.html # custom not found page
|
||||
|
||||
Audio video content should not be compressed in your ZIP files.
|
||||
Uncompressed assets enable browsers to send Range HTTP request.
|
||||
On the other hand compressed assets are best for gzip encoding.
|
||||
|
||||
zip redbean.com index.html # adds file
|
||||
zip -0 redbean.com video.mp4 # adds without compression
|
||||
zip redbean index.html # adds file
|
||||
zip -0 redbean video.mp4 # adds without compression
|
||||
|
||||
You can have redbean run as a daemon by doing the following:
|
||||
|
||||
sudo ./redbean.com -vvdp80 -p443 -L redbean.log -P redbean.pid
|
||||
sudo ./redbean -vvdp80 -p443 -L redbean.log -P redbean.pid
|
||||
kill -TERM $(cat redbean.pid) # 1x: graceful shutdown
|
||||
kill -TERM $(cat redbean.pid) # 2x: forceful shutdown
|
||||
|
||||
|
@ -241,11 +239,11 @@ USAGE
|
|||
is on the system path beforehand. You can also "assimilate" any
|
||||
redbean into the platform-local executable format by running:
|
||||
|
||||
$ file redbean.com
|
||||
redbean.com: DOS/MBR boot sector
|
||||
$ ./redbean.com --assimilate
|
||||
$ file redbean.com
|
||||
redbean.com: ELF 64-bit LSB executable
|
||||
$ file redbean
|
||||
redbean: DOS/MBR boot sector
|
||||
$ ./redbean --assimilate
|
||||
$ file redbean
|
||||
redbean: ELF 64-bit LSB executable
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
SECURITY
|
||||
|
@ -352,7 +350,7 @@ REPL
|
|||
interpreter then you can pass the `-i` flag to put redbean into
|
||||
interpreter mode.
|
||||
|
||||
redbean.com -i binarytrees.lua 15
|
||||
redbean -i binarytrees.lua 15
|
||||
|
||||
When the `-i` flag is passed (for interpreter mode), redbean won't
|
||||
start a web server and instead functions like the `lua` command. The
|
||||
|
@ -369,12 +367,12 @@ REPL
|
|||
encoded in its preferred executable format. You can assimilate your
|
||||
redbean into the local format using the following commands:
|
||||
|
||||
$ file redbean.com
|
||||
redbean.com: DOS/MBR boot sector
|
||||
$ ./redbean.com --assimilate
|
||||
$ file redbean.com
|
||||
redbean.com: ELF 64-bit LSB executable
|
||||
$ sudo cp redbean.com /usr/bin/redbean
|
||||
$ file redbean
|
||||
redbean: DOS/MBR boot sector
|
||||
$ ./redbean --assimilate
|
||||
$ file redbean
|
||||
redbean: ELF 64-bit LSB executable
|
||||
$ sudo cp redbean /usr/bin/redbean
|
||||
|
||||
By following the above steps, redbean can be installed systemwide for
|
||||
multiple user accounts. It's also possible to chmod the binary to have
|
||||
|
@ -423,11 +421,11 @@ LUA ENHANCEMENTS
|
|||
---
|
||||
--- For example, if you launch your redbean as follows:
|
||||
---
|
||||
--- redbean.com -v arg1 arg2
|
||||
--- redbean -v arg1 arg2
|
||||
---
|
||||
--- Then your `/.init.lua` file will have the `arg` array like:
|
||||
---
|
||||
--- arg[-1] = '/usr/bin/redbean.com'
|
||||
--- arg[-1] = '/usr/bin/redbean'
|
||||
--- arg[ 0] = '/zip/.init.lua'
|
||||
--- arg[ 1] = 'arg1'
|
||||
--- arg[ 2] = 'arg2'
|
||||
|
@ -435,11 +433,11 @@ LUA ENHANCEMENTS
|
|||
--- If you launch redbean in interpreter mode (rather than web
|
||||
--- server) mode, then an invocation like this:
|
||||
---
|
||||
--- ./redbean.com -i script.lua arg1 arg2
|
||||
--- ./redbean -i script.lua arg1 arg2
|
||||
---
|
||||
--- Would have an `arg` array like this:
|
||||
---
|
||||
--- arg[-1] = './redbean.com'
|
||||
--- arg[-1] = './redbean'
|
||||
--- arg[ 0] = 'script.lua'
|
||||
--- arg[ 1] = 'arg1'
|
||||
--- arg[ 2] = 'arg2'
|
||||
|
@ -511,7 +509,7 @@ SPECIAL PATHS
|
|||
If the special argument `...` *is* encountered, then it'll be
|
||||
replaced with whatever CLI args were specified by the user.
|
||||
|
||||
For example, you might want to use redbean.com in interpreter
|
||||
For example, you might want to use redbean in interpreter
|
||||
mode, where your script file is inside the zip. Then, if your
|
||||
redbean is run, what you want is to have the default behavior
|
||||
be running your script. In that case, you might:
|
||||
|
@ -525,13 +523,13 @@ SPECIAL PATHS
|
|||
print("hello world")
|
||||
EOF
|
||||
|
||||
$ zip redbean.com .args hello.lua
|
||||
$ ./redbean.com
|
||||
$ zip redbean .args hello.lua
|
||||
$ ./redbean
|
||||
hello world
|
||||
|
||||
Please note that if you ran:
|
||||
|
||||
$ ./redbean.com -vv
|
||||
$ ./redbean -vv
|
||||
|
||||
Then the default mode of redbean will kick back in. To prevent
|
||||
that from happening, simply add the magic arg `...` to the end
|
||||
|
@ -3855,7 +3853,7 @@ function path.islink(path) end
|
|||
--- The database file is distributed by MaxMind. You need to sign up on their
|
||||
--- website to get a free copy. The database has a generalized structure. For a
|
||||
--- concrete example of how this module may be used, please see `maxmind.lua`
|
||||
--- in `redbean-demo.com`.
|
||||
--- in `redbean-demo`.
|
||||
maxmind = {}
|
||||
|
||||
---@param filepath string the location of the MaxMind database
|
||||
|
@ -7004,7 +7002,7 @@ function unix.getrusage(who) end
|
|||
--- If the executable in question needs a loader, then you will need
|
||||
--- "rpath prot_exec" too. With APE, security is strongest when you
|
||||
--- assimilate your binaries beforehand, using the --assimilate flag,
|
||||
--- or the o//tool/build/assimilate.com program. On OpenBSD this is
|
||||
--- or the o//tool/build/assimilate program. On OpenBSD this is
|
||||
--- mandatory.
|
||||
---
|
||||
--- ### prot_exec
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Write('This Lua Server Page is stored in ZIP\r\n')
|
||||
Write('as compressed byte code, see luac.com and net.mk\r\n')
|
||||
Write('as compressed byte code, see luac and net.mk\r\n')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SYNOPSIS
|
||||
|
||||
redbean.com [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...]
|
||||
redbean [-?BVabdfghjkmsuvz] [-p PORT] [-D DIR] [-- SCRIPTARGS...]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
|
@ -10,9 +10,7 @@ OVERVIEW
|
|||
|
||||
redbean makes it possible to share web applications that run offline
|
||||
as a single-file Actually Portable Executable PKZIP archive which
|
||||
contains your assets. All you need to do is download the redbean.com
|
||||
program below, change the filename to .zip, add your content in a zip
|
||||
editing tool, and then change the extension back to .com.
|
||||
contains your assets.
|
||||
|
||||
redbean can serve 1 million+ gzip encoded responses per second on a
|
||||
cheap personal computer. That performance is thanks to zip and gzip
|
||||
|
@ -139,15 +137,15 @@ USAGE
|
|||
This executable is also a ZIP file that contains static assets.
|
||||
You can run redbean interactively in your terminal as follows:
|
||||
|
||||
./redbean.com -vvvmbag # starts server verbosely
|
||||
./redbean -vvvmbag # starts server verbosely
|
||||
open http://127.0.0.1:8080/ # shows zip listing page
|
||||
CTRL-C # 1x: graceful shutdown
|
||||
CTRL-C # 2x: forceful shutdown
|
||||
|
||||
You can override the default listing page by adding:
|
||||
|
||||
zip redbean.com index.lua # lua server pages take priority
|
||||
zip redbean.com index.html # default page for directory
|
||||
zip redbean index.lua # lua server pages take priority
|
||||
zip redbean index.html # default page for directory
|
||||
|
||||
The listing page only applies to the root directory. However the
|
||||
default index page applies to subdirectories too. In order for it
|
||||
|
@ -162,7 +160,7 @@ USAGE
|
|||
--no-parent \
|
||||
--no-if-modified-since \
|
||||
http://a.example/index.html
|
||||
zip -r redbean.com a.example/ # default page for directory
|
||||
zip -r redbean a.example/ # default page for directory
|
||||
|
||||
redbean normalizes the trailing slash for you automatically:
|
||||
|
||||
|
@ -200,18 +198,18 @@ USAGE
|
|||
by default, embedded as a bas64 data uri. You can override the
|
||||
custom page for various errors by adding files to the zip root.
|
||||
|
||||
zip redbean.com 404.html # custom not found page
|
||||
zip redbean 404.html # custom not found page
|
||||
|
||||
Audio video content should not be compressed in your ZIP files.
|
||||
Uncompressed assets enable browsers to send Range HTTP request.
|
||||
On the other hand compressed assets are best for gzip encoding.
|
||||
|
||||
zip redbean.com index.html # adds file
|
||||
zip -0 redbean.com video.mp4 # adds without compression
|
||||
zip redbean index.html # adds file
|
||||
zip -0 redbean video.mp4 # adds without compression
|
||||
|
||||
You can have redbean run as a daemon by doing the following:
|
||||
|
||||
sudo ./redbean.com -vvdp80 -p443 -L redbean.log -P redbean.pid
|
||||
sudo ./redbean -vvdp80 -p443 -L redbean.log -P redbean.pid
|
||||
kill -TERM $(cat redbean.pid) # 1x: graceful shutdown
|
||||
kill -TERM $(cat redbean.pid) # 2x: forceful shutdown
|
||||
|
||||
|
@ -235,11 +233,11 @@ USAGE
|
|||
is on the system path beforehand. You can also "assimilate" any
|
||||
redbean into the platform-local executable format by running:
|
||||
|
||||
$ file redbean.com
|
||||
redbean.com: DOS/MBR boot sector
|
||||
$ ./redbean.com --assimilate
|
||||
$ file redbean.com
|
||||
redbean.com: ELF 64-bit LSB executable
|
||||
$ file redbean
|
||||
redbean: DOS/MBR boot sector
|
||||
$ ./redbean --assimilate
|
||||
$ file redbean
|
||||
redbean: ELF 64-bit LSB executable
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
SECURITY
|
||||
|
@ -391,7 +389,7 @@ REPL
|
|||
interpreter then you can pass the `-i` flag to put redbean into
|
||||
interpreter mode.
|
||||
|
||||
redbean.com -i binarytrees.lua 15
|
||||
redbean -i binarytrees.lua 15
|
||||
|
||||
When the `-i` flag is passed (for interpreter mode), redbean won't
|
||||
start a web server and instead functions like the `lua` command. The
|
||||
|
@ -408,12 +406,12 @@ REPL
|
|||
encoded in its preferred executable format. You can assimilate your
|
||||
redbean into the local format using the following commands:
|
||||
|
||||
$ file redbean.com
|
||||
redbean.com: DOS/MBR boot sector
|
||||
$ ./redbean.com --assimilate
|
||||
$ file redbean.com
|
||||
redbean.com: ELF 64-bit LSB executable
|
||||
$ sudo cp redbean.com /usr/bin/redbean
|
||||
$ file redbean
|
||||
redbean: DOS/MBR boot sector
|
||||
$ ./redbean --assimilate
|
||||
$ file redbean
|
||||
redbean: ELF 64-bit LSB executable
|
||||
$ sudo cp redbean /usr/bin/redbean
|
||||
|
||||
By following the above steps, redbean can be installed systemwide for
|
||||
multiple user accounts. It's also possible to chmod the binary to have
|
||||
|
@ -459,11 +457,11 @@ GLOBALS
|
|||
|
||||
For example, if you launch your redbean as follows:
|
||||
|
||||
redbean.com -v arg1 arg2
|
||||
redbean -v arg1 arg2
|
||||
|
||||
Then your `/.init.lua` file will have the `arg` array like:
|
||||
|
||||
arg[-1] = '/usr/bin/redbean.com'
|
||||
arg[-1] = '/usr/bin/redbean'
|
||||
arg[ 0] = '/zip/.init.lua'
|
||||
arg[ 1] = 'arg1'
|
||||
arg[ 2] = 'arg2'
|
||||
|
@ -471,11 +469,11 @@ GLOBALS
|
|||
If you launch redbean in interpreter mode (rather than web
|
||||
server) mode, then an invocation like this:
|
||||
|
||||
./redbean.com -i script.lua arg1 arg2
|
||||
./redbean -i script.lua arg1 arg2
|
||||
|
||||
Would have an `arg` array like this:
|
||||
|
||||
arg[-1] = './redbean.com'
|
||||
arg[-1] = './redbean'
|
||||
arg[ 0] = 'script.lua'
|
||||
arg[ 1] = 'arg1'
|
||||
arg[ 2] = 'arg2'
|
||||
|
@ -540,7 +538,7 @@ SPECIAL PATHS
|
|||
If the special argument `...` *is* encountered, then it'll be
|
||||
replaced with whatever CLI args were specified by the user.
|
||||
|
||||
For example, you might want to use redbean.com in interpreter
|
||||
For example, you might want to use redbean in interpreter
|
||||
mode, where your script file is inside the zip. Then, if your
|
||||
redbean is run, what you want is to have the default behavior
|
||||
be running your script. In that case, you might:
|
||||
|
@ -554,13 +552,13 @@ SPECIAL PATHS
|
|||
print("hello world")
|
||||
EOF
|
||||
|
||||
$ zip redbean.com .args hello.lua
|
||||
$ ./redbean.com
|
||||
$ zip redbean .args hello.lua
|
||||
$ ./redbean
|
||||
hello world
|
||||
|
||||
Please note that if you ran:
|
||||
|
||||
$ ./redbean.com -vv
|
||||
$ ./redbean -vv
|
||||
|
||||
Then the default mode of redbean will kick back in. To prevent
|
||||
that from happening, simply add the magic arg `...` to the end
|
||||
|
@ -2485,7 +2483,7 @@ MAXMIND MODULE
|
|||
Write(EscapeHtml(asorg))
|
||||
end
|
||||
|
||||
For further details, please see maxmind.lua in redbean-demo.com.
|
||||
For further details, please see maxmind.lua in redbean-demo.
|
||||
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
|
@ -4469,7 +4467,7 @@ UNIX MODULE
|
|||
If the executable in question needs a loader, then you will need
|
||||
"rpath prot_exec" too. With APE, security is strongest when you
|
||||
assimilate your binaries beforehand, using the --assimilate flag,
|
||||
or the o//tool/build/assimilate.com program. On OpenBSD this is
|
||||
or the o//tool/build/assimilate program. On OpenBSD this is
|
||||
mandatory.
|
||||
|
||||
prot_exec
|
||||
|
|
|
@ -152,9 +152,7 @@ __static_yoink("blink_xnu_aarch64"); // is apple silicon
|
|||
*
|
||||
* redbean makes it possible to share web applications that run offline
|
||||
* as a single-file αcτµαlly pδrταblε εxεcµταblε zip archive which
|
||||
* contains your assets. All you need to do is download the redbean.com
|
||||
* program below, change the filename to .zip, add your content in a zip
|
||||
* editing tool, and then change the extension back to .com.
|
||||
* contains your assets.
|
||||
*
|
||||
* redbean can serve 1 million+ gzip encoded responses per second on a
|
||||
* cheap personal computer. That performance is thanks to zip and gzip
|
||||
|
@ -6936,7 +6934,7 @@ static void MakeExecutableModifiable(void) {
|
|||
if (IsWindows()) return; // TODO
|
||||
if (IsOpenbsd()) return; // TODO
|
||||
if (IsNetbsd()) return; // TODO
|
||||
if (endswith(zpath, ".com.dbg")) return;
|
||||
if (endswith(zpath, ".dbg")) return;
|
||||
close(zfd);
|
||||
ft = ftrace_enabled(0);
|
||||
if ((zfd = __open_executable()) == -1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SYNOPSIS
|
||||
|
||||
redbean.com [-hvduzmbagf] [-p PORT] [-D DIR]
|
||||
redbean [-hvduzmbagf] [-p PORT] [-D DIR]
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ TOOL_PLINKO_OBJS = \
|
|||
$(TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_PLINKO_COMS = \
|
||||
$(TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.com)
|
||||
$(TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%)
|
||||
|
||||
TOOL_PLINKO_BINS = \
|
||||
$(TOOL_PLINKO_COMS) \
|
||||
|
@ -36,7 +36,7 @@ o/$(MODE)/tool/plinko/plinko.pkg: \
|
|||
$(TOOL_PLINKO_OBJS) \
|
||||
$(foreach x,$(TOOL_PLINKO_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/plinko/%.com.dbg: \
|
||||
o/$(MODE)/tool/plinko/%.dbg: \
|
||||
$(TOOL_PLINKO_DEPS) \
|
||||
o/$(MODE)/tool/plinko/%.o \
|
||||
o/$(MODE)/tool/plinko/plinko.pkg \
|
||||
|
@ -45,18 +45,10 @@ o/$(MODE)/tool/plinko/%.com.dbg: \
|
|||
$(APE_NO_MODIFY_SELF)
|
||||
@$(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.zip.o: \
|
||||
o/$(MODE)/tool/plinko/plinko
|
||||
|
||||
o/$(MODE)/tool/plinko/plinko.com.zip.o: \
|
||||
o/$(MODE)/tool/plinko/plinko.com
|
||||
|
||||
o/$(MODE)/tool/plinko/plinko.com.zip.o \
|
||||
o/$(MODE)/tool/plinko/plinko.zip.o \
|
||||
o/$(MODE)/tool/plinko/lib/library.lisp.zip.o \
|
||||
o/$(MODE)/tool/plinko/lib/binarytrees.lisp.zip.o \
|
||||
o/$(MODE)/tool/plinko/lib/algebra.lisp.zip.o \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
bing.com <"$1" |
|
||||
fold.com |
|
||||
bing <"$1" |
|
||||
fold |
|
||||
exec less
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python.com
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import re
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python.com
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# fix-third-party.py
|
||||
# normalizes third party codebases to cosmopolitan style
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python.com
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# OVERVIEW
|
||||
#
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
exec grep \
|
||||
--exclude=TAGS \
|
||||
--exclude=HTAGS \
|
||||
--exclude=*.com \
|
||||
--exclude=*.dbg \
|
||||
--exclude-dir=o \
|
||||
--exclude-dir=gcc \
|
||||
--exclude-dir=.git \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
ASCII2UTF8=$(command -v ascii2utf8.com 2>/dev/null) || {
|
||||
ASCII2UTF8=$(ls -1 o/*/tool/viz/ascii2utf8.com | head -n1)
|
||||
ASCII2UTF8=$(command -v ascii2utf8 2>/dev/null) || {
|
||||
ASCII2UTF8=$(ls -1 o/*/tool/viz/ascii2utf8 | head -n1)
|
||||
}
|
||||
|
||||
for x; do
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
exec python.com -c "
|
||||
exec python -c "
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from math import *
|
||||
|
|
|
@ -6,4 +6,4 @@ from math import *
|
|||
s = str($*)
|
||||
sys.stdout.write(s)
|
||||
" >/tmp/pe
|
||||
exec python.com /tmp/pe
|
||||
exec python /tmp/pe
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
exec python.com -c "
|
||||
exec python -c "
|
||||
import sys
|
||||
from math import *
|
||||
s = str(oct($*).replace('o',''))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
exec python.com -c "
|
||||
exec python -c "
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from math import *
|
||||
|
|
|
@ -5,111 +5,95 @@ PKGS += TOOL_VIZ
|
|||
|
||||
TOOL_VIZ_SRCS := $(wildcard tool/viz/*.c)
|
||||
|
||||
TOOL_VIZ_OBJS = \
|
||||
TOOL_VIZ_OBJS = \
|
||||
$(TOOL_VIZ_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TOOL_VIZ_COMS = \
|
||||
$(TOOL_VIZ_SRCS:%.c=o/$(MODE)/%.com)
|
||||
TOOL_VIZ_COMS = \
|
||||
$(TOOL_VIZ_SRCS:%.c=o/$(MODE)/%)
|
||||
|
||||
TOOL_VIZ_BINS = \
|
||||
$(TOOL_VIZ_COMS) \
|
||||
TOOL_VIZ_BINS = \
|
||||
$(TOOL_VIZ_COMS) \
|
||||
$(TOOL_VIZ_COMS:%=%.dbg)
|
||||
|
||||
TOOL_VIZ_DIRECTDEPS = \
|
||||
DSP_CORE \
|
||||
DSP_MPEG \
|
||||
DSP_SCALE \
|
||||
DSP_TTY \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_LOG \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_NT_COMDLG32 \
|
||||
LIBC_NT_GDI32 \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_USER32 \
|
||||
LIBC_PROC \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_SOCK \
|
||||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_VGA \
|
||||
LIBC_X \
|
||||
NET_HTTP \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_DLMALLOC \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_MAXMIND \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_STB \
|
||||
THIRD_PARTY_XED \
|
||||
THIRD_PARTY_ZLIB \
|
||||
TOOL_DECODE_LIB \
|
||||
TOOL_VIZ_DIRECTDEPS = \
|
||||
DSP_CORE \
|
||||
DSP_MPEG \
|
||||
DSP_SCALE \
|
||||
DSP_TTY \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_LOG \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_NT_COMDLG32 \
|
||||
LIBC_NT_GDI32 \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_USER32 \
|
||||
LIBC_PROC \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_SOCK \
|
||||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_VGA \
|
||||
LIBC_X \
|
||||
NET_HTTP \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_DLMALLOC \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_MAXMIND \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_STB \
|
||||
THIRD_PARTY_XED \
|
||||
THIRD_PARTY_ZLIB \
|
||||
TOOL_DECODE_LIB \
|
||||
TOOL_VIZ_LIB
|
||||
|
||||
TOOL_VIZ_DEPS := \
|
||||
TOOL_VIZ_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TOOL_VIZ_DIRECTDEPS),$($(x))))
|
||||
|
||||
o/$(MODE)/tool/viz/viz.pkg: \
|
||||
$(TOOL_VIZ_OBJS) \
|
||||
o/$(MODE)/tool/viz/viz.pkg: \
|
||||
$(TOOL_VIZ_OBJS) \
|
||||
$(foreach x,$(TOOL_VIZ_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/viz/%.com.dbg: \
|
||||
$(TOOL_VIZ_DEPS) \
|
||||
o/$(MODE)/tool/viz/%.o \
|
||||
o/$(MODE)/tool/viz/viz.pkg \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/viz/%.dbg: \
|
||||
$(TOOL_VIZ_DEPS) \
|
||||
o/$(MODE)/tool/viz/%.o \
|
||||
o/$(MODE)/tool/viz/viz.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/tool/viz/printimage.com.dbg: \
|
||||
$(TOOL_VIZ_DEPS) \
|
||||
o/$(MODE)/tool/viz/printimage.o \
|
||||
o/$(MODE)/tool/viz/viz.pkg \
|
||||
o/$(MODE)/LICENSE.zip.o \
|
||||
$(CRT) \
|
||||
o/$(MODE)/tool/viz/printimage.dbg: \
|
||||
$(TOOL_VIZ_DEPS) \
|
||||
o/$(MODE)/tool/viz/printimage.o \
|
||||
o/$(MODE)/tool/viz/viz.pkg \
|
||||
o/$(MODE)/LICENSE.zip.o \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(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 \
|
||||
CFLAGS += \
|
||||
-DSTACK_FRAME_UNLIMITED \
|
||||
o/$(MODE)/tool/viz/derasterize.o: private \
|
||||
CFLAGS += \
|
||||
-DSTACK_FRAME_UNLIMITED \
|
||||
$(MATHEMATICAL)
|
||||
|
||||
o/$(MODE)/tool/viz/magikarp.o: private \
|
||||
CFLAGS += \
|
||||
o/$(MODE)/tool/viz/magikarp.o: private \
|
||||
CFLAGS += \
|
||||
$(MATHEMATICAL)
|
||||
|
||||
$(TOOL_VIZ_OBJS): \
|
||||
$(BUILD_FILES) \
|
||||
$(TOOL_VIZ_OBJS): \
|
||||
$(BUILD_FILES) \
|
||||
tool/viz/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/tool/viz
|
||||
o/$(MODE)/tool/viz: \
|
||||
o/$(MODE)/tool/viz/lib \
|
||||
$(TOOL_VIZ_BINS) \
|
||||
o/$(MODE)/tool/viz: \
|
||||
o/$(MODE)/tool/viz/lib \
|
||||
$(TOOL_VIZ_BINS) \
|
||||
$(TOOL_VIZ_CHECKS)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Getting started:
|
||||
|
||||
nroff -mandoc -rLL=72n -rLT=78n -Tutf8 <manpage.1 |
|
||||
o/tool/viz/ascii2utf8.com
|
||||
o/tool/viz/ascii2utf8
|
||||
|
||||
ASCII Bold:
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ DESCRIPTION\n\
|
|||
\n\
|
||||
EXAMPLES\n\
|
||||
\n\
|
||||
$ ./derasterize.com samples/wave.png > wave.uaart\n\
|
||||
$ ./derasterize samples/wave.png > wave.uaart\n\
|
||||
$ cat wave.uaart\n\
|
||||
\n\
|
||||
AUTHORS\n\
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
/**
|
||||
* @fileoverview Hex String Literal Converter, e.g.
|
||||
*
|
||||
* $ echo hello | o/tool/viz/dumphexc.com
|
||||
* $ echo hello | o/tool/viz/dumphexc
|
||||
* "\
|
||||
* \x68\x65\x6c\x6c\x6f\x0a"
|
||||
*/
|
||||
|
|
|
@ -102,11 +102,11 @@
|
|||
* Here's how you can compile this program on Linux:
|
||||
*
|
||||
* git clone https://github.com/jart/cosmopolitan && cd cosmopolitan
|
||||
* make -j12 o//tool/viz/life.com
|
||||
* make -j12 o//tool/viz/life
|
||||
*
|
||||
* The output binary works on Linux, Windows, Mac, and FreeBSD:
|
||||
*
|
||||
* o//tool/viz/life.com
|
||||
* o//tool/viz/life
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
|
||||
* @see https://www.conwaylife.com/wiki/Run_Length_Encoded
|
||||
|
@ -225,10 +225,10 @@ static char16_t statusline16[256];
|
|||
#define GODOWN(x) ((x) << 8)
|
||||
#define GORIGHT(x) (((x) & ~RIGHT) << 1)
|
||||
#define GOLEFT(x) (((x) & ~LEFT) >> 1)
|
||||
#define LEFTMOST(x) ((x)&LEFT)
|
||||
#define RIGHTMOST(x) ((x)&RIGHT)
|
||||
#define TOPMOST(x) ((x)&TOP)
|
||||
#define BOTMOST(x) ((x)&BOTTOM)
|
||||
#define LEFTMOST(x) ((x) & LEFT)
|
||||
#define RIGHTMOST(x) ((x) & RIGHT)
|
||||
#define TOPMOST(x) ((x) & TOP)
|
||||
#define BOTMOST(x) ((x) & BOTTOM)
|
||||
|
||||
#define ADD(X) \
|
||||
do { \
|
||||
|
|
|
@ -84,9 +84,10 @@ FLAGS\n\
|
|||
\n\
|
||||
EXAMPLES\n\
|
||||
\n\
|
||||
printansi.com -w80 -h40 logo.png\n\
|
||||
printansi -w80 -h40 logo.png\n\
|
||||
\n\
|
||||
\n", NULL);
|
||||
\n",
|
||||
NULL);
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,9 @@ FLAGS\n\
|
|||
\n\
|
||||
EXAMPLES\n\
|
||||
\n\
|
||||
printimage.com -sxd lemurs.jpg # 256-color dither unsharp\n\
|
||||
\n", NULL);
|
||||
printimage -sxd lemurs.jpg # 256-color dither unsharp\n\
|
||||
\n",
|
||||
NULL);
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
|
|
|
@ -1572,7 +1572,7 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(stderr, "please install either the "
|
||||
"`play` (sox) or "
|
||||
"`ffplay` (ffmpeg) "
|
||||
"commands, so printvideo.com can play audio\n");
|
||||
"commands, so printvideo can play audio\n");
|
||||
usleep(10000);
|
||||
}
|
||||
infd_ = STDIN_FILENO;
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
* something almost representing a source code file. A hack also exists
|
||||
* for comments in such files: 𝘶𝘴𝘦 𝑛𝑜𝑛-𝑎𝑠𝑐𝑖𝑖 𝗹𝗲𝘁𝘁𝗲𝗿𝗶𝗻𝗴 𝔞𝔩𝔱𝔢𝔯𝔫𝔞𝔱𝔦𝔳𝔢𝔰.
|
||||
*
|
||||
* bash$ o/tool/viz/bing.com </bin/sh | o/tool/viz/fold.com >sh.txt
|
||||
* bash$ o/tool/viz/bing </bin/sh | o/tool/viz/fold >sh.txt
|
||||
* bash$ emacs sh.txt
|
||||
* bash$ o/tool/viz/unbing.com <sh.txt >sh
|
||||
* bash$ o/tool/viz/unbing <sh.txt >sh
|
||||
* bash$ chmod +x sh
|
||||
* bash$ ./sh
|
||||
*
|
||||
|
|
|
@ -39,7 +39,7 @@ done
|
|||
j=-j$(nproc)
|
||||
}
|
||||
local make=${MAKE:-${COSMOCC:-/opt/cosmocc/current}/bin/make}
|
||||
[[ -x $make ]] || make=${COSMO:-$PWD}/build/bootstrap/make.com
|
||||
[[ -x $make ]] || make=${COSMO:-$PWD}/build/bootstrap/make
|
||||
( set -x
|
||||
exec $make $j $flags MODE=$mode $targs )
|
||||
# vim:ft=zsh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue