Skip to content

Commit

Permalink
[osx/build] Fix i18n dir path + fix Qt plugin path in avidemux_jobs +…
Browse files Browse the repository at this point in the history
… add --nopkg build option to skip creating an app bundle
  • Loading branch information
eumagga0x2a committed Jul 5, 2017
1 parent 378a396 commit 7f58916
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 79 deletions.
5 changes: 2 additions & 3 deletions avidemux/qt4/ADM_jobs/src/ADM_jobControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,11 @@ bool jobWindow::popup(const char *errorMessage)
bool jobRun(int ac,char **av)
{

#if defined(__APPLE__)
#if defined(__APPLE__) && defined(CREATE_BUNDLE)
printf("Setting qt plugin folder\n");
QDir dir(QApplication::applicationDirPath());
dir.cdUp();
dir.cdUp();
dir.cd("plugins");
dir.cd("PlugIns");
printf("New plugin path =%s\n",dir.absolutePath().toUtf8().constData());
QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif
Expand Down
9 changes: 4 additions & 5 deletions avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,10 +1580,8 @@ int UI_Init(int nargc, char **nargv)
global_argc=nargc;
global_argv=nargv;
ADM_renderLibInit(&UI_Hooks);
Q_INIT_RESOURCE(avidemux);
Q_INIT_RESOURCE(filter);

#if defined(__APPLE__)
#if defined(__APPLE__) && defined(CREATE_BUNDLE)
printf("Setting qt plugin folder\n");
QDir dir(QApplication::applicationDirPath());
dir.cdUp();
Expand All @@ -1593,8 +1591,9 @@ int UI_Init(int nargc, char **nargv)
#endif
myApplication=new myQApplication (global_argc, global_argv);
myApplication->connect(myApplication, SIGNAL(lastWindowClosed()), myApplication, SLOT(quit()));
myApplication->connect(myApplication, SIGNAL(aboutToQuit()), myApplication, SLOT(cleanup()));

myApplication->connect(myApplication, SIGNAL(aboutToQuit()), myApplication, SLOT(cleanup()));
Q_INIT_RESOURCE(avidemux);
Q_INIT_RESOURCE(filter);

loadTranslator();

Expand Down
30 changes: 21 additions & 9 deletions avidemux/qt4/adm_osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#
SET(bundle avidemux3_${QT_EXTENSION})
#
IF(CREATE_BUNDLE)
ADD_DEFINITIONS(-DCREATE_BUNDLE)
ENDIF(CREATE_BUNDLE)
#
MACRO(ADM_PREBUILD)
LIST(APPEND PlatformLibs "-lm -lstdc++")
LIST(APPEND PlatformLibs "-framework CoreServices -framework CoreAudio -framework AudioUnit -framework Carbon")
Expand All @@ -13,22 +17,30 @@ ENDMACRO(ADM_PREBUILD)
MACRO(ADM_MAIN_APP)
SET(S_VERSION "${AVIDEMUX_MAJOR_MINOR}") # Short version
SET(B_VERSION "${AVIDEMUX_VERSION}") # Long version
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_BINARY_DIR}/Info.plist @ONLY)
ADD_EXECUTABLE(avidemux3_${QT_EXTENSION} MACOSX_BUNDLE ${ADM_EXE_SRCS})
IF(CREATE_BUNDLE)
ADD_EXECUTABLE(avidemux3_${QT_EXTENSION} MACOSX_BUNDLE ${ADM_EXE_SRCS})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_BINARY_DIR}/Info.plist @ONLY)
SET( MACOSX_BUNDLE_INFO_STRING "Avidemux - version ${AVIDEMUX_MAJOR_MINOR}" )
SET( MACOSX_BUNDLE_BUNDLE_VERSION "${AVIDEMUX_MAJOR_MINOR}" )
SET( MACOSX_BUNDLE_ICON_FILE avidemux.icns )
SET_PROPERTY(TARGET avidemux3_${QT_EXTENSION} PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/Info.plist)
SET_SOURCE_FILES_PROPERTIES(avidemux.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
ELSE(CREATE_BUNDLE)
ADD_EXECUTABLE(avidemux3_${QT_EXTENSION} ${ADM_EXE_SRCS})
ENDIF(CREATE_BUNDLE)
SET_PROPERTY(TARGET avidemux3_${QT_EXTENSION} PROPERTY OUTPUT_NAME Avidemux${AVIDEMUX_MAJOR_MINOR})
SET( MACOSX_BUNDLE_INFO_STRING "Avidemux - version ${AVIDEMUX_MAJOR_MINOR}" )
SET( MACOSX_BUNDLE_BUNDLE_VERSION "${AVIDEMUX_MAJOR_MINOR}" )
SET( MACOSX_BUNDLE_ICON_FILE avidemux.icns )
SET_PROPERTY(TARGET avidemux3_${QT_EXTENSION} PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/Info.plist)
SET_SOURCE_FILES_PROPERTIES(avidemux.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
qt5_use_modules( avidemux3_${QT_EXTENSION} Widgets Network)
IF (USE_SDL)
TARGET_LINK_LIBRARIES(avidemux3_${QT_EXTENSION} ADM_libsdl)
ENDIF(USE_SDL)
ENDMACRO(ADM_MAIN_APP)
#
MACRO(ADM_POSTBUILD)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/..)
INSTALL(TARGETS avidemux3_${QT_EXTENSION} BUNDLE DESTINATION . COMPONENT RUNTIME)
IF(CREATE_BUNDLE)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/..)
INSTALL(TARGETS avidemux3_${QT_EXTENSION} BUNDLE DESTINATION . COMPONENT RUNTIME)
ELSE(CREATE_BUNDLE)
ADM_INSTALL_BIN(avidemux3_${QT_EXTENSION})
ENDIF(CREATE_BUNDLE)
ENDMACRO(ADM_POSTBUILD)

6 changes: 5 additions & 1 deletion avidemux_core/ADM_core/src/ADM_folder_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ void ADM_initBaseDir(int argc, char *argv[])
const std::string ADM_getI8NDir(const std::string &flavor)
{

std::string partialPath=flavor+std::string("/i18n/");
std::string partialPath=flavor+std::string("/i18n");
#ifdef CREATE_BUNDLE
char *ppath=ADM_getInstallRelativePath("../Resources/share","avidemux6",partialPath.c_str());
#else
char *ppath=ADM_getInstallRelativePath("../share","avidemux6",partialPath.c_str());
#endif
std::string r=std::string(ppath);
delete [] ppath;
ppath=NULL;
Expand Down
3 changes: 3 additions & 0 deletions avidemux_core/ADM_core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ IF (MINGW)
SET(ADM_core_SRCS ${ADM_core_SRCS} ADM_crashdump_mingw.cpp ADM_folder_win32.cpp ADM_folder_mingw.cpp ADM_win32_mingw.cpp )
ELSEIF (APPLE)
SET(ADM_core_SRCS ${ADM_core_SRCS} ADM_crashdump_apple.cpp ADM_folder_mac.cpp)
IF(CREATE_BUNDLE)
ADD_DEFINITIONS(-DCREATE_BUNDLE)
ENDIF(CREATE_BUNDLE)
ELSEIF (UNIX)
SET(ADM_core_SRCS ${ADM_core_SRCS} ADM_crashdump_unix.cpp ADM_folder_linux.cpp)
ELSEIF (MSVC)
Expand Down
145 changes: 84 additions & 61 deletions bootStrapOsx_Sierra.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
# Bootstrapper to semi-automatically build avidemux from source on OSX
# (c) Mean 2009
export MYQT=/usr/local/Cellar/qt5/5.6.1-1/
export PATH=$PATH:$MYQT/bin/:/usr/local/bin:/opt//local/libexec/qt5/bin/ # Both brew and macport
#export MYQT=/usr/local/Cellar/qt/5.9.1
export PATH=$PATH:$MYQT/bin:/usr/local/bin:/opt/local/libexec/qt5/bin # Both brew and macport
export MINOR=`cat cmake/avidemuxVersion.cmake | grep "VERSION_MINOR " | sed 's/..$//g' | sed 's/^.*"//g'`
export API_VERSION=2.$MINOR
# Specify the the directory where you want to install avidemux (a.k.a. the cmake_install_prefix)
# like export BASE_INSTALL_DIR="<full_path_to_installation>". This can be /usr/local or /opt/local (macports) or /sw (Fink)
export DAT=`date +"%Y_%m_%d"`
export DAT=`date +"%Y-%m-%d_%H%M"`
export gt=`git log --format=oneline -1 | head -c 11`
export REV="${DAT}_$gt"
#
Expand All @@ -16,14 +15,6 @@ export REV="${DAT}_$gt"
export FLAVOR="-DENABLE_QT5=True"
export qt_ext=Qt5
#
export BASE_INSTALL_DIR="/";
export BASE_APP="$PWD/Avidemux${API_VERSION}.app/"
export PREFIX="${BASE_APP}/Contents/Resources/"
rm ~/A*.dmg
rm -Rf $BASE_APP/*
mkdir -p $BASE_APP
mkdir -p $BASE_APP/Contents
mkdir -p $BASE_APP/Contents/Resources
echo "Revision : $REV"
packages_ext=""
do_core=1
Expand All @@ -33,6 +24,7 @@ do_qt4=1
do_plugins=1
do_rebuild=0
debug=0
create_app_bundle=1
#
test -f $HOME/myCC && export COMPILER="-DCMAKE_C_COMPILER=$HOME/myCC -DCMAKE_CXX_COMPILER=$HOME/myC++"

Expand All @@ -41,7 +33,23 @@ fail()
echo "** Failed at $1**"
exit 1
}
rm -Rf $PREFIX/*
setupPaths()
{
# Specify the the directory where you want to install avidemux (a.k.a. the cmake_install_prefix)
# like export BASE_INSTALL_DIR="<full_path_to_installation>". This can be /usr/local or /opt/local (macports) or /sw (Fink)
if [ "x$create_app_bundle" = "x1" ] ; then
export BASE_INSTALL_DIR="/"
export BASE_APP="$PWD/Avidemux${API_VERSION}.app"
export PREFIX="${BASE_APP}/Contents/Resources"
if [ ! -e $BASE_APP/Contents/Resources ] ; then
mkdir -p $BASE_APP/Contents/Resources
fi
else
export BASE_INSTALL_DIR="$PWD/out"
export BASE_APP="$BASE_INSTALL_DIR"
export PREFIX="$BASE_INSTALL_DIR"
fi
}
Process()
{
export BUILDDIR=$1
Expand All @@ -50,23 +58,23 @@ Process()
export EXTRA="$3"
export DEBUG=""
BUILDER="Unix Makefiles"
echo "**************** $1 *******************"
echo "**************** $1 *******************"
if [ "x$debug" = "x1" ] ; then
DEBUG="-DVERBOSE=1 -DCMAKE_BUILD_TYPE=Debug "
BUILDDIR="${BUILDDIR}_debug"
BUILDER="CodeBlocks - Unix Makefiles"
fi

echo "Building $BUILDDIR from $SOURCEDIR with EXTRA=<$EXTRA>, DEBUG=<$DEBUG>"
if [ "x$do_rebuild" != x1 ] ; then
rm -Rf ./$BUILDDIR
fi
rm -Rf ./$BUILDDIR
fi
mkdir -p $BUILDDIR || fail mkdir
cd $BUILDDIR
cmake $COMPILER $PKG $FAKEROOT -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_EDIT_COMMAND=vim -DAVIDEMUX_SOURCE_DIR=$TOP $EXTRA $FLAVOR $DEBUG -G "$BUILDER" $SOURCEDIR || fail cmakeZ
make -j 2 > /tmp/log$BUILDDIR || fail make
echo "** installing at $FAKEROOT_DIR **"
make install DESTDIR=$FAKEROOT_DIR || fail install
echo "** installing at $FAKEROOT_DIR **"
make install DESTDIR=$FAKEROOT_DIR || fail install
}
printModule()
{
Expand All @@ -75,20 +83,25 @@ printModule()
if [ "x$value" = "x1" ]; then echo " $name will be built"
else echo " $name will be skipped"
fi


}
config()
{
setupPaths
echo "Build configuration :"
echo "******************* :"
echo "Build type :"
if [ "x$debug" = "x1" ] ; then echo "Debug build"
else echo "Release build"
fi
if [ "x$create_app_bundle" != "x1" ] ; then
echo "No macOS app bundle will be created"
fi
if [ "x$do_rebuild" != "x1" -a "x$BASE_APP" != "x" ] ; then
rm -Rf $BASE_APP/*
fi
printModule $do_core Core
printModule $do_gtk Gtk
printModule $do_qt4 Qt4
printModule $do_qt4 Qt
printModule $do_cli Cli
printModule $do_plugins Plugins
}
Expand All @@ -98,17 +111,18 @@ usage()
echo "***********************"
echo " --help : Print usage"
echo " --tgz : Build tgz packages"
echo " --nopkg : Don't create macOS app bundle"
echo " --debug : Switch debugging on"
echo " --rebuild : Preserve existing build directories"
echo " --with-core : Build core"
echo " --without-core : Dont build core"
echo " --with-cli : Build cli"
echo " --without-cli : Dont build cli"
echo " --with-core : Build core"
echo " --without-qt4 : Dont build qt4"
echo " --with-plugins : Build plugins"
echo " --without-plugins : Dont build plugins"
config
echo " --rebuild : Preserve existing build directories"
echo " --with-core : Build core (default)"
echo " --without-core : Don't build core"
echo " --with-cli : Build cli (default)"
echo " --without-cli : Don't build cli"
echo " --with-qt : Build qt (default)"
echo " --without-qt : Don't build qt"
echo " --with-plugins : Build plugins (default)"
echo " --without-plugins : Don't build plugins"
config

}
# Could probably do it with getopts...
Expand All @@ -131,7 +145,10 @@ while [ $# != 0 ] ;do
packages_ext=tar.gz
PKG="$PKG -DAVIDEMUX_PACKAGER=tgz"
;;
--without-qt4)
--nopkg)
create_app_bundle=0
;;
--without-qt)
do_qt4=0
;;
--without-cli)
Expand All @@ -143,7 +160,7 @@ while [ $# != 0 ] ;do
--without-core)
do_core=0
;;
--with-qt4)
--with-qt)
do_qt4=1
;;
--with-cli)
Expand All @@ -164,56 +181,62 @@ while [ $# != 0 ] ;do
shift
done
config
echo "**BootStrapping avidemux **"
echo "** BootStrapping avidemux **"
export TOP=$PWD
export POSTFIX=""
echo "Top dir : $TOP"
if [ "x$debug" = "x1" ] ; then echo
if [ "x$debug" = "x1" ] ; then echo
POSTFIX="_debug"
fi

if [ "x$do_core" = "x1" ] ; then
if [ "x$create_app_bundle" = "x1" ] ; then
export DO_BUNDLE="-DCREATE_BUNDLE=true"
else
export DO_BUNDLE=""
fi
if [ "x$do_core" = "x1" ] ; then
echo "** CORE **"
cd $TOP
Process buildCore ../avidemux_core
Process buildCore ../avidemux_core $DO_BUNDLE
fi
if [ "x$do_qt4" = "x1" ] ; then
echo "** QT4 **"
if [ "x$do_qt4" = "x1" ] ; then
echo "** QT **"
cd $TOP
Process buildQt4 ../avidemux/qt4
Process build${qt_ext} ../avidemux/qt4 $DO_BUNDLE
fi
if [ "x$do_cli" = "x1" ] ; then
if [ "x$do_cli" = "x1" ] ; then
echo "** CLI **"
cd $TOP
Process buildCli ../avidemux/cli
fi
if [ "x$do_plugins" = "x1" ] ; then
if [ "x$do_plugins" = "x1" ] ; then
echo "** Plugins **"
cd $TOP
Process buildPluginsCommon ../avidemux_plugins -DPLUGIN_UI=COMMON
Process buildPluginsCommon ../avidemux_plugins -DPLUGIN_UI=COMMON
fi
if [ "x$do_plugins" = "x1" -a "x$do_qt4" = "x1" ] ; then
echo "** Plugins Qt4 **"
if [ "x$do_plugins" = "x1" -a "x$do_qt4" = "x1" ] ; then
echo "** Plugins Qt **"
cd $TOP
Process buildPluginsQt4 ../avidemux_plugins -DPLUGIN_UI=QT4
Process buildPlugins${qt_ext} ../avidemux_plugins -DPLUGIN_UI=QT4
fi
if [ "x$do_plugins" = "x1" -a "x$do_cli" = "x1" ] ; then
if [ "x$do_plugins" = "x1" -a "x$do_cli" = "x1" ] ; then
echo "** Plugins CLI **"
cd $TOP
Process buildPluginsCLI ../avidemux_plugins -DPLUGIN_UI=CLI
Process buildPluginsCLI ../avidemux_plugins -DPLUGIN_UI=CLI
fi
mkdir $PREFIX/fonts
cp $TOP/cmake/osx/fonts.conf $PREFIX/fonts
mkdir -p $PREFIX/../MacOS
# Copy icons
echo "Copying icons"
cp $TOP/cmake/osx/*.icns $PREFIX/
#
cd $TOP
mkdir -p installer
rm -Rf installer/*
cd installer
cmake -DAVIDEMUX_MAJOR_MINOR="2.7" ../avidemux/osxInstaller/
make && make install
if [ "x$create_app_bundle" = "x1" ] ; then
mkdir $PREFIX/fonts
cp $TOP/cmake/osx/fonts.conf $PREFIX/fonts
# Copy icons
echo "Copying icons"
cp $TOP/cmake/osx/*.icns $PREFIX/
mkdir -p $PREFIX/../MacOS
mkdir -p installer
rm -Rf installer/*
cd installer
cmake -DAVIDEMUX_MAJOR_MINOR="2.7" ../avidemux/osxInstaller
make && make install
echo "** Preparing packaging **"
fi
echo "** ALL DONE **"

0 comments on commit 7f58916

Please sign in to comment.