Skip to content

Instantly share code, notes, and snippets.

@kateinoigakukun
Last active September 11, 2019 02:24
Show Gist options
  • Save kateinoigakukun/c700986abc7373c177566ef2abe0773f to your computer and use it in GitHub Desktop.
Save kateinoigakukun/c700986abc7373c177566ef2abe0773f to your computer and use it in GitHub Desktop.
#!/bin/sh
COMPILE_SERVICE=$SWIFTWASM_SOURCE/swiftwasm-compile-service
WASM_SYSROOT=$COMPILE_SERVICE/compiler/wasi-sdk/opt/wasi-sdk/share/sysroot
input=$1
object_file=input.o
output=$2
$SWIFTWASM_SOURCE/build/Ninja-DebugAssert/swift-linux-x86_64/bin/swiftc \
-target wasm32-unknown-unknown-wasm \
-sdk $WASM_SYSROOT \
-o $object_file -c $input
$COMPILE_SERVICE/compiler/wasi-sdk/opt/wasi-sdk/bin/wasm-ld \
--error-limit=0 -o $output \
$WASM_SYSROOT/lib/wasm32-wasi/crt1.o \
$COMPILE_SERVICE/extra_objs/swift_start.o \
$COMPILE_SERVICE/compiler/opt/swiftwasm-sdk/lib/swift_static/wasm/wasm32/swiftrt.o \
$object_file \
-L $COMPILE_SERVICE/compiler/opt/swiftwasm-sdk/lib/swift_static/wasm \
-L $WASM_SYSROOT/lib/wasm32-wasi \
-L $COMPILE_SERVICE/compiler/icu_out/lib \
-lswiftCore \
-lc -lc++ -lc++abi -lswiftImageInspectionShared \
-licuuc -licudata \
$COMPILE_SERVICE/compiler/wasi-sdk/opt/wasi-sdk/lib/clang/8.0.0/lib/wasi/libclang_rt.builtins-wasm32.a \
$COMPILE_SERVICE/extra_objs/fakepthread.o \
$COMPILE_SERVICE/extra_objs/fakelocaltime.o \
$COMPILE_SERVICE/extra_objs/swift_end.o \
--no-gc-sections \
--no-threads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment