Fix compilation process for XCode 5 and following.

Transitioned to using Clang instead of GCC everywhere possible,
including x264 (some ASM was modified for that)
This commit is contained in:
Guillaume BIENKOWSKI 2013-09-30 17:32:46 +02:00
parent f9a64f6e48
commit e053a0ee19
10 changed files with 200 additions and 85 deletions

View file

@ -8,9 +8,12 @@ ffmpeg_configure_options=\
--cross-prefix=$$SDK_BIN_PATH/ \
--sysroot=$$SYSROOT_PATH --arch=$$ARCH \
--enable-static --disable-shared --target-os=darwin \
--extra-cflags="-arch $$ARCH " --extra-ldflags="-arch $$ARCH -Wl,-syslibroot,$$SYSROOT_PATH " \
--extra-cflags="$$COMMON_FLAGS" --extra-ldflags="$$COMMON_FLAGS" \
--disable-iconv \
--disable-armv5te
--disable-armv5te \
--ar="$$AR" \
--nm="$$NM" \
--cc="$$CC"
# --as=$(BUILDER_SRC_DIR)/externals/x264/extras/gas-preprocessor.pl
@ -32,10 +35,12 @@ $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/config.mak:
mkdir -p $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)
cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/ \
&& host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& $(BUILDER_SRC_DIR)/$(ffmpeg_dir)/configure --prefix=$(prefix) $(ffmpeg_configure_options)
&& $(BUILDER_SRC_DIR)/$(ffmpeg_dir)/configure --prefix=$(prefix) $(ffmpeg_configure_options)
build-ffmpeg: $(BUILDER_BUILD_DIR)/$(ffmpeg_dir)/config.mak
cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make && make install
cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) \
&& host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig make RANLIB="$$RANLIB" && make RANLIB="$$RANLIB" install
clean-ffmpeg:
cd $(BUILDER_BUILD_DIR)/$(ffmpeg_dir) && make clean

View file

@ -7,12 +7,13 @@ libvpx_configure_options=\
ifneq (,$(findstring armv6,$(host)))
libvpx_configure_options+= --target=armv6-darwin-gcc --cpu=arm1176jzf-s
else ifneq (,$(findstring armv7s,$(host)))
libvpx_configure_options+= --target=armv7s-darwin-gcc --cpu=cortex-a8
libvpx_configure_options+= --target=armv7s-darwin-gcc
else ifneq (,$(findstring armv7,$(host)))
libvpx_configure_options+= --target=armv7-darwin-gcc --cpu=cortex-a8
libvpx_configure_options+= --target=armv7-darwin-gcc
else
libvpx_configure_options+= --target=x86-darwin10-gcc
endif
libvpx_dir?=externals/libvpx
all_p=armv6-darwin-gcc #neon Cortex-A8
all_p+=armv7-darwin-gcc #neon Cortex-A8
@ -27,10 +28,12 @@ $(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: $(BUILDER_SRC_DIR)/$(libvpx_dir)/p
mkdir -p $(BUILDER_BUILD_DIR)/$(libvpx_dir)
cd $(BUILDER_BUILD_DIR)/$(libvpx_dir)/ \
&& host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& export all_platforms="${all_p}" && $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) --sdk-path=$$SDK_BIN_PATH/../../ --libc=$$SYSROOT_PATH $(libvpx_configure_options)
&& export all_platforms="${all_p}" && $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) --sdk-path=$$SDK_BIN_PATH/../../ --libc=$$SYSROOT_PATH $(libvpx_configure_options)
build-libvpx: $(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk
cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) && PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make && make install
cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) \
&& host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) make && make install
clean-libvpx:
cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) && make clean

View file

@ -1,16 +1,28 @@
diff --git a/build/make/configure.sh b/build/make/configure.sh
index c99a01c..48f8876 100755
index c99a01c..f7f54c6 100755
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -892,7 +892,7 @@ process_common_toolchain() {
CXX=${TOOLCHAIN_PATH}/g++
CC=${TOOLCHAIN_PATH}/gcc
AR=${TOOLCHAIN_PATH}/ar
@@ -889,13 +889,13 @@ process_common_toolchain() {
SDK_PATH=${sdk_path}
fi
TOOLCHAIN_PATH=${SDK_PATH}/usr/bin
- CXX=${TOOLCHAIN_PATH}/g++
- CC=${TOOLCHAIN_PATH}/gcc
- AR=${TOOLCHAIN_PATH}/ar
- LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-llvm-gcc-4.2
+ LD=${TOOLCHAIN_PATH}/gcc
AS=${TOOLCHAIN_PATH}/as
STRIP=${TOOLCHAIN_PATH}/strip
NM=${TOOLCHAIN_PATH}/nm
- AS=${TOOLCHAIN_PATH}/as
- STRIP=${TOOLCHAIN_PATH}/strip
- NM=${TOOLCHAIN_PATH}/nm
+ CXX=`xcrun --find g++`
+ CC=`xcrun --find gcc`
+ AR=`xcrun --find ar`
+ LD=`xcrun --find ld`
+ AS=`xcrun --find as`
+ STRIP=`xcrun --find strip`
+ NM=`xcrun --find nm`
AS_SFX=.s
# ASFLAGS is written here instead of using check_add_asflags
@@ -904,7 +904,7 @@ process_common_toolchain() {
ASFLAGS="-version -arch ${tgt_isa} -g"
@ -20,3 +32,16 @@ index c99a01c..48f8876 100755
if [ -z "${alt_libc}" ]; then
alt_libc=${SDK_PATH}/SDKs/iPhoneOS5.1.sdk
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index a4a00f6..72d0b6d 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -92,7 +92,7 @@ void vp8_mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd)
}
}
-static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
+void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
unsigned int mb_idx)
{
MB_PREDICTION_MODE mode;

View file

@ -30,7 +30,7 @@ $(BUILDER_BUILD_DIR)/$(mssilk_dir)/Makefile: $(BUILDER_SRC_DIR)/$(mssilk_dir)/co
echo -e "\033[01;32m Running configure in $(BUILDER_BUILD_DIR)/$(mssilk_dir) \033[0m"
mkdir -p $(BUILDER_BUILD_DIR)/$(mssilk_dir)
cd $(BUILDER_BUILD_DIR)/$(mssilk_dir)/ \
&& PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site_gcc) \
&& PKG_CONFIG_LIBDIR=$(prefix)/lib/pkgconfig CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \
$(BUILDER_SRC_DIR)/$(mssilk_dir)/configure -prefix=$(prefix) --host=$(host) ${library_mode} \
--enable-static
@ -40,7 +40,7 @@ build-mssilk: $(BUILDER_BUILD_DIR)/$(mssilk_dir)/Makefile
echo -e "\033[01;32m building silk \033[0m"
cd $(BUILDER_BUILD_DIR)/$(mssilk_dir) \
&& PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig \
CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site_gcc) \
CONFIG_SITE=$(BUILDER_SRC_DIR)/build/$(config_site) \
make -j1 && make install

View file

@ -19,9 +19,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
ifneq (,$(findstring arm,$(host)))
opencore-amr-configure-option=--enable-gcc-armv5
endif
opencore-amr_dir?=externals/opencore-amr

View file

@ -26,22 +26,18 @@ x264-configure-option= \
--host=$(host)\
--enable-static \
--cross-prefix=$$SDK_BIN_PATH/ \
--extra-ldflags="-arch $$ARCH -isysroot $$SYSROOT_PATH"
--extra-ldflags="$$COMMON_FLAGS"
XCFLAGS:=$$COMMON_FLAGS
ifneq (,$(findstring i386,$(host)))
x264-configure-option+= --extra-cflags="-arch $$ARCH -isysroot $$SYSROOT_PATH"
endif
ifneq (,$(findstring armv6,$(host)))
x264-configure-option+= --extra-cflags="-arch $$ARCH -mcpu=arm1176jzf-s -marm -isysroot $$SYSROOT_PATH"
x264-configure-option+= --disable-asm
endif
ifneq (,$(findstring armv7,$(host)))
x264-configure-option+= --extra-cflags="-arch $$ARCH -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isysroot $$SYSROOT_PATH"
XCFLAGS+= -mfpu=neon -mfloat-abi=softfp
endif
x264-configure-option+= --extra-cflags="${XCFLAGS}"
x264_dir?=externals/x264
#$(BUILDER_SRC_DIR)/$(x264_dir)/patched :
# cd $(BUILDER_SRC_DIR)/$(x264_dir) \
@ -56,10 +52,12 @@ $(BUILDER_BUILD_DIR)/$(x264_dir)/configure:
$(BUILDER_BUILD_DIR)/$(x264_dir)/config.mak: $(BUILDER_BUILD_DIR)/$(x264_dir)/configure
cd $(BUILDER_BUILD_DIR)/$(x264_dir)/ \
&& host_alias=$(host) . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& ./configure --prefix=$(prefix) ${x264-configure-option}
&& CC="$$CC" ./configure --prefix=$(prefix) $(x264-configure-option)
build-x264: $(BUILDER_BUILD_DIR)/$(x264_dir)/config.mak
cd $(BUILDER_BUILD_DIR)/$(x264_dir) make && make install
cd $(BUILDER_BUILD_DIR)/$(x264_dir) \
&& host_alias=$(host) . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& make STRIP="$$STRIP" AR="$$AR -r " RANLIB="$$RANLIB" CC="$$CC" && make STRIP="$$STRIP" AR="$$AR" RANLIB="$$RANLIB" install
clean-x264:
cd $(BUILDER_BUILD_DIR)/$(x264_dir) && make clean

View file

@ -10,3 +10,139 @@ index 8e70403..259bb92 100644
.global EXTERN_ASM\name
EXTERN_ASM\name:
ELF .hidden \name
diff --git a/common/arm/cpu-a.S b/common/arm/cpu-a.S
index a459553..bc91505 100644
--- a/common/arm/cpu-a.S
+++ b/common/arm/cpu-a.S
@@ -26,7 +26,7 @@
#include "asm.S"
.fpu neon
-.align
+// .align
// done in gas because .fpu neon overrides the refusal to assemble
// instructions the selected -march/-mcpu doesn't support
@@ -95,7 +95,7 @@ average_loop:
sub r2, r2, r1
cmpgt r2, #30 << 3 // assume context switch if it took over 30 cycles
addle r3, r3, r2
- subles ip, ip, #1
+ suble ip, ip, #1
bgt average_loop
// disable counters if we enabled them
diff --git a/common/arm/mc-a.S b/common/arm/mc-a.S
index 507bbba..d5554be 100644
--- a/common/arm/mc-a.S
+++ b/common/arm/mc-a.S
@@ -166,7 +166,7 @@ function x264_pixel_avg_\w\()x\h\()_neon
ldr ip, [sp, #8]
push {r4-r6,lr}
cmp ip, #32
- ldrd r4, [sp, #16]
+ ldrd r4, r5, [sp, #16]
mov lr, #\h
beq x264_pixel_avg_w\w\()_neon
rsbs r6, ip, #64
@@ -446,7 +446,7 @@ avg2_w20_loop:
.ifc \type, full
ldr lr, [r4, #32] // denom
.endif
- ldrd r4, [r4, #32+4] // scale, offset
+ ldrd r4, r5, [r4, #32+4] // scale, offset
vdup.16 q0, r4
vdup.16 q1, r5
.ifc \type, full
@@ -815,7 +815,7 @@ copy_w16_aligned_loop:
// int dx, int dy, int i_width, int i_height );
function x264_mc_chroma_neon
push {r4-r6, lr}
- ldrd r4, [sp, #16]
+ ldrd r4, r5, [sp, #16]
ldr r6, [sp, #24]
asr lr, r5, #3
@@ -1271,8 +1271,8 @@ filter_h_loop:
function x264_frame_init_lowres_core_neon
push {r4-r10,lr}
vpush {d8-d15}
- ldrd r4, [sp, #96]
- ldrd r6, [sp, #104]
+ ldrd r4, r5, [sp, #96]
+ ldrd r6, r7, [sp, #104]
ldr lr, [sp, #112]
sub r10, r6, r7 // dst_stride - width
and r10, r10, #~15
diff --git a/common/arm/pixel-a.S b/common/arm/pixel-a.S
index 8bce3b6..0784ae6 100644
--- a/common/arm/pixel-a.S
+++ b/common/arm/pixel-a.S
@@ -328,9 +328,9 @@ SAD_FUNC_DUAL 16, 16
function x264_pixel_sad_x\x\()_\w\()x\h\()_neon
push {r6-r7,lr}
.if \x == 3
- ldrd r6, [sp, #12]
+ ldrd r6, r7, [sp, #12]
.else
- ldrd r6, [sp, #16]
+ ldrd r6, r7, [sp, #16]
ldr r12, [sp, #12]
.endif
mov lr, #FENC_STRIDE
@@ -596,7 +596,7 @@ function x264_pixel_var2_8x8_neon
vadd.s32 d1, d2, d3
vpadd.s32 d0, d0, d1
- vmov.32 r0, r1, d0
+ vmov r0, r1, d0
vst1.32 {d0[1]}, [ip,:32]
mul r0, r0, r0
sub r0, r1, r0, lsr #6
diff --git a/common/arm/predict-a.S b/common/arm/predict-a.S
index af65bd7..8cdaf50 100644
--- a/common/arm/predict-a.S
+++ b/common/arm/predict-a.S
@@ -181,9 +181,9 @@ function x264_predict_4x4_ddl_neon
function x264_predict_8x8_dc_neon
mov ip, #0
- ldrd r2, [r1, #8]
+ ldrd r2, r3, [r1, #8]
push {r4-r5,lr}
- ldrd r4, [r1, #16]
+ ldrd r4, r5, [r1, #16]
lsl r3, r3, #8
ldrb lr, [r1, #7]
usad8 r2, r2, ip
diff --git a/common/arm/quant-a.S b/common/arm/quant-a.S
index e851562..c159f9e 100644
--- a/common/arm/quant-a.S
+++ b/common/arm/quant-a.S
@@ -271,7 +271,7 @@ dequant_4x4_dc_rshift:
// int coeff_last( int16_t *l )
function x264_coeff_last4_arm
- ldrd r2, [r0]
+ ldrd r2, r3, [r0]
subs r0, r3, #0
movne r0, #2
movne r2, r3
@@ -300,7 +300,7 @@ function x264_coeff_last\size\()_neon
subs r1, ip, r1, lsr #2
addge r0, r1, #\size - 8
- sublts r0, r3, r0, lsr #2
+ sublt r0, r3, r0, lsr #2
movlt r0, #0
bx lr
.endfunc
@@ -349,7 +349,7 @@ function x264_coeff_last64_neon
subs r1, ip, r1
addge r0, r1, #32
- sublts r0, ip, r0
+ sublt r0, ip, r0
movlt r0, #0
bx lr
.endfunc

View file

@ -4,7 +4,7 @@ $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/Makefile:
cd $(BUILDER_BUILD_DIR)/$(zrtpcpp_dir)/\
&& host_alias=$(host) . $(BUILDER_SRC_DIR)/build/$(config_site) \
&& cmake $(BUILDER_SRC_DIR)/$(zrtpcpp_dir) -Denable-ccrtp=false -DCMAKE_TOOLCHAIN_FILE=$(BUILDER_SRC_DIR)build/iphone-toolchain.cmake \
-LH -Wdev -DCMAKE_C_COMPILER=$$SDK_BIN_PATH/gcc -DCMAKE_CXX_COMPILER=$$SDK_BIN_PATH/g++ \
-LH -Wdev -DCMAKE_C_COMPILER=`xcrun --find gcc` -DCMAKE_CXX_COMPILER=`xcrun --find g++` \
-DCMAKE_SYSTEM_PROCESSOR=$$ARCH -DCMAKE_C_FLAGS="$$COMMON_FLAGS" -DCMAKE_CXX_FLAGS="$$COMMON_FLAGS" \
-DCMAKE_INSTALL_PREFIX=$(prefix) -DCMAKE_FIND_ROOT_PATH="$(prefix) -DBUILD_STATIC=ON "
# Used toolchain: $(TC)

View file

@ -1,51 +0,0 @@
# -*- shell-script -*-
SDK_VERSION_MAJOR=4
SDK_VERSION=4.0
MCPU=""
if test "${host_alias}" = "i386-apple-darwin" ; then
PLATFORM=Simulator
ARCH=i386
CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=i386"
MCPU=""
elif test "${host_alias}" = "armv6-apple-darwin" ; then
ARCH=armv6
PLATFORM=OS
CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=arm"
MCPU="-mcpu=arm1176jzf-s"
elif test "${host_alias}" = "armv7-apple-darwin" ; then
ARCH=armv7
PLATFORM=OS
CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=arm"
MCPU="-mcpu=cortex-a8"
elif test "${host_alias}" = "armv7s-apple-darwin" ; then
ARCH=armv7s
PLATFORM=OS
CMAKE_OPTS="-DCMAKE_SYSTEM_PROCESSOR=arm"
else
echo "bad host ${host_alias} must be either i386-apple-darwin or armv6-apple-darwin"
exit
fi
echo "Loading config.site for iPhone platform=${PLATFORM} version=${SDK_VERSION}"
XCODE_DEV_PATH=`xcode-select -print-path`
#new path with Xcode 4.3:
if test -d ${XCODE_DEV_PATH}/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs ; then
SDK_PATH_LIST=`ls -drt ${XCODE_DEV_PATH}/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}*`
SDK_BIN_PATH=${XCODE_DEV_PATH}/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin
else
SDK_PATH_LIST=`ls -drt /Developer/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}*`
SDK_BIN_PATH=/Developer/Platforms/iPhone${PLATFORM}.platform/Developer/usr/bin
fi
for SYSROOT_PATH in $SDK_PATH_LIST ; do echo $SYSROOT_PATH ; done ;
echo "Selecting SDK path = ${SYSROOT_PATH}"
COMMON_FLAGS=" -arch ${ARCH} ${MCPU} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE=1 -D__IOS"
CC="${SDK_BIN_PATH}/gcc -std=c99 $COMMON_FLAGS"
OBJC="${SDK_BIN_PATH}/gcc -std=c99 $COMMON_FLAGS"
CXX="${SDK_BIN_PATH}/g++ $COMMON_FLAGS"
LD="${SDK_BIN_PATH}/ld -arch ${ARCH}"
AR=${SDK_BIN_PATH}/ar
RANLIB=${SDK_BIN_PATH}/ranlib
CPPFLAGS="-Dasm=__asm"
OBJCFLAGS="-x objective-c -fexceptions -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch"

View file

@ -39,6 +39,7 @@ fi
for SYSROOT_PATH in $SDK_PATH_LIST ; do echo $SYSROOT_PATH ; done ;
echo "Selecting SDK path = ${SYSROOT_PATH}"
COMMON_FLAGS=" -arch ${ARCH} ${MCPU} -isysroot ${SYSROOT_PATH} -miphoneos-version-min=${SDK_VERSION} -DTARGET_OS_IPHONE=1 -D__IOS -fms-extensions"
CC="xcrun clang -std=c99 $COMMON_FLAGS"
OBJC="xcrun clang -std=c99 $COMMON_FLAGS"
@ -46,6 +47,7 @@ CXX="xcrun clang++ $COMMON_FLAGS"
LD="xcrun ld -arch ${ARCH}"
AR="xcrun ar"
RANLIB="xcrun ranlib"
STRIP="xcrun strip"
CPPFLAGS="-Dasm=__asm"
OBJCFLAGS="-x objective-c -fexceptions -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch"