Skip to content

Commit 0676e83

Browse files
committed
DEV: Add a script for building on macos-x86_64
1 parent 6101402 commit 0676e83

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

libexec/build-macos-x86_64

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#/bin/sh
2+
3+
set -e
4+
set -u
5+
6+
BASEDIR="${PWD}"
7+
8+
TARGET_PLATFORM=x86_64-darwin
9+
RUBY_TARGET_PLATFORM=x86_64-darwin
10+
11+
bundle install
12+
13+
RUBY_PLATFORM=$(./libexec/metadata ruby_platform)
14+
GEM_PLATFORM=$(./libexec/metadata gem_platform)
15+
GEM_VERSION=$(./libexec/metadata gem_version)
16+
NODE_VERSION=$(./libexec/metadata node_version)
17+
LIBV8_VERSION=$(./libexec/metadata libv8_version)
18+
19+
./libexec/download-node $NODE_VERSION
20+
./libexec/extract-node $NODE_VERSION
21+
22+
# Validate that we have the correct V8 version.
23+
libv8_version_h=$(./libexec/metadata libv8_version_h)
24+
if [ "$libv8_version_h" != "$LIBV8_VERSION" ]; then
25+
echo "LIBV8 version mismatch: expected $LIBV8_VERSION but found $libv8_version_h"
26+
exit 1
27+
fi
28+
29+
# Build the package.
30+
./libexec/build-libv8 $NODE_VERSION
31+
./libexec/build-monolith $NODE_VERSION
32+
./libexec/inject-libv8 $NODE_VERSION
33+
34+
# Run V8 tests.
35+
cd test/gtest
36+
cmake -S . -B build
37+
cd build
38+
cmake --build .
39+
./c_v8_tests
40+
41+
if [ $? -ne 0 ]; then
42+
echo "Tests failed."
43+
exit 1
44+
fi
45+
46+
# Build the gem.
47+
cd "${BASEDIR}"
48+
bundle exec rake binary
49+
50+
# Test that the gem can be installed and used.
51+
gem install pkg/libv8-node-$GEM_VERSION-$GEM_PLATFORM.gem
52+
53+
git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1
54+
cd test/mini_racer
55+
ruby -i -ne "\$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(\" LIBV8_NODE_VERSION = \\\"$GEM_VERSION\\\"\\n\") : print" lib/mini_racer/version.rb
56+
ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec
57+
bundle install
58+
bundle exec rake compile
59+
bundle exec rake test

0 commit comments

Comments
 (0)