bug 1163828 - build system changes to support building for iOS. r=glandium
authorTed Mielczarek <ted@mielczarek.org>
Wed, 10 Jun 2015 11:10:40 -0400
changeset 281110 6f894e0e33adda8bc3ed35b3653f29bd4230ee65
parent 281109 986edcc945241f9d2a2244a1f747c557afbedd3c
child 281111 2cb85653aa6f7de8db6c9128cecf9bff601ea5ca
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1163828
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1163828 - build system changes to support building for iOS. r=glandium
aclocal.m4
build/autoconf/arch.m4
build/autoconf/ios.m4
config/rules.mk
configure.in
js/src/configure.in
toolkit/library/moz.build
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -29,16 +29,17 @@ builtin(include, build/autoconf/android.
 builtin(include, build/autoconf/zlib.m4)dnl
 builtin(include, build/autoconf/linux.m4)dnl
 builtin(include, build/autoconf/python-virtualenv.m4)dnl
 builtin(include, build/autoconf/winsdk.m4)dnl
 builtin(include, build/autoconf/icu.m4)dnl
 builtin(include, build/autoconf/ffi.m4)dnl
 builtin(include, build/autoconf/clang-plugin.m4)dnl
 builtin(include, build/autoconf/alloc.m4)dnl
+builtin(include, build/autoconf/ios.m4)dnl
 
 MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
 # configure.in: autoconf puts the argument parsing code above anything
 # expanded from configure.in, and we need to get the configure options
 # from .mozconfig in place before that argument parsing code.
 MOZ_READ_MOZCONFIG(.)
--- a/build/autoconf/arch.m4
+++ b/build/autoconf/arch.m4
@@ -32,17 +32,16 @@ if test -z "$MOZ_ARCH"; then
         MOZ_THUMB=yes
         MOZ_ARCH=armv7-a
         MOZ_FPU=vfp
         MOZ_FLOAT_ABI=softfp
         MOZ_ALIGN=no
         ;;
     arm-Darwin)
         MOZ_ARCH=toolchain-default
-        MOZ_THUMB=yes
         ;;
     esac
 fi
 
 if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
    MOZ_FPU=vfp
 fi
 
new file mode 100644
--- /dev/null
+++ b/build/autoconf/ios.m4
@@ -0,0 +1,108 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_IOS_PATH_PROG],
+[
+changequote({,})
+_prog_name=ifelse($2, {}, `echo $1 | tr "[:upper:]" "[:lower:]"`, $2)
+changequote([,])
+AC_CACHE_CHECK([for $_prog_name in iOS SDK],
+ac_cv_ios_path_$1,
+[
+_path=`xcrun --sdk $ios_sdk --find $_prog_name 2>/dev/null`
+_res=$?
+if test $_res -ne 0; then
+   AC_MSG_ERROR([Could not find '$_prog_name' in the iOS SDK])
+fi
+ac_cv_ios_path_$1=$_path
+])
+$1="${ac_cv_ios_path_$1}$3"
+])
+
+AC_DEFUN([MOZ_IOS_SDK],
+[
+
+MOZ_ARG_WITH_STRING(ios-sdk,
+[  --with-ios-sdk=TYPE
+                          Type of iOS SDK to use (iphonesimulator, iphoneos)
+                          and optionally version (like iphoneos8.2)],
+    ios_sdk=$withval)
+
+MOZ_ARG_ENABLE_STRING(ios-target,
+                      [  --enable-ios-target=VER (default=8.0)
+                          Set the minimum iOS version needed at runtime],
+                      [_IOS_TARGET=$enableval])
+_IOS_TARGET_DEFAULT=8.0
+
+case "$target" in
+arm*-apple-darwin*)
+    if test -z "$ios_sdk" -o "$ios_sdk" = "yes"; then
+       ios_sdk=iphoneos
+    fi
+    case "$ios_sdk" in
+         iphoneos*)
+                ios_target_arg="-miphoneos-version-min"
+                ;;
+         *)
+                AC_MSG_ERROR([Only 'iphoneos' SDKs are valid when targeting iOS device, don't know what to do with '$ios_sdk'.])
+                ;;
+    esac
+    ;;
+*-apple-darwin*)
+    ios_target_arg="-mios-simulator-version-min"
+    case "$ios_sdk" in
+         # Empty SDK is okay, this might be an OS X desktop build.
+         ""|iphonesimulator*)
+                ;;
+         # Default to iphonesimulator
+         yes)
+                ios_sdk=iphonesimulator
+                ;;
+         *)
+                AC_MSG_ERROR([Only 'iphonesimulator' SDKs are valid when targeting iOS simulator.])
+                ;;
+    esac
+    ;;
+esac
+
+
+if test -n "$ios_sdk"; then
+   if test -z "$_IOS_TARGET"; then
+      _IOS_TARGET=$_IOS_TARGET_DEFAULT
+      ios_target_arg="${ios_target_arg}=${_IOS_TARGET}"
+   fi
+   # Ensure that xcrun knows where this SDK is.
+   ios_sdk_path=`xcrun --sdk $ios_sdk --show-sdk-path 2>/dev/null`
+   _ret=$?
+   if test $_ret -ne 0; then
+      AC_MSG_ERROR([iOS SDK '$ios_sdk' could not be found.])
+   fi
+   MOZ_IOS=1
+   export HOST_CC=clang
+   export HOST_CXX=clang++
+   # Add isysroot, arch, and ios target arguments
+   case "$target_cpu" in
+        arm*)
+                ARGS="-arch armv7"
+                ;;
+        *)
+                # Unfortunately simulator builds need this.
+                export CROSS_COMPILE=1
+                ;;
+   esac
+   ARGS=" $ARGS -isysroot $ios_sdk_path $ios_target_arg"
+   # Now find our tools
+   MOZ_IOS_PATH_PROG(CC, clang, $ARGS)
+   MOZ_IOS_PATH_PROG(CXX, clang++, $ARGS)
+   export CPP="$CC -E"
+   export LD="$CXX"
+   MOZ_IOS_PATH_PROG(AR)
+   MOZ_IOS_PATH_PROG(AS, as, $ARGS)
+   MOZ_IOS_PATH_PROG(OTOOL)
+   MOZ_IOS_PATH_PROG(STRIP)
+   export PKG_CONFIG_PATH=${ios_sdk_path}/usr/lib/pkgconfig/
+fi
+
+AC_SUBST(MOZ_IOS)
+])
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -209,16 +209,22 @@ ifdef DEFFILE
 OS_LDFLAGS += $(call normalizepath,$(DEFFILE))
 EXTRA_DEPS += $(DEFFILE)
 endif
 
 endif # !GNU_CC
 
 endif # WINNT
 
+ifeq (arm-Darwin,$(CPU_ARCH)-$(OS_TARGET))
+ifdef PROGRAM
+MOZ_PROGRAM_LDFLAGS += -Wl,-rpath -Wl,@executable_path/Frameworks
+endif
+endif
+
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 ifeq (86,$(findstring 86,$(OS_TEST)))
 OS_LDFLAGS += -M $(MOZILLA_DIR)/config/solaris_ia32.map
 endif # x86
 endif # Solaris Sun Studio C++
 
 ifeq ($(HOST_OS_ARCH),WINNT)
 HOST_PDBFILE=$(basename $(@F)).pdb
@@ -385,17 +391,22 @@ endif # IS_COMPONENT
 # MacOS X specific stuff
 #
 
 ifeq ($(OS_ARCH),Darwin)
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 EXTRA_DSO_LDOPTS	+= -bundle
 else
-EXTRA_DSO_LDOPTS	+= -dynamiclib -install_name @executable_path/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
+ifdef MOZ_IOS
+_LOADER_PATH := @rpath
+else
+_LOADER_PATH := @executable_path
+endif
+EXTRA_DSO_LDOPTS	+= -dynamiclib -install_name $(_LOADER_PATH)/$(SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
 endif
 endif
 endif
 
 #
 # On NetBSD a.out systems, use -Bsymbolic.  This fixes what would otherwise be
 # fatal symbol name clashes between components.
 #
--- a/configure.in
+++ b/configure.in
@@ -333,16 +333,22 @@ else
         ZLIB_DIR=yes
         ;;
     *-linux*)
         AC_PATH_PROG(OBJCOPY,objcopy)
         ;;
     esac
 fi
 
+case "$target" in
+*-apple-darwin*)
+    MOZ_IOS_SDK
+    ;;
+esac
+
 AC_SUBST(ANDROID_SOURCE)
 AC_SUBST(ANDROID_PACKAGE_NAME)
 AC_SUBST(OBJCOPY)
 
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 
@@ -1813,17 +1819,22 @@ Android)
     ;;
 Linux)
     case "${CPU_ARCH}" in
     x86 | x86_64) ;;
     *)
         MOZ_ENABLE_PROFILER_SPS=
     esac
     ;;
-WINNT|Darwin) ;;
+WINNT) ;;
+Darwin)
+    if test -n "$MOZ_IOS"; then
+        MOZ_ENABLE_PROFILER_SPS=
+    fi
+    ;;
 *)
     MOZ_ENABLE_PROFILER_SPS=
     ;;
 esac
 
 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
     AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
 fi
@@ -2031,27 +2042,30 @@ case "$target" in
     MOZ_OPTIMIZE_FLAGS="-O3"
     # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
     if test "$HAVE_64BIT_BUILD"; then
         MOZ_MEMORY=1
     fi
     DLL_SUFFIX=".dylib"
     DSO_LDOPTS=''
     STRIP_FLAGS="$STRIP_FLAGS -x -S"
-    # Check whether we're targeting OS X or iOS
+    # Ensure that if we're targeting iOS an SDK was provided.
     AC_CACHE_CHECK(for iOS target,
                    ac_cv_ios_target,
                    [AC_TRY_COMPILE([#include <TargetConditionals.h>
 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
 #error not iOS
 #endif],
                                    [],
                                    ac_cv_ios_target="yes",
                                    ac_cv_ios_target="no")])
-    if test "$ac_cv_ios_target" = "yes"; then
+    if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
+       AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
+    fi
+    if test -n "$MOZ_IOS"; then
         AC_DEFINE(XP_IOS)
         AC_DEFINE(XP_DARWIN)
         _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
     else
         AC_DEFINE(XP_MACOSX)
         AC_DEFINE(XP_DARWIN)
         _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
         # The ExceptionHandling framework is needed for Objective-C exception
@@ -3806,16 +3820,19 @@ MOZ_ARG_HEADER(Application)
 
 ENABLE_TESTS=1
 ENABLE_SYSTEM_EXTENSION_DIRS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_FEEDS=1
 MOZ_WEBAPP_RUNTIME=
 MOZ_AUTH_EXTENSION=1
+if test "$MOZ_IOS"; then
+   MOZ_AUTH_EXTENSION=
+fi
 MOZ_RAW=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
 MOZ_WEBM=1
 MOZ_GSTREAMER=
@@ -3863,16 +3880,19 @@ MOZ_SPELLCHECK=1
 MOZ_ANDROID_APZ=
 MOZ_TOOLKIT_SEARCH=1
 MOZ_UI_LOCALE=en-US
 MOZ_UNIVERSALCHARDET=1
 MOZ_URL_CLASSIFIER=
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 NS_PRINTING=1
+if test "$MOZ_IOS"; then
+   NS_PRINTING=
+fi
 MOZ_PDF_PRINTING=
 MOZ_NO_SMART_CARDS=
 NSS_DISABLE_DBM=
 NECKO_COOKIES=1
 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
 if test -n "$MOZ_RTSP"; then
   NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
 fi
@@ -4311,25 +4331,28 @@ cairo-cocoa)
     # Use -Wl as a trick to avoid -framework and framework names from
     # being separated by AC_SUBST_LIST.
     TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL'
     TK_CFLAGS="-DNO_X11"
     CFLAGS="$CFLAGS $TK_CFLAGS"
     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
     MOZ_USER_DIR="Mozilla"
     MOZ_FS_LAYOUT=bundle
-    MOZ_INSTRUMENT_EVENT_LOOP=1
+    # skip event loop instrumentation on UIKit for now
+    if test "$MOZ_WIDGET_TOOLKIT" == "cocoa"; then
+      MOZ_INSTRUMENT_EVENT_LOOP=1
+    fi
     ;;
 
 cairo-uikit)
     MOZ_WIDGET_TOOLKIT=uikit
     AC_DEFINE(MOZ_WIDGET_UIKIT)
     LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
     TK_CFLAGS="-DNO_X11"
-    TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
+    TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
     CFLAGS="$CFLAGS $TK_CFLAGS"
     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
     MOZ_USER_DIR="Mozilla"
     MOZ_FS_LAYOUT=bundle
     ;;
 
 cairo-android)
     AC_DEFINE(MOZ_WIDGET_ANDROID)
@@ -4443,16 +4466,20 @@ AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION
 dnl ========================================================
 dnl Disable printing
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(printing,
 [  --disable-printing      Disable printing support],
     NS_PRINTING=,
     NS_PRINTING=1)
 
+if test -n "$MOZ_IOS" -a -n "$NS_PRINTING"; then
+   AC_MSG_ERROR([Printing is not supported on iOS.])
+fi
+
 if test "$NS_PRINTING"; then
     AC_DEFINE(NS_PRINTING)
     AC_DEFINE(NS_PRINT_PREVIEW)
 fi
 
 dnl ========================================================
 dnl = QT support
 dnl ========================================================
@@ -5743,21 +5770,26 @@ if test -n "$MOZ_B2G"; then
         AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
     fi
 fi
 AC_SUBST(MOZ_CHILD_PERMISSIONS)
 
 dnl ========================================================
 dnl NegotiateAuth
 dnl ========================================================
+
 MOZ_ARG_DISABLE_BOOL(negotiateauth,
 [  --disable-negotiateauth Disable GSS-API negotiation ],
     MOZ_AUTH_EXTENSION=,
     MOZ_AUTH_EXTENSION=1 )
 
+if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
+   AC_MSG_ERROR([negotiateauth is not supported on iOS.])
+fi
+
 dnl ========================================================
 dnl Pref extensions (autoconfig)
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(pref-extensions,
 [  --disable-pref-extensions
                           Disable pref extensions such as autoconfig],
   MOZ_PREF_EXTENSIONS=,
   MOZ_PREF_EXTENSIONS=1 )
@@ -6023,19 +6055,24 @@ fi
 dnl ========================================================
 dnl Gamepad support
 dnl ========================================================
 MOZ_GAMEPAD=
 MOZ_GAMEPAD_BACKEND=stub
 
 # Gamepad DOM is built on supported platforms by default.
 case "$OS_TARGET" in
-     Darwin|WINNT|Linux)
+     WINNT|Linux)
        MOZ_GAMEPAD=1
        ;;
+     Darwin)
+       if test -z "$MOZ_IOS"; then
+         MOZ_GAMEPAD=1
+       fi
+       ;;
      Android)
        if test "$MOZ_WIDGET_TOOLKIT" != "gonk"; then
          MOZ_GAMEPAD=1
        fi
        ;;
      *)
        ;;
 esac
@@ -6043,17 +6080,19 @@ esac
 MOZ_ARG_DISABLE_BOOL(gamepad,
 [  --disable-gamepad   Disable gamepad support],
     MOZ_GAMEPAD=,
     MOZ_GAMEPAD=1)
 
 if test "$MOZ_GAMEPAD"; then
     case "$OS_TARGET" in
     Darwin)
-        MOZ_GAMEPAD_BACKEND=cocoa
+        if test -z "$MOZ_IOS"; then
+            MOZ_GAMEPAD_BACKEND=cocoa
+        fi
         ;;
     WINNT)
         MOZ_GAMEPAD_BACKEND=windows
         ;;
     Linux)
         MOZ_CHECK_HEADER([linux/joystick.h])
         if test "$ac_cv_header_linux_joystick_h" != "yes"; then
           AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
@@ -6076,17 +6115,19 @@ dnl ====================================
 dnl = Breakpad crash reporting (on by default on supported platforms)
 dnl ========================================================
 
 case $target in
 i?86-*-mingw*|x86_64-*-mingw*)
   MOZ_CRASHREPORTER=1
   ;;
 i?86-apple-darwin*|x86_64-apple-darwin*)
-  MOZ_CRASHREPORTER=1
+  if test -z "$MOZ_IOS"; then
+    MOZ_CRASHREPORTER=1
+  fi
   ;;
 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
   if test "$MOZ_ENABLE_GTK"; then
     MOZ_CRASHREPORTER=1
   fi
   ;;
 *-android*|*-linuxandroid*)
   MOZ_CRASHREPORTER=1
@@ -6160,16 +6201,18 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
   dnl Do we support libjpeg-turbo on this platform?
   case "$OS_ARCH:$CPU_ARCH" in
   Darwin:x86)
     LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
   ;;
   Darwin:x86_64)
     LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
   ;;
+  Darwin:arm*)
+  ;;
   WINNT:x86)
     LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
   ;;
   WINNT:x86_64)
     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
   ;;
   *:arm)
     LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
@@ -6450,16 +6493,20 @@ MOZ_ARG_ENABLE_BOOL(signmar,
 if test -n "$MOZ_ENABLE_SIGNMAR"; then
   AC_DEFINE(MOZ_ENABLE_SIGNMAR)
 fi
 
 dnl ========================================================
 dnl Updater
 dnl ========================================================
 
+if test "$MOZ_IOS"; then
+  MOZ_UPDATER=
+fi
+
 MOZ_ARG_DISABLE_BOOL(updater,
 [  --disable-updater       Disable building of updater],
     MOZ_UPDATER=,
     MOZ_UPDATER=1 )
 
 if test -n "$MOZ_UPDATER"; then
     AC_DEFINE(MOZ_UPDATER)
 fi
@@ -8317,17 +8364,22 @@ dnl option to disable necko's wifi scann
 dnl
 
 case "$OS_TARGET" in
   Android)
     if test -n "$gonkdir"; then
       NECKO_WIFI=1
     fi
     ;;
-  Darwin|DragonFly|FreeBSD|SunOS|WINNT)
+  Darwin)
+    if test -z "$MOZ_IOS"; then
+      NECKO_WIFI=1
+    fi
+    ;;
+  DragonFly|FreeBSD|SunOS|WINNT)
     NECKO_WIFI=1
     ;;
   Linux)
     NECKO_WIFI=1
     NECKO_WIFI_DBUS=1
     ;;
 esac
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -233,16 +233,22 @@ if test -n "$gonkdir" ; then
     fi
 
     AC_DEFINE(ANDROID)
     AC_DEFINE(GONK)
 else
     MOZ_ANDROID_NDK
 fi
 
+case "$target" in
+*-apple-darwin*)
+    MOZ_IOS_SDK
+    ;;
+esac
+
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 
 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
 AR_FLAGS='crs $@'
 
 if test "$COMPILE_ENVIRONMENT"; then
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -1,17 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 @template
 def Libxul(name):
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
         # This is going to be a framework named "XUL", not an ordinary library named
         # "libxul.dylib"
         GeckoFramework(name, linkage=None)
         SHARED_LIBRARY_NAME = 'XUL'
     else:
         GeckoSharedLibrary(name, linkage=None)
         SHARED_LIBRARY_NAME = 'xul'
 
@@ -265,17 +265,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
 
 if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
     OS_LIBS += [
         'stagefright_foundation',
     ]
 
 OS_LIBS += CONFIG['ICONV_LIBS']
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
     OS_LIBS += CONFIG['TK_LIBS']
 
 if CONFIG['OS_ARCH'] == 'OpenBSD':
     OS_LIBS += [
         'sndio',
     ]
 
 if CONFIG['MOZ_ENABLE_DBUS']: