7 local green
="\033[1;32m"
9 echo "[${green}build${normal}] $1"
13 MINIMAL_OSX_VERSION
="10.10"
14 OSX_VERSION
=`xcrun --show-sdk-version`
15 OSX_KERNELVERSION
=`uname -r | cut -d. -f1`
16 SDKROOT
=`xcode-select -print-path`/Platforms
/MacOSX.platform
/Developer
/SDKs
/MacOSX
$OSX_VERSION.sdk
19 CORE_COUNT
=`getconf NPROCESSORS_ONLN 2>&1`
20 let JOBS
=$CORE_COUNT+1
27 Build vlc in the current directory
32 -j Force number of cores to be used
33 -r Rebuild everything (tools, contribs, vlc)
34 -c Recompile contribs from sources
35 -p Build packages for all artifacts
36 -k <sdk> Use the specified sdk (default: $SDKROOT)
37 -a <arch> Use the specified arch (default: $ARCH)
38 -C Use the specified VLC build dir
45 pushd "$1" > /dev
/null
53 while getopts "hvrcpk:a:j:C:" OPTION
68 CONTRIBFROMSOURCE
="yes"
87 shift $
(($OPTIND - 1))
89 if [ "x$1" != "x" ]; then
95 # Various initialization
99 if [ "$QUIET" = "yes" ]; then
103 info
"Building VLC for the Mac OS X"
105 spushd
`dirname $0`/..
/..
/..
111 info
"Building in \"$builddir\""
113 TRIPLET
=$ARCH-apple-darwin$OSX_KERNELVERSION
115 export CC
="`xcrun --find clang`"
116 export CXX
="`xcrun --find clang++`"
117 export OBJC
="`xcrun --find clang`"
120 export PATH
="${vlcroot}/extras/tools/build/bin:${vlcroot}/contrib/${TRIPLET}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:${PATH}"
122 # Select avcodec flavor to compile contribs with
125 # The following symbols do not exist on the minimal macOS version (10.7), so they are disabled
126 # here. This allows compilation also with newer macOS SDKs.
127 # Added symbols in 10.13
128 export ac_cv_func_open_wmemstream
=no
129 export ac_cv_func_fmemopen
=no
130 export ac_cv_func_open_memstream
=no
131 export ac_cv_func_futimens
=no
132 export ac_cv_func_utimensat
=no
134 # Added symbols between 10.11 and 10.12
135 export ac_cv_func_basename_r
=no
136 export ac_cv_func_clock_getres
=no
137 export ac_cv_func_clock_gettime
=no
138 export ac_cv_func_clock_settime
=no
139 export ac_cv_func_dirname_r
=no
140 export ac_cv_func_getentropy
=no
141 export ac_cv_func_mkostemp
=no
142 export ac_cv_func_mkostemps
=no
144 # Added symbols between 10.7 and 10.11
145 export ac_cv_func_ffsll
=no
146 export ac_cv_func_flsll
=no
147 export ac_cv_func_fdopendir
=no
148 export ac_cv_func_openat
=no
149 export ac_cv_func_fstatat
=no
150 export ac_cv_func_readlinkat
=no
152 # libnetwork does not exist yet on 10.7 (used by libcddb)
153 export ac_cv_lib_network_connect
=no
159 info
"Building building tools"
160 spushd
"${vlcroot}/extras/tools"
162 if [ "$REBUILD" = "yes" ]; then
172 # Usually, VLCs contrib libraries do not support partial availability at runtime.
173 # Forcing those errors has two reasons:
174 # - Some custom configure scripts include the right header for testing availability.
175 # Those configure checks fail (correctly) with those errors, and replacements are
176 # enabled. (e.g. ffmpeg)
177 # - This will fail the build if a partially available symbol is added later on
178 # in contribs and not mentioned in the list of symbols above.
179 export CFLAGS
="-Werror=partial-availability"
180 export CXXFLAGS
="-Werror=partial-availability"
181 export OBJCFLAGS
="-Werror=partial-availability"
183 info
"Building contribs"
184 spushd
"${vlcroot}/contrib"
185 mkdir
-p contrib-
$TRIPLET && cd contrib-
$TRIPLET
186 ..
/bootstrap
--build=$TRIPLET --host=$TRIPLET > $out
187 if [ "$REBUILD" = "yes" ]; then
190 if [ "$CONTRIBFROMSOURCE" = "yes" ]; then
192 make -j$JOBS .
gettext
195 if [ "$PACKAGE" = "yes" ]; then
200 if [ ! -e "../$TRIPLET" ]; then
210 # Enable debug symbols by default
213 export OBJCFLAGS
="-g"
219 info
"Bootstrap-ing configure"
221 if ! [ -e "${vlcroot}/configure" ]; then
222 ${vlcroot}/bootstrap
> $out
227 if [ ! -z "$VLCBUILDDIR" ];then
228 mkdir
-p $VLCBUILDDIR
235 if [ "${vlcroot}/configure" -nt Makefile
]; then
237 ${vlcroot}/extras
/package
/macosx
/configure.sh \
240 --with-macosx-version-min=$MINIMAL_OSX_VERSION \
241 --with-macosx-sdk=$SDKROOT \
242 $VLC_CONFIGURE_ARGS > $out
250 if [ "$REBUILD" = "yes" ]; then
251 info
"Running make clean"
255 info
"Running make -j$JOBS"
258 info
"Preparing VLC.app"
262 if [ "$PACKAGE" = "yes" ]; then
263 info
"Building VLC dmg package"
267 if [ ! -z "$VLCBUILDDIR" ];then