diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e3dee4..06e8a15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: run: | bundle exec rake build - name: Upload gem - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-ruby path: pkg @@ -82,7 +82,7 @@ jobs: name: Build (darwin) outputs: GEM_VERSION: ${{ steps.set-metadata.outputs.GEM_VERSION }} - runs-on: macos-12 + runs-on: macos-13 env: TARGET_PLATFORM: ${{ matrix.platform }}-darwin RUBY_TARGET_PLATFORM: ${{ matrix.platform }}-darwin @@ -95,15 +95,15 @@ jobs: id: set-metadata run: | ./libexec/metadata ruby_platform | tee ruby_platform - echo "::set-output name=RUBY_PLATFORM::$(cat ruby_platform)" + echo "RUBY_PLATFORM=$RUBY_TARGET_PLATFORM" >> $GITHUB_OUTPUT ./libexec/metadata gem_platform | tee gem_platform - echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)" + echo "GEM_PLATFORM=$TARGET_PLATFORM" >> $GITHUB_OUTPUT ./libexec/metadata gem_version | tee gem_version - echo "::set-output name=GEM_VERSION::$(cat gem_version)" + echo "GEM_VERSION=$(cat gem_version)" >> $GITHUB_OUTPUT ./libexec/metadata node_version | tee node_version - echo "::set-output name=NODE_VERSION::$(cat node_version)" + echo "NODE_VERSION=$(cat node_version)" >> $GITHUB_OUTPUT ./libexec/metadata libv8_version | tee libv8_version - echo "::set-output name=LIBV8_VERSION::$(cat libv8_version)" + echo "LIBV8_VERSION=$(cat libv8_version)" >> $GITHUB_OUTPUT - name: Download Node.js run: | ./libexec/download-node ${{ steps.set-metadata.outputs.NODE_VERSION }} @@ -135,12 +135,12 @@ jobs: run: | bundle exec rake binary - name: Upload V8 - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: v8-${{ steps.set-metadata.outputs.LIBV8_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }} path: vendor - name: Upload gem - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }} path: pkg @@ -204,10 +204,10 @@ jobs: run: | case ${{ matrix.libc }} in gnu) - echo 'ruby:2.7' + echo 'ruby:3.1' ;; musl) - echo 'ruby:2.7-alpine' + echo 'ruby:3.1-alpine' ;; esac | tee container_image echo "::set-output name=image::$(cat container_image)" @@ -274,12 +274,12 @@ jobs: run: | docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle exec rake binary[${{ steps.platform.outputs.ruby_target_platform }}] - name: Upload V8 - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: v8-${{ steps.set-metadata.outputs.LIBV8_VERSION }}-${{ steps.platform.outputs.ruby_target_platform }} path: vendor - name: Upload gem - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: gem-${{ steps.set-metadata.outputs.GEM_VERSION }}-${{ steps.platform.outputs.ruby_target_platform }} path: pkg @@ -327,7 +327,7 @@ jobs: ruby -e 'puts Gem.platforms.last.to_s' | tee gem_platform echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)" - name: Download a single artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: gem-${{ needs.build-ruby.outputs.GEM_VERSION }}-ruby path: pkg @@ -338,10 +338,6 @@ jobs: export BUNDLE_FORCE_RUBY_PLATFORM=y git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1 cd test/mini_racer - git fetch origin refs/pull/299/head - git checkout FETCH_HEAD - git reset --hard - git clean -f -d -x ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-ruby.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec bundle install @@ -356,7 +352,7 @@ jobs: # arm64 name: Test (darwin) needs: build-darwin - runs-on: macos-12 + runs-on: macos-13 steps: - name: Set metadata id: set-metadata @@ -364,7 +360,7 @@ jobs: ruby -e 'puts Gem.platforms.last.to_s.gsub(/-darwin-?\d+/, "-darwin")' | tee gem_platform echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)" - name: Download a single artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: gem-${{ needs.build-darwin.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }} path: pkg @@ -374,10 +370,6 @@ jobs: run: | git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1 cd test/mini_racer - git fetch origin refs/pull/299/head - git checkout FETCH_HEAD - git reset --hard - git clean -f -d -x ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-darwin.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec bundle install @@ -448,7 +440,7 @@ jobs: docker exec -w "${PWD}" ${{ steps.container.outputs.id }} ruby -e 'puts Gem::Platform.local.tap { |p| RUBY_PLATFORM =~ /musl/ && p.version.nil? and p.instance_eval { @version = "musl" } }.to_s' | tee gem_platform echo "::set-output name=GEM_PLATFORM::$(cat gem_platform)" - name: Download a single artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: gem-${{ needs.build-linux.outputs.GEM_VERSION }}-${{ steps.set-metadata.outputs.GEM_PLATFORM }} path: pkg @@ -458,10 +450,6 @@ jobs: run: | git clone https://github.com/rubyjs/mini_racer.git test/mini_racer --depth 1 cd test/mini_racer - git fetch origin refs/pull/299/head - git checkout FETCH_HEAD - git reset --hard - git clean -f -d -x ruby -i -ne '$_ =~ /^\s+LIBV8_NODE_VERSION/ ? print(" LIBV8_NODE_VERSION = \"${{ needs.build-linux.outputs.GEM_VERSION }}\"\n") : print' lib/mini_racer/version.rb ruby -i -ne '$_ =~ /spec.required_ruby_version/ ? "" : print' mini_racer.gemspec docker exec -w "${PWD}" ${{ steps.container.outputs.id }} bundle install diff --git a/Dockerfile b/Dockerfile index f625509..32ddc54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -ARG RUBY_VERSION=2.7 +ARG RUBY_VERSION=3.1 FROM ruby:${RUBY_VERSION} RUN test ! -f /etc/alpine-release || apk add --no-cache build-base bash python3 git curl tar ccache clang -RUN test -f /etc/alpine-release || (apt-get update && apt-get install -y ccache) +RUN test -f /etc/alpine-release || (apt-get update && apt-get install -y ccache clang) ENV CCACHE_DIR=/ccache RUN gem update --system 3.3.26 && gem install bundler -v '~> 2.3.26' diff --git a/Makefile.docker b/Makefile.docker index 0532ea4..5e67e45 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -21,19 +21,19 @@ test/linux: test/$(subst arm64,aarch64,$(CPU))-linux test/linux-musl: test/$(subst arm64,aarch64,$(CPU))-linux-musl pkg/libv8-node-$(VERSION)-x86_64-linux.gem: - docker buildx build --platform linux/amd64 --build-arg RUBY_VERSION=2.7 --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-gnu . + docker buildx build --platform linux/amd64 --build-arg RUBY_VERSION=3.1 --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-gnu . docker run --platform linux/amd64 --rm -it -v "$(PWD)/pkg":/pkg libv8-node:$(VERSION)-gnu cp $@ /pkg/ pkg/libv8-node-$(VERSION)-x86_64-linux-musl.gem: - docker buildx build --platform linux/amd64 --build-arg RUBY_VERSION=2.7-alpine --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-musl . + docker buildx build --platform linux/amd64 --build-arg RUBY_VERSION=3.1-alpine --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-musl . docker run --platform linux/amd64 --rm -it -v "$(PWD)/pkg":/pkg libv8-node:$(VERSION)-musl cp $@ /pkg/ pkg/libv8-node-$(VERSION)-aarch64-linux.gem: - docker buildx build --platform linux/arm64 --build-arg RUBY_VERSION=2.7 --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-gnu . + docker buildx build --platform linux/arm64 --build-arg RUBY_VERSION=3.1 --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-gnu . docker run --platform linux/arm64 --rm -it -v "$(PWD)/pkg":/pkg libv8-node:$(VERSION)-gnu cp $@ /pkg/ pkg/libv8-node-$(VERSION)-aarch64-linux-musl.gem: - docker buildx build --platform linux/arm64 --build-arg RUBY_VERSION=2.7-alpine --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-musl . + docker buildx build --platform linux/arm64 --build-arg RUBY_VERSION=3.1-alpine --build-arg NODE_VERSION=$(NODE_VERSION) --progress plain -t libv8-node:$(VERSION)-musl . docker run --platform linux/arm64 --rm -it -v "$(PWD)/pkg":/pkg libv8-node:$(VERSION)-musl cp $@ /pkg/ test/x86_64-linux: pkg/libv8-node-$(VERSION)-x86_64-linux.gem diff --git a/lib/libv8/node/version.rb b/lib/libv8/node/version.rb index ee03597..bebed4a 100644 --- a/lib/libv8/node/version.rb +++ b/lib/libv8/node/version.rb @@ -4,7 +4,7 @@ module Libv8 end module Libv8::Node - VERSION = '22.7.0.1' - NODE_VERSION = '22.7.0' + VERSION = '22.13.1.0' + NODE_VERSION = '22.13.1' LIBV8_VERSION = '12.4.254.21' # from src/node-.../deps/v8/include/v8-version.h end diff --git a/libexec/build-libv8 b/libexec/build-libv8 index 309c8e9..f19b58f 100755 --- a/libexec/build-libv8 +++ b/libexec/build-libv8 @@ -17,6 +17,8 @@ BUILDTYPE="${BUILDTYPE:-Release}" cd "${src}/node-v${version}" +# Maglev is disabled because of a suspected x64 snapshot regression in +# DoComputeOutputFrames configure_flags='--openssl-no-asm --without-npm --shared --with-intl=full-icu' eval "$("${libexec}/platform")" @@ -41,4 +43,4 @@ if [ "$host_platform" != "$target_platform" ] && [ "${target_platform%%-*}" = "a fi export PATH="${PWD}/out/tools/bin:${PATH}" -make -j"${NJOBS}" -C out BUILDTYPE="${BUILDTYPE}" V=0 +make -j"${NJOBS}" -C out BUILDTYPE="${BUILDTYPE}" V=0 CC=clang CC.host=clang CXX=clang++ CXX.host=clang++ diff --git a/libexec/extract-node b/libexec/extract-node index d2bd205..61b5b2a 100755 --- a/libexec/extract-node +++ b/libexec/extract-node @@ -29,20 +29,6 @@ extract "${src}" "${src}/node-v${version}.tar.gz" cd "${src}/node-v${version}" -#patch -p1 < "${top}"/patch/gyp-libv8_monolith.patch -#patch -p1 < "${top}"/patch/py2-icutrim.patch -#patch -p1 < "${top}"/patch/py2-genv8constants.patch -patch -p1 < "${top}"/patch/v8-no-assert-trivially-copyable.patch +patch -p1 < "${top}"/patch/v8-std-is-trivially-destructible.patch patch -p1 < "${top}"/patch/v8-disable-madv-dontfork.patch patch -p1 < "${top}"/patch/v8-disable-pkey.patch - -# TODO: the following still fails on py3 so the above one forcing py2 is needed -# patch -p1 < ../../py3-genv8constants.patch -# -# This is the error: -# -# Traceback (most recent call last): -# File "tools/genv8constants.py", line 99, in -# curr_val += int('0x%s' % octetstr, 16) << (curr_octet * 8) -# ValueError: invalid literal for int() with base 16: "0xb'04 '" -# node_dtrace_ustack.target.mk:13: recipe for target '/usbkey/user_home/vagrant/ruby-libv8-node/src/node-14.14.0/out/Release/obj/gen/v8constants.h' failed diff --git a/libexec/inject-libv8 b/libexec/inject-libv8 index 2142e1e..11cec84 100755 --- a/libexec/inject-libv8 +++ b/libexec/inject-libv8 @@ -56,7 +56,9 @@ for lib in libv8_monolith.a; do "$AR" "$AREXTRACTFLAGS" "$BASEDIR/out/${BUILDTYPE}/$lib" # strip all objects - "$FIND" -type f -exec "$STRIP" -Sx {} + + if [ "$BUILDTYPE" = "Release" ]; then + "$FIND" -type f -exec "$STRIP" -Sx {} + + fi # rebuild the archive "$FIND" -type f -exec "$AR" "$ARCOLLECTFLAGS" "../$lib" {} + diff --git a/libexec/platform b/libexec/platform index 91343aa..74ea826 100755 --- a/libexec/platform +++ b/libexec/platform @@ -98,10 +98,10 @@ if [ "${host_platform}" != "${target_platform}" ]; then configure_flags='--dest-cpu=arm --cross-compiling --dest-os=linux --with-arm-float-abi=hard --with-arm-fpu=neon' ;; x86_64-*linux*) - CC='x86_64-linux-gnu-gcc' - CXX='x86_64-linux-gnu-g++' - CC_host='gcc' - CXX_host='g++' + CC='clang -arch x86_64' + CXX='clang++ -arch x86_64' + CC_host='clang' + CXX_host='clang++' STRIP='x86_64-linux-gnu-strip' configure_flags='--dest-cpu=x86_64 --cross-compiling --dest-os=linux' ;; diff --git a/patch/gyp-libv8_monolith.patch b/patch/gyp-libv8_monolith.patch deleted file mode 100644 index af99a51..0000000 --- a/patch/gyp-libv8_monolith.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/node.gyp 2020-11-04 15:55:48.000000000 +0100 -+++ b/node.gyp 2020-11-04 15:55:51.000000000 +0100 -@@ -1467,6 +1467,16 @@ - }], - ], - }, # node_mksnapshot -+ { -+ 'target_name': 'libv8_monolith', -+ 'type': 'none', -+ 'includes': [ -+ 'node.gypi' -+ ], -+ #'dependencies': [ -+ # 'tools/v8_gypfiles/v8.gyp:v8_monolith', -+ #], -+ }, - ], # end targets - - 'conditions': [ ---- a/tools/v8_gypfiles/v8.gyp 2020-11-04 16:34:06.000000000 +0100 -+++ b/tools/v8_gypfiles/v8.gyp 2020-11-04 16:34:10.000000000 +0100 -@@ -1726,5 +1726,21 @@ - '<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h', - ], - }, # v8_zlib -+ { -+ 'target_name': 'v8_monolith', -+ 'type': 'static_library', -+ 'sources': [ -+ ':')) --v8dbg = re.compile(bytes('^v8dbg.*$')) --numpattern = re.compile(bytes('^[0-9a-fA-F]{2} $')) -+if str == bytes: -+ pattern = re.compile(bytes('([0-9a-fA-F]{8}|[0-9a-fA-F]{16}) <(.*)>:')) -+ v8dbg = re.compile(bytes('^v8dbg.*$')) -+ numpattern = re.compile(bytes('^[0-9a-fA-F]{2} $')) -+else: -+ pattern = re.compile(bytes('([0-9a-fA-F]{8}|[0-9a-fA-F]{16}) <(.*)>:', 'utf-8')) -+ v8dbg = re.compile(bytes('^v8dbg.*$', 'utf-8')) -+ numpattern = re.compile(bytes('^[0-9a-fA-F]{2} $', 'utf-8')) - octets = 4 - - outfile.write(""" diff --git a/patch/v8-no-assert-trivially-copyable.patch b/patch/v8-no-assert-trivially-copyable.patch deleted file mode 100644 index 2148c14..0000000 --- a/patch/v8-no-assert-trivially-copyable.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/deps/v8/src/base/small-vector.h b/deps/v8/src/base/small-vector.h -index edaab3a7a6..533a536178 100644 ---- a/deps/v8/src/base/small-vector.h -+++ b/deps/v8/src/base/small-vector.h -@@ -20,9 +20,6 @@ namespace base { - // dynamic storage when it overflows. - template > - class SmallVector { -- // Currently only support trivially copyable and trivially destructible data -- // types, as it uses memcpy to copy elements and never calls destructors. -- ASSERT_TRIVIALLY_COPYABLE(T); - static_assert(std::is_trivially_destructible::value); - - public: diff --git a/patch/v8-std-is-trivially-destructible.patch b/patch/v8-std-is-trivially-destructible.patch new file mode 100644 index 0000000..1da7be0 --- /dev/null +++ b/patch/v8-std-is-trivially-destructible.patch @@ -0,0 +1,22 @@ +diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h +index d404b6120a..053ac0e5ba 100644 +--- a/deps/v8/src/base/macros.h ++++ b/deps/v8/src/base/macros.h +@@ -173,7 +173,7 @@ namespace base { + // base::is_trivially_copyable will differ for these cases. + template + struct is_trivially_copyable { +-#if V8_CC_MSVC || (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) ++#if V8_CC_MSVC || (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) || defined(__clang__) + // Unfortunately, MSVC 2015 is broken in that std::is_trivially_copyable can + // be false even though it should be true according to the standard. + // (status at 2018-02-26, observed on the msvc waterfall bot). +@@ -186,6 +186,8 @@ struct is_trivially_copyable { + // distributions, so the same polyfill is also used. + // See + // https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc ++ // ++ // The same is observed with at least clang 14 and 15. + static constexpr bool value = + // Copy constructor is trivial or deleted. + (std::is_trivially_copy_constructible::value || diff --git a/sums/v22.13.1.sum b/sums/v22.13.1.sum new file mode 100644 index 0000000..60e9fbc --- /dev/null +++ b/sums/v22.13.1.sum @@ -0,0 +1 @@ +e7d5b1e84e7f3c3cebda81e2b138469eef41ba4ecf16a87fd15fc3f7afa3f701 diff --git a/sums/v22.9.0.sum b/sums/v22.9.0.sum new file mode 100644 index 0000000..0f710d9 --- /dev/null +++ b/sums/v22.9.0.sum @@ -0,0 +1 @@ +296854aa1dca140b0462c2415637d0419e42af91114538a7e6fdf623971a6833