1#!/bin/bash 2# Bootstrapper to semi-automatically build avidemux from source on OSX 3# (c) Mean 2009 4 5# Specify the the directory where you want to install avidemux (a.k.a. the cmake_install_prefix) 6# like export BASE_INSTALL_DIR="<full_path_to_installation>". This can be /usr/local or /opt/local (macports) or /sw (Fink) 7export DAT=`date +"%Y_%m_%d"` 8export gt=`git log --format=oneline -1 | head -c 11` 9export REV="${DAT}_$gt" 10# 11export BASE_INSTALL_DIR="/"; 12export BASE_APP="$HOME/Avidemux2.6.app/" 13export PREFIX="${BASE_APP}/Contents/Resources/" 14rm ~/A*.dmg 15rm -Rf $BASE_APP/* 16mkdir -p $BASE_APP 17mkdir -p $BASE_APP/Contents 18mkdir -p $BASE_APP/Contents/Resources 19echo "Revision : $REV" 20packages_ext="" 21do_core=1 22do_cli=0 23do_gtk=0 # Note that gtk is no fully longer supported on OSX. You are on your own here 24do_qt4=1 25do_plugins=1 26debug=0 27fail() 28{ 29 echo "** Failed at $1**" 30 exit 1 31} 32 33rm -Rf $PREFIX/* 34Process() 35{ 36 export BUILDDIR=$1 37 export SOURCEDIR=$2 38 export FAKEROOT="-DFAKEROOT=$FAKEROOT_DIR" 39 export EXTRA="$3" 40 export DEBUG="" 41 BUILDER="Unix Makefiles" 42 echo "**************** $1 *******************" 43 if [ "x$debug" = "x1" ] ; then 44 DEBUG="-DVERBOSE=1 -DCMAKE_BUILD_TYPE=Debug " 45 BUILDDIR="${BUILDDIR}_debug" 46 BUILDER="CodeBlocks - Unix Makefiles" 47 fi 48 49 echo "Building $BUILDDIR from $SOURCEDIR with EXTRA=<$EXTRA>, DEBUG=<$DEBUG>" 50 rm -Rf ./$BUILDDIR 51 mkdir $BUILDDIR || fail mkdir 52 cd $BUILDDIR 53 cmake $PKG $FAKEROOT -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_EDIT_COMMAND=vim -DAVIDEMUX_SOURCE_DIR=$TOP $EXTRA $DEBUG -G "$BUILDER" $SOURCEDIR || fail cmakeZ 54 make -j 2 > /tmp/log$BUILDDIR || fail make 55 echo "** installing at $FAKEROOT_DIR **" 56 make install DESTDIR=$FAKEROOT_DIR || fail install 57} 58printModule() 59{ 60 value=$1 61 name=$2 62 if [ "x$value" = "x1" ]; then echo " $name will be built" 63 else echo " $name will be skipped" 64 fi 65 66 67} 68config() 69{ 70 echo "Build configuration :" 71 echo "******************* :" 72 echo "Build type :" 73 if [ "x$debug" = "x1" ] ; then echo "Debug build" 74 else echo "Release build" 75 fi 76 printModule $do_core Core 77 printModule $do_gtk Gtk 78 printModule $do_qt4 Qt4 79 printModule $do_cli Cli 80 printModule $do_plugins Plugins 81} 82usage() 83{ 84 echo "Bootstrap avidemux 2.6:" 85 echo "***********************" 86 echo " --help : Print usage" 87 echo " --tgz : Build tgz packages" 88 echo " --debug : Switch debugging on" 89 echo " --with-core : Build core" 90 echo " --without-core : Dont build core" 91 echo " --with-cli : Build cli" 92 echo " --without-cli : Dont build cli" 93 echo " --with-core : Build core" 94 echo " --without-qt4 : Dont build qt4" 95 echo " --with-plugins : Build plugins" 96 echo " --without-plugins : Dont build plugins" 97 config 98 99} 100# Could probably do it with getopts... 101while [ $# != 0 ] ;do 102 case "$1" in 103 -h|--help) 104 usage 105 exit 1 106 ;; 107 --debug) 108 debug=1 109 ;; 110 --pause) 111 pause_script=true 112 ;; 113 --tgz) 114 packages_ext=tar.gz 115 PKG="$PKG -DAVIDEMUX_PACKAGER=tgz" 116 ;; 117 --without-qt4) 118 do_qt4=0 119 ;; 120 --without-cli) 121 do_cli=0 122 ;; 123 --without-plugins) 124 do_plugins=0 125 ;; 126 --without-core) 127 do_core=0 128 ;; 129 --with-qt4) 130 do_qt4=1 131 ;; 132 --with-cli) 133 do_cli=1 134 ;; 135 --with-plugins) 136 do_plugins=1 137 ;; 138 --with-core) 139 do_core=1 140 ;; 141 *) 142 echo "unknown parameter $1" 143 usage 144 exit 1 145 ;; 146 esac 147 shift 148done 149config 150echo "**BootStrapping avidemux **" 151export TOP=$PWD 152export POSTFIX="" 153echo "Top dir : $TOP" 154if [ "x$debug" = "x1" ] ; then echo 155POSTFIX="_debug" 156fi 157 158if [ "x$do_core" = "x1" ] ; then 159 echo "** CORE **" 160 cd $TOP 161 Process buildCore ../avidemux_core 162fi 163if [ "x$do_qt4" = "x1" ] ; then 164 echo "** QT4 **" 165 cd $TOP 166 Process buildQt4 ../avidemux/qt4 167fi 168if [ "x$do_cli" = "x1" ] ; then 169 echo "** CLI **" 170 cd $TOP 171 Process buildCli ../avidemux/cli 172fi 173if [ "x$do_plugins" = "x1" ] ; then 174 echo "** Plugins **" 175 cd $TOP 176 Process buildPluginsCommon ../avidemux_plugins -DPLUGIN_UI=COMMON 177fi 178if [ "x$do_plugins" = "x1" -a "x$do_qt4" = "x1" ] ; then 179 echo "** Plugins Qt4 **" 180 cd $TOP 181 Process buildPluginsQt4 ../avidemux_plugins -DPLUGIN_UI=QT4 182fi 183if [ "x$do_plugins" = "x1" -a "x$do_cli" = "x1" ] ; then 184 echo "** Plugins CLI **" 185 cd $TOP 186 Process buildPluginsCLI ../avidemux_plugins -DPLUGIN_UI=CLI 187fi 188echo "** Copying Qt nib files**" 189cp -Rap /opt/local/Library/Frameworks/QtGui.framework/Resources/qt_menu.nib $PREFIX/bin/ 190echo "** Changing link path**" 191python $TOP/cmake/osx_libs.py 192echo "* Copying make files **" 193cp $TOP/cmake/osx/Info.plist $PREFIX/../ 194mkdir -p $PREFIX/../MacOS 195cp $TOP/cmake/osx/Avidemux2.6 $PREFIX/../MacOS/Avidemux2.6.app 196chmod +x $PREFIX/../MacOS/Avidemux2.6.app 197# Copy icons 198echo "Copying icons" 199cp $TOP/cmake/osx/*.icns $PREFIX/ 200# creating dmg file 201cd $TOP 202rm -f *.dmg 203hdiutil create Avidemux2.6_r${REV}.dmg -srcfolder $HOME/Avidemux2.6.app/ -ov 204echo "** Preparing packaging **" 205echo "** ALL DONE **" 206