]> git.sesse.net Git - vlc/commitdiff
build_system: osx: use xcrun and SDKROOT env variable. (close #6305)
authorJon Stacey <jon@jonsview.com>
Thu, 17 May 2012 11:59:27 +0000 (13:59 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Thu, 17 May 2012 11:59:27 +0000 (13:59 +0200)
Defaults to OSX_VERSION=10.6

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
contrib/bootstrap
extras/package/macosx/build.sh

index df3dd85c9c061d60e3ede42fedbf4200e9b83c84..a0a7244c1032f898d3c40335515eba9ea9a42cc5 100755 (executable)
@@ -143,15 +143,19 @@ add_make_enabled()
 
 check_macosx_sdk()
 {
-   [ -z "${OSX_VERSION}" ] && echo "OSX_VERSION not specified, assuming 10.5" && OSX_VERSION=10.5
-   SDK="/Developer/SDKs/MacOSX${OSX_VERSION}.sdk"
-   if [ ! -d "${SDK}" ]
+   [ -z "${OSX_VERSION}" ] && echo "OSX_VERSION not specified, assuming 10.6" && OSX_VERSION=10.6
+   if test -z "$SDKROOT"
    then
-          echo "
-*** ${SDK} does not exist, please install required SDK, or use export OSX_VERSION=10.6 ***
-"
-          exit 1
+      SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
+      echo "SDKROOT not specified, assuming $SDKROOT"
    fi
+
+   if [ ! -d "${SDKROOT}" ]
+   then
+      echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
+      exit 1
+   fi
+
    add_make "OSX_VERSION ?= ${OSX_VERSION}"
 }
 
index 4ed57be7146a4084b4fbf8e8fddaaa5adcec838d..d9b3601a8d9ca637e2da8b9c900e7f25cebcc7c7 100755 (executable)
@@ -10,7 +10,8 @@ info()
 }
 
 ARCH="x86_64"
-SDK="10.6"
+OSX_VERSION="10.6"
+SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
 
 usage()
 {
@@ -22,7 +23,7 @@ Build vlc in the current directory
 OPTIONS:
    -h            Show some help
    -q            Be quiet
-   -k <sdk>      Use the specified sdk (default: $SDK)
+   -k <sdk>      Use the specified sdk (default: $SDKROOT)
    -a <arch>     Use the specified arch (default: $ARCH)
 EOF
 
@@ -53,7 +54,7 @@ do
              ARCH=$OPTARG
          ;;
          k)
-             SDK=$OPTARG
+             SDKROOT=$OPTARG
          ;;
      esac
 done
@@ -83,10 +84,11 @@ builddir=`pwd`
 
 info "Building in \"$builddir\""
 
-export CC=/Developer/usr/bin/clang
-export CXX="/Developer/usr/bin/clang++"
-export OBJC=/Developer/usr/bin/clang
-export OSX_VERSION=$SDK
+export CC="xcrun clang"
+export CXX="xcrun clang++"
+export OBJC="xcrun clang"
+export OSX_VERSION
+export SDKROOT
 export PATH="${vlcroot}/extras/tools/build/bin:$PATH"
 
 TRIPLET=$ARCH-apple-darwin10
@@ -139,7 +141,7 @@ if [ "${vlcroot}/configure" -nt Makefile ]; then
       --build=$TRIPLET \
       --host=$TRIPLET \
       --with-macosx-version-min=$OSX_VERSION \
-      --with-macosx-sdk=/Developer/SDKs/MacOSX$OSX_VERSION.sdk > $out
+      --with-macosx-sdk=$SDKROOT > $out
 fi