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
8 changes: 0 additions & 8 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ XCODE_VERSION=11.0
XCODE_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_11_GM_Seed_2.xip
XCODE_DEVELOPER_ROOT=/Applications/Xcode11-GM2.app/Contents/Developer

XCODE94_VERSION=9.4
XCODE94_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_9.4.xip
XCODE94_DEVELOPER_ROOT=/Applications/Xcode94.app/Contents/Developer

# Mono version embedded in XI/XM (NEEDED_MONO_VERSION/BRANCH) are specified in mk/mono.mk
include $(TOP)/mk/mono.mk
MONO_HASH := $(NEEDED_MONO_VERSION)
Expand Down Expand Up @@ -136,15 +132,11 @@ APPLETLS_DEFINES = -d:XAMARIN_APPLETLS
endif

XCODE_MAC_SDKROOT=$(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
XCODE94_MAC_SDKROOT=$(XCODE94_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

# The MAC_* variables do not contain the -mmacosx-version-min flag on purpose: each usage must specify it separately.
MAC_CC=$(CCACHE)$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot $(XCODE_MAC_SDKROOT) -stdlib=libc++
MAC_CXX=$(CCACHE)$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot $(XCODE_MAC_SDKROOT) -stdlib=libc++

MAC32_CC=$(CCACHE)$(XCODE94_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot $(XCODE94_MAC_SDKROOT) -stdlib=libc++
MAC32_CXX=$(CCACHE)$(XCODE94_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot $(XCODE94_MAC_SDKROOT) -stdlib=libc++

MAC_INSTALL_VERSION ?= git
IOS_INSTALL_VERSION ?= git

Expand Down
2 changes: 1 addition & 1 deletion builds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ else
# Configuration for the mono sdk makefiles
#
SDK_ARGS= \
XCODE_DIR=$(XCODE_DEVELOPER_ROOT) XCODE32_DIR=$(XCODE94_DEVELOPER_ROOT) \
XCODE_DIR=$(XCODE_DEVELOPER_ROOT) \
IOS_VERSION=$(IOS_SDK_VERSION) IOS_VERSION_MIN=$(MIN_IOS_SDK_VERSION) \
TVOS_VERSION=$(TVOS_SDK_VERSION) TVOS_VERSION_MIN=$(MIN_TVOS_SDK_VERSION) \
WATCHOS_VERSION=$(WATCH_SDK_VERSION) WATCHOS_VERSION_MIN=$(MIN_WATCHOS_SDK_VERSION) \
Expand Down
2 changes: 1 addition & 1 deletion mk/mono.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEEDED_MONO_VERSION := 29b1ac19c961b959a09097dbc0fe4cd567cc5298
NEEDED_MONO_VERSION := 70d690305348cb30cf620db0679ba1173dc7adb0
NEEDED_MONO_BRANCH := 2019-08

MONO_DIRECTORY := mono
Expand Down
16 changes: 7 additions & 9 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ MAC_ARCHITECTURES = x86_64

CLANG_ARCH = $(addprefix -arch ,$(MAC_ARCHITECTURES))
MAC_CLANG = DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) $(MAC_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION)
MAC32_CLANG = DEVELOPER_DIR=$(XCODE94_DEVELOPER_ROOT) $(MAC32_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION)
MAC64_CLANG = DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) $(MAC_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION)

MAC_SHIPPED_HEADERS = xamarin/launch.h

Expand Down Expand Up @@ -469,25 +467,25 @@ STATIC_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basena
SYSTEM_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).system.$(1).o)

.libs/mac/%$(3).dylib.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_OBJC_CFLAGS) $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$<
$$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_OBJC_CFLAGS) $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$<

.libs/mac/%$(3).dylib.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$<
$$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$<

.libs/mac/%$(3).static.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$<
$$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$<

.libs/mac/%$(3).static.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$<
$$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$<

.libs/mac/%$(3).system.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$<
$$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$<

.libs/mac/%$(3).system.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac
$$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$<
$$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$<

.libs/mac/libxammac$(3).$(1).dylib: $$(DYNAMIC_DYLIB$(2)_OBJECTS)
$$(call Q_2,LD, [mac]) $(MAC$(5)_CLANG) -arch $(1) -dynamiclib $$(MAC_LDFLAGS) -Wl,-install_name,libxammac$(3).dylib -o $$@ $$^ $$(addprefix -Xlinker -U -Xlinker ,$$(ALLOWED_UNDEFINED_SYMBOLS))
$$(call Q_2,LD, [mac]) $(MAC_CLANG) -arch $(1) -dynamiclib $$(MAC_LDFLAGS) -Wl,-install_name,libxammac$(3).dylib -o $$@ $$^ $$(addprefix -Xlinker -U -Xlinker ,$$(ALLOWED_UNDEFINED_SYMBOLS))

.libs/mac/libxammac$(3).$(1).a: $$(STATIC_LAUNCHER$(2)_OBJECTS)
$$(call Q_2,LIB, [mac]) xcrun libtool -no_warning_for_no_symbols -static -o $$@ $$^
Expand Down
5 changes: 0 additions & 5 deletions system-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,6 @@ function check_xcode () {
# must have latest Xcode in /Applications/Xcode<version>.app
check_specific_xcode
install_coresimulator
# Xcode 9,4 does not longer start on catalina
local current_os=$(sw_vers -productVersion)
if test $current_os != "10.15"; then
check_specific_xcode "94"
fi

local XCODE_DEVELOPER_ROOT=`grep ^XCODE_DEVELOPER_ROOT= Make.config | sed 's/.*=//'`
local IOS_SDK_VERSION=`grep ^IOS_SDK_VERSION= Make.config | sed 's/.*=//'`
Expand Down
2 changes: 1 addition & 1 deletion tests/common/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public static string SourceRoot {
// might need tweaking.
if (mt_src_root == null)
#if MONOMAC
mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../.."));
mt_src_root = RootPath;
#else
mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../../.."));
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/common/ProductTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach
foreach (var machoFile in machoFiles) {
var fatfile = MachO.Read (machoFile);
foreach (var slice in fatfile) {
if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */)
if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent != null && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */)
continue;
var any_load_command = false;
foreach (var lc in slice.load_commands) {
Expand Down
3 changes: 3 additions & 0 deletions tests/mmptest/mmptest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
<Link>SdkVersions.cs</Link>
</Compile>
<Compile Include="src\TargetFrameworkMutateTests.cs" />
<Compile Include="..\..\tools\common\MachO.cs">
<Link>MachO.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
Expand Down
16 changes: 13 additions & 3 deletions tests/mmptest/src/CodeStrippingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using NUnit.Framework;

using Xamarin.Utils;
using Xamarin.Tests;

namespace Xamarin.MMP.Tests
{
Expand Down Expand Up @@ -59,6 +60,10 @@ void StripTestCore (TI.UnifiedTestConfig test, bool debugStrips, bool releaseStr
[TestCase (false, false, false)]
public void ShouldStripMonoPosixHelper (bool? strip, bool debugStrips, bool releaseStrips)
{
var posixHelper = Path.Combine (Configuration.SdkRootXM, "lib", "libMonoPosixHelper.dylib");
if (Xamarin.MachO.GetArchitectures (posixHelper).Count < 2)
Assert.Ignore ($"libMonoPosixHelper.dylib is not a fat library.");

MMPTests.RunMMPTest (tmpDir =>
{
TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir);
Expand Down Expand Up @@ -90,16 +95,21 @@ public void ExplictStripOption_ThirdPartyLibrary_AndWarnsIfSo (bool? strip, bool
{
MMPTests.RunMMPTest (tmpDir =>
{
string originalLocation = Path.Combine (TI.FindRootDirectory (), MonoPosixOffset);
string originalLocation = Path.Combine (Configuration.SourceRoot, "tests", "test-libraries", "libtest-fat.macos.dylib");
string newLibraryLocation = Path.Combine (tmpDir, "libTest.dylib");
File.Copy (originalLocation, newLibraryLocation);

TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir, $" --native-reference=\"{newLibraryLocation}\"");
test.Release = true;

string buildOutput = TI.TestUnifiedExecutable (test).BuildOutput;
var testOutput = TI.TestUnifiedExecutable (test);
string buildOutput = testOutput.BuildOutput;
Assert.AreEqual (shouldStrip, DidAnyLipoStrip (buildOutput), "lipo usage did not match expectations");
Assert.AreEqual (shouldStrip, buildOutput.Contains ("MM2108"), "Warning did not match expectations");
if (shouldStrip) {
testOutput.Messages.AssertWarning (2108, "libTest.dylib was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures");
} else {
testOutput.Messages.AssertWarningCount (0);
}
});
}

Expand Down
Binary file added tests/test-libraries/libtest-fat.macos.dylib
Binary file not shown.
15 changes: 12 additions & 3 deletions tools/common/MachO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,19 @@ public static IEnumerable<MachOFile> Read (string filename)
}
} else {
var mf = file as MachOFile;
if (mf != null)
if (mf != null) {
yield return mf;
else
throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename);
yield break;
}

var sl = file as StaticLibrary;
if (sl != null) {
foreach (var obj in sl.ObjectFiles)
yield return obj;
yield break;
}

throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename);
}
}

Expand Down