Commit ee8920f9 authored by David's avatar David
Browse files

macOS build.sh: Move PATH and triplet calculation out in helper funcs

This should give a complete environment when using env.build.sh
as a standalone helper.
parent 92782a17
......@@ -15,16 +15,12 @@ source "$SCRIPTDIR/env.build.sh" "none"
ARCH="x86_64"
MINIMAL_OSX_VERSION="10.10"
OSX_VERSION=`xcrun --show-sdk-version`
OSX_KERNELVERSION=`uname -r | cut -d. -f1`
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
VLCBUILDDIR=""
CORE_COUNT=`getconf NPROCESSORS_ONLN 2>&1`
let JOBS=$CORE_COUNT+1
if [ ! -z "$VLC_FORCE_KERNELVERSION" ]; then
OSX_KERNELVERSION="$VLC_FORCE_KERNELVERSION"
fi
usage()
{
......@@ -121,23 +117,15 @@ fi
info "Building VLC for the Mac OS X"
spushd `dirname $0`/../../..
vlcroot=`pwd`
spopd
TRIPLET=$(vlcGetTriplet)
export SDKROOT
vlcSetBaseEnvironment
vlcroot="$(vlcGetRootDir)"
builddir=`pwd`
builddir="$(pwd)"
info "Building in \"$builddir\""
TRIPLET=$ARCH-apple-darwin$OSX_KERNELVERSION
export CC="`xcrun --find clang`"
export CXX="`xcrun --find clang++`"
export OBJC="`xcrun --find clang`"
export OSX_VERSION
export SDKROOT
export PATH="${vlcroot}/extras/tools/build/bin:${vlcroot}/contrib/${TRIPLET}/bin:${VLC_PATH}:/bin:/sbin:/usr/bin:/usr/sbin"
#
# vlc/extras/tools
#
......@@ -264,6 +252,6 @@ elif [ "$PACKAGETYPE" = "n" -o "$PACKAGE" = "yes" ]; then
make package-macosx
fi
if [ ! -z "$VLCBUILDDIR" ];then
if [ ! -z "$VLCBUILDDIR" ]; then
popd
fi
#!/bin/bash
vlcGetTriplet() {
local OSX_KERNELVERSION=$(uname -r | cut -d. -f1)
if [ ! -z "$VLC_FORCE_KERNELVERSION" ]; then
OSX_KERNELVERSION="$VLC_FORCE_KERNELVERSION"
fi
local LOCAL_ARCH="x86_64"
if [ -n "$ARCH" ]; then
LOCAL_ARCH="$ARCH"
fi
echo "$LOCAL_ARCH-apple-darwin$OSX_KERNELVERSION"
}
# Gets VLCs root dir based on location of this file, also follow symlinks
vlcGetRootDir() {
local SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
local DIR="$(cd -P "$( dirname "$SOURCE" )" && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # Relative symlink needs dir prepended
done
echo "$(cd -P "$(dirname "$SOURCE")/../../../" && pwd)"
}
vlcSetBaseEnvironment() {
local LOCAL_TRIPLET="$TRIPLET"
if [ -z "$LOCAL_TRIPLET" ]; then
LOCAL_TRIPLET="$(vlcGetTriplet)"
fi
local VLC_ROOT_DIR="$(vlcGetRootDir)"
echo "Setting base environment"
echo "Using VLC root dir $VLC_ROOT_DIR and triplet $LOCAL_TRIPLET"
export CC="$(xcrun --find clang)"
export CXX="$(xcrun --find clang++)"
export OBJC="$(xcrun --find clang)"
export PATH="${VLC_ROOT_DIR}/extras/tools/build/bin:${VLC_ROOT_DIR}/contrib/${LOCAL_TRIPLET}/bin:${VLC_PATH}:/bin:/sbin:/usr/bin:/usr/sbin"
}
vlcSetSymbolEnvironment() {
echo "Setting symbol environment"
......@@ -93,9 +135,11 @@ if [ "$1" = "none" ]; then
fi
if [ "$VLC_ENV_MODE" = "contrib" ]; then
vlcSetBaseEnvironment
vlcSetSymbolEnvironment
vlcSetContribEnvironment "10.10"
elif [ "$VLC_ENV_MODE" = "vlc" ]; then
vlcSetBaseEnvironment
vlcSetSymbolEnvironment
vlcUnsetContribEnvironment
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment