summaryrefslogtreecommitdiff
path: root/net/rubygem-grpc-gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'net/rubygem-grpc-gitlab')
-rw-r--r--net/rubygem-grpc-gitlab/Makefile29
-rw-r--r--net/rubygem-grpc-gitlab/distinfo3
-rw-r--r--net/rubygem-grpc-gitlab/files/patch-src_ruby_ext_grpc_extconf.rb60
-rw-r--r--net/rubygem-grpc-gitlab/files/patch-src_ruby_lib_grpc.rb11
-rw-r--r--net/rubygem-grpc-gitlab/pkg-descr1
5 files changed, 104 insertions, 0 deletions
diff --git a/net/rubygem-grpc-gitlab/Makefile b/net/rubygem-grpc-gitlab/Makefile
new file mode 100644
index 000000000000..898f7fb49370
--- /dev/null
+++ b/net/rubygem-grpc-gitlab/Makefile
@@ -0,0 +1,29 @@
+PORTNAME= grpc
+PORTVERSION= 1.72.0
+CATEGORIES= net rubygems
+MASTER_SITES= RG
+PKGNAMESUFFIX= -gitlab
+
+MAINTAINER= mfechner@FreeBSD.org
+COMMENT= Ruby implementation of gRPC
+WWW= https://github.com/grpc/grpc/tree/master/src/ruby
+
+LICENSE= BSD3CLAUSE
+
+LIB_DEPENDS= libgrpc.so:devel/grpc
+RUN_DEPENDS= ca_root_nss>=0:security/ca_root_nss \
+ rubygem-google-protobuf>=3.25<5.0:devel/rubygem-google-protobuf \
+ rubygem-googleapis-common-protos-types>=1.0<2:devel/rubygem-googleapis-common-protos-types
+
+USES= cpe gem gmake pkgconfig
+
+MAKE_JOBS_UNSAFE= yes
+
+post-patch:
+ @${RM} ${WRKSRC}/Makefile ${WRKSRC}/.yardopts
+ @${RM} -r ${WRKSRC}/etc ${WRKSRC}/include ${WRKSRC}/third_party ${WRKSRC}/src/boringssl ${WRKSRC}/src/core
+ @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/src/ruby/lib/grpc.rb
+ @${REINPLACE_CMD} -Ee '/s\.files = /s;, "(Makefile|etc|include|third_party|src/boringssl|src/core)[^"]*"\.freeze;;g' ${WRKSRC}/${GEMSPEC}
+ @${REINPLACE_CMD} -e '/s\.files = /s|"\.yardopts"\.freeze, ||' ${WRKSRC}/${GEMSPEC}
+
+.include <bsd.port.mk>
diff --git a/net/rubygem-grpc-gitlab/distinfo b/net/rubygem-grpc-gitlab/distinfo
new file mode 100644
index 000000000000..889f84971194
--- /dev/null
+++ b/net/rubygem-grpc-gitlab/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1750238898
+SHA256 (rubygem/grpc-1.72.0.gem) = 56fa0da2f4f96471f59430a9ef08a612cc77649e8fa118c83ae7d0bb619bea09
+SIZE (rubygem/grpc-1.72.0.gem) = 6834176
diff --git a/net/rubygem-grpc-gitlab/files/patch-src_ruby_ext_grpc_extconf.rb b/net/rubygem-grpc-gitlab/files/patch-src_ruby_ext_grpc_extconf.rb
new file mode 100644
index 000000000000..b15b15fabb59
--- /dev/null
+++ b/net/rubygem-grpc-gitlab/files/patch-src_ruby_ext_grpc_extconf.rb
@@ -0,0 +1,60 @@
+--- src/ruby/ext/grpc/extconf.rb.orig 2024-05-18 09:15:48 UTC
++++ src/ruby/ext/grpc/extconf.rb
+@@ -96,9 +96,9 @@ end
+ end
+
+ # Don't embed on TruffleRuby (constant-time crypto is unsafe with Sulong, slow build times)
+-ENV['EMBED_OPENSSL'] = (RUBY_ENGINE != 'truffleruby').to_s
++ENV['EMBED_OPENSSL'] = 'false'
+ # Don't embed on TruffleRuby (the system zlib is already linked for the zlib C extension, slow build times)
+-ENV['EMBED_ZLIB'] = (RUBY_ENGINE != 'truffleruby').to_s
++ENV['EMBED_ZLIB'] = 'false'
+
+ ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
+ if apple_toolchain && !cross_compiling
+@@ -122,30 +122,10 @@ strip_tool += ' -x' if apple_toolchain
+ strip_tool = RbConfig::CONFIG['STRIP']
+ strip_tool += ' -x' if apple_toolchain
+
+-unless windows
+- puts 'Building internal gRPC into ' + grpc_lib_dir
+- nproc = 4
+- nproc = Etc.nprocessors if Etc.respond_to? :nprocessors
+- nproc_override = ENV['GRPC_RUBY_BUILD_PROCS']
+- unless nproc_override.nil? or nproc_override.size == 0
+- nproc = nproc_override
+- puts "Overriding make parallelism to #{nproc}"
+- end
+- make = bsd ? 'gmake' : 'make'
+- cmd = "#{make} -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config} Q="
+- puts "Building grpc native library: #{cmd}"
+- system(cmd)
+- exit 1 unless $? == 0
+-end
+-
+ # C-core built, generate Makefile for ruby extension
+ $LDFLAGS = maybe_remove_strip_all_linker_flag($LDFLAGS)
+ $DLDFLAGS = maybe_remove_strip_all_linker_flag($DLDFLAGS)
+
+-$CFLAGS << ' -DGRPC_RUBY_WINDOWS_UCRT' if windows_ucrt
+-$CFLAGS << ' -I' + File.join(grpc_root, 'include')
+-$CFLAGS << ' -g'
+-
+ def have_ruby_abi_version()
+ return true if RUBY_ENGINE == 'truffleruby'
+ # ruby_abi_version is only available in development versions: https://github.com/ruby/ruby/pull/6231
+@@ -174,13 +154,12 @@ ext_export_file = File.join(grpc_root, 'src', 'ruby',
+ end
+
+ ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', ext_export_filename())
+-$LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if linux
+ if apple_toolchain
+ $LDFLAGS << ' -weak_framework CoreFoundation'
+ $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"'
+ end
+
+-$LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
++$LDFLAGS << ' -lgrpc' unless windows
+ if grpc_config == 'gcov'
+ $CFLAGS << ' -O0 -fprofile-arcs -ftest-coverage'
+ $LDFLAGS << ' -fprofile-arcs -ftest-coverage -rdynamic'
diff --git a/net/rubygem-grpc-gitlab/files/patch-src_ruby_lib_grpc.rb b/net/rubygem-grpc-gitlab/files/patch-src_ruby_lib_grpc.rb
new file mode 100644
index 000000000000..2671a57a57f4
--- /dev/null
+++ b/net/rubygem-grpc-gitlab/files/patch-src_ruby_lib_grpc.rb
@@ -0,0 +1,11 @@
+--- src/ruby/lib/grpc.rb.orig 2020-09-23 17:48:57 UTC
++++ src/ruby/lib/grpc.rb
+@@ -12,7 +12,7 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+-ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
++ssl_roots_path = '%%LOCALBASE%%/etc/ssl/cert.pem'
+
+ require_relative 'grpc/errors'
+ require_relative 'grpc/structs'
diff --git a/net/rubygem-grpc-gitlab/pkg-descr b/net/rubygem-grpc-gitlab/pkg-descr
new file mode 100644
index 000000000000..f60aa1ca888f
--- /dev/null
+++ b/net/rubygem-grpc-gitlab/pkg-descr
@@ -0,0 +1 @@
+A Ruby implementation of gRPC.