Skip to content

Commit 612cf2d

Browse files
authored
Merge pull request #155 from rake-compiler/macos-mig
Install mig which is a Macos specific RPC code generator
2 parents d0f0510 + 2b9ba74 commit 612cf2d

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

Dockerfile.mri.erb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@ RUN sudo cp /llvm-mingw/aarch64-w64-mingw32/bin/libc++.dll /llvm-mingw/aarch64-w
218218
COPY build/strip_wrapper_codesign /root/
219219
RUN mv /opt/osxcross/target/bin/<%= target %>-strip /opt/osxcross/target/bin/<%= target %>-strip.bin && \
220220
ln /root/strip_wrapper_codesign /opt/osxcross/target/bin/<%= target %>-strip
221+
222+
# Install mig which is a Macos specific RPC code generator, which is part of xcode
223+
RUN apt-get -y update && \
224+
apt-get install -y bison flex && \
225+
rm -rf /var/lib/apt/lists/*
226+
RUN git clone --branch=cross_platform https://github.com/markmentovai/bootstrap_cmds && \
227+
cd bootstrap_cmds && \
228+
autoreconf --install && \
229+
sh configure && \
230+
make && \
231+
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 && \
232+
sudo make install
221233
<% end %>
222234

223235
<% if platform =~ /arm64-darwin/ %>

test/fixtures/mig_test_rpc.defs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <mach/std_types.defs>
2+
#include <mach/mach_types.defs>
3+
4+
subsystem mig_test_ipc 1;
5+
6+
routine mig_test_call(
7+
server_port : mach_port_t;
8+
out returnvalue : int);

test/test_mig.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'rake_compiler_dock'
2+
require 'test/unit'
3+
4+
class TestMigCompile < Test::Unit::TestCase
5+
TEST_PLATFORM = ENV["TEST_PLATFORM"] || 'arm64-darwin'
6+
7+
def test_mig_compile
8+
omit "only on darwin platform" unless TEST_PLATFORM =~ /darwin/
9+
10+
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
11+
12+
h_file = File.read("tmp/mig_test_rpc.h")
13+
assert_match /Request_mig_test_call/, h_file
14+
15+
c_file = File.read("tmp/mig_test_rpc.c")
16+
assert_match /Reply__mig_test_call/, c_file
17+
end
18+
end

0 commit comments

Comments
 (0)