diff --git a/lang/ruby/Makefile b/lang/ruby/Makefile index 5c5717ca7..56c4e8010 100644 --- a/lang/ruby/Makefile +++ b/lang/ruby/Makefile @@ -25,7 +25,15 @@ PKG_LICENSE:=BSD-2-Clause PKG_LICENSE_FILES:=COPYING PKG_CPE_ID:=cpe:/a:ruby-lang:ruby -PKG_BUILD_DEPENDS:=ruby/host + +# YJIT may not be suitable for certain applications. It +# currently only supports macOS, Linux and BSD on x86-64 and +# arm64/aarch64 CPUs. +# Ruby 3.3.5 (latest) still does not support cross-compiling. It +# will only work when target matches the host arch. Anyway, we +# will provide a working rustc for those supported archs to let +# it work when they match. +PKG_BUILD_DEPENDS:=ruby/host RUBY_ENABLE_YJIT:rust/host PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 PKG_FIXUP:=autoreconf @@ -38,6 +46,7 @@ HOST_CONFIGURE_ARGS += \ --disable-install-doc \ --disable-install-rdoc \ --disable-install-capi \ + --disable-yjit \ --without-gmp \ --with-static-linked-ext \ --with-out-ext=-test-/*,bigdecimal,cgi/escape,continuation,coverage,etc,fcntl,fiddle,io/console,json,json/generator,json/parser,mathn/complex,mathn/rational,nkf,objspace,pty,racc/cparse,rbconfig/sizeof,readline,rubyvm,syslog,win32,win32ole,win32/resolv @@ -71,6 +80,12 @@ CONFIGURE_ARGS += --disable-jit-support # Host JIT does work but it is not worth it HOST_CONFIGURE_ARGS += --disable-jit-support +ifndef CONFIG_RUBY_ENABLE_YJIT + # it is only worth it to enable yjit for target package + CONFIGURE_ARGS += --disable-yjit +endif + + # Apple ld generates warning if LD_FLAGS var includes path to lib that is not # exist (e.g. -L$(STAGING_DIR)/host/lib). configure script fails if ld generates # any output @@ -152,6 +167,17 @@ define RubyDependency endef define Package/ruby/config + config RUBY_ENABLE_YJIT + bool "Enable YJIT" + depends on PACKAGE_ruby + depends on x86_64||aarch64 + default y if x86_64||aarch64 + help + YJIT is a lightweight, minimalistic Ruby JIT built + inside CRuby. It lazily compiles code using a Basic Block Versioning (BBV) + architecture. YJIT is currently supported for macOS, Linux and BSD on x86-64 + and arm64/aarch64 CPUs. + comment "Standard Library" depends on PACKAGE_ruby