Commit 9520ddeb authored by Craig Watson's avatar Craig Watson

Reworked build and deployment scripts for linux:

- Separated building and packaging
- OpenBoard is now installed in /opt/openboard instead of
/usr/local/OpenBoard-$VERSION/
- Placed a shortcut to run.sh in /usr/bin (so it can be executed with
the `openboard` command)
- Corrected .deb control files to avoid warnings e.g when installing via
software center on Ubuntu
- Added xdg bindings so that .ubz files are recognized and opened
automatically with OpenBoard

- Moved the release scripts into their own folder to clean up the
repository root a bit

(Merge branch 'new-release-script-linux' into dev)
parents f70ff4ac 88c1feaf
......@@ -61,6 +61,8 @@ Makefile
Makefile.Debug
Makefile.Release
buildContext
# plugins #
###########
......
This diff is collapsed.
#!/bin/bash
# --------------------------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
initializeVariables()
{
APPLICATION_NAME="OpenBoard"
STANDARD_QT_USED=false
# Root directory
PROJECT_ROOT="`pwd`/../.."
BUILD_DIR="$PROJECT_ROOT/build/linux/release"
PRODUCT_PATH="$BUILD_DIR/product"
# Qt installation path. This may vary across machines
QT_PATH="/opt/qt55"
PLUGINS_PATH="$QT_PATH/plugins"
GUI_TRANSLATIONS_DIRECTORY_PATH="$QT_PATH/translations"
QT_LIBRARY_DEST_PATH="$PRODUCT_PATH/qtlib"
QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib"
QMAKE_PATH="$QT_PATH/bin/qmake"
LRELEASES="$QT_PATH/bin/lrelease"
NOTIFY_CMD=`which notify-send`
ZIP_PATH=`which zip`
if [ -z $ARCHITECTURE ]; then
ARCHITECTURE=`uname -m`
if [ $ARCHITECTURE == "x86_64" ]; then
ARCHITECTURE="amd64"
fi
fi
}
notifyError(){
if [ -e "$NOTIFY_CMD" ]; then
$NOTIFY_CMD -t 0 -i "/usr/share/icons/oxygen/64x64/status/dialog-error.png" "$1"
fi
printf "\033[31merror:\033[0m $1\n"
exit 1
}
notifyProgress(){
if [ -e "$NOTIFY_CMD" ]; then
$NOTIFY_CMD "$1" "$2"
fi
printf "\033[32m--> Achieved task:\033[0m $1:\n\t$2\n"
}
checkDir(){
if [ ! -d "$1" ]; then
notifyError "Directory not found : $1"
fi
}
checkExecutable(){
if [ ! -e "$1" ]; then
notifyError "$1 command not found"
fi
}
buildWithStandardQt(){
# if both Qt4 and Qt5 are installed, choose Qt5
export QT_SELECT=5
STANDARD_QT=`which qmake`
if [ $? == "0" ]; then
QT_VERSION=`$STANDARD_QT --version | grep -i "Using Qt version" | sed -e "s/Using Qt version \(.*\) in.*/\1/"`
if [ `echo $QT_VERSION | sed -e "s/\.//g"` -gt 480 ]; then
notifyProgress "Standard QT" "A recent enough qmake has been found. Using this one instead of custom one"
STANDARD_QT_USED=true
QMAKE_PATH=$STANDARD_QT
LRELEASES=`which lrelease`
PLUGINS_PATH="$STANDARD_QT/../plugins"
fi
fi
}
buildImporter(){
IMPORTER_DIR="../OpenBoard-Importer/"
IMPORTER_NAME="OpenBoardImporter"
checkDir $IMPORTER_DIR
cd ${IMPORTER_DIR}
rm moc_*
rm -rf debug release
rm *.o
notifyProgress "Building importer"
$QMAKE_PATH ${IMPORTER_NAME}.pro
make clean
make -j4
checkExecutable $IMPORTER_NAME
cd -
}
createBuildContext() {
BUILD_CONTEXT="buildContext"
echo $ARCHITECTURE > $BUILD_CONTEXT
}
# Check command-line arguments to force an architecture
for var in "$@"
do
if [ $var == "i386" ]; then
ARCHITECTURE="i386"
fi
if [ $var == "amd64" ]; then
ARCHITECTURE="amd64"
fi
done
initializeVariables
#buildWithStandardQt
createBuildContext
cd $PROJECT_ROOT
# check of directories and executables
checkDir $QT_PATH
checkDir $PLUGINS_PATH
checkDir $GUI_TRANSLATIONS_DIRECTORY_PATH
checkExecutable $QMAKE_PATH
checkExecutable $LRELEASES
checkExecutable $ZIP_PATH
#build third party application
buildImporter
notifyProgress "OpenBoardImporter" "Built Importer"
# cleaning the build directory
rm -rf $BUILD_DIR
# Generate translations
notifyProgress "QT" "Internationalization"
$LRELEASES ${APPLICATION_NAME}.pro
cd $GUI_TRANSLATIONS_DIRECTORY_PATH
$LRELEASES translations.pro
cd -
notifyProgress "${APPLICATION_NAME}" "Building ${APPLICATION_NAME}"
if [ "$ARCHITECTURE" == "amd64" ] || [ "$ARCHITECTURE" == "x86_64" ]; then
$QMAKE_PATH ${APPLICATION_NAME}.pro -spec linux-g++-64
else
$QMAKE_PATH ${APPLICATION_NAME}.pro -spec linux-g++
fi
make -j4 release-install
if [ ! -e "$PRODUCT_PATH/${APPLICATION_NAME}" ]; then
notifyError "${APPLICATION_NAME} build failed"
else
notifyProgress "Finished building OpenBoard. You may now run the packaging script."
fi
#!/bin/bash
# --------------------------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
xdg-mime install --mode system /opt/openboard/etc/openboard-ubz.xml
xdg-desktop-menu install --novendor /usr/share/applications/openboard.desktop
xdg-mime default /usr/share/applications/openboard.desktop application/ubz
ln -s /opt/openboard/run.sh /usr/bin/openboard
exit 0
#!/bin/bash
# --------------------------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
xdg-desktop-menu uninstall /usr/share/applications/openboard.desktop
rm -f /usr/bin/openboard
exit 0
This diff is collapsed.
......@@ -14,13 +14,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
SCRIPT_PATH="`pwd`"
PROJECT_ROOT="$SCRIPT_PATH/../.."
APPLICATION_NAME="OpenBoard"
BASE_QT_DIR=~/Qt/5.5/clang_64
# Executables
QMAKE=$BASE_QT_DIR/bin/qmake
MACDEPLOYQT=$BASE_QT_DIR/bin/macdeployqt
DMGUTIL="`pwd`/../OpenBoard-ThirdParty/refnum/dmgutil/dmgutil.pl"
DMGUTIL="$PROJECT_ROOT/../OpenBoard-ThirdParty/refnum/dmgutil/dmgutil.pl"
DSYMUTIL=/usr/bin/dsymutil
STRIP=/usr/bin/strip
PLISTBUDDY=/usr/libexec/PlistBuddy
......@@ -28,7 +31,7 @@ ICEBERG=/usr/local/bin/freeze
LRELEASE=$BASE_QT_DIR/bin/lrelease
# Directories
BUILD_DIR="build/macx/release"
BUILD_DIR="$PROJECT_ROOT/build/macx/release"
PRODUCT_DIR="$BUILD_DIR/product"
BASE_QT_TRANSLATIONS_DIRECTORY=$BASE_QT_DIR/translations
......@@ -106,6 +109,8 @@ trap "defaults write org.oe-f.OpenBoard.release Running -bool NO" EXIT
notify "Running OpenBoard release script (`date`)"
cd $PROJECT_ROOT
script_is_running=`defaults read org.oe-f.OpenBoard.release Running 2>/dev/null`
if [[ $? -eq 0 ]] && [[ "$script_is_running" = "1" ]]; then
trap EXIT
......@@ -200,7 +205,7 @@ $DSYMUTIL "$APP/Contents/MacOS/$APPLICATION_NAME" -o "$DSYM"
$STRIP -S "$APP/Contents/MacOS/$APPLICATION_NAME"
if [ "$1" == "pkg" ]; then
BASE_ICEBERG_CONFIG_FILE="$APPLICATION_NAME.packproj"
BASE_ICEBERG_CONFIG_FILE="$SCRIPT_PATH/$APPLICATION_NAME.packproj"
#copy the standard file for working with
ICEBERG_CONFIG_FILE="$APPLICATION_NAME-working.packproj"
cp -r $BASE_ICEBERG_CONFIG_FILE $ICEBERG_CONFIG_FILE
......
......@@ -14,6 +14,8 @@ REM You should have received a copy of the GNU General Public License
REM along with this program. If not, see <http://www.gnu.org/licenses/>.
REM ---------------------------------------------------------------------
set SCRIPT_PATH=%~dp0
set PROJECT_ROOT=%SCRIPT_PATH%\..\..
set APPLICATION_NAME=OpenBoard
set QT_DIR=C:\Qt\5.5\msvc2010
......@@ -25,7 +27,7 @@ set GIT_BIN=%PROGRAMS_FILE_PATH%\Git\bin
set VS_BIN=%PROGRAMS_FILE_PATH%\Microsoft Visual Studio 10.0\VC\bin
set WIN_SDK_BIN=%PROGRAMS_FILE_PATH%\Microsoft SDKs\Windows\v6.0A\Bin
set INNO_EXE=%PROGRAMS_FILE_PATH%\Inno Setup 5\iscc.exe
set BUILD_DIR=build\win32\release
set BUILD_DIR=%PROJECT_ROOT%\build\win32\release
set LRELEASE=%QT_DIR%\bin\lrelease
set BASE_QT_TRANSLATIONS_DIRECTORY=%QT_DIR%\translations
......@@ -35,11 +37,14 @@ call "%VS_BIN%\vcvars32.bat"
echo %PATH%
cd %PROJECT_ROOT%
REM Third party impoter application
set IMPORTER_NAME=OpenBoardImporter
set IMPORTER_PATH="..\OpenBoard-Importer"
IF NOT EXIST "%IMPORTER_PATH%" GOTO EXIT_WITH_ERROR
set HOME_DIR="%cd%"
cd %IMPORTER_PATH%
IF EXIST "release" (del "release\*.*" /Q)
......@@ -96,7 +101,7 @@ del build\win32\release\product\i18n\qt_help*
del "build\win32\release\product\%APPLICATION_NAME%.pdb"
call "%INNO_EXE%" "%APPLICATION_NAME%.iss" /F"%APPLICATION_NAME%_Installer_%VERSION%"
call "%INNO_EXE%" "%SCRIPT_PATH%\%APPLICATION_NAME%.iss" /F"%APPLICATION_NAME%_Installer_%VERSION%"
GOTO END
......
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/ubz">
<comment>OpenBoard document file</comment>
<comment xml:lang="fr">Document OpenBoard</comment>
<glob pattern="*.ubz"/>
</mime-type>
</mime-info>
......@@ -14,4 +14,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
env LD_LIBRARY_PATH=$PWD/qtlib:$PWD/plugins/cffadaptor:$LD_LIBRARY_PATH ./Open-Sankore
# Directory of the script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Add custom libraries to LD_LIBRARY_PATH
# TODO: Remomve the need for this
env LD_LIBRARY_PATH=$DIR/qtlib:$LD_LIBRARY_PATH $DIR/OpenBoard
......@@ -51,7 +51,7 @@ void UBOpenSankoreImporter::onProceedClicked()
{
QProcess newProcess;
#ifdef Q_OS_LINUX
newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter");
newProcess.startDetached(qApp->applicationDirPath()+"/importer/OpenBoardImporter");
#elif defined Q_OS_OSX
newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter");
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment