IMAGE_NAME := javascriptcore
help:
@echo "Usage: make [target] [platform=<platform>]"
@echo "Targets:"
@echo " build-docker-jsc: Build the Docker image with JavaScriptCore"
@echo " build-jsc: Build JavaScriptCore"
@echo " build-lib: Build the Rust library"
@echo " gen-bindings: Generate the Rust bindings"
@echo " test: Run the tests"
@echo " all-tests: Run all the tests"
@echo " archive: Archive the build artifacts with the platform parameter"
test:
RUST_BACKTRACE=1 cargo test --lib
all-tests:
cargo test
run-example:
(cd examples/hello_world && cargo run)
build-docker-jsc:
@if [ ! -d "WebKit" ]; then \
git submodule update --init --recursive; \
fi
@if [ ! -d ".libs" ]; then \
mkdir .libs; \
fi
DOCKER_BUILDKIT=1 docker build -o ./.libs -t $(IMAGE_NAME) .
build-docker-jsc-musl:
@if [ ! -d "WebKit" ]; then \
git submodule update --init --recursive; \
fi
@if [ ! -d ".libs-musl" ]; then \
mkdir .libs-musl; \
fi
DOCKER_BUILDKIT=1 docker build -o ./.libs-musl -t "$(IMAGE_NAME)-musl" -f Dockerfile.musl .
build-docker-jsc-arm:
@if [ ! -d "WebKit" ]; then \
git submodule update --init --recursive; \
fi
@if [ ! -d ".libs-arm" ]; then \
mkdir .libs-arm; \
fi
DOCKER_BUILDKIT=1 docker build -o ./.libs-arm -t "$(IMAGE_NAME)-arm" -f Dockerfile.arm .
build-jsc:
@if [ ! -d "WebKit/Tools" ]; then \
git submodule update --init --recursive; \
fi
@if [ "$(shell uname)" = "Darwin" ]; then \
if [ ! -x "$(shell command -v cmake)" ]; then \
brew install cmake; \
fi; \
fi
WebKit/Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DENABLE_REMOTE_INSPECTOR=ON -DENABLE_EXPERIMENTAL_FEATURES=OFF -DUSE_THIN_ARCHIVES=OFF"
archive:
@echo "Archiving the build artifacts..."
@if [ -z "$(platform)" ]; then \
echo "Please provide the platform parameter"; \
exit 1; \
fi
@cd WebKit/WebKitBuild/JSCOnly/Release/lib/ && \
tar -czf libjsc-$(platform).a.gz *.a && \
mv libjsc-$(platform).a.gz ../../../../../
archive-linux:
@echo "Archiving the build artifacts..."
@if [ -z "$(platform)" ]; then \
echo "Please provide the platform parameter"; \
exit 1; \
fi
@cd .libs && \
tar -czf libjsc-$(platform).a.gz *.a && \
mv libjsc-$(platform).a.gz ../
build-lib:
cargo build --release
gen-bindings:
(cd gen && cargo build --release)
.PHONY: build-docker-jsc build-jsc build-lib gen-bindings test archive