bug 1163828 - build system changes to support building for iOS. r=glandium

--HG--
extra : commitid : EAxgCmmuwAx
extra : rebase_source : 854a55e62573e59e042a326d62450fa3fbf2db18
This commit is contained in:
Ted Mielczarek 2015-06-10 11:10:40 -04:00
Родитель 7916ef866c
Коммит f6af9a3909
7 изменённых файлов: 190 добавлений и 13 удалений

1
aclocal.m4 поставляемый
Просмотреть файл

@ -34,6 +34,7 @@ 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()

Просмотреть файл

@ -37,7 +37,6 @@ if test -z "$MOZ_ARCH"; then
;;
arm-Darwin)
MOZ_ARCH=toolchain-default
MOZ_THUMB=yes
;;
esac
fi

108
build/autoconf/ios.m4 Normal file
Просмотреть файл

@ -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)
])

Просмотреть файл

@ -214,6 +214,12 @@ 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
@ -390,7 +396,12 @@ 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

Просмотреть файл

@ -338,6 +338,12 @@ else
esac
fi
case "$target" in
*-apple-darwin*)
MOZ_IOS_SDK
;;
esac
AC_SUBST(ANDROID_SOURCE)
AC_SUBST(ANDROID_PACKAGE_NAME)
AC_SUBST(OBJCOPY)
@ -1818,7 +1824,12 @@ Linux)
MOZ_ENABLE_PROFILER_SPS=
esac
;;
WINNT|Darwin) ;;
WINNT) ;;
Darwin)
if test -n "$MOZ_IOS"; then
MOZ_ENABLE_PROFILER_SPS=
fi
;;
*)
MOZ_ENABLE_PROFILER_SPS=
;;
@ -2036,7 +2047,7 @@ case "$target" in
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>
@ -2046,7 +2057,10 @@ case "$target" in
[],
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'
@ -3811,6 +3825,9 @@ 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=
@ -3868,6 +3885,9 @@ 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=
@ -4316,7 +4336,10 @@ cairo-cocoa)
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)
@ -4324,7 +4347,7 @@ cairo-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"
@ -4448,6 +4471,10 @@ MOZ_ARG_DISABLE_BOOL(printing,
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)
@ -5748,11 +5775,16 @@ 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 ========================================================
@ -6028,9 +6060,14 @@ 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
@ -6048,7 +6085,9 @@ MOZ_ARG_DISABLE_BOOL(gamepad,
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
@ -6081,7 +6120,9 @@ 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
@ -6165,6 +6206,8 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
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"
;;
@ -6455,6 +6498,10 @@ 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=,
@ -8322,7 +8369,12 @@ case "$OS_TARGET" in
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)

Просмотреть файл

@ -238,6 +238,12 @@ else
MOZ_ANDROID_NDK
fi
case "$target" in
*-apple-darwin*)
MOZ_IOS_SDK
;;
esac
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================

Просмотреть файл

@ -6,7 +6,7 @@
@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)
@ -270,7 +270,7 @@ if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
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':