Bug 1257051 - Use separate target triplets for iOS and OSX. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Mar 2016 08:23:31 +0900
changeset 316067 bea1d2b7531368d5b3a5228b430c3caa685a43d1
parent 316064 186064e556caa51a3cb804e43ff7356b36e3e2f2
child 316068 f11a8d6f09553d1edf8a7f96099cd237fa18dc46
push idunknown
push userunknown
push dateunknown
reviewersted
bugs1257051
milestone48.0a1
Bug 1257051 - Use separate target triplets for iOS and OSX. r=ted This aligns with the triplets used by clang/llvm. Technically, this won't break iOS builds still using -darwin triplets until we move MOZ_IOS_SDK to moz.configure and actively reject non iOS targets with the iOS sdk. Also allow to distinguish iOS and OSX with target.os.
build/moz.configure/init.configure
moz.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -355,17 +355,21 @@ def split_triplet(triplet):
     elif os.startswith('kfreebsd') and os.endswith('-gnu'):
         canonical_os = 'GNU'
         canonical_kernel = 'kFreeBSD'
     elif os.startswith('gnu'):
         canonical_os = canonical_kernel = 'GNU'
     elif os.startswith('mingw'):
         canonical_os = canonical_kernel = 'WINNT'
     elif os.startswith('darwin'):
-        canonical_os = canonical_kernel = 'Darwin'
+        canonical_kernel = 'Darwin'
+        canonical_os = 'OSX'
+    elif os.startswith('ios'):
+        canonical_kernel = 'Darwin'
+        canonical_os = 'iOS'
     elif os.startswith('dragonfly'):
         canonical_os = canonical_kernel = 'DragonFly'
     elif os.startswith('freebsd'):
         canonical_os = canonical_kernel = 'FreeBSD'
     elif os.startswith('netbsd'):
         canonical_os = canonical_kernel = 'NetBSD'
     elif os.startswith('openbsd'):
         canonical_os = canonical_kernel = 'OpenBSD'
@@ -429,27 +433,34 @@ def target(value, host):
         return host
     return split_triplet(value[0])
 
 
 @depends(host, target)
 def host_and_target_for_old_configure(host, target):
     # Autoconf needs these set
     add_old_configure_arg('--host=%s' % host.alias)
-    add_old_configure_arg('--target=%s' % target.alias)
+
+    target_alias = target.alias
+    # old-configure does plenty of tests against $target and $target_os
+    # and expects darwin for iOS, so make it happy.
+    if target.os == 'iOS':
+        target_alias = target_alias.replace('-ios', '-darwin')
+    add_old_configure_arg('--target=%s' % target_alias)
 
 
 # These variables are for compatibility with the current moz.builds and
 # old-configure. Eventually, we'll want to canonicalize better.
 @depends(target)
 def target_variables(target):
     if target.kernel == 'kFreeBSD':
         os_target = 'GNU/kFreeBSD'
         os_arch = 'GNU_kFreeBSD'
-    elif target.kernel == 'Linux' and target.os == 'GNU':
+    elif target.kernel == 'Darwin' or (target.kernel == 'Linux' and
+                                       target.os == 'GNU'):
         os_target = target.kernel
         os_arch = target.kernel
     else:
         os_target = target.os
         os_arch = target.kernel
     add_old_configure_assignment('OS_TARGET', os_target)
     set_config('OS_TARGET', os_target)
     add_old_configure_assignment('OS_ARCH', os_arch)
--- a/moz.configure
+++ b/moz.configure
@@ -116,17 +116,17 @@ perl_version_check('5.006')
 check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
 check_prog('TAR', ('gnutar', 'gtar', 'tar'))
 check_prog('UNZIP', ('unzip',))
 check_prog('XARGS', ('xargs',))
 check_prog('ZIP', ('zip',))
 
 @depends(target)
 def mac_programs(target):
-    if target.os == 'Darwin':
+    if target.kernel == 'Darwin':
         check_prog('DSYMUTIL', ('dsymutil', 'llvm-dsymutil'), allow_missing=True)
         check_prog('GENISOIMAGE', ('genisoimage',), allow_missing=True)
 
 @depends(target)
 def linux_programs(target):
     if target.os == 'GNU' and target.kernel == 'Linux':
         check_prog('RPMBUILD', ('rpmbuild',), allow_missing=True)