Skip to content

Commit

Permalink
Add x86_64-unknown-linux-musl library release
Browse files Browse the repository at this point in the history
This adds x86_64-unknown-linux-musl as a new supported target for the
pre-built rusty_v8 library releases, which should avoid multiple
downstream consumers having to build this themselves.

This target is useful when trying to build statically-compiled
executables, which seems like a good thing to support for the purpose of
using deno_core as an embedded JavaScript runtime.

Closes denoland#49.
  • Loading branch information
cd-work committed Jun 4, 2022
1 parent d05949e commit b75eba1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ci

on:
on:
push:
branches: [main]
pull_request:
Expand Down Expand Up @@ -174,6 +174,12 @@ jobs:
- name: Rustfmt
run: cargo fmt -- --check

- name: Build Musl
if: matrix.config.target == 'x86_64-unknown-linux-gnu'
run: |
docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 tools/musl-build.sh
cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a
- name: Prepare binary publish
run: cp
target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }}
Expand Down
32 changes: 32 additions & 0 deletions tools/musl-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

apk add git
apk add gcc
apk add ninja
apk add python3
apk add clang
apk add g++
apk add pkgconfig
apk add glib-dev
apk add llvm13-dev
apk add binutils-gold
ln -s /usr/bin/python3 /usr/bin/python

export V8_FROM_SOURCE=yes
GN="$(pwd)/gn/out/gn"
export GN
export CLANG_BASE_PATH=/usr
export GN_ARGS='use_custom_libcxx=false use_lld=false v8_enable_backtrace=false v8_enable_debugging_features=false'

# Bulid GN
if [ ! -d "./gn" ]; then
git clone https://gn.googlesource.com/gn
(
cd gn || exit
python3 build/gen.py
ninja -C out
)
fi

# Build rusty_v8
cargo build

0 comments on commit b75eba1

Please sign in to comment.