diff --git a/Mk/Uses/ruby.mk b/Mk/Uses/ruby.mk --- a/Mk/Uses/ruby.mk +++ b/Mk/Uses/ruby.mk @@ -165,13 +165,21 @@ RUBY_DISTVERSION= 3.3.6 RUBY_PORTREVISION= 0 + +. elif ${RUBY_VER} == 3.4 +# +# Ruby 3.4 +# +RUBY_DISTVERSION= 3.4.1 +RUBY_PORTREVISION= 0 + # When adding a version, please keep the comment in # Mk/bsd.default-versions.mk in sync. . else # # Other versions # -IGNORE= Only ruby 3.1, 3,2 and 3.3 are supported +IGNORE= Only ruby 3.1, 3,2, 3.3 and 3.4 are supported _INVALID_RUBY_VER= 1 . endif RUBY_PORTEPOCH= 1 @@ -183,6 +191,7 @@ RUBY31?= "@comment " RUBY32?= "@comment " RUBY33?= "@comment " +RUBY34?= "@comment " . if defined(BROKEN_RUBY${RUBY_VER:R}${RUBY_VER:E}) . if ${BROKEN_RUBY${RUBY_VER:R}${RUBY_VER:E}} == "yes" diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk --- a/Mk/bsd.default-versions.mk +++ b/Mk/bsd.default-versions.mk @@ -140,7 +140,7 @@ PYTHON_DEFAULT?= 3.11 # Possible values: 2.7 PYTHON2_DEFAULT?= 2.7 -# Possible values: 3.1, 3.2, 3.3 +# Possible values: 3.1, 3.2, 3.3, 3.4 RUBY_DEFAULT?= 3.2 # Possible values: rust, rust-nightly RUST_DEFAULT?= rust diff --git a/lang/Makefile b/lang/Makefile --- a/lang/Makefile +++ b/lang/Makefile @@ -331,6 +331,7 @@ SUBDIR += ruby31 SUBDIR += ruby32 SUBDIR += ruby33 + SUBDIR += ruby34 SUBDIR += rubygem-rb_sys SUBDIR += rubygem-ruby_language_server SUBDIR += runawk diff --git a/lang/ruby34/Makefile b/lang/ruby34/Makefile new file mode 100644 --- /dev/null +++ b/lang/ruby34/Makefile @@ -0,0 +1,203 @@ +PORTNAME= ruby +DISTVERSION= ${RUBY_DISTVERSION} +PORTREVISION= ${RUBY_PORTREVISION} +PORTEPOCH= ${RUBY_PORTEPOCH} +CATEGORIES= lang ruby +MASTER_SITES= RUBY/${MASTER_SITE_SUBDIR_RUBY} +DIST_SUBDIR= ruby + +MAINTAINER= ruby@FreeBSD.org +COMMENT= Object-oriented interpreted scripting language +WWW= https://www.ruby-lang.org/en/ + +LICENSE= BSD2CLAUSE RUBY +LICENSE_COMB= dual +LICENSE_FILE_BSD2CLAUSE= ${WRKSRC}/BSDL +LICENSE_FILE_RUBY= ${WRKSRC}/COPYING + +# Using LIB_DEPENDS finds the libffi from gcc which causes problems +BUILD_DEPENDS= libffi>=0:devel/libffi +LIB_DEPENDS= libyaml.so:textproc/libyaml +RUN_DEPENDS= libffi>=0:devel/libffi + +USES= autoreconf cpe localbase ruby:none ssl tar:xz +CPE_VENDOR= ruby-lang +CPE_VERSION= ${RUBY_RELVERSION} +CPE_UPDATE= p${RUBY_PATCHLEVEL} +USE_LDCONFIG= yes + +GNU_CONFIGURE= yes +CONFIGURE_ARGS= ${RUBY_CONFIGURE_ARGS} \ + --disable-rpath \ + --enable-install-static-library \ + --enable-pthread \ + --enable-shared \ + --with-ruby-version="${RUBY_VER}" \ + --with-sitedir="${PREFIX}/lib/ruby/site_ruby" \ + --with-vendordir="${PREFIX}/lib/ruby/vendor_ruby" +CONFIGURE_ENV= debugflags= + +# Keep this, else ruby will fail to load libraries dependent of libpthread. +LIBS+= -lpthread + +EXTRACT_AFTER_ARGS= --exclude ${DISTNAME}/bin/gem --exclude \ + ${DISTNAME}/ext/win32* --exclude \ + ${DISTNAME}/lib/bundler* --exclude ${DISTNAME}/lib/irb* \ + --exclude ${DISTNAME}/man/erb.1 --exclude \ + ${DISTNAME}/man/irb.1 --exclude ${DISTNAME}/man/ri.1 \ + --exclude ${DISTNAME}/sample/win32ole --no-same-owner \ + --no-same-permissions + +WRKSRC= ${RUBY_WRKSRC} + +RUBY_VER= 3.4 + +OPTIONS_DEFINE= CAPIDOCS DEBUG DOCS EXAMPLES GMP RDOC YJIT +OPTIONS_DEFAULT= RDOC +OPTIONS_SUB= yes + +CAPIDOCS_DESC= Build and install C API documents +GMP_DESC= Use GMP to accelerate Bignum operations +RDOC_DESC= Build and install Rdoc indexes +YJIT_DESC= Enable YJIT (Yet Another Ruby JIT) + +CAPIDOCS_BUILD_DEPENDS= dot:graphics/graphviz \ + doxygen>=1.8.13,2:devel/doxygen +CAPIDOCS_CONFIGURE_ENABLE= install-capi +GMP_LIB_DEPENDS= libgmp.so:math/gmp +GMP_CONFIGURE_WITH= gmp +RDOC_CONFIGURE_ENABLE= install-rdoc +YJIT_BUILD_DEPENDS= ${RUST_DEFAULT}>=1.58.0:lang/${RUST_DEFAULT} +YJIT_CONFIGURE_ENABLE= yjit + +.include + +# PORTREVISION/PORTEPOCH hack + +.if ${PORTREVISION} != 0 +_SUF1= _${PORTREVISION} +.endif + +.if ${PORTEPOCH} != 0 +_SUF2= ,${PORTEPOCH} +.endif + +#.if ${OPSYS} == "FreeBSD" +#.if exists(/usr/sbin/dtrace) && (${ARCH} == amd64 || ${ARCH} == i386 || ${ARCH} == powerpc64le || ${ARCH} == powerpc64 || ${ARCH} == powerpc) +#CONFIGURE_ARGS+=--enable-dtrace +#.else +#CONFIGURE_ARGS+=--disable-dtrace +#.endif +#.endif + +# keep in sync with all platforms where libunwind is available +.if ${ARCH} == aarch64 || ${ARCH} == amd64 || ${ARCH} == armv7 || ${ARCH} == \ + i386 || ${ARCH} == powerpc || ${ARCH} == powerpc64 || ${ARCH} == \ + powerpc64le +LIB_DEPENDS+= libunwind.so:devel/libunwind +.endif + +.if ${ARCH} == armv6 || ${ARCH} == armv7 || ${ARCH} == powerpc +CONFIGURE_ARGS+= --with-setjmp-type=_setjmp +CONFIGURE_ENV+= ac_cv_func__setjmp=yes +.endif + +.if ${RUBY_VER} == ${RUBY_DEFAULT_VER} +PLIST_SUB+= IF_DEFAULT="" +.else +PKGNAMESUFFIX= ${RUBY_SUFFIX} +PLIST_SUB+= IF_DEFAULT="@comment " +.endif + +INSTALLED_SCRIPTS= ruby +INSTALLED_MANUALS= ruby + +EXTDOCS= ripper/README stringio/README.md + +# Macros to change variables in rbconfig.rb +RB_SET_CONF_VAR= ${SH} -c \ + '${REINPLACE_CMD} -E -e "s,(CONFIG\[\"$$0\"\][[:space:]]*=[[:space:]]*)(\(?)(.*)(\)?),\1\2$$1\4," ${WRKSRC}/rbconfig.rb' \ + -- + +post-extract-DOCS-on: + ${MV} ${WRKSRC}/ChangeLog ${WRKSRC}/doc/ChangeLog + +post-build: +# +# Hack to allow modules to be installed into separate PREFIX and/or under user +# privileges +# + @${RB_SET_CONF_VAR} "prefix" "ENV['PREFIX'] || \3" + @${RB_SET_CONF_VAR} "INSTALL" "'/usr/bin/install -c'" + @${RB_SET_CONF_VAR} "INSTALL_PROGRAM" "ENV['RB_USER_INSTALL'] ? '${INSTALL} ${COPY} ${STRIP} -m ${BINMODE}' : '${INSTALL_PROGRAM}'" + @${RB_SET_CONF_VAR} "INSTALL_SCRIPT" "ENV['RB_USER_INSTALL'] ? '${INSTALL} ${COPY} -m ${BINMODE}' : '${INSTALL_SCRIPT}'" + @${RB_SET_CONF_VAR} "INSTALL_DATA" "ENV['RB_USER_INSTALL'] ? '${INSTALL} ${COPY} -m ${SHAREMODE}' : '${INSTALL_DATA}'" + +post-build-CAPIDOCS-on: + @${FIND} ${WRKSRC}/doc -type d -empty -delete + +pre-install: + ${MKDIR} ${STAGEDIR}${RUBY_SITEARCHLIBDIR} + ${MKDIR} ${STAGEDIR}${RUBY_VENDORARCHLIBDIR} + +pre-install-DOCS-on: + ${MKDIR} ${STAGEDIR}${RUBY_DOCDIR} + +pre-install-EXAMPLES-on: + ${MKDIR} ${STAGEDIR}${RUBY_EXAMPLESDIR} + +pre-install-RDOC-on: + ${MKDIR} ${STAGEDIR}${RUBY_RIDIR} + ${MKDIR} ${STAGEDIR}${RUBY_SITERIDIR} + +post-install: +.if ${RUBY_VER} == ${RUBY_DEFAULT_VER} +# +# Link just installed "ruby" to "ruby31", etc. +# +. for FILE in ${INSTALLED_SCRIPTS} + ${LN} -fs ${FILE}${RUBY_SUFFIX} ${STAGEDIR}${PREFIX}/bin/${FILE} +. endfor +# +# Link "ruby.1.gz" to "ruby31.1.gz", etc. +# +. for FILE in ${INSTALLED_MANUALS} + ${LN} -fs ${FILE}${RUBY_SUFFIX}.1.gz ${STAGEDIR}${PREFIX}/share/man/man1/${FILE}.1.gz +. endfor +.endif + +post-install-CAPIDOCS-on: + ${RM} ${WRKSRC}/doc/capi/.timestamp ${STAGEDIR}${PREFIX}/share/doc/ruby${RUBY_SUFFIX}/capi/.timestamp + cd ${STAGEDIR}${PREFIX} && ${FIND} share/doc/ruby${RUBY_SUFFIX}/capi/ -type f >> ${TMPPLIST} + +post-install-DEBUG-off: +# +# XXX: hack to strip ruby binary. Ruby uses its own install script that seems +# bogus to hack. +# +.if defined(STRIP) && ${STRIP} == -s + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/ruby${RUBY_SUFFIX} + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libruby${RUBY_SHLIBVER}.so.${RUBY_SHLIBVER} + ${FIND} ${STAGEDIR}${RUBY_ARCHLIBDIR} -type f -name '*\.so' -exec ${STRIP_CMD} {} \; +.endif + +post-install-DOCS-on: +# Create all dirs required (":u" isn't available in STABLE yet :-() + ${MKDIR} ${EXTDOCS:C|^([^/]+)/.*|\1|:S|^|${STAGEDIR}${RUBY_DOCDIR}/|} +.for FILE in ${EXTDOCS} + ${INSTALL_DATA} ${WRKSRC}/ext/${FILE} \ + ${STAGEDIR}${RUBY_DOCDIR}/${FILE:C|^([^/]+)/.*|\1|}/ +.endfor + @(cd ${WRKSRC}/doc/ && ${COPYTREE_SHARE} \* ${STAGEDIR}${RUBY_DOCDIR}/) + ${INSTALL_DATA} ${WRKSRC}/COPYING* \ + ${WRKSRC}/LEGAL \ + ${WRKSRC}/README* \ + ${STAGEDIR}${RUBY_DOCDIR}/ + +post-install-EXAMPLES-on: + (cd ${WRKSRC}/sample/ && ${COPYTREE_SHARE} . ${STAGEDIR}${RUBY_EXAMPLESDIR}/) + +do-test: + cd ${WRKSRC} && ${MAKE_CMD} test + +.include diff --git a/lang/ruby34/distinfo b/lang/ruby34/distinfo new file mode 100644 --- /dev/null +++ b/lang/ruby34/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1735311696 +SHA256 (ruby/ruby-3.4.1.tar.xz) = 018d59ffb52be3c0a6d847e22d3fd7a2c52d0ddfee249d3517a0c8c6dbfa70af +SIZE (ruby/ruby-3.4.1.tar.xz) = 17222800 diff --git a/lang/ruby34/files/patch-common.mk b/lang/ruby34/files/patch-common.mk new file mode 100644 --- /dev/null +++ b/lang/ruby34/files/patch-common.mk @@ -0,0 +1,26 @@ +--- common.mk.orig 2024-12-12 01:10:13 UTC ++++ common.mk +@@ -487,17 +487,17 @@ install-all: pre-install-all do-install-all post-insta + $(ruby_pc): $(srcdir)/template/ruby.pc.in config.status + + install-all: pre-install-all do-install-all post-install-all +-pre-install-all:: all pre-install-local pre-install-ext pre-install-gem pre-install-doc ++pre-install-all:: all pre-install-local pre-install-ext pre-install-doc + do-install-all: pre-install-all $(DOT_WAIT) docs +- $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all $(INSTALL_DOC_OPTS) +-post-install-all:: post-install-local post-install-ext post-install-gem post-install-doc ++ $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all --exclude=gem $(INSTALL_DOC_OPTS) ++post-install-all:: post-install-local post-install-ext post-install-doc + @$(NULLCMD) + + install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc +-pre-install-nodoc:: pre-install-local pre-install-ext pre-install-gem ++pre-install-nodoc:: pre-install-local pre-install-ext + do-install-nodoc: main pre-install-nodoc +- $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all --exclude=doc +-post-install-nodoc:: post-install-local post-install-ext post-install-gem ++ $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all --exclude=doc --exclude=gem ++post-install-nodoc:: post-install-local post-install-ext + + install-local: pre-install-local do-install-local post-install-local + pre-install-local:: pre-install-bin pre-install-lib pre-install-man diff --git a/lang/ruby34/files/patch-configure.ac b/lang/ruby34/files/patch-configure.ac new file mode 100644 --- /dev/null +++ b/lang/ruby34/files/patch-configure.ac @@ -0,0 +1,36 @@ +--- configure.ac.orig 2024-12-12 01:10:13 UTC ++++ configure.ac +@@ -1411,7 +1411,7 @@ AC_CHECK_HEADERS(stdatomic.h) + AC_CHECK_HEADERS(stdckdint.h) + AC_CHECK_HEADERS(stdatomic.h) + +-AS_CASE("$target_cpu", [x64|x86_64|[i[3-6]86*]], [ ++AS_CASE("$target_cpu", [amd64|x64|x86_64|[i[3-6]86*]], [ + AC_CHECK_HEADERS(x86intrin.h) + ]) + RUBY_UNIVERSAL_CHECK_HEADER([x86_64, i386], x86intrin.h) +@@ -3149,7 +3149,7 @@ AC_SUBST(EXTOBJS) + : ${LDSHARED='$(CC) -shared'} + AS_IF([test "$rb_cv_binary_elf" = yes], [ + LDFLAGS="$LDFLAGS -rdynamic" +- DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@' ++ DLDFLAGS="$DLDFLAGS "'-Wl,-E' + ], [ + test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable' + ]) +@@ -3611,6 +3611,7 @@ AS_CASE("$enable_shared", [yes], [ + [freebsd*|dragonfly*], [ + LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)' + LIBRUBY_SONAME='$(LIBRUBY_SO)' ++ RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,${LIBRUBY_SO}']) + AS_IF([test "$rb_cv_binary_elf" != "yes" ], [ + LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)" + LIBRUBY_ALIASES='' +@@ -4443,6 +4444,7 @@ AS_IF([test "${universal_binary-no}" = yes ], [ + arch="${target_cpu}-mingw-ucrt" + ], [ + arch="${target_cpu}-${target_os}" ++ AS_CASE(["$target_cpu-$target_os"], [x86_64-freebsd*],[arch=amd64-${target_os}]) + ]) + AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "$arch") + diff --git a/lang/ruby34/files/patch-lib_mkmf.rb b/lang/ruby34/files/patch-lib_mkmf.rb new file mode 100644 --- /dev/null +++ b/lang/ruby34/files/patch-lib_mkmf.rb @@ -0,0 +1,11 @@ +--- lib/mkmf.rb.orig 2024-05-16 04:54:44 UTC ++++ lib/mkmf.rb +@@ -242,7 +242,7 @@ module MakeMakefile + end + $extmk ||= false + if not $extmk and File.exist?(($hdrdir = RbConfig::CONFIG["rubyhdrdir"]) + "/ruby/ruby.h") +- $topdir = $hdrdir ++ $topdir = $hdrdir + "/" + "#{CONFIG['arch']}/ruby/" + $top_srcdir = $hdrdir + $arch_hdrdir = RbConfig::CONFIG["rubyarchhdrdir"] + elsif File.exist?(($hdrdir = ($top_srcdir ||= topdir) + "/include") + "/ruby.h") diff --git a/lang/ruby34/files/patch-lib_rdoc_generator_json__index.rb b/lang/ruby34/files/patch-lib_rdoc_generator_json__index.rb new file mode 100644 --- /dev/null +++ b/lang/ruby34/files/patch-lib_rdoc_generator_json__index.rb @@ -0,0 +1,20 @@ +--- lib/rdoc/generator/json_index.rb.orig 2023-05-12 09:25:10 UTC ++++ lib/rdoc/generator/json_index.rb +@@ -178,7 +178,7 @@ class RDoc::Generator::JsonIndex + debug_msg "Writing gzipped search index to %s" % outfile + + Zlib::GzipWriter.open(outfile) do |gz| +- gz.mtime = File.mtime(search_index_file) ++ gz.mtime = 1 + gz.orig_name = search_index_file.basename.to_s + gz.write search_index + gz.close +@@ -196,7 +196,7 @@ class RDoc::Generator::JsonIndex + debug_msg "Writing gzipped file to %s" % outfile + + Zlib::GzipWriter.open(outfile) do |gz| +- gz.mtime = File.mtime(dest) ++ gz.mtime = 1 + gz.orig_name = dest.basename.to_s + gz.write data + gz.close diff --git a/lang/ruby34/files/patch-tool_mkconfig.rb b/lang/ruby34/files/patch-tool_mkconfig.rb new file mode 100644 --- /dev/null +++ b/lang/ruby34/files/patch-tool_mkconfig.rb @@ -0,0 +1,14 @@ +--- tool/mkconfig.rb.orig 2024-12-12 01:10:13 UTC ++++ tool/mkconfig.rb +@@ -170,8 +170,9 @@ end + val.replace(newval) unless newval == val + val + end +-prefix = vars.expand(vars["prefix"] ||= +"") +-rubyarchdir = vars.expand(vars["rubyarchdir"] ||= +"") ++prefix = vars.expand(vars["rubyarchdir"]) ++major, minor, *rest = RUBY_VERSION.split('.') ++rubyarchdir = "/lib/ruby/#{major}.#{minor}/#{arch}" + relative_archdir = rubyarchdir.rindex(prefix, 0) ? rubyarchdir[prefix.size..-1] : rubyarchdir + + puts %[\ diff --git a/lang/ruby34/pkg-descr b/lang/ruby34/pkg-descr new file mode 100644 --- /dev/null +++ b/lang/ruby34/pkg-descr @@ -0,0 +1,17 @@ +Ruby is the interpreted scripting language for quick and +easy object-oriented programming. It has many features to +process text files and to do system management tasks (as in +Perl). It is simple, straight-forward, and extensible. + +Features of Ruby are shown below. + + + Simple Syntax + + *Normal* Object-Oriented features(ex. class, method calls) + + *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method) + + Operator Overloading + + Exception Handling + + Iterators and Closures + + Garbage Collection + + Dynamic Loading of Object files(on some architecture) + + Highly Portable(works on many UNIX machines, and on DOS, + Windows, Mac, BeOS etc.) diff --git a/lang/ruby34/pkg-message b/lang/ruby34/pkg-message new file mode 100644 --- /dev/null +++ b/lang/ruby34/pkg-message @@ -0,0 +1,44 @@ +[ +{ type: install + message: <