Skip to content

Commit

Permalink
[osx/build] Allow to specify a custom Avidemux version string and dmg…
Browse files Browse the repository at this point in the history
… filename
  • Loading branch information
eumagga0x2a committed Jul 7, 2017
1 parent 76d07d7 commit 425b944
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
16 changes: 11 additions & 5 deletions avidemux/osxInstaller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ FILE(RENAME "${ExeName}" "${BIN}/avidemux")
FILE(WRITE "${ExeName}" "#!/bin/sh\n")
FILE(APPEND "${ExeName}" "DIR=`dirname $0`\n")
FILE(APPEND "${ExeName}" "export FONTCONFIG_FILE=\"$DIR/../Resources/fonts/fonts.conf\"\n")
FILE(APPEND "${ExeName}" "cd \"$DIR\" && ./avidemux \"$@\"")
execute_process( COMMAND chmod +x ${ExeName})
FILE(APPEND "${ExeName}" "cd \"$DIR\" && ./avidemux \"$@\"\n")
execute_process( COMMAND chmod +x "${ExeName}")

# Create Qt.conf
SET(QT_CONF "${BUNDLE}/Contents/Resources/qt.conf")
Expand Down Expand Up @@ -134,15 +134,21 @@ ENDFOREACH(frame ${frameworks})
#
MESSAGE(STATUS "* Creating dmg *")
# Call cpack to create the dmg using the dragndrop installer
#
IF(NOT DMG_BASENAME)
SET(DMG_BASENAME "Avidemux ${AVIDEMUX_VERSION}")
IF(NOT RELEASE AND BUILD_REV)
SET(DMG_BASENAME "${DMG_BASENAME} ${BUILD_REV}")
ENDIF(NOT RELEASE AND BUILD_REV)
ENDIF(NOT DMG_BASENAME)

#
SET(CPACK_GENERATOR "DragNDrop")
SET(CPACK_PACKAGE_NAME "Avidemux")
SET(CPACK_PACKAGE_VENDOR "Mean")
SET(CPACK_SOURCE_GENERATOR "")
SET(CPACK_PACKAGE_FILE_NAME "Avidemux ${AVIDEMUX_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "${DMG_BASENAME}")
SET(CPACK_DMG_FORMAT "UDBZ")
SET(CPACK_DMG_VOLUME_NAME "Avidemux ${AVIDEMUX_VERSION}")
SET(CPACK_DMG_VOLUME_NAME "${CPACK_PACKAGE_FILE_NAME}")
SET(CPACK_BINARY_DRAGNDROP ON)
SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/avidemux_dmg.icns")
INSTALL(DIRECTORY ${BUNDLE} DESTINATION .
Expand Down
59 changes: 48 additions & 11 deletions bootStrapOsx_Sierra.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
export MYQT=/usr/local/Cellar/qt5/5.6.1-1/
#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 MAJOR=`cat cmake/avidemuxVersion.cmake | grep "VERSION_MAJOR " | sed 's/..$//g' | sed 's/^.*"//g'`
export MINOR=`cat cmake/avidemuxVersion.cmake | grep "VERSION_MINOR " | sed 's/..$//g' | sed 's/^.*"//g'`
export API_VERSION=2.$MINOR
export DAT=`date +"%Y-%m-%d_%H%M"`
export PATCH=`cat cmake/avidemuxVersion.cmake | grep "VERSION_P " | sed 's/..$//g' | sed 's/^.*"//g'`
export API_VERSION="${MAJOR}.${MINOR}"
export DAT=`date +"%y%m%d-%Hh%Mm"`
export gt=`git log --format=oneline -1 | head -c 11`
export REV="${DAT}_$gt"
#
Expand All @@ -15,7 +17,6 @@ export REV="${DAT}_$gt"
export FLAVOR="-DENABLE_QT5=True"
export qt_ext=Qt5
#
echo "Revision : $REV"
packages_ext=""
do_core=1
do_cli=1
Expand Down Expand Up @@ -71,7 +72,7 @@ Process()
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
cmake $COMPILER $PKG $FAKEROOT -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_EDIT_COMMAND=vim -DAVIDEMUX_SOURCE_DIR=$TOP -DAVIDEMUX_VERSION="$ADM_VERSION" $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
Expand All @@ -93,6 +94,12 @@ config()
if [ "x$debug" = "x1" ] ; then echo "Debug build"
else echo "Release build"
fi
if [ "x$adm_version" = "x" ] ; then
export ADM_VERSION="${MAJOR}.${MINOR}.${PATCH}"
else
export ADM_VERSION=$adm_version
fi
echo "Avidemux version : $ADM_VERSION"
if [ "x$create_app_bundle" != "x1" ] ; then
echo "No macOS app bundle will be created"
fi
Expand All @@ -114,6 +121,8 @@ usage()
echo " --nopkg : Don't create macOS app bundle"
echo " --debug : Switch debugging on"
echo " --rebuild : Preserve existing build directories"
echo " --output=NAME : Specify a custom basename for dmg"
echo " --version=STRING : Specify a custom Avidemux version string"
echo " --with-core : Build core (default)"
echo " --without-core : Don't build core"
echo " --with-cli : Build cli (default)"
Expand All @@ -123,11 +132,34 @@ usage()
echo " --with-plugins : Build plugins (default)"
echo " --without-plugins : Don't build plugins"
config

}
option_value()
{
echo $(echo $* | cut -d '=' -f 2-)
}
validate()
{
opt="$1"
str="$2"
if [ "$opt" = "adm_version" ] ; then
reg="[^a-zA-Z0-9_.-]"
msg="Only alphanumeric characters, hyphen, underscore and period are allowed for Avidemux version, aborting."
elif [ "$opt" = "output" ] ; then
reg="[^a-zA-Z0-9\ _.-]"
msg="Only alphanumeric characters, space, hyphen, underscore and period are allowed for .dmg basename, aborting."
else
>&2 echo "incorrect usage of validate(), aborting."
exit 1
fi
if [[ "$str" =~ $reg ]] ; then
>&2 echo $msg
exit 1
fi
}
# Could probably do it with getopts...
while [ $# != 0 ] ;do
case "$1" in
config_option="$1"
case "$config_option" in
-h|--help)
usage
exit 1
Expand All @@ -138,16 +170,19 @@ while [ $# != 0 ] ;do
--rebuild)
do_rebuild=1
;;
--pause)
pause_script=true
;;
--tgz)
packages_ext=tar.gz
PKG="$PKG -DAVIDEMUX_PACKAGER=tgz"
;;
--nopkg)
create_app_bundle=0
;;
--output=*)
output=$(option_value "$config_option")
;;
--version=*)
adm_version=$(option_value "$config_option")
;;
--without-qt)
do_qt4=0
;;
Expand All @@ -173,13 +208,15 @@ while [ $# != 0 ] ;do
do_core=1
;;
*)
echo "unknown parameter $1"
echo "unknown parameter $config_option"
usage
exit 1
;;
esac
shift
done
validate adm_version "$adm_version" || exit 1
validate output "$output" || exit 1
config
echo "** BootStrapping avidemux **"
export TOP=$PWD
Expand Down Expand Up @@ -235,7 +272,7 @@ if [ "x$create_app_bundle" = "x1" ] ; then
mkdir -p installer
rm -Rf installer/*
cd installer
cmake ../avidemux/osxInstaller
cmake -DAVIDEMUX_VERSION="$ADM_VERSION" -DDMG_BASENAME="$output" -DBUILD_REV="$REV" ../avidemux/osxInstaller
make && make package
echo "** Preparing packaging **"
fi
Expand Down
4 changes: 3 additions & 1 deletion cmake/avidemuxVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ SET(CPACK_PACKAGE_VERSION_MINOR "7")
SET(CPACK_PACKAGE_VERSION_P "0")
SET(AVIDEMUX_MAJOR_MINOR "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_P}")
SET(AVIDEMUX_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
IF(NOT AVIDEMUX_VERSION)
SET(AVIDEMUX_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
ENDIF(NOT AVIDEMUX_VERSION)
SET(AVIDEMUX_API_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
IF(NOT RELEASE)
# use date instead of subversion, we use git now
Expand Down

0 comments on commit 425b944

Please sign in to comment.