Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.9-pre #16

Merged
merged 6 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ lo
.vscode
scratch
deps
notes.md
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CCARGS=-std=c++17 -c -fno-omit-frame-pointer -fno-rtti -fno-exceptions
CARGS=-c -fno-omit-frame-pointer
WARN=-Werror -Wpedantic -Wall -Wextra -Wno-unused-parameter
OPT=-O3
VERSION=0.0.8-pre
VERSION=0.0.9-pre
V8_VERSION=1.0.0
RUNTIME=lo
LO_HOME=$(shell pwd)
Expand Down Expand Up @@ -83,6 +83,8 @@ curl.o: lib/curl/curl.cc ## build the curl binding
$(CC) -fPIC $(CCARGS) $(OPT) -I. -I./v8 -I./v8/include $(WARN) ${V8_FLAGS} -o curl.o lib/curl/curl.cc

inflate.a: lib/inflate/inflate.cc ## build the curl binding
curl -L -o lib/inflate/em_inflate.h https://raw.githubusercontent.com/emmanuel-marty/em_inflate/master/lib/em_inflate.h
curl -L -o lib/inflate/em_inflate.c https://raw.githubusercontent.com/emmanuel-marty/em_inflate/master/lib/em_inflate.c
$(C) -fPIC $(CARGS) $(OPT) -I. -I./v8 -I./v8/include -Ilib/inflate -o em_inflate.o lib/inflate/em_inflate.c
$(CC) -fPIC $(CCARGS) $(OPT) -I. -I./v8 -I./v8/include -Ilib/inflate $(WARN) ${V8_FLAGS} -o inflate.o lib/inflate/inflate.cc
ar crsT inflate.a inflate.o em_inflate.o
Expand Down
15 changes: 15 additions & 0 deletions builtins.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ __binary_lib_build_js_start:
.incbin "lib/build.js"
.global __binary_lib_build_js_end
__binary_lib_build_js_end:
.global __binary_lib_asm_js_start
__binary_lib_asm_js_start:
.incbin "lib/asm.js"
.global __binary_lib_asm_js_end
__binary_lib_asm_js_end:
.global __binary_lib_ffi_js_start
__binary_lib_ffi_js_start:
.incbin "lib/ffi.js"
.global __binary_lib_ffi_js_end
__binary_lib_ffi_js_end:
.global __binary_lib_binary_js_start
__binary_lib_binary_js_start:
.incbin "lib/binary.js"
.global __binary_lib_binary_js_end
__binary_lib_binary_js_end:
.global __binary_main_cc_start
__binary_main_cc_start:
.incbin "main.cc"
Expand Down
15 changes: 15 additions & 0 deletions builtins_linux.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ _binary_lib_build_js_start:
.incbin "lib/build.js"
.global _binary_lib_build_js_end
_binary_lib_build_js_end:
.global _binary_lib_asm_js_start
_binary_lib_asm_js_start:
.incbin "lib/asm.js"
.global _binary_lib_asm_js_end
_binary_lib_asm_js_end:
.global _binary_lib_ffi_js_start
_binary_lib_ffi_js_start:
.incbin "lib/ffi.js"
.global _binary_lib_ffi_js_end
_binary_lib_ffi_js_end:
.global _binary_lib_binary_js_start
_binary_lib_binary_js_start:
.incbin "lib/binary.js"
.global _binary_lib_binary_js_end
_binary_lib_binary_js_end:
.global _binary_main_cc_start
_binary_main_cc_start:
.incbin "main.cc"
Expand Down
88 changes: 81 additions & 7 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async function build_runtime ({ libs = lo.builtins(), bindings = lo.libraries(),
}
const dynamic_libs = await linkArgs(bindings.map(n => `lib/${n}/api.js`))
const mbed_tls = []
exec2([...LINK.split(' '), ...LARGS, OPT, '-rdynamic', ...WARN, '-o',
exec2([...LINK.split(' '), ...LARGS, OPT, ...LINK_TYPE, ...WARN, '-o',
`${TARGET}`, `${TARGET}.o`, 'main.o', 'builtins.o', 'v8/libv8_monolith.a',
...static_libs, ...mbed_tls, ...dynamic_libs], verbose)
assert(chdir(cwd) === 0)
Expand Down Expand Up @@ -232,9 +232,10 @@ const encoder = new TextEncoder()
const status = new Int32Array(2)

// todo: clean up api so we can pass a config in and run builds through api
const VERSION = getenv('VERSION') || '"0.0.8pre"'
const VERSION = getenv('VERSION') || '"0.0.9pre"'
const RUNTIME = getenv('RUNTIME') || '"lo"'
const TARGET = getenv('TARGET') || 'lo'
const LINK_TYPE = (getenv('LINK_TYPE') || '-rdynamic').split(' ')
const C = getenv('C') || 'gcc'
const CC = getenv('CC') || 'g++'
const LINK = getenv('LINK') || 'g++'
Expand Down Expand Up @@ -267,14 +268,78 @@ const runtimes = {
libs: []
},
core: {
bindings: ['core'],
bindings: [
'core'
],
libs: []
},
builder: {
bindings: ['core', 'inflate', 'curl'],
libs: [
'lib/bench.js', 'lib/gen.js', 'lib/fs.js', 'lib/untar.js', 'lib/proc.js',
'lib/path.js', 'lib/inflate.js', 'lib/curl.js', 'lib/build.js'
'lib/path.js', 'lib/inflate.js', 'lib/curl.js', 'lib/build.js',
'lib/asm.js', 'lib/ffi.js', 'lib/binary.js'
],
embeds: [
'main.cc',
'lo.cc',
'lo.h',
'lib/core/api.js',
'lib/curl/api.js',
'lib/encode/api.js',
'lib/epoll/api.js',
'lib/inflate/api.js',
'lib/libffi/api.js',
'lib/libssl/api.js',
'lib/lz4/api.js',
'lib/inflate/em_inflate.c',
'lib/inflate/em_inflate.h',
'lib/mbedtls/api.js',
'lib/net/api.js',
'lib/pico/api.js',
'lib/pthread/api.js',
'lib/seccomp/api.js',
'lib/sqlite/api.js',
'lib/system/api.js',
'lib/tcc/api.js',
'lib/wireguard/api.js',
'lib/zlib/api.js',
'lib/duckdb/api.js',
]
},
full: {
bindings: [
'core',
'inflate',
'zlib',
'libssl',
'pico',
'sqlite',
'system',
'pthread',
'net',
'lz4',
'epoll',
'encode',
'duckdb',
'curl'
],
libs: [
'lib/bench.js',
'lib/gen.js',
'lib/fs.js',
'lib/untar.js',
'lib/proc.js',
'lib/path.js',
'lib/inflate.js',
'lib/curl.js',
'lib/build.js',
'lib/asm.js',
'lib/ffi.js',
'lib/binary.js',
'lib/tcc.js',
'lib/zlib.js',
'lib/sqlite.js'
],
embeds: [
'main.cc',
Expand Down Expand Up @@ -304,10 +369,19 @@ const runtimes = {
]
},
mbedtls: {
bindings: ['core', 'inflate', 'mbedtls'],
bindings: [
'core',
'inflate',
'mbedtls'
],
libs: [
'lib/bench.js', 'lib/gen.js', 'lib/fs.js', 'lib/untar.js', 'lib/proc.js',
'lib/path.js', 'lib/inflate.js', 'lib/build.js'
'lib/bench.js',
'lib/gen.js',
'lib/fs.js',
'lib/untar.js',
'lib/proc.js',
'lib/path.js',
'lib/inflate.js'
]
}
}
Expand Down
21 changes: 20 additions & 1 deletion lib/duckdb/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,25 @@ const api = {
result: 'i32',
name: 'duckdb_column_count'
},
value_timestamp: {
parameters: ['pointer', 'u32', 'u32'],
pointers: ['duckdb_result*'],
rpointer: 'duckdb_timestamp',
result: 'pointer',
name: 'duckdb_value_timestamp'
},
value_uint32: {
parameters: ['pointer', 'u32', 'u32'],
pointers: ['duckdb_result*'],
result: 'u32',
name: 'duckdb_value_uint32'
},
value_int32: {
parameters: ['pointer', 'u32', 'u32'],
pointers: ['duckdb_result*'],
result: 'i32',
name: 'duckdb_value_int32'
},
value_varchar: {
// todo: these should be u64
parameters: ['pointer', 'u32', 'u32'],
Expand Down Expand Up @@ -86,14 +99,20 @@ const api = {
result: 'i32',
name: 'duckdb_execute_prepared'
},
duckdb_column_name: {
column_name: {
// todo: these should be u64
parameters: ['pointer', 'u32'],
pointers: ['duckdb_result*'],
result: 'pointer',
rpointer: 'const char*',
name: 'duckdb_column_name'
},
column_type: {
parameters: ['pointer', 'u32'],
pointers: ['duckdb_result*'],
result: 'i32',
name: 'duckdb_column_type'
},
result_error: {
parameters: ['pointer'],
pointers: ['duckdb_result*'],
Expand Down
Loading