Add /.args feature to Redbean/Lua/SQLite/Python/QuickJS

You now have some ability to truly make an executable yours, by adding a
`.args` file to the root of the zip structure. If this is specified,
then you'll be overriding the default CLI args.

This will be a great feature for folks who want to distribute their own
apps, using the interpreter executable, but have the executable appears
to be just your app rather than being the interpreter.
This commit is contained in:
Justine Tunney 2022-05-12 11:01:58 -07:00
parent 0f6251f4d2
commit 4499f98e76
19 changed files with 421 additions and 19 deletions

53
tool/args/args.mk Normal file
View file

@ -0,0 +1,53 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
PKGS += TOOL_ARGS
TOOL_ARGS_ARTIFACTS += TOOL_ARGS_A
TOOL_ARGS = $(TOOL_ARGS_A_DEPS) $(TOOL_ARGS_A)
TOOL_ARGS_A = o/$(MODE)/tool/args/args.a
TOOL_ARGS_A_FILES := $(wildcard tool/args/*)
TOOL_ARGS_A_HDRS = $(filter %.h,$(TOOL_ARGS_A_FILES))
TOOL_ARGS_A_SRCS = $(filter %.c,$(TOOL_ARGS_A_FILES))
TOOL_ARGS_A_OBJS = $(TOOL_ARGS_A_SRCS:%.c=o/$(MODE)/%.o)
TOOL_ARGS_A_CHECKS = \
$(TOOL_ARGS_A_HDRS:%=o/$(MODE)/%.ok) \
$(TOOL_ARGS_A).pkg
TOOL_ARGS_A_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_STUBS \
LIBC_X \
LIBC_ZIPOS \
NET_HTTPS \
THIRD_PARTY_COMPILER_RT
TOOL_ARGS_A_DEPS := \
$(call uniq,$(foreach x,$(TOOL_ARGS_A_DIRECTDEPS),$($(x))))
$(TOOL_ARGS_A): tool/args/ \
$(TOOL_ARGS_A).pkg \
$(TOOL_ARGS_A_OBJS)
$(TOOL_ARGS_A).pkg: \
$(TOOL_ARGS_A_OBJS) \
$(foreach x,$(TOOL_ARGS_A_DIRECTDEPS),$($(x)_A).pkg)
TOOL_ARGS_LIBS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)))
TOOL_ARGS_SRCS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_SRCS))
TOOL_ARGS_HDRS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_HDRS))
TOOL_ARGS_BINS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_BINS))
TOOL_ARGS_CHECKS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_CHECKS))
TOOL_ARGS_OBJS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_OBJS))
TOOL_ARGS_TESTS = $(foreach x,$(TOOL_ARGS_ARTIFACTS),$($(x)_TESTS))
.PHONY: o/$(MODE)/tool/args
o/$(MODE)/tool/args: $(TOOL_ARGS_CHECKS)