|
51 | 51 | 'buildusandboo=i'=>\$buildUsAndBoo,
|
52 | 52 | );
|
53 | 53 |
|
| 54 | +my $monoArch32Target = "i386"; |
| 55 | + |
| 56 | +print(">>> Building $monoArch32Target\n"); |
| 57 | +system("perl", "$buildscriptsdir/build.pl", "--arch32=1", "--clean=1", "--classlibtests=0", @passAlongArgs) eq 0 or die ("failing building $monoArch32Target"); |
| 58 | + |
54 | 59 | if ($artifactsCommon)
|
55 | 60 | {
|
56 | 61 | push @passAlongArgs, "--artifactscommon=1";
|
|
66 | 71 |
|
67 | 72 | if ($artifact)
|
68 | 73 | {
|
69 |
| - print(">>> Copying libMonoPosixHelper.dylib to lib directory\n"); |
| 74 | + print(">>> Creating universal binaries\n"); |
| 75 | + # Merge stuff in the embedruntimes directory |
| 76 | + my $embedDirRoot = "$buildsroot/embedruntimes"; |
| 77 | + my $embedDirDestination = "$embedDirRoot/osx"; |
| 78 | + my $embedDirSource32 = "$embedDirRoot/osx-tmp-$monoArch32Target"; |
| 79 | + my $embedDirSource64 = "$embedDirRoot/osx-tmp-x86_64"; |
| 80 | + |
| 81 | + system("mkdir -p $embedDirDestination"); |
| 82 | + |
| 83 | + if (!(-d $embedDirSource32)) |
| 84 | + { |
| 85 | + die("Expected source directory not found : $embedDirSource32\n"); |
| 86 | + } |
| 87 | + |
| 88 | + if (!(-d $embedDirSource64)) |
| 89 | + { |
| 90 | + die("Expected source directory not found : $embedDirSource64\n"); |
| 91 | + } |
| 92 | + |
| 93 | + # Create universal binaries |
| 94 | + for my $file ('libmonobdwgc-2.0.dylib','libmonosgen-2.0.dylib','libMonoPosixHelper.dylib') |
| 95 | + { |
| 96 | + print(">>> lipo $embedDirSource32/$file $embedDirSource64/$file -create -output $embedDirDestination/$file\n\n"); |
| 97 | + system ('lipo', "$embedDirSource32/$file", "$embedDirSource64/$file", '-create', '-output', "$embedDirDestination/$file"); |
| 98 | + } |
| 99 | + |
| 100 | + if (not $buildMachine) |
| 101 | + { |
| 102 | + print(">>> Doing non-build machine stuff...\n"); |
| 103 | + for my $file ('libmonobdwgc-2.0.dylib','libmonosgen-2.0.dylib','libMonoPosixHelper.dylib') |
| 104 | + { |
| 105 | + print(">>> Removing $embedDirDestination/$file.dSYM\n"); |
| 106 | + rmtree ("$embedDirDestination/$file.dSYM"); |
| 107 | + print(">>> 'dsymutil $embedDirDestination/$file\n"); |
| 108 | + system ('dsymutil', "$embedDirDestination/$file") eq 0 or warn ("Failed creating $embedDirDestination/$file.dSYM"); |
| 109 | + } |
| 110 | + |
| 111 | + print(">>> Done with non-build machine stuff\n"); |
| 112 | + } |
| 113 | + |
| 114 | + # Merge stuff in the monodistribution directory |
| 115 | + my $distDirRoot = "$buildsroot/monodistribution"; |
| 116 | + my $distDirDestinationBin = "$buildsroot/monodistribution/bin"; |
| 117 | + my $distDirDestinationLib = "$buildsroot/monodistribution/lib"; |
| 118 | + my $distDirSourceBin32 = "$distDirRoot/bin-osx-tmp-$monoArch32Target"; |
| 119 | + my $distDirSourceBin64 = "$distDirRoot/bin-osx-tmp-x86_64"; |
70 | 120 |
|
71 |
| - my $libDir = "$buildsroot/monodistribution/lib"; |
72 |
| - if (!(-d $libDir)) |
| 121 | + # Should always exist because build_all would have put stuff in it, but in some situations |
| 122 | + # depending on the options it may not. So create it if it does not exist |
| 123 | + if (!(-d $distDirDestinationBin)) |
73 | 124 | {
|
74 |
| - system("mkdir -p $libDir"); |
| 125 | + system("mkdir -p $distDirDestinationBin"); |
75 | 126 | }
|
76 | 127 |
|
77 |
| - system("cp","$buildsroot/embedruntimes/osx/libMonoPosixHelper.dylib", "$libDir/") |
| 128 | + if (!(-d $distDirDestinationLib)) |
| 129 | + { |
| 130 | + system("mkdir -p $distDirDestinationLib"); |
| 131 | + } |
| 132 | + |
| 133 | + if (!(-d $distDirSourceBin32)) |
| 134 | + { |
| 135 | + die("Expected source directory not found : $distDirSourceBin32\n"); |
| 136 | + } |
| 137 | + |
| 138 | + if (!(-d $distDirSourceBin64)) |
| 139 | + { |
| 140 | + die("Expected source directory not found : $distDirSourceBin64\n"); |
| 141 | + } |
| 142 | + |
| 143 | + for my $file ('mono','pedump') |
| 144 | + { |
| 145 | + print(">>> lipo $distDirSourceBin32/$file $distDirSourceBin64/$file -create -output $distDirDestinationBin/$file\n\n"); |
| 146 | + system ('lipo', "$distDirSourceBin32/$file", "$distDirSourceBin64/$file", '-create', '-output', "$distDirDestinationBin/$file"); |
| 147 | + } |
| 148 | + |
| 149 | + #Create universal binaries for stuff is in the embed dir but will end up in the dist dir |
| 150 | + for my $file ('libMonoPosixHelper.dylib') |
| 151 | + { |
| 152 | + print(">>> lipo $embedDirSource32/$file $embedDirSource64/$file -create -output $distDirDestinationLib/$file\n\n"); |
| 153 | + system ('lipo', "$embedDirSource32/$file", "$embedDirSource64/$file", '-create', '-output', "$distDirDestinationLib/$file"); |
| 154 | + } |
| 155 | + |
| 156 | + if ($buildMachine) |
| 157 | + { |
| 158 | + print(">>> Clean up temporary arch specific build directories\n"); |
| 159 | + |
| 160 | + rmtree("$distDirSourceBin32"); |
| 161 | + rmtree("$distDirSourceBin64"); |
| 162 | + rmtree("$embedDirSource32"); |
| 163 | + rmtree("$embedDirSource64"); |
| 164 | + } |
78 | 165 | }
|
0 commit comments