Skip to content

Commit

Permalink
Merge pull request #13816 from Rechi/fix/darwin
Browse files Browse the repository at this point in the history
[depends][darwin] cleanup, fix variable order & build / host mix up
  • Loading branch information
Rechi committed Apr 26, 2018
2 parents d4678b9 + 7c1a959 commit 2f5f0c0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 68 deletions.
1 change: 0 additions & 1 deletion tools/depends/Makefile.include.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ CROSS_COMPILING=@cross_compiling@
ARCH_DEFINES=@ARCH_DEFINES@
NATIVE_ARCH_DEFINES=@NATIVE_ARCH_DEFINES@
TARGET_PLATFORM=@target_platform@
XCODE_VERSION=@use_xcode@
AAPT=@AAPT@
DX=@DX@
ZIPALIGN=@ZIPALIGN@
Expand Down
40 changes: 8 additions & 32 deletions tools/depends/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ case $build in
;;
*darwin*)
build_os="osx"
native_platform_min_version=-mmacosx-version-min=`sw_vers | grep ProductVersion | sed -E "s/.*:.*(10\..*)\.?.*/\1/"`
;;
*)
AC_MSG_ERROR(unsupported native build platform: $build)
Expand Down Expand Up @@ -257,33 +258,21 @@ case $host in
prefix=/Users/Shared/xbmc-depends
fi

native_platform_min_version=-mmacosx-version-min=`sw_vers | grep ProductVersion | sed -E "s/.*:.*(10\..*)\.?.*/\1/"`
use_xcodepath=`xcode-select -print-path`
use_xcodebuild=$use_xcodepath/usr/bin/xcodebuild
use_xcode=[`$use_xcodebuild -version | grep Xcode | awk '{ print $2}'`]
AC_MSG_RESULT(found xcodebuild at $use_xcodebuild)
use_build_toolchain=$use_xcodepath
use_toolchain="${use_xcodepath}/Toolchains/XcodeDefault.xctoolchain"

# darwin builds are always cross
cross_compiling="yes"

platform_cflags="-std=gnu99 -no_compact_linkedit -no-cpp-precomp"
platform_ldflags="-Wl,-search_paths_first -no_compact_linkedit"
platform_cxxflags="-no_compact_linkedit -no-cpp-precomp"
platform_cc=clang
platform_cxx=clang++
platform_cflags="-fheinous-gnu-extensions -no-cpp-precomp"
platform_ldflags="-Wl,-search_paths_first"
platform_cxxflags="-no-cpp-precomp"

case $use_xcode in
4.* | 4.*.*)
platform_cc=llvm-gcc-4.2
platform_cxx=llvm-g++-4.2
;;
*)
platform_cc=clang
platform_cxx=clang++
platform_cflags="-fheinous-gnu-extensions -no-cpp-precomp"
platform_ldflags="-Wl,-search_paths_first"
platform_cxxflags="-no-cpp-precomp"
;;
esac
case $host in
*86*-apple-darwin)
MC_CHECK_NOT_CPU([$use_cpu], "arm")
Expand Down Expand Up @@ -325,16 +314,6 @@ case $host in

use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name Path`]
platform_os="osx"

# find the matching toolchain
case $use_xcode in
5.* | 5.*.* )
use_toolchain="${use_xcodepath}/Toolchains/XcodeDefault.xctoolchain"
;;
*)
use_toolchain="${use_toolchain:-$use_xcodepath}"
;;
esac
;;

arm-apple-darwin*)
Expand Down Expand Up @@ -377,8 +356,6 @@ case $host in
;;
esac

use_toolchain="${use_xcodepath}/Toolchains/XcodeDefault.xctoolchain"

platform_os="ios"

if [ ! test "x$use_cpu" = "xarm64" ]; then
Expand All @@ -389,9 +366,9 @@ case $host in
platform_cflags+=" -Wreturn-type -Wunused-variable -fmessage-length=0 -gdwarf-2"
platform_cflags+=" -Wno-error=implicit-function-declaration"
optimize_flags="-O3"
use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name | grep ^Path | awk '{ print $2}'`]
platform_ldflags+=" -L$use_sdk_path/usr/lib/system"
platform_cxxflags+=" $cpu_flags"
use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name | grep ^Path | awk '{ print $2}'`]
;;
esac
platform_cflags+=" -arch $use_cpu -m$platform_min_version"
Expand Down Expand Up @@ -693,7 +670,6 @@ AC_SUBST(has_zlib)
AC_SUBST(link_iconv)
AC_SUBST(need_libiconv)
AC_SUBST(use_gplv3)
AC_SUBST(use_xcode)
AC_SUBST(use_ccache)
AC_SUBST(native_platform_min_version)
AC_SUBST(app_rendersystem)
Expand Down
2 changes: 1 addition & 1 deletion tools/depends/native/config.site.native.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
LD_LIBRARY_PATH=@prefix@/@tool_dir@/lib:$LD_LIBRARY_PATH
NASM=@prefix@/@tool_dir@/bin/yasm

if test "@platform_os@" = "osx" ; then
if test "@build_os@" = "osx" ; then
# Xcode 8 + 10.11, clock_gettime and getentropy is present
# in 10.12 but will get wrongly detected if building on 10.11
ac_cv_search_clock_gettime=no
Expand Down
16 changes: 0 additions & 16 deletions tools/depends/target/config-binaddons.site.in
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,6 @@ if test "@platform_os@" = "ios"; then
ac_cv_func_clock_gettime=no
ac_cv_func_getentropy=no

# tweaks for libffi (ios must use llvm-gcc-4.2)
if test "${PACKAGE_NAME}" = "libffi" ; then
case "@use_xcode@" in
4.* | 4.*.*)
export CC="@use_toolchain@/usr/bin/llvm-gcc-4.2"
export CPP="@use_toolchain@/usr/bin/llvm-gcc-4.2 -E"
;;
*)
export CC="@use_toolchain@/usr/bin/clang"
export CPP="@use_toolchain@/usr/bin/clang -E"
;;
esac
unset AS
unset CCAS
fi

# tweaks for flac
if test "${ac_unique_file}" = "src/flac/main.c" ; then
# compiler barfs if we use -O3/O2 for flac
Expand Down
19 changes: 2 additions & 17 deletions tools/depends/target/config.site.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,11 @@ if test "@platform_os@" = "ios"; then
ac_cv_func_clock_gettime=no
ac_cv_func_getentropy=no

# tweaks for libffi (ios must use llvm-gcc-4.2)
# tweaks for libffi
if test "${PACKAGE_NAME}" = "libffi" ; then
case "@use_xcode@" in
4.* | 4.*.*)
export CC="@use_toolchain@/usr/bin/llvm-gcc-4.2"
export CPP="@use_toolchain@/usr/bin/llvm-gcc-4.2 -E"
;;
*)
export CC="@use_toolchain@/usr/bin/clang"
export CPP="@use_toolchain@/usr/bin/clang -E"
;;
esac

if test "@use_cpu@" = "arm64"; then
host=aarch64-apple-darwin
host_alias=aarch64-apple-darwin
fi

unset AS
unset CCAS
fi
fi

# tweaks for flac
Expand Down
5 changes: 4 additions & 1 deletion tools/depends/target/gmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ ifeq ($(OS),linux)
endif

ifeq ($(OS),ios)
CONFIGURE_FLAGS=CC_FOR_BUILD=llvm-gcc CPP_FOR_BUILD="llvm-gcc -E" --disable-assembly
CONFIGURE_FLAGS=--disable-assembly
endif
ifeq ($(OS),osx)
CONFIGURE_FLAGS=--with-pic
endif
ifeq ($(OS), android)
CONFIGURE_FLAGS=--with-pic
endif
ifeq ($(NATIVE_OS), osx)
CONFIGURE_FLAGS+= CC_FOR_BUILD="$(CC_FOR_BUILD)" CPP_FOR_BUILD="$(CC_FOR_BUILD) -E"
endif

# configuration settings
CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
Expand Down

0 comments on commit 2f5f0c0

Please sign in to comment.