From c4393042fedd74140e449652eb10c22664e8bd09 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 17 Jul 2025 22:09:35 +0200 Subject: [PATCH 1/2] Install mig which is a Macos specific RPC code generator It is part of xcode, but not part of our RCD installation so far. "mig" command is used by krb5 for instance. Fortunately there's a port for Linux, so it can be installed easily. --- Dockerfile.mri.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Dockerfile.mri.erb b/Dockerfile.mri.erb index f03a4c5b..f53d640e 100644 --- a/Dockerfile.mri.erb +++ b/Dockerfile.mri.erb @@ -197,6 +197,18 @@ RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \ COPY build/strip_wrapper_codesign /root/ RUN mv /opt/osxcross/target/bin/<%= target %>-strip /opt/osxcross/target/bin/<%= target %>-strip.bin && \ ln /root/strip_wrapper_codesign /opt/osxcross/target/bin/<%= target %>-strip + +# Install mig which is a Macos specific RPC code generator, which is part of xcode +RUN apt-get -y update && \ + apt-get install -y bison flex && \ + rm -rf /var/lib/apt/lists/* +RUN git clone --branch=cross_platform https://github.com/markmentovai/bootstrap_cmds && \ + cd bootstrap_cmds && \ + autoreconf --install && \ + sh configure && \ + make && \ + sed -E -i 's/^cppflags=(.*)/cppflags=(\1 "-D<%= platform =~ /arm64/ ? "__arm64__" : "__x86_64__" %>" "-I\/opt\/osxcross\/target\/SDK\/MacOSX11.1.sdk\/usr\/include")/' migcom.tproj/mig.sh && \ + sudo make install <% end %> <% if platform =~ /arm64-darwin/ %> From 2b9ba74867beeee484d7d173c0aae206f439737c Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Fri, 18 Jul 2025 18:43:24 +0200 Subject: [PATCH 2/2] Add a test case for mig tool on darwon platforms --- test/fixtures/mig_test_rpc.defs | 8 ++++++++ test/test_mig.rb | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/fixtures/mig_test_rpc.defs create mode 100644 test/test_mig.rb diff --git a/test/fixtures/mig_test_rpc.defs b/test/fixtures/mig_test_rpc.defs new file mode 100644 index 00000000..a7a050da --- /dev/null +++ b/test/fixtures/mig_test_rpc.defs @@ -0,0 +1,8 @@ +#include +#include + +subsystem mig_test_ipc 1; + +routine mig_test_call( + server_port : mach_port_t; + out returnvalue : int); diff --git a/test/test_mig.rb b/test/test_mig.rb new file mode 100644 index 00000000..1a4ad7ef --- /dev/null +++ b/test/test_mig.rb @@ -0,0 +1,18 @@ +require 'rake_compiler_dock' +require 'test/unit' + +class TestMigCompile < Test::Unit::TestCase + TEST_PLATFORM = ENV["TEST_PLATFORM"] || 'arm64-darwin' + + def test_mig_compile + omit "only on darwin platform" unless TEST_PLATFORM =~ /darwin/ + + RakeCompilerDock::Starter.sh "mig -header tmp/mig_test_rpc.h -user tmp/mig_test_rpc.c -sheader /dev/null -server /dev/null -I. test/fixtures/mig_test_rpc.defs ", platform: TEST_PLATFORM, verbose: false + + h_file = File.read("tmp/mig_test_rpc.h") + assert_match /Request_mig_test_call/, h_file + + c_file = File.read("tmp/mig_test_rpc.c") + assert_match /Reply__mig_test_call/, c_file + end +end