[vlmc-devel] Rework Mac compilation process
Felix Paul Kühne
git at videolan.org
Fri Apr 29 16:39:27 CEST 2016
vlmc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Apr 29 16:39:10 2016 +0200| [0ce98bb0a0000ea9572da536e2241f92165ddf6b] | committer: Felix Paul Kühne
Rework Mac compilation process
Note: the created bundle is _NOT_ distributable (yet)
Note: you might want to see the flags of the build script
> https://code.videolan.org/videolan/vlmc/commit/0ce98bb0a0000ea9572da536e2241f92165ddf6b
---
.gitignore | 1 +
INSTALL.macosx.md | 6 +-
cmake/FindLIBVLC.cmake | 14 +-
contribs/build-libvlc-for-mac.sh | 283 +++++++++++++++++++++++++++++++++++++++
4 files changed, 295 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index 52b4851..187bda3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ vlmc
/contribs/tools
/contribs/plugins
/contribs/ts
+/contribs/vlc
.DS_Store
Thumbs.db
diff --git a/INSTALL.macosx.md b/INSTALL.macosx.md
index 21bdb67..1f0d81a 100644
--- a/INSTALL.macosx.md
+++ b/INSTALL.macosx.md
@@ -10,12 +10,12 @@
## Building and Packaging
### Get the actual dependencies:
-* brew tap tomahawk-player/tomahawkqt5
* brew install cmake
-* brew install vlc
* brew install Qt5
* brew install frei0r
-
+* ./contribs/build-libvlc-for-mac.sh
+* git submodule init
+* git submodule update
### Compile vlmc:
Now cd to root source directory and build:
diff --git a/cmake/FindLIBVLC.cmake b/cmake/FindLIBVLC.cmake
index e13a706..48f1914 100644
--- a/cmake/FindLIBVLC.cmake
+++ b/cmake/FindLIBVLC.cmake
@@ -33,8 +33,8 @@ FIND_PATH(LIBVLC_INCLUDE_DIR vlc/vlc.h
"/usr/local/include/vlc"
#mingw
c:/msys/local/include
- # MacOS install dir
- /Applications/VLC.app/Contents/MacOS/include
+ # Modern Mac locations
+ "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/include"
)
FIND_PATH(LIBVLC_INCLUDE_DIR PATHS "${CMAKE_INCLUDE_PATH}/vlc" NAMES vlc.h)
@@ -47,8 +47,9 @@ FIND_LIBRARY(LIBVLC_LIBRARY NAMES vlc libvlc
#Mac OS
"${CMAKE_CURRENT_SOURCE_DIR}/contribs/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/contribs/plugins"
- # MacOS install dir
- /Applications/VLC.app/Contents/MacOS/lib
+ # Modern Mac location
+ "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib/vlc"
#mingw
c:/msys/local/lib
)
@@ -60,8 +61,9 @@ FIND_LIBRARY(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore
#Mac OS
"${CMAKE_CURRENT_SOURCE_DIR}/contribs/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/contribs/plugins"
- # MacOS install dir
- /Applications/VLC.app/Contents/MacOS/lib
+ # Modern Mac location
+ "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../contribs/vlc/x86_64-install/lib/vlc"
#mingw
c:/msys/local/lib
)
diff --git a/contribs/build-libvlc-for-mac.sh b/contribs/build-libvlc-for-mac.sh
new file mode 100755
index 0000000..ace6a2c
--- /dev/null
+++ b/contribs/build-libvlc-for-mac.sh
@@ -0,0 +1,283 @@
+#!/bin/sh
+set -e
+
+info()
+{
+ local green="\033[1;32m"
+ local normal="\033[0m"
+ echo "[${green}build${normal}] $1"
+}
+
+OSX_VERSION="10.11"
+ARCH="x86_64"
+MINIMAL_OSX_VERSION="10.7"
+SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
+UNSTABLE=no
+
+usage()
+{
+cat << EOF
+usage: $0 [-v] [-d]
+
+OPTIONS
+ -v Be more verbose
+ -u Use unstable libvlc
+ -k <sdk> Use the specified sdk (default: $SDKROOT for $ARCH)
+ -a <arch> Use the specified arch (default: $ARCH)
+EOF
+}
+
+spushd()
+{
+ pushd "$1" 2>&1> /dev/null
+}
+
+spopd()
+{
+ popd 2>&1> /dev/null
+}
+
+info()
+{
+ local green="\033[1;32m"
+ local normal="\033[0m"
+ echo "[${green}info${normal}] $1"
+}
+
+while getopts "hvua:k:" OPTION
+do
+ case $OPTION in
+ h)
+ usage
+ exit 1
+ ;;
+ v)
+ VERBOSE=yes
+ ;;
+ u)
+ UNSTABLE=yes
+ ;;
+ a)
+ ARCH=$OPTARG
+ ;;
+ k)
+ SDKROOT=$OPTARG
+ ;;
+ ?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+out="/dev/null"
+if [ "$VERBOSE" = "yes" ]; then
+ out="/dev/stdout"
+fi
+
+if [ "x$1" != "x" ]; then
+ usage
+ exit 1
+fi
+
+export OSX_VERSION
+export SDKROOT
+
+# Get root dir
+spushd .
+vlmc_root_dir=`pwd`
+spopd
+
+info $vlmc_root_dir
+
+info "Preparing build dirs"
+
+spushd contribs
+
+if ! [ -e vlc ]; then
+if [ "$UNSTABLE" = "yes" ]; then
+git clone git://git.videolan.org/vlc.git vlc
+else
+git clone git://git.videolan.org/vlc/vlc-2.2.git vlc
+fi
+fi
+
+spopd #contribs
+
+#
+# Build time
+#
+
+export PATH="${vlmc_root_dir}/contribs/vlc/extras/tools/build/bin:${vlmc_root_dir}/contribs/contrib/${ARCH}-apple-darwin11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
+
+info "Building tools"
+spushd contribs/vlc/extras/tools
+if ! [ -e build ]; then
+./bootstrap && make
+fi
+spopd
+
+info "Fetching contrib"
+
+spushd contribs/vlc/contrib
+
+if ! [ -e ${ARCH}-vlmc ]; then
+mkdir ${ARCH}-vlmc
+fi
+cd ${ARCH}-vlmc
+../bootstrap --build=${ARCH}-apple-darwin11
+make prebuilt
+spopd
+
+export CC="xcrun clang"
+export CXX="xcrun clang++"
+export OBJC="xcrun clang"
+PREFIX="${vlmc_root_dir}/contribs/vlc/${ARCH}-install"
+
+info "Configuring VLC"
+
+if ! [ -e ${PREFIX} ]; then
+ mkdir ${PREFIX}
+fi
+
+spushd contribs/vlc
+if ! [ -e configure ]; then
+ ./bootstrap > ${out}
+fi
+if ! [ -e ${ARCH}-build ]; then
+ mkdir ${ARCH}-build
+fi
+
+CONFIG_OPTIONS=""
+if [ "$ARCH" = "i686" ]; then
+ CONFIG_OPTIONS="--disable-vda"
+ export LDFLAGS="-Wl,-read_only_relocs,suppress"
+fi
+
+cd ${ARCH}-build
+../configure \
+ --build=${ARCH}-apple-darwin11 \
+ --prefix=${PREFIX} \
+ --with-macosx-version-min=${MINIMAL_OSX_VERSION} \
+ --with-macosx-sdk=$SDKROOT \
+ --disable-lua --disable-httpd --disable-vlm \
+ --disable-vcd --disable-screen \
+ --disable-debug \
+ --disable-macosx \
+ --disable-notify \
+ --disable-projectm \
+ --disable-growl \
+ --disable-faad \
+ --disable-bluray \
+ --enable-flac \
+ --enable-theora \
+ --enable-shout \
+ --disable-ncurses \
+ --disable-twolame \
+ --disable-realrtsp \
+ --enable-libass \
+ --disable-macosx-avfoundation \
+ --disable-macosx-dialog-provider \
+ --disable-macosx-eyetv \
+ --disable-macosx-qtkit \
+ --disable-macosx-quartztext \
+ --disable-macosx-vlc-app \
+ --disable-skins2 \
+ --disable-xcb \
+ --disable-caca \
+ --disable-sdl \
+ --disable-samplerate \
+ --disable-upnp \
+ --disable-goom \
+ --disable-nls \
+ --disable-sdl \
+ --disable-sdl-image \
+ ${CONFIG_OPTIONS} \
+ > ${out}
+
+info "Compiling VLC"
+
+CORE_COUNT=`sysctl -n machdep.cpu.core_count`
+let MAKE_JOBS=$CORE_COUNT+1
+
+if [ "$VERBOSE" = "yes" ]; then
+ make V=1 -j$MAKE_JOBS > ${out}
+else
+ make -j$MAKE_JOBS > ${out}
+fi
+
+info "Installing VLC"
+make install > ${out}
+cd ..
+
+info "Removing unneeded modules"
+blacklist="
+stats
+access_bd
+shm
+oldrc
+real
+hotkeys
+gestures
+sap
+dynamicoverlay
+rss
+ball
+magnify
+audiobargraph_
+clone
+mosaic
+osdmenu
+puzzle
+mediadirs
+ripple
+motion
+sharpen
+grain
+posterize
+mirror
+wall
+scene
+blendbench
+psychedelic
+alphamask
+netsync
+audioscrobbler
+motiondetect
+motionblur
+export
+smf
+podcast
+bluescreen
+erase
+remoteosd
+magnify
+gradient
+logger
+visual
+fb
+aout_file
+dummy
+invert
+sepia
+wave
+hqdn3d
+headphone_channel_mixer
+gaussianblur
+gradfun
+extract
+colorthres
+antiflicker
+anaglyph
+remap
+"
+
+for i in ${blacklist}
+do
+ find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;
+done
+
+spopd
+
+info "Build completed"
More information about the Vlmc-devel
mailing list