Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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/ %>
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/mig_test_rpc.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <mach/std_types.defs>
#include <mach/mach_types.defs>

subsystem mig_test_ipc 1;

routine mig_test_call(
server_port : mach_port_t;
out returnvalue : int);
18 changes: 18 additions & 0 deletions test/test_mig.rb
Original file line number Diff line number Diff line change
@@ -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