Re: Update: lang/mruby 3.0.0

2021-08-27 Thread Stuart Henderson
On 2021/08/27 15:30, Jeremy Evans wrote:
> This updates mruby to 3.0.0.  Release notes available at:
> 
> https://u22788749.ct.sendgrid.net/ls/click?upn=yGPgKxLt0dQzFpcLvHl2PPhK3N-2FLVZTiDzy5GreoSYyxB5XtNmZ56IyvgOD5F0fB7RrALRMkzE3dK2a5lyHxVdpPN1U10A7vZfmPwd9pln4-3DQhJj_7a8z5HXKglTa4iEppNBl7pmmyiLmNe-2BkBcvOJjbwgwSewIYonLntRuoN4GwM7WjPvc-2FXMqASZb04MiyaLnVHylaO4EcWA7oZInCQ-2FzqsvrtCeoCImCCHD2bnubMrEApg46D3lZhO9D1mhb4InQ8q86xmft7sRvJwRzF39EIjWDV-2F6BKUE45BZGD-2FmQ2U8It0D7-2FiFkQYgjxnaXjFc-2FgW-2FQ-3D-3D
> 
> Tested on amd64.  I'd like to commit it when I commit the default
> Ruby version change to 3.0.
> 
> There is a comment about keeping the version in sync with www/h2o,
> but otto@ (h2o maintainer) doesn't know why, and fcambus@ (who added the
> comment) hasn't responded yet.  mruby is embedded, not linked, so I'm
> not sure why the mruby version should need to be in sync.

www/h2o,mruby build fails if the newer version is present at build time.



Re: Update: lang/mruby 3.0.0

2021-08-27 Thread Jeremy Evans
On 08/27 08:16, Stuart Henderson wrote:
> On 2021/08/27 15:30, Jeremy Evans wrote:
> > This updates mruby to 3.0.0.  Release notes available at:
> > 
> > https://u22788749.ct.sendgrid.net/ls/click?upn=yGPgKxLt0dQzFpcLvHl2PKt5t-2BXSL6jBeJFtWa8J6ek1Fkq4F7CLpJlx9PNUIUDAY4EV1DGrT6gryw339cicnQ2JYOiclBVEPMpFqHvt1WDBJEchEbPiyB5bUlBCSgza20Cgyp4MFH4fIVqtSEIxRQpcudsRU8AdToaPQ5kcikc-2Fx8AV6q-2FVFkzd1FPt640I1jj-2FAT7q-2BnJ5ZDomfO82BjzlELrshqntJDxb-2B2C16V8vFrL1jAaaIjKNuZIyFkBt4fejNaJon7B-2FafNaRpjwzK7q3DFSB5dc8kD5LwMMcqI7mgVwq0Wz02LEyJuqSNpXhq135PnLGViOATpG0koBF8kuT6G6gCGfdsNzmPd7Bs4deW5N9gq1eLERNIg-2BHzfxEbV91LApOhkB2yy5HJlmExtLdVU19Q745a9A5AHn0stQdj6TM9RijdfI4ltct-2FPHJ3dVJM0QnCzH4md49xM1YoeqD6voM4o2xf6SdFgJFPocPIEpmEZI0IIovUFAB1MCDvgaZqR1KG1UdqA-2FP3lCBKIE6eANT9fLya9IOrEdizc-3D3Vrg_7a8z5HXKglTa4iEppNBl7pmmyiLmNe-2BkBcvOJjbwgwQYaM-2FF409Z5JsGwn-2FV3RSMwvAwM3l64RnOkMfPlrf9RHVE7X13ddR9bPASGCK5BSPDMHh9ViO33cxfWkl3yTqLr-2FfGwZzU0ld1Y8x6nCgpaMea2ubh3TO2dy7-2B741O6w5u3DPHGN2h9Yj3O8tgACHCxnfZf0tT4vRps4uUvaq1qQ-3D-3D
> > 
> > Tested on amd64.  I'd like to commit it when I commit the default
> > Ruby version change to 3.0.
> > 
> > There is a comment about keeping the version in sync with www/h2o,
> > but otto@ (h2o maintainer) doesn't know why, and fcambus@ (who added the
> > comment) hasn't responded yet.  mruby is embedded, not linked, so I'm
> > not sure why the mruby version should need to be in sync.
> 
> www/h2o,mruby build fails if the newer version is present at build time.

I tested building www/h2o,mruby with mruby-3.0.0 installed, and it
worked correctly.  mruby does not expose a shared library (as it is
designed for embedding), and h2o embeds it's own copy of mruby, so
there should be no need for the versions to be in sync.

However, it looks like a build fix is needed for www/h2o,mruby if
the default Ruby version in ports is 3.0.0 (see below).  No bump as
this is only a build issue and should not affect runtime.  OKs to
commit this build fix? It should work fine even if the default Ruby
version is 2.7, it doesn't have to wait until the default version is
switched to 3.0.

Thanks,
Jeremy

Index: patches/patch-deps_mruby_Rakefile
===
RCS file: patches/patch-deps_mruby_Rakefile
diff -N patches/patch-deps_mruby_Rakefile
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-deps_mruby_Rakefile   27 Aug 2021 19:38:12 -
@@ -0,0 +1,68 @@
+$OpenBSD$
+
+Fix build with Ruby 3.0.
+
+Index: deps/mruby/Rakefile
+--- deps/mruby/Rakefile.orig
 deps/mruby/Rakefile
+@@ -37,15 +37,15 @@ load "#{MRUBY_ROOT}/tasks/gitlab.rake"
+ task :default => :all
+ 
+ bin_path = ENV['INSTALL_DIR'] || "#{MRUBY_ROOT}/bin"
+-FileUtils.mkdir_p bin_path, { :verbose => $verbose }
++FileUtils.mkdir_p bin_path, :verbose => $verbose
+ 
+ depfiles = MRuby.targets['host'].bins.map do |bin|
+   install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}")
+   source_path = 
MRuby.targets['host'].exefile("#{MRuby.targets['host'].build_dir}/bin/#{bin}")
+ 
+   file install_path => source_path do |t|
+-FileUtils.rm_f t.name, { :verbose => $verbose }
+-FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
++FileUtils.rm_f t.name, :verbose => $verbose
++FileUtils.cp t.prerequisites.first, t.name, :verbose => $verbose
+   end
+ 
+   install_path
+@@ -78,8 +78,8 @@ MRuby.each_target do |target|
+ install_path = MRuby.targets['host'].exefile("#{bin_path}/#{bin}")
+ 
+ file install_path => exec do |t|
+-  FileUtils.rm_f t.name, { :verbose => $verbose }
+-  FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose }
++  FileUtils.rm_f t.name, :verbose => $verbose
++  FileUtils.cp t.prerequisites.first, t.name, :verbose => $verbose
+ end
+ depfiles += [ install_path ]
+   elsif target == MRuby.targets['host-debug']
+@@ -87,8 +87,8 @@ MRuby.each_target do |target|
+   install_path = 
MRuby.targets['host-debug'].exefile("#{bin_path}/#{bin}")
+ 
+   file install_path => exec do |t|
+-FileUtils.rm_f t.name, { :verbose => $verbose }
+-FileUtils.cp t.prerequisites.first, t.name, { :verbose => 
$verbose }
++FileUtils.rm_f t.name, :verbose => $verbose
++FileUtils.cp t.prerequisites.first, t.name, :verbose => $verbose
+   end
+   depfiles += [ install_path ]
+ end
+@@ -127,16 +127,16 @@ end
+ desc "clean all built and in-repo installed artifacts"
+ task :clean do
+   MRuby.each_target do |t|
+-FileUtils.rm_rf t.build_dir, { :verbose => $verbose }
++FileUtils.rm_rf t.build_dir, :verbose => $verbose
+   end
+-  FileUtils.rm_f depfiles, { :verbose => $verbose }
++  FileUtils.rm_f depfiles, :verbose => $verbose
+   puts "Cleaned up target build folder"
+ end
+ 
+ desc "clean everything!"
+ task :deep_clean => ["clean"] do
+   MRuby.each_target do |t|
+-FileUtils.rm_rf t.gem_clone_dir, { :verbos

Re: Update: lang/mruby 3.0.0

2021-08-27 Thread George Koehler
On Fri, 27 Aug 2021 15:30:21 + (UTC)
Jeremy Evans  wrote:

> This updates mruby to 3.0.0.  Release notes available at:
> 
> https://u22788749.ct.sendgrid.net/ls/click?upn=yGPgKxLt0dQzFpcLvHl2PPhK3N-2FLVZTiDzy5GreoSYyxB5XtNmZ56IyvgOD5F0fB7RrALRMkzE3dK2a5lyHxVdpPN1U10A7vZfmPwd9pln4-3DQhJj_7a8z5HXKglTa4iEppNBl7pmmyiLmNe-2BkBcvOJjbwgwSewIYonLntRuoN4GwM7WjPvc-2FXMqASZb04MiyaLnVHylaO4EcWA7oZInCQ-2FzqsvrtCeoCImCCHD2bnubMrEApg46D3lZhO9D1mhb4InQ8q86xmft7sRvJwRzF39EIjWDV-2F6BKUE45BZGD-2FmQ2U8It0D7-2FiFkQYgjxnaXjFc-2FgW-2FQ-3D-3D
> 
> Tested on amd64.  I'd like to commit it when I commit the default
> Ruby version change to 3.0.

mruby 3.0.0 looks good on macppc.

> There is a comment about keeping the version in sync with www/h2o,
> but otto@ (h2o maintainer) doesn't know why, and fcambus@ (who added the
> comment) hasn't responded yet.  mruby is embedded, not linked, so I'm
> not sure why the mruby version should need to be in sync.

It isn't in sync: we have lang/mruby 2.0.1, but h2o has embedded mruby
1.3.0.  These versions have incompatible bytecode, but this isn't a
problem, because h2o isn't using lang/mruby's mrbc.  I would delete
the sync comment.

I can run "Math.sqrt(2)" and "Digest::MD5.hexdigest('abc')" in h2o.
If I use lang/mruby to "mrbc -o handle.mrb handle.rb", then
"load '/path/to/handle.mrb'" raises LoadError in h2o, but
"load '/path/to/handle.rb'" works.

--George

> Thanks,
> Jeremy
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/lang/mruby/Makefile,v
> retrieving revision 1.18
> diff -u -p -r1.18 Makefile
> --- Makefile  17 Nov 2020 03:19:37 -  1.18
> +++ Makefile  13 Aug 2021 15:32:19 -
> @@ -7,8 +7,7 @@ COMMENT = lightweight, embeddable imple
>  # Keep in sync with the version bundled in www/h2o
>  GH_ACCOUNT = mruby
>  GH_PROJECT = mruby
> -GH_TAGNAME = 2.0.1
> -REVISION =   1
> +GH_TAGNAME = 3.0.0
>  
>  CATEGORIES = lang
>  HOMEPAGE =   
> https://u22788749.ct.sendgrid.net/ls/click?upn=yGPgKxLt0dQzFpcLvHl2PGAfC22xVKe29SU9ZLF5-2Bww-3DZfhT_7a8z5HXKglTa4iEppNBl7pmmyiLmNe-2BkBcvOJjbwgwSewIYonLntRuoN4GwM7WjPJgYFJlxQ1KStBVDKpdTGO07ypOQVRID4VYY02WGFzQbLba0Ct14l4m66LgRkscBO5xx6KC0I9-2BdNPdYvFMND9AcocfnclYMzpThcHTDdeXlelT7ZQMg5IoTtw4VM6lP3zZaBMzHk5LK-2FRUWmjm0f-2Bg-3D-3D
> @@ -29,7 +28,7 @@ NO_CONFIGURE =  Yes
>  SUBST_VARS = RUBY
>  
>  do-build:
> - cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBY} ./minirake --verbose
> + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RAKE} --verbose
>  
>  do-install:
>   ${INSTALL_PROGRAM} ${WRKSRC}/bin/* ${PREFIX}/bin/
> @@ -39,6 +38,6 @@ do-install:
>   ${INSTALL_DATA} ${WRKSRC}/doc/guides/* ${PREFIX}/share/doc/mruby/ 
>  
>  do-test:
> - cd ${WRKSRC} && RUBY=${RUBY} ${RUBY} ./minirake test
> + cd ${WRKSRC} && RUBY=${RUBY} ${RAKE} test
>  
>  .include 
> Index: distinfo
> ===
> RCS file: /cvs/ports/lang/mruby/distinfo,v
> retrieving revision 1.5
> diff -u -p -r1.5 distinfo
> --- distinfo  11 Nov 2019 11:42:36 -  1.5
> +++ distinfo  13 Aug 2021 15:32:19 -
> @@ -1,2 +1,2 @@
> -SHA256 (mruby-2.0.1.tar.gz) = /gxQoltNx2kv1/an38HVi6c/U/7dpXYoRbhTaSz6yBA=
> -SIZE (mruby-2.0.1.tar.gz) = 517932
> +SHA256 (mruby-3.0.0.tar.gz) = lbeYzdkx7ynTiOKwsmfLpNxGnociw31O+O5SSLyQdbA=
> +SIZE (mruby-3.0.0.tar.gz) = 701142
> Index: patches/patch-build_config_rb
> ===
> RCS file: patches/patch-build_config_rb
> diff -N patches/patch-build_config_rb
> --- patches/patch-build_config_rb 12 Nov 2019 09:25:28 -  1.4
> +++ /dev/null 1 Jan 1970 00:00:00 -
> @@ -1,25 +0,0 @@
> -$OpenBSD: patch-build_config_rb,v 1.4 2019/11/12 09:25:28 fcambus Exp $
> -
> -Avoid adding "-g3 -O0" to CFLAGS.
> -
> -Index: build_config.rb
>  build_config.rb.orig
> -+++ build_config.rb
> -@@ -95,7 +95,7 @@ MRuby::Build.new('host-debug') do |conf|
> - toolchain :gcc
> -   end
> - 
> --  enable_debug
> -+  # enable_debug
> - 
> -   # include the default GEMs
> -   conf.gembox 'default'
> -@@ -118,7 +118,7 @@ MRuby::Build.new('test') do |conf|
> - toolchain :gcc
> -   end
> - 
> --  enable_debug
> -+  # enable_debug
> -   conf.enable_bintest
> -   conf.enable_test
> - 
> Index: patches/patch-lib_mruby_build_rb
> ===
> RCS file: /cvs/ports/lang/mruby/patches/patch-lib_mruby_build_rb,v
> retrieving revision 1.3
> diff -u -p -r1.3 patch-lib_mruby_build_rb
> --- patches/patch-lib_mruby_build_rb  11 Nov 2019 11:42:36 -  1.3
> +++ patches/patch-lib_mruby_build_rb  13 Aug 2021 15:32:19 -
> @@ -3,12 +3,12 @@ $OpenBSD: patch-lib_mruby_build_rb,v 1.3
>  Index: lib/mruby/build.rb
>  --- lib/mruby/build.rb.orig
>  +++ lib/mruby/build.rb
> -@@ -317,7 +317,7 @@ EOS
> -   puts ">>> Bintest #{name} <<<"
> -