When 1.21 was released for Windows and Linux only, I decided to see if I could build an 'official' version.
This turned out to be much more complex than compiling PSM for home use. Unified, statically linked binaries and libraries seem to be required, and exactly which options are used to compile all those libraries, tools and PSM?
Google shows a lot of fragmented and sometimes contradicting tips on how to build the required stuff, enough to drive a grown man crazy.
So I decided to write One Script To Build Them All, with the intention to submit it for inclusion in the PSM source tree, e.g. as "contrib/build-pms-osx.sh". This way, building the latest OSX version would be easy for anyone, and we would be certain of what tools and libraries it contains.
The script below builds everything successfully.
Development is still ongoing.
- Code: Select all
#!/bin/sh
#
# build-psm-osx.sh
#
# Version: 1.4
# Last updated: 2011-04-25
# Author: Patrick Atoon
#
#
# DESCRIPTION
#
# Building a statically linked PS3 Media Server for OSX is not an easy
# task and requires advanced knowledge of building the libraries and
# tools involved.
#
# This script will take care of building all that is required to build
# a statically linked PS3 Media Server for OSX.
# It will attempt to build unified binaries (for Intel and PCC) where
# possible. However, some libraries do not support this and the script
# will compile for the current architecture.
#
# The script will compile the PS3 Media Server disk image file:
#
# pms-macosx-x.xx.x.dmg
#
# This script is provided as is. If it works for you, good! If it does
# not, try to figure out why and share your findings on the PS3 Media
# Server forums (http://www.ps3mediaserver.org/forum/)
#
#
# REQUIREMENTS
#
# Some Developer tools need to be installed manually. The script detects
# this and provides help. Other sources will be downloaded automatically.
#
#
# ACKNOWLEDGEMENTS
#
# Many thanks to the PS3 Media Server developers and forum moderators
# for keeping the project alive and the info coming. Special thanks to
# Adrian Stutz for sharing his findings of how to build a statically
# linked MPlayerOSX, without his hard work this script would not have
# been possible.
#
# Overview of libraries:
# http://tracker.mplayerosx.ch/projects/mplayerosx/wiki/CompileMPlayerLibraries
#
#
# COPYRIGHT
#
# This script is distributed under the Creative Commons Attribution 3.0
# (CC BY) license. This means you are free to copy, distribute, transmit
# and adapt it to suit your needs, as long as you mention the original
# author in your work.
# For more details, see http://creativecommons.org/licenses/by/3.0/
#
# Set FIXED_REVISIONS to "no" to check out the latest revisions.
# Default is "yes" to check out the last known working revision.
FIXED_REVISIONS="yes"
# Set TARGET_ARCHITECTURE for building binaries. Choose one of the
# following:
# native: build for your own computer
# i386: build for Intel 386
# ppc: build for PowerPC
# unified: build for both Intel 386 and PowerPC
#
# TODO: use it and work out UB with lipo.
TARGET_ARCHITECTURE="native"
##########################################
# It should not be necessary to change anything below this line
# Binaries
ANT=/usr/bin/ant
CURL=/usr/bin/curl
GCC=/usr/bin/gcc
GIT=/usr/local/git/bin/git
HDID=/usr/bin/hdid
HDIUTIL=/usr/bin/hdiutil
MAKE=/usr/bin/make
SED=/usr/bin/sed
SVN=/usr/bin/svn
TAR=/usr/bin/tar
YASM=/usr/local/bin/yasm
UNZIP=/usr/bin/unzip
##########################################
# Create a directory when it does not exist
#
createdir() {
if [ ! -d $1 ]; then
mkdir $1
fi
}
##########################################
# Check for gcc, make, svn, ant and curl
#
check_xcode() {
if [ ! -x $GCC -o ! -x $SVN -o ! -x $ANT -o ! -x $CURL -o ! -x $MAKE ]; then
cat << EOM
It seems you are missing Xcode from Apple, which is required to run this script.
Please go to http://developer.apple.com/technologies/xcode.html, create a free
Apple developer account and download Xcode and install it.
EOM
exit;
fi
}
##########################################
# Check for yasm
#
check_yasm() {
if [ ! -x $YASM ]; then
cat << EOM
It seems you are missing "yasm", which is required to run this script.
Please run the following commands to install "yasm":
$SVN checkout http://www.tortall.net/svn/yasm/trunk/yasm yasm
cd yasm
./autogen.sh
./configure
make
sudo make install
cd $WORKDIR
EOM
exit;
fi
}
##########################################
# Check for git
#
check_git() {
if [ ! -x $GIT ]; then
cat << EOM
It seems you are missing "git", which is required to run this script.
Please go to http://code.google.com/p/git-osx-installer/, download git
and install it.
EOM
exit;
fi
}
##########################################
# Set the compiler flags to determine the architecture to compile for
# Optional parameter: architecture flags string to replace the default,
# e.g. "-arch ppc -faltivec -mcpu=7450"
#
set_flags() {
# Minimum OS version as target
export MACOSX_DEPLOYMENT_TARGET=10.5
export CFLAGS="-mmacosx-version-min=10.5 -isystem /Developer/SDKs/MacOSX10.5.sdk"
export LDFLAGS="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
export CXXFLAGS="-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
if [ "$1" != "" ]; then
# Use the supplied parameter string for architecture flags
export CFLAGS="$CFLAGS $1"
export LDFLAGS="$LDFLAGS $1"
export CXXFLAGS="$CXXFLAGS $1"
else
# Uncomment for single architecture binary
export CFLAGS="$CFLAGS -arch $ARCHITECTURE"
export LDFLAGS="$LDFLAGS -arch $ARCHITECTURE"
export CXXFLAGS="$CXXFLAGS -arch $ARCHITECTURE"
# For universal binaries, choose both i386 and PPC as target
# export CFLAGS="$CFLAGS -arch i386 -arch ppc"
# export LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
# export CXXFLAGS="$CXXFLAGS -arch i386 -arch ppc"
# For PCC
# export CFLAGS="$CFLAGS -arch ppc -faltivec -mcpu=7450"
# export LDFLAGS="$LDFLAGS -arch ppc"
# export CXXFLAGS="$CXXFLAGS -arch ppc -faltivec -mcpu=7450"
fi
# Paths of the build environment
export LDFLAGS="$LDFLAGS -L$TARGET/lib -Wl,-search_paths_first"
export CFLAGS="$CFLAGS -I$TARGET/include"
export CXXFLAGS="$CXXFLAGS -I$TARGET/include"
}
##########################################
# Initialize building environment
#
initialize() {
WORKDIR=`pwd`
# Directories for statically compiled libraries
TARGET="$WORKDIR/target"
SRC="$WORKDIR/src"
createdir "$SRC"
createdir "$TARGET"
if [ "$TARGET_ARCHITECTURE" == "native" ]; then
ARCHITECTURE=`/usr/bin/uname -p`
elif [ "$TARGET_ARCHITECTURE" == "unified" ]; then
# FIXME: Hmmm...
ARCHITECTURE=`/usr/bin/uname -p`
else
ARCHITECTURE=$TARGET_ARCHITECTURE
fi
# Set default compiler flags
set_flags
# Reset paths for compiling
export PATH="$TARGET/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
export PKG_CONFIG_PATH=""
}
##########################################
# DCRAWU
# http://www.cybercom.net/~dcoffin/dcraw/
# Not sure what "dcrawU" is, "dcraw" seems to be the next best thing.
#
build_dcrawU() {
cd $SRC
if [ ! -d dcraw-9.07 ]; then
$CURL -L http://www.cybercom.net/~dcoffin/dcraw/archive/dcraw-9.07.tar.gz > dcraw-9.07.tar.gz
$TAR xzf dcraw-9.07.tar.gz -s /dcraw/dcraw-9.07/
fi
cd dcraw-9.07
set_flags
$GCC -O4 -o dcraw dcraw.c -lm -ljpeg -DNO_LCMS $CFLAGS -L$TARGET/lib
createdir $TARGET/bin
cp dcraw $TARGET/bin
cd $WORKDIR
}
##########################################
# EXPAT
# http://expat.sourceforge.net/
#
build_expat() {
cd $SRC
if [ ! -d expat-2.0.1 ]; then
$CURL -L http://garr.dl.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz > expat-2.0.1.tar.gz
$TAR xzf expat-2.0.1.tar.gz
fi
cd expat-2.0.1
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# FAAD2
# http://www.audiocoding.com/faad2.html
#
build_faad2() {
cd $SRC
if [ ! -d faad2-2.7 ]; then
$CURL -L http://mesh.dl.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz > faad2-2.7.tar.gz
$TAR xzf faad2-2.7.tar.gz
fi
cd faad2-2.7
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# FFMPEG
# http://www.ffmpeg.org/
#
build_ffmpeg() {
cd $SRC
if [ -d ffmpeg ]; then
cd ffmpeg
$GIT pull
else
$GIT clone git://git.videolan.org/ffmpeg.git ffmpeg
cd ffmpeg
fi
if [ "$FIXED_REVISIONS" == "yes" ]; then
$GIT checkout "`$GIT rev-list master -n 1 --first-parent --before=2011-04-24`"
fi
set_flags
# Not sure why --enable-libx264 won't work
# Also not sure why --enable-libvorbis won't work
./configure --enable-gpl --enable-libtheora --disable-shared --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# FLAC
# http://flac.sourceforge.net/
#
build_flac() {
cd $SRC
if [ ! -d flac-1.2.1 ]; then
$CURL -L http://downloads.xiph.org/releases/flac/flac-1.2.1.tar.gz > flac-1.2.1.tar.gz
$TAR xzf flac-1.2.1.tar.gz
fi
cd flac-1.2.1
set_flags
./configure --disable-shared --disable-dependency-tracking --disable-asm-optimizations --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# FONTCONFIG
# http://fontconfig.org/wiki/
#
build_fontconfig() {
cd $SRC
if [ ! -d fontconfig-2.8.0 ]; then
$CURL -L http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.8.0.tar.gz > fontconfig-2.8.0.tar.gz
$TAR xzf fontconfig-2.8.0.tar.gz
fi
cd fontconfig-2.8.0
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# FREETYPE
# http://www.freetype.org/
#
build_freetype() {
cd $SRC
if [ ! -d freetype-2.4.4 ]; then
$CURL -L http://download.savannah.gnu.org/releases/freetype/freetype-2.4.4.tar.gz > freetype-2.4.4.tar.gz
$TAR xzf freetype-2.4.4.tar.gz
fi
cd freetype-2.4.4
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# GIFLIB
# http://sourceforge.net/projects/giflib/
#
build_giflib() {
cd $SRC
if [ ! -d giflib-4.1.6 ]; then
$CURL -L http://leaseweb.dl.sourceforge.net/project/giflib/giflib%204.x/giflib-4.1.6/giflib-4.1.6.tar.bz2 > giflib-4.1.6.tar.bz2
$TAR xjf giflib-4.1.6.tar.bz2
fi
cd giflib-4.1.6
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# ICONV
# http://www.gnu.org/software/libiconv/
#
build_iconv() {
cd $SRC
if [ ! -d libiconv-1.13.1 ]; then
$CURL -L http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz > libiconv-1.13.1.tar.gz
$TAR xzf libiconv-1.13.1.tar.gz
fi
cd libiconv-1.13.1
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# JPEG
# http://www.ijg.org/
#
build_jpeg() {
cd $SRC
if [ ! -d jpeg-8c ]; then
$CURL -L http://www.ijg.org/files/jpegsrc.v8c.tar.gz > jpegsrc.v8c.tar.gz
$TAR xzf jpegsrc.v8c.tar.gz
fi
cd jpeg-8c
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBDCA
# http://www.videolan.org/developers/libdca.html
#
build_libdca() {
cd $SRC
if [ ! -d libdca-0.0.5 ]; then
$CURL -L http://download.videolan.org/pub/videolan/libdca/0.0.5/libdca-0.0.5.tar.bz2 > libdca-0.0.5.tar.bz2
$TAR xjf libdca-0.0.5.tar.bz2
fi
cd libdca-0.0.5
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBDV
# http://libdv.sourceforge.net/
#
build_libdv() {
cd $SRC
if [ ! -d libdv-1.0.0 ]; then
$CURL -L http://puzzle.dl.sourceforge.net/project/libdv/libdv/1.0.0/libdv-1.0.0.tar.gz > libdv-1.0.0.tar.gz
$TAR xzf libdv-1.0.0.tar.gz
fi
cd libdv-1.0.0
set_flags
export LDFLAGS="$LDFLAGS -flat_namespace -undefined suppress"
./configure --disable-shared --disable-dependency-tracking --disable-xv --disable-gtk --disable-sdl --disable-asm --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBDVDCSS
# http://www.videolan.org/developers/libdvdcss.html
#
build_libdvdcss() {
cd $SRC
if [ ! -d libdvdcss-1.2.9 ]; then
$CURL -L http://download.videolan.org/pub/libdvdcss/1.2.9/libdvdcss-1.2.9.tar.gz > libdvdcss-1.2.9.tar.gz
$TAR xzf libdvdcss-1.2.9.tar.gz
fi
cd libdvdcss-1.2.9
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBDVDNAV
# svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdnav/
#
build_libdvdnav() {
cd $SRC
if [ "$FIXED_REVISIONS" == "yes" ]; then
REVISION="-r 1226"
else
REVISION=""
fi
if [ ! -d libdvdnav ]; then
$SVN checkout $REVISION svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdnav/ libdvdnav
cd libdvdnav
else
cd libdvdnav
$SVN update $REVISION
fi
set_flags
./autogen.sh --with-dvdread-config=$TARGET/bin/dvdread-config --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBDVDREAD
# svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread/
#
build_libdvdread() {
cd $SRC
if [ "$FIXED_REVISIONS" == "yes" ]; then
REVISION="-r 1226"
else
REVISION=""
fi
if [ ! -d libdvdread ]; then
$SVN checkout $REVISION svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread/ libdvdread
cd libdvdread
else
cd libdvdread
$SVN update $REVISION
fi
set_flags
./autogen.sh --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBMAD
# http://www.underbit.com/products/mad/
#
build_libmad() {
cd $SRC
if [ ! -d libmad-0.15.1b ]; then
$CURL -L ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz > libmad-0.15.1b.tar.gz
$TAR xzf libmad-0.15.1b.tar.gz
fi
cd libmad-0.15.1b
if [ "$ARCHITECTURE" == "i386" ]; then
set_flags "-arch i386"
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
else
set_flags "-arch ppc"
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
fi
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBMEDIAINFO
# http://sourceforge.net/projects/mediainfo/
#
build_libmediainfo() {
cd $SRC
if [ ! -d libmediainfo_0.7.44 ]; then
$CURL -L http://freefr.dl.sourceforge.net/project/mediainfo/source/libmediainfo/0.7.44/libmediainfo_0.7.44.tar.bz2 > libmediainfo_0.7.44.tar.bz2
$TAR xjf libmediainfo_0.7.44.tar.bz2 -s /MediaInfoLib/libmediainfo_0.7.44/
fi
cd libmediainfo_0.7.44
cd Project/GNU/Library
export CFLAGS=
export LDFLAGS=
export CXXFLAGS=
# Note: libmediainfo requires libzen source to compile
./autogen
./configure --enable-arch-i386 --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBOGG
# http://xiph.org/downloads/
#
build_libogg() {
cd $SRC
if [ ! -d libogg-1.2.2 ]; then
$CURL -L http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz > libogg-1.2.2.tar.gz
$TAR xzf libogg-1.2.2.tar.gz
fi
cd libogg-1.2.2
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBPNG
# http://www.libpng.org/pub/png/libpng.html
#
build_libpng() {
cd $SRC
if [ ! -d libpng-1.5.2 ]; then
$CURL -L http://mesh.dl.sourceforge.net/project/libpng/libpng15/1.5.2/libpng-1.5.2.tar.gz > libpng-1.5.2.tar.gz
$TAR xzf libpng-1.5.2.tar.gz
fi
cd libpng-1.5.2
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBTHEORA
# http://xiph.org/downloads/
#
build_libtheora() {
cd $SRC
if [ ! -d libtheora-1.1.1 ]; then
$CURL -L http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 > libtheora-1.1.1.tar.bz2
$TAR xjf libtheora-1.1.1.tar.bz2
fi
cd libtheora-1.1.1
if [ "$ARCHITECTURE" == "i386" ]; then
set_flags "-arch i386"
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
else
set_flags "-arch ppc"
./configure --disable-shared --disable-dependency-tracking --disable-asm --prefix=$TARGET
fi
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBVORBIS
# http://xiph.org/downloads/
#
build_libvorbis() {
cd $SRC
if [ ! -d libvorbis-1.3.2 ]; then
$CURL -L http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz > libvorbis-1.3.2.tar.gz
$TAR xzf libvorbis-1.3.2.tar.gz
fi
cd libvorbis-1.3.2
set_flags
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LIBZEN
# http://sourceforge.net/projects/zenlib/
#
build_libzen() {
cd $SRC
if [ ! -d libzen_0.4.19 ]; then
$CURL -L http://heanet.dl.sourceforge.net/project/zenlib/ZenLib%20-%20Sources/0.4.19/libzen_0.4.19.tar.bz2 > libzen_0.4.19.tar.bz2
$TAR xjf libzen_0.4.19.tar.bz2 -s /ZenLib/libzen_0.4.19/
# libmediainfo needs this
ln -s libzen_0.4.19 ZenLib
fi
cd libzen_0.4.19
cd Project/GNU/Library
export CFLAGS=
export LDFLAGS=
export CXXFLAGS=
./autogen
./configure --enable-arch-i386 --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# LZO2
# http://www.oberhumer.com/opensource/lzo/
#
build_lzo2() {
cd $SRC
if [ ! -d lzo-2.04 ]; then
$CURL -L http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz > lzo-2.04.tar.gz
$TAR xzf lzo-2.04.tar.gz
fi
cd lzo-2.04
if [ "$ARCHITECTURE" == "i386" ]; then
set_flags "-arch i386"
./configure --disable-shared --disable-dependency-tracking --prefix=$TARGET
else
set_flags "-arch ppc"
./configure --disable-shared --disable-dependency-tracking --disable-asm --prefix=$TARGET
fi
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# MPLAYER
# http://www.mplayerhq.hu/design7/news.html
#
build_mplayer() {
cd $SRC
if [ "$FIXED_REVISIONS" == "yes" ]; then
REVISION="-r 33325"
else
REVISION=""
fi
if [ -d mplayer ]; then
cd mplayer
$SVN update $REVISION
else
$SVN checkout $REVISION svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
fi
# Copy ffmpeg source to avoid making another git clone by configure
cp -rf $SRC/ffmpeg .
set_flags
# Flags for compiling mplayer
export CFLAGS="-O4 -fomit-frame-pointer -pipe $CFLAGS"
export CXXFLAGS="-O4 -fomit-frame-pointer -pipe -arch $CXXFLAGS"
export LDFLAGS="-arch $ARCHITECTURE"
./configure --extra-libs="-ldvdcss" --disable-x11 --disable-gl --disable-qtx \
--disable-dvdread-internal --enable-apple-remote --enable-theora --disable-libvorbis \
--with-freetype-config=$TARGET/bin/freetype-config --prefix=$TARGET
# Somehow -I/usr/X11/include still made it into the config.mak, regardless of the --disable-x11
$SED -i -e "s/-I\/usr\/X11\/include//g" config.mak
# Remove the ffmpeg directory and copy the compiled ffmpeg again to avoid "make" rebuilding it
rm -rf ffmpeg
cp -rf $SRC/ffmpeg .
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# NCURSES
# http://www.gnu.org/software/ncurses/
#
build_ncurses() {
cd $SRC
if [ ! -d ncurses-5.9 ]; then
$CURL -L http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz > ncurses-5.9.tar.gz
$TAR xzf ncurses-5.9.tar.gz
fi
cd ncurses-5.9
set_flags
./configure --without-shared --disable-shared --disable-dependency-tracking --prefix=$TARGET
$MAKE libs
$MAKE install.libs
cd $WORKDIR
}
##########################################
# PS3MEDIASERVER
# http://code.google.com/p/ps3mediaserver/
#
build_ps3mediaserver() {
cd $SRC
if [ "$FIXED_REVISIONS" == "yes" ]; then
REVISION="-r 560"
else
REVISION=""
fi
if [ -d ps3mediaserver ]; then
cd ps3mediaserver
$SVN update $REVISION
else
$SVN checkout $REVISION http://ps3mediaserver.googlecode.com/svn/trunk/ps3mediaserver ps3mediaserver
cd ps3mediaserver
fi
cd osx
# Overwrite with the home built tools
cp $TARGET/bin/dcraw .
cp $TARGET/bin/ffmpeg .
cp $TARGET/bin/flac .
cp $TARGET/bin/mplayer .
cp $TARGET/bin/mencoder .
cp $TARGET/bin/rtmpdump .
cp $TARGET/bin/tsMuxeR .
set_flags
$ANT DMG
cp pms-macosx-*.dmg $WORKDIR
cd $WORKDIR
}
##########################################
# RTMPDUMP
# http://www.mplayerhq.hu/design7/news.html
#
build_rtmpdump() {
cd $SRC
if [ "$FIXED_REVISIONS" == "yes" ]; then
REVISION="-r 568"
else
REVISION=""
fi
if [ -d rtmpdump ]; then
cd rtmpdump
$SVN update $REVISION
else
$SVN checkout $REVISION svn://svn.mplayerhq.hu/rtmpdump/trunk rtmpdump
cd rtmpdump
fi
set_flags
export XCFLAGS=$CFLAGS
export XLIBS=
# The Makefile uses the wrong variable ($XLDFLAGS) to compile, so copy $CFLAGS
export XLDFLAGS=$CFLAGS
$MAKE SYS=darwin
# Cannot use "make install" which installs to /usr/local instead of $TARGET.
cp rtmpdump $TARGET/bin
cp librtmp/librtmp.a $TARGET/lib
cd $WORKDIR
}
##########################################
# TSMUXER
# http://www.smlabs.net/en/products/tsmuxer/
# http://www.videohelp.com/tools/tsMuxeR
# Interesting Open Source followup project in development: https://github.com/kierank/libmpegts
#
build_tsMuxeR() {
cd $SRC
if [ ! -d tsMuxeR_1.10.6 ]; then
$CURL -H "Referer: http://www.videohelp.com/tools/tsMuxeR" -L http://www.videohelp.com/download/tsMuxeR_1.10.6.dmg > tsMuxeR_1.10.6.dmg
createdir tsMuxeR_1.10.6
fi
# Nothing to build. Just open the disk image, copy the binary and detach the disk image
$HDID tsMuxeR_1.10.6.dmg
cp -f /Volumes/tsMuxeR/tsMuxerGUI.app/Contents/MacOS/tsMuxeR tsMuxeR_1.10.6/tsMuxeR
cp -f tsMuxeR_1.10.6/tsMuxeR $TARGET/bin
$HDIUTIL detach /Volumes/tsMuxeR
cd $WORKDIR
}
##########################################
# X264
# svn://svn.videolan.org/x264/trunk
#
build_x264() {
cd $SRC
if [ -d x264 ]; then
cd x264
$GIT pull
else
$GIT clone git://git.videolan.org/x264.git x264
cd x264
fi
if [ "$FIXED_REVISIONS" == "yes" ]; then
$GIT checkout "`$GIT rev-list master -n 1 --first-parent --before=2011-04-24`"
fi
set_flags " "
./configure --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# XVID
# http://www.xvid.org/
#
build_xvid() {
cd $SRC
if [ ! -d xvidcore-1.3.1 ]; then
$CURL -L http://downloads.xvid.org/downloads/xvidcore-1.3.1.tar.gz > xvidcore-1.3.1.tar.gz
$TAR xzf xvidcore-1.3.1.tar.gz -s /xvidcore/xvidcore-1.3.1/
fi
cd xvidcore-1.3.1/build/generic
set_flags
./configure --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# ZLIB
# http://zlib.net/
#
build_zlib() {
cd $SRC
if [ ! -d zlib-1.2.5 ]; then
$CURL -L http://zlib.net/zlib-1.2.5.tar.gz > zlib-1.2.5.tar.gz
$TAR xzf zlib-1.2.5.tar.gz
fi
cd zlib-1.2.5
set_flags
./configure --prefix=$TARGET
$MAKE
$MAKE install
cd $WORKDIR
}
##########################################
# Finally, execute the script...
#
# Check requirements
check_xcode
check_yasm
check_git
# Initialize variables for compiling
initialize
# Build static libraries to link against
build_zlib
build_expat
build_faad2
build_fontconfig
build_freetype
build_giflib
build_jpeg
build_iconv
build_ncurses
build_libdca
build_libdv
build_libdvdcss
build_libdvdread
build_libdvdnav
build_libmad
build_libzen
# Note: libmediainfo requires libzen to build
build_libmediainfo
build_libogg
build_libpng
build_libtheora
build_libvorbis
build_lzo2
build_x264
build_xvid
# Build tools for including with PS3 Media Server
build_ffmpeg
build_flac
build_rtmpdump
build_dcrawU
build_tsMuxeR
build_mplayer
# Build PS3 Media Server itself
build_ps3mediaserver
