From 1ce6f841399c3514736bf3e09ff993fee673ab55 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Mon, 18 Apr 2016 14:25:26 +0200 Subject: [PATCH 1/9] Updated linux release scripts - Separated build and package - OpenBoard now installs in /opt - All binaries are stripped, for smaller package size --- .gitignore | 2 + buildDebianPackage.sh | 429 ------------------ release_scripts/linux/build.sh | 166 +++++++ .../linux/debian_package_files/postinst | 19 + .../linux/debian_package_files/prerm | 19 + release_scripts/linux/package.sh | 270 +++++++++++ .../osx/OpenBoard.packproj | 0 .../osx/release.macx.sh | 0 .../windows/OpenBoard.iss | 0 .../windows/release.win7.vc9.bat | 0 resources/linux/run.sh | 13 +- 11 files changed, 488 insertions(+), 430 deletions(-) delete mode 100755 buildDebianPackage.sh create mode 100755 release_scripts/linux/build.sh create mode 100644 release_scripts/linux/debian_package_files/postinst create mode 100644 release_scripts/linux/debian_package_files/prerm create mode 100755 release_scripts/linux/package.sh rename OpenBoard.packproj => release_scripts/osx/OpenBoard.packproj (100%) rename release.macx.sh => release_scripts/osx/release.macx.sh (100%) rename OpenBoard.iss => release_scripts/windows/OpenBoard.iss (100%) rename release.win7.vc9.bat => release_scripts/windows/release.win7.vc9.bat (100%) diff --git a/.gitignore b/.gitignore index 624229a4..6de0441e 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ Makefile Makefile.Debug Makefile.Release +buildContext + # plugins # ########### diff --git a/buildDebianPackage.sh b/buildDebianPackage.sh deleted file mode 100755 index ea624b90..00000000 --- a/buildDebianPackage.sh +++ /dev/null @@ -1,429 +0,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 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 . -# --------------------------------------------------------------------- - - -#********************** -# functions -#********************** - -checkUser() -{ - if [ `id -u` -ne 0 ]; then - echo "Please run the script as root, may be using fakeroot command as follow" - echo "fakeroot ./buildDebianPackage.sh [options]" - exit 1 - fi -} - -initializeVariables() -{ - APPLICATION_NAME="OpenBoard" - MAKE_TAG=true - STANDARD_QT_USED=false - - PRODUCT_PATH="build/linux/release/product" - 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" - if [ -z $ARCHITECTURE ]; then - ARCHITECTURE=`uname -m` - if [ "$ARCHITECTURE" == "x86_64" ]; then - ARCHITECTURE="amd64" - fi - if [ "$ARCHITECTURE" == "i686" ]; then - ARCHITECTURE="i386" - fi - fi - NOTIFY_CMD=`which notify-send` - QMAKE_PATH="$QT_PATH/bin/qmake" - LRELEASES="$QT_PATH/bin/lrelease" - ZIP_PATH=`which zip` - -} - - -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" -} - -alertIfPreviousVersionInstalled(){ - APT_CACHE=`which apt-cache` - if [ ! -e "$APT_CACHE" ]; then - notifyError "apt-cache command not found" - else - SEARCH_RESULT=`$APT_CACHE search ${APPLICATION_NAME}` - if [ `echo $SEARCH_RESULT | grep -c ${APPLICATION_NAME}` -ge 1 ]; then - notifyError "Found a previous version of ${APPLICATION_NAME}. Remove it to avoid to put it as dependency" - fi - fi -} - -checkDir(){ - if [ ! -d "$1" ]; then - notifyError "Directory not found : $1" - fi -} - -checkExecutable(){ - if [ ! -e "$1" ]; then - notifyError "$1 command not found" - fi -} - -copyQtLibrary(){ - if ls "$QT_LIBRARY_SOURCE_PATH/$1.so" &> /dev/null; then - cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.? "$QT_LIBRARY_DEST_PATH/" - cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.? "$QT_LIBRARY_DEST_PATH/" - cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.?.? "$QT_LIBRARY_DEST_PATH/" - else - notifyError "$1 library not found in path: $QT_LIBRARY_SOURCE_PATH" - 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 - - #git reset --hard - #git pull - - $QMAKE_PATH ${IMPORTER_NAME}.pro - make clean - make -j4 - checkExecutable $IMPORTER_NAME - cd - -} - -#********************** -# script -#********************** -checkUser - -for var in "$@" -do - if [ $var == "notag" ]; then - MAKE_TAG=false - fi -# forcing a architecture because of cross compiling - if [ $var == "i386" ]; then - ARCHITECTURE="i386" - fi - if [ $var == "amd64" ]; then - ARCHITECTURE="amd64" - fi -done - -initializeVariables -#buildWithStandardQt - -alertIfPreviousVersionInstalled - -# 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/linux/release" -rm -rf install - -notifyProgress "QT" "Internalization" -$LRELEASES ${APPLICATION_NAME}.pro -cd $GUI_TRANSLATIONS_DIRECTORY_PATH -$LRELEASES translations.pro -cd - - -notifyProgress "${APPLICATION_NAME}" "Building ${APPLICATION_NAME}" - -if [ "$ARCHITECTURE" == "amd64" ]; then - $QMAKE_PATH ${APPLICATION_NAME}.pro -spec linux-g++-64 -else - $QMAKE_PATH ${APPLICATION_NAME}.pro -spec linux-g++ -fi - -make -j 4 release-install - -if [ ! -e "$PRODUCT_PATH/${APPLICATION_NAME}" ]; then - notifyError "${APPLICATION_NAME} build failed" -fi - -notifyProgress "Git Hub" "Make a tag of the delivered version" - -VERSION=`cat build/linux/release/version` - -if [ ! -f build/linux/release/version ]; then - notifyError "version not found" -#else -# LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`" -# if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then -# if [ $MAKE_TAG == true ]; then -# git tag -a "OBv$VERSION" -m "OpenBoard setup for v$VERSION" -# git push origin --tags -# fi -# fi -fi - -cp resources/linux/run.sh $PRODUCT_PATH -chmod a+x $PRODUCT_PATH/run.sh - -cp -R resources/linux/qtlinux/* $PRODUCT_PATH/ - -notifyProgress "QT" "Copying plugins and library ..." -cp -R $PLUGINS_PATH $PRODUCT_PATH/ - -# copying customization -cp -R resources/customizations $PRODUCT_PATH/ - -# copying importer -mkdir -p $PRODUCT_PATH/Importer -cp -R ${IMPORTER_DIR}/${IMPORTER_NAME} $PRODUCT_PATH/Importer - -if [ $STANDARD_QT_USED == false ]; then -#copying custom qt library - mkdir -p $QT_LIBRARY_DEST_PATH - copyQtLibrary libQt5Core - copyQtLibrary libQt5Gui - copyQtLibrary libQt5Multimedia - copyQtLibrary libQt5MultimediaWidgets - copyQtLibrary libQt5Network - copyQtLibrary libQt5OpenGL - copyQtLibrary libQt5PrintSupport - copyQtLibrary libQt5Script - copyQtLibrary libQt5Svg - copyQtLibrary libQt5WebKit - copyQtLibrary libQt5WebKitWidgets - copyQtLibrary libQt5Xml - copyQtLibrary libQt5XmlPatterns -fi - -notifyProgress "QT" "Internationalization" -if [ ! -e $PRODUCT_PATH/i18n ]; then - mkdir $PRODUCT_PATH/i18n -fi -#copying qt gui translation -cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm $PRODUCT_PATH/i18n/ - -rm -rf install/linux -mkdir -p install/linux - -#Removing .svn directories ... -cd $PRODUCT_PATH -find . -name .svn -exec rm -rf {} \; 2> /dev/null -cd - - -notifyProgress "Building ${APPLICATION_NAME}" "Finished to build ${APPLICATION_NAME} building the package" - -BASE_WORKING_DIR="packageBuildDir" - -#creating package directory -mkdir $BASE_WORKING_DIR -mkdir "$BASE_WORKING_DIR/DEBIAN" -mkdir -p "$BASE_WORKING_DIR/usr/share/applications" -mkdir -p "$BASE_WORKING_DIR/usr/local" - - -cat > "$BASE_WORKING_DIR/DEBIAN/prerm" << EOF -#!/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 . -# --------------------------------------------------------------------- - -xdg-desktop-menu uninstall /usr/share/applications/${APPLICATION_NAME}.desktop -exit 0 -#DEBHELPER# -EOF - -cat > "$BASE_WORKING_DIR/DEBIAN/postinst" << EOF -#!/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 . -# --------------------------------------------------------------------- - -xdg-desktop-menu install --novendor /usr/share/applications/${APPLICATION_NAME}.desktop -exit 0 -#DEBHELPER# -EOF - - -APPLICATION_DIRECTORY_NAME="${APPLICATION_NAME}-$VERSION" -PACKAGE_DIRECTORY="$BASE_WORKING_DIR/usr/local/$APPLICATION_DIRECTORY_NAME" -#move build directory to packages directory -cp -R $PRODUCT_PATH $PACKAGE_DIRECTORY - - -cat > $BASE_WORKING_DIR/usr/local/$APPLICATION_DIRECTORY_NAME/run.sh << EOF -#!/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 . -# --------------------------------------------------------------------- - -env LD_LIBRARY_PATH=/usr/local/$APPLICATION_DIRECTORY_NAME/qtlib:$LD_LIBRARY_PATH /usr/local/$APPLICATION_DIRECTORY_NAME/${APPLICATION_NAME} -EOF - - -CHANGE_LOG_FILE="$BASE_WORKING_DIR/DEBIAN/changelog-${APPLICATION_NAME}-$VERSION.txt" -CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control" -CHANGE_LOG_TEXT="changelog.txt" - -echo "${APPLICATION_NAME} ($VERSION) $ARCHITECTURE; urgency=low" > "$CHANGE_LOG_FILE" -echo >> "$CHANGE_LOG_FILE" -cat $CHANGE_LOG_TEXT >> "$CHANGE_LOG_FILE" -echo >> "$CHANGE_LOG_FILE" -echo "-- Claudio Valerio `date`" >> "$CHANGE_LOG_FILE" - -echo "Package: ${APPLICATION_NAME}" > "$CONTROL_FILE" -echo "Version: $VERSION" >> "$CONTROL_FILE" -echo "Section: education" >> "$CONTROL_FILE" -echo "Priority: optional" >> "$CONTROL_FILE" -echo "Architecture: $ARCHITECTURE" >> "$CONTROL_FILE" -echo "Essential: no" >> "$CONTROL_FILE" -echo "Installed-Size: `du -s $PACKAGE_DIRECTORY | awk '{ print $1 }'`" >> "$CONTROL_FILE" -echo "Maintainer: ${APPLICATION_NAME} Developers team " >> "$CONTROL_FILE" -echo "Homepage: http://www.openboard.org" >> "$CONTROL_FILE" -echo -n "Depends: " >> "$CONTROL_FILE" -unset tab -declare -a tab -let count=0 -for l in `objdump -p $PACKAGE_DIRECTORY/${APPLICATION_NAME} | grep NEEDED | awk '{ print $2 }'`; do - for lib in `dpkg -S $l | awk -F":" '{ print $1 }'`; do - #echo $lib - presence=`echo ${tab[*]} | grep -c "$lib"`; - if [ "$presence" == "0" ]; then - tab[$count]=$lib; - ((count++)); - fi; - done; -done; - -for ((i=0;i<${#tab[@]};i++)); do - if [ $i -ne "0" ]; then - echo -n ", " >> "$CONTROL_FILE" - fi - echo -n "${tab[$i]} (>= "`dpkg -p ${tab[$i]} | grep "Version: " | awk '{ print $2 }' | sed -e 's/\([:. 0-9?]*\).*/\1/g' | sed -e 's/\.$//'`") " >> "$CONTROL_FILE" -done -echo -n ", onboard" >> "$CONTROL_FILE" -echo "" >> "$CONTROL_FILE" -echo "Description: This a interactive white board that uses a free standard format." >> "$CONTROL_FILE" - -find $BASE_WORKING_DIR/usr/ -exec md5sum {} > $BASE_WORKING_DIR/DEBIAN/md5sums 2>/dev/null \; -APPLICATION_SHORTCUT="$BASE_WORKING_DIR/usr/share/applications/${APPLICATION_NAME}.desktop" -echo "[Desktop Entry]" > $APPLICATION_SHORTCUT -echo "Version=$VERSION" >> $APPLICATION_SHORTCUT -echo "Encoding=UTF-8" >> $APPLICATION_SHORTCUT -echo "Name=${APPLICATION_NAME} ($VERSION)" >> $APPLICATION_SHORTCUT -echo "GenericName=${APPLICATION_NAME}" >> $APPLICATION_SHORTCUT -echo "Comment=Logiciel de création de présentations pour tableau numérique interactif (TNI)" >> $APPLICATION_SHORTCUT -echo "Exec=/usr/local/$APPLICATION_DIRECTORY_NAME/run.sh" >> $APPLICATION_SHORTCUT -echo "Icon=/usr/local/$APPLICATION_DIRECTORY_NAME/${APPLICATION_NAME}.png" >> $APPLICATION_SHORTCUT -echo "StartupNotify=true" >> $APPLICATION_SHORTCUT -echo "Terminal=false" >> $APPLICATION_SHORTCUT -echo "Type=Application" >> $APPLICATION_SHORTCUT -echo "Categories=Education;" >> $APPLICATION_SHORTCUT -cp "resources/images/${APPLICATION_NAME}.png" "$PACKAGE_DIRECTORY/${APPLICATION_NAME}.png" -chmod 755 "$BASE_WORKING_DIR/DEBIAN" -chmod 755 "$BASE_WORKING_DIR/DEBIAN/prerm" -chmod 755 "$BASE_WORKING_DIR/DEBIAN/postinst" - -mkdir -p "install/linux" -DEBIAN_PACKAGE_NAME="${APPLICATION_NAME}_`lsb_release -is`_`lsb_release -rs`_${VERSION}_$ARCHITECTURE.deb" - -chown -R root:root $BASE_WORKING_DIR -dpkg -b "$BASE_WORKING_DIR" "install/linux/$DEBIAN_PACKAGE_NAME" - -#clean up mess -rm -rf $BASE_WORKING_DIR - -notifyProgress "${APPLICATION_NAME}" "Package built" - - -exit 0 diff --git a/release_scripts/linux/build.sh b/release_scripts/linux/build.sh new file mode 100755 index 00000000..d241083d --- /dev/null +++ b/release_scripts/linux/build.sh @@ -0,0 +1,166 @@ +#!/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 . +# --------------------------------------------------------------------- + +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="/home/craig/dev/qt5/qtbase" + 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` + 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 - +} + + + + +# Check command-line arguments to force an architecture + +for var in "$@" +do + if [ $var == "i686" ]; then + ARCHITECTURE="i386" + fi + if [ $var == "x86_64" ]; then + ARCHITECTURE="amd64" + fi +done + + +initializeVariables +#buildWithStandardQt + +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" ]; 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 diff --git a/release_scripts/linux/debian_package_files/postinst b/release_scripts/linux/debian_package_files/postinst new file mode 100644 index 00000000..f3152d3b --- /dev/null +++ b/release_scripts/linux/debian_package_files/postinst @@ -0,0 +1,19 @@ +#!/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 . +# --------------------------------------------------------------------- + +xdg-desktop-menu install --novendor /usr/share/applications/openboard.desktop +ln -s /opt/openboard/run.sh /usr/bin/openboard +exit 0 diff --git a/release_scripts/linux/debian_package_files/prerm b/release_scripts/linux/debian_package_files/prerm new file mode 100644 index 00000000..5b1612c1 --- /dev/null +++ b/release_scripts/linux/debian_package_files/prerm @@ -0,0 +1,19 @@ +#!/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 . +# --------------------------------------------------------------------- + +xdg-desktop-menu uninstall /usr/share/applications/openboard.desktop +rm -f /usr/bin/openboard +exit 0 diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh new file mode 100755 index 00000000..f4b9311a --- /dev/null +++ b/release_scripts/linux/package.sh @@ -0,0 +1,270 @@ +#!/bin/bash +# ---------------------------------------------------------------------------- +# Packaging script for OpenBoard, for debian-compatible distributions. +# +# This should be run after `build.sh`. +# ---------------------------------------------------------------------------- + + +# ---------------------------------------------------------------------------- +# Function definitions +# ---------------------------------------------------------------------------- +checkUser() +{ + if [ `id -u` -ne 0 ]; then + echo "Please run the script as root" + exit 1 + fi +} + +checkBuild() +{ + if [ -z "$ARCHITECTURE" ]; then + echo "Make sure you have built the software first using ./build.sh" + exit 1 + 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--> \033[0m $1:\n\t$2\n" +} + +copyQtLibrary(){ + if ls "$QT_LIBRARY_SOURCE_PATH/$1.so" &> /dev/null; then + cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.? "$QT_LIBRARY_DEST_PATH/" + cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.? "$QT_LIBRARY_DEST_PATH/" + cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.?.? "$QT_LIBRARY_DEST_PATH/" + strip $QT_LIBRARY_DEST_PATH/$1.so.?.?.? + else + notifyError "$1 library not found in path: $QT_LIBRARY_SOURCE_PATH" + fi +} + +copyQtPlugin(){ + if ls "$QT_PLUGINS_SOURCE_PATH/$1" &> /dev/null; then + cp -r $QT_PLUGINS_SOURCE_PATH/$1 $QT_PLUGINS_DEST_PATH/ + strip $QT_PLUGINS_DEST_PATH/$1/* + + else + notifyError "$1 plugin not found in path: $QT_PLUGINS_SOURCE_PATH" + fi +} + +initializeVariables() +{ + # This script's path + SCRIPT_PATH=`pwd` + + PROJECT_ROOT="$SCRIPT_PATH/../.." + + # Where the application was built (see build.sh) + BUILD_DIR="$PROJECT_ROOT/build/linux/release" + PRODUCT_PATH="$BUILD_DIR/product" + IMPORTER_DIR="$PROJECT_ROOT/../OpenBoard-Importer/" + IMPORTER_NAME="OpenBoardImporter" + + # Where the package is built to + PACKAGE_BUILD_DIR="$PROJECT_ROOT/install" + + # Temporary folder, where we put all the files that will be built into the + # package + BASE_WORKING_DIR="debianPackage" + + APPLICATION_NAME="OpenBoard" + APPLICATION_CODE="openboard" + APPLICATION_PATH="/opt" + + # Where most of the files end up in the package + PACKAGE_DIRECTORY=$BASE_WORKING_DIR/$APPLICATION_PATH/$APPLICATION_CODE + QT_PLUGINS_DEST_PATH="$PACKAGE_DIRECTORY/plugins" + QT_LIBRARY_DEST_PATH="$PACKAGE_DIRECTORY/qtlib" + + DESKTOP_FILE_PATH="$BASE_WORKING_DIR/usr/share/applications" + APPLICATION_SHORTCUT="$DESKTOP_FILE_PATH/${APPLICATION_CODE}.desktop" + + DESCRIPTION="Interactive white board software" + VERSION=`cat $BUILD_DIR/version` + ARCHITECTURE=`cat buildContext` + + # Qt installation path. This may vary across machines + QT_PATH="/home/craig/dev/qt5/qtbase" + QT_PLUGINS_SOURCE_PATH="$QT_PATH/plugins" + GUI_TRANSLATIONS_DIRECTORY_PATH="$QT_PATH/translations" + QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib" + + NOTIFY_CMD=`which notify-send` + ZIP_PATH=`which zip` +} + +# ---------------------------------------------------------------------------- +# Script +# ---------------------------------------------------------------------------- + +initializeVariables + +checkBuild +checkUser + +cd $PROJECT_ROOT + +rm -rf $PACKAGE_DIRECTORY +mkdir -p $PACKAGE_DIRECTORY + +rm -rf $PACKAGE_BUILD_DIR + + +notifyProgress "Copying product directory and resources" +cp -R $PRODUCT_PATH/* $PACKAGE_DIRECTORY +chown -R root:root $PACKAGE_DIRECTORY + +cp resources/linux/run.sh $PACKAGE_DIRECTORY +chmod a+x $PACKAGE_DIRECTORY/run.sh + +cp -R resources/customizations $PACKAGE_DIRECTORY/ +cp -R resources/linux/qtlinux/* $PACKAGE_DIRECTORY/ + +notifyProgress "Copying importer" +mkdir -p $PACKAGE_DIRECTORY/Importer +cp -R "$IMPORTER_DIR/$IMPORTER_NAME" "$PACKAGE_DIRECTORY/Importer" + +notifyProgress "Stripping importer and main executable" +strip $PACKAGE_DIRECTORY/$APPLICATION_NAME +strip $PACKAGE_DIRECTORY/Importer/$IMPORTER_NAME + +notifyProgress "Copying and stripping Qt plugins" +mkdir -p $QT_PLUGINS_DEST_PATH +copyQtPlugin mediaservice +copyQtPlugin audio +copyQtPlugin generic +copyQtPlugin platforms +copyQtPlugin printsupport +copyQtPlugin xcbglintegrations + +notifyProgress "Copying and stripping Qt libraries" +mkdir -p $QT_LIBRARY_DEST_PATH +copyQtLibrary libQt5Core +copyQtLibrary libQt5Gui +copyQtLibrary libQt5Multimedia +copyQtLibrary libQt5MultimediaWidgets +copyQtLibrary libQt5Network +copyQtLibrary libQt5OpenGL +copyQtLibrary libQt5PrintSupport +copyQtLibrary libQt5Script +copyQtLibrary libQt5Svg +copyQtLibrary libQt5WebChannel +copyQtLibrary libQt5WebKit +copyQtLibrary libQt5WebKitWidgets +copyQtLibrary libQt5Widgets +copyQtLibrary libQt5XcbQpa +copyQtLibrary libQt5Xml +copyQtLibrary libQt5XmlPatterns + +notifyProgress "Copying Qt translations" +mkdir -p $PACKAGE_DIRECTORY/i18n +cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm $PACKAGE_DIRECTORY/i18n/ + + +# ---------------------------------------------------------------------------- +# DEBIAN directory of package (control, md5sums, postinst etc) +# ---------------------------------------------------------------------------- +mkdir -p "$BASE_WORKING_DIR/DEBIAN" + +# Copy prerm, postinst scripts +cp -r "$SCRIPT_PATH/debian_package_files/prerm" "$BASE_WORKING_DIR/DEBIAN/" +cp -r "$SCRIPT_PATH/debian_package_files/postinst" "$BASE_WORKING_DIR/DEBIAN/" +chmod 755 "$BASE_WORKING_DIR/DEBIAN/prerm" +chmod 755 "$BASE_WORKING_DIR/DEBIAN/postinst" + +# Generate md5 sums of everything in the application path (e.g /opt) and the desktop entry +find $BASE_WORKING_DIR/$APPLICATION_PATH/ -exec md5sum {} > $BASE_WORKING_DIR/DEBIAN/md5sums 2>/dev/null \; +find $DESKTOP_FILE_PATH/ -exec md5sum {} > $BASE_WORKING_DIR/DEBIAN/md5sums 2>/dev/null \; + +# Generate control file +CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control" + +echo "Package: ${APPLICATION_NAME}" > "$CONTROL_FILE" +echo "Version: $VERSION" >> "$CONTROL_FILE" +echo "Section: education" >> "$CONTROL_FILE" +echo "Priority: optional" >> "$CONTROL_FILE" +echo "Architecture: $ARCHITECTURE" >> "$CONTROL_FILE" +echo "Essential: no" >> "$CONTROL_FILE" +echo "Installed-Size: `du -s $PACKAGE_DIRECTORY | awk '{ print $1 }'`" >> "$CONTROL_FILE" +echo "Maintainer: ${APPLICATION_NAME} Developers team " >> "$CONTROL_FILE" +echo "Homepage: https://github.com/DIP-SEM/OpenBoard" >> "$CONTROL_FILE" + +# Generate dependency list +echo -n "Depends: " >> "$CONTROL_FILE" +echo -n "libpaper1, zlib1g (>= 1.2.8), libssl1.0.0 (>= 1.0.1), libx11-6, libgl1-mesa-glx, libc6 (>= 2.19), libstdc++6 (>= 4.9.2), libgomp1, libgcc1 (>= 4.9.2), onboard" >> "$CONTROL_FILE" + +#unset tab +#declare -a tab +#let count=0 +#for l in `objdump -p $PACKAGE_DIRECTORY/${APPLICATION_NAME} | grep NEEDED | awk '{ print $2 }'`; do +# for lib in `dpkg -S $l | awk -F":" '{ print $1 }'`; do +# echo $lib +# presence=`echo ${tab[*]} | grep -c "$lib"`; +# if [ "$presence" == "0" ]; then +# tab[$count]=$lib; +# ((count++)); +# fi; +# done; +#done; + +#for ((i=0;i<${#tab[@]};i++)); do +# if [ $i -ne "0" ]; then +# echo -n ", " >> "$CONTROL_FILE" +# fi +# echo -n "${tab[$i]} (>= "`dpkg -p ${tab[$i]} | grep "Version: " | awk '{ print $2 }' | sed -e 's/\([:. 0-9?]*\).*/\1/g' | sed -e 's/\.$//'`") " >> "$CONTROL_FILE" +#done +#echo -n ", onboard" >> "$CONTROL_FILE" + +echo "" >> "$CONTROL_FILE" +echo "Description: $DESCRIPTION" >> "$CONTROL_FILE" + +# ---------------------------------------------------------------------------- +# .desktop file +# ---------------------------------------------------------------------------- +mkdir -p $DESKTOP_FILE_PATH +echo "[Desktop Entry]" > $APPLICATION_SHORTCUT +echo "Version=$VERSION" >> $APPLICATION_SHORTCUT +echo "Encoding=UTF-8" >> $APPLICATION_SHORTCUT +echo "Name=${APPLICATION_NAME} ($VERSION)" >> $APPLICATION_SHORTCUT +echo "Comment=$DESCRIPTION" >> $APPLICATION_SHORTCUT +#echo "Exec=$APPLICATION_PATH/$APPLICATION_CODE/run.sh" >> $APPLICATION_SHORTCUT +echo "Exec=$APPLICATION_CODE %f" >> $APPLICATION_SHORTCUT +echo "Icon=$APPLICATION_PATH/$APPLICATION_CODE/${APPLICATION_NAME}.png" >> $APPLICATION_SHORTCUT +echo "StartupNotify=true" >> $APPLICATION_SHORTCUT +echo "Terminal=false" >> $APPLICATION_SHORTCUT +echo "Type=Application" >> $APPLICATION_SHORTCUT +echo "Categories=Education;" >> $APPLICATION_SHORTCUT +cp "resources/images/${APPLICATION_NAME}.png" "$PACKAGE_DIRECTORY/${APPLICATION_NAME}.png" + + + +# ---------------------------------------------------------------------------- +# Building the package +# ---------------------------------------------------------------------------- +notifyProgress "Building package" +mkdir -p "$PACKAGE_BUILD_DIR/linux" +DEBIAN_PACKAGE_NAME="${APPLICATION_NAME}_`lsb_release -is`_`lsb_release -rs`_${VERSION}_$ARCHITECTURE.deb" + +dpkg -b "$BASE_WORKING_DIR" "$PACKAGE_BUILD_DIR/linux/$DEBIAN_PACKAGE_NAME" + +#clean up mess +#rm -rf $BASE_WORKING_DIR + +notifyProgress "${APPLICATION_NAME}" "Package built" + + +exit 0 diff --git a/OpenBoard.packproj b/release_scripts/osx/OpenBoard.packproj similarity index 100% rename from OpenBoard.packproj rename to release_scripts/osx/OpenBoard.packproj diff --git a/release.macx.sh b/release_scripts/osx/release.macx.sh similarity index 100% rename from release.macx.sh rename to release_scripts/osx/release.macx.sh diff --git a/OpenBoard.iss b/release_scripts/windows/OpenBoard.iss similarity index 100% rename from OpenBoard.iss rename to release_scripts/windows/OpenBoard.iss diff --git a/release.win7.vc9.bat b/release_scripts/windows/release.win7.vc9.bat similarity index 100% rename from release.win7.vc9.bat rename to release_scripts/windows/release.win7.vc9.bat diff --git a/resources/linux/run.sh b/resources/linux/run.sh index a9c1a4a5..b84a92fd 100644 --- a/resources/linux/run.sh +++ b/resources/linux/run.sh @@ -14,4 +14,15 @@ # along with this program. If not, see . # --------------------------------------------------------------------- -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 From a722b493c869b93d79c7a73b70b9c6e73ef312f9 Mon Sep 17 00:00:00 2001 From: Craig Date: Mon, 18 Apr 2016 17:29:42 +0200 Subject: [PATCH 2/9] Multiple corrections to packaging script: - Fixed permissions of qt libs and plugins - Added some missing plugins (and maybe a couple too many) - Dependency list is built automatically, while excluding qt libs --- release_scripts/linux/build.sh | 2 +- release_scripts/linux/package.sh | 64 ++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/release_scripts/linux/build.sh b/release_scripts/linux/build.sh index d241083d..05d96d1f 100755 --- a/release_scripts/linux/build.sh +++ b/release_scripts/linux/build.sh @@ -25,7 +25,7 @@ initializeVariables() PRODUCT_PATH="$BUILD_DIR/product" # Qt installation path. This may vary across machines - QT_PATH="/home/craig/dev/qt5/qtbase" + QT_PATH="/opt/qt55" PLUGINS_PATH="$QT_PATH/plugins" GUI_TRANSLATIONS_DIRECTORY_PATH="$QT_PATH/translations" QT_LIBRARY_DEST_PATH="$PRODUCT_PATH/qtlib" diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index f4b9311a..69a08dc4 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -41,20 +41,24 @@ notifyProgress(){ } copyQtLibrary(){ + echo -e "\t $1" if ls "$QT_LIBRARY_SOURCE_PATH/$1.so" &> /dev/null; then cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.? "$QT_LIBRARY_DEST_PATH/" cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.? "$QT_LIBRARY_DEST_PATH/" cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.?.? "$QT_LIBRARY_DEST_PATH/" strip $QT_LIBRARY_DEST_PATH/$1.so.?.?.? + chmod 644 $QT_LIBRARY_DEST_PATH/$1.so.?.?.? # 644 = rw-r-r else notifyError "$1 library not found in path: $QT_LIBRARY_SOURCE_PATH" fi } copyQtPlugin(){ + echo -e "\t $1" if ls "$QT_PLUGINS_SOURCE_PATH/$1" &> /dev/null; then cp -r $QT_PLUGINS_SOURCE_PATH/$1 $QT_PLUGINS_DEST_PATH/ strip $QT_PLUGINS_DEST_PATH/$1/* + chmod 644 $QT_PLUGINS_DEST_PATH/$1/* # 644 = rw-r-r else notifyError "$1 plugin not found in path: $QT_PLUGINS_SOURCE_PATH" @@ -83,7 +87,7 @@ initializeVariables() APPLICATION_NAME="OpenBoard" APPLICATION_CODE="openboard" - APPLICATION_PATH="/opt" + APPLICATION_PATH="opt" # Where most of the files end up in the package PACKAGE_DIRECTORY=$BASE_WORKING_DIR/$APPLICATION_PATH/$APPLICATION_CODE @@ -98,10 +102,10 @@ initializeVariables() ARCHITECTURE=`cat buildContext` # Qt installation path. This may vary across machines - QT_PATH="/home/craig/dev/qt5/qtbase" + QT_PATH="/opt/qt55" QT_PLUGINS_SOURCE_PATH="$QT_PATH/plugins" GUI_TRANSLATIONS_DIRECTORY_PATH="$QT_PATH/translations" - QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib" + QT_LIBRARY_SOURCE_PATH="/home/craig/openboard/qtlib" NOTIFY_CMD=`which notify-send` ZIP_PATH=`which zip` @@ -144,11 +148,18 @@ strip $PACKAGE_DIRECTORY/Importer/$IMPORTER_NAME notifyProgress "Copying and stripping Qt plugins" mkdir -p $QT_PLUGINS_DEST_PATH -copyQtPlugin mediaservice copyQtPlugin audio copyQtPlugin generic +copyQtPlugin iconengines +copyQtPlugin imageformats +copyQtPlugin mediaservice +copyQtPlugin platforminputcontexts copyQtPlugin platforms +copyQtPlugin platformthemes +copyQtPlugin position copyQtPlugin printsupport +copyQtPlugin qtwebengine +copyQtPlugin sceneparsers copyQtPlugin xcbglintegrations notifyProgress "Copying and stripping Qt libraries" @@ -205,29 +216,28 @@ echo "Homepage: https://github.com/DIP-SEM/OpenBoard" >> "$CONTROL_FILE" # Generate dependency list echo -n "Depends: " >> "$CONTROL_FILE" -echo -n "libpaper1, zlib1g (>= 1.2.8), libssl1.0.0 (>= 1.0.1), libx11-6, libgl1-mesa-glx, libc6 (>= 2.19), libstdc++6 (>= 4.9.2), libgomp1, libgcc1 (>= 4.9.2), onboard" >> "$CONTROL_FILE" - -#unset tab -#declare -a tab -#let count=0 -#for l in `objdump -p $PACKAGE_DIRECTORY/${APPLICATION_NAME} | grep NEEDED | awk '{ print $2 }'`; do -# for lib in `dpkg -S $l | awk -F":" '{ print $1 }'`; do -# echo $lib -# presence=`echo ${tab[*]} | grep -c "$lib"`; -# if [ "$presence" == "0" ]; then -# tab[$count]=$lib; -# ((count++)); -# fi; -# done; -#done; - -#for ((i=0;i<${#tab[@]};i++)); do -# if [ $i -ne "0" ]; then -# echo -n ", " >> "$CONTROL_FILE" -# fi -# echo -n "${tab[$i]} (>= "`dpkg -p ${tab[$i]} | grep "Version: " | awk '{ print $2 }' | sed -e 's/\([:. 0-9?]*\).*/\1/g' | sed -e 's/\.$//'`") " >> "$CONTROL_FILE" -#done -#echo -n ", onboard" >> "$CONTROL_FILE" +#echo -n "libpaper1, zlib1g (>= 1.2.8), libssl1.0.0 (>= 1.0.1), libx11-6, libgl1-mesa-glx, libc6 (>= 2.19), libstdc++6 (>= 4.8.4), libgomp1, onboard" >> "$CONTROL_FILE" + +unset tab +declare -a tab +let count=0 +for l in `objdump -p $PACKAGE_DIRECTORY/${APPLICATION_NAME} | grep NEEDED | awk '{ print $2 }'`; do + for lib in `dpkg -S $l | grep -v "libqt5" | grep -v "qt55" | awk -F":" '{ print $1 }'`; do + presence=`echo ${tab[*]} | grep -c "$lib"`; + if [ "$presence" == "0" ]; then + tab[$count]=$lib; + ((count++)); + fi; + done; +done; + +for ((i=0;i<${#tab[@]};i++)); do + if [ $i -ne "0" ]; then + echo -n ", " >> "$CONTROL_FILE" + fi + echo -n "${tab[$i]} (>= "`dpkg -p ${tab[$i]} | grep "Version: " | awk '{ print $2 }' | sed -e 's/\([:. 0-9?]*\).*/\1/g' | sed -e 's/\.$//'`") " >> "$CONTROL_FILE" +done +echo -n ", onboard" >> "$CONTROL_FILE" echo "" >> "$CONTROL_FILE" echo "Description: $DESCRIPTION" >> "$CONTROL_FILE" From 9de8ab6d088e888b10f56397bd71a4e1da2c16d4 Mon Sep 17 00:00:00 2001 From: Craig Date: Mon, 18 Apr 2016 17:44:35 +0200 Subject: [PATCH 3/9] package name is now lowercase --- release_scripts/linux/package.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index 69a08dc4..19a0db28 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -267,9 +267,10 @@ cp "resources/images/${APPLICATION_NAME}.png" "$PACKAGE_DIRECTORY/${APPLICATION_ # ---------------------------------------------------------------------------- notifyProgress "Building package" mkdir -p "$PACKAGE_BUILD_DIR/linux" -DEBIAN_PACKAGE_NAME="${APPLICATION_NAME}_`lsb_release -is`_`lsb_release -rs`_${VERSION}_$ARCHITECTURE.deb" +PACKAGE_NAME="${APPLICATION_NAME}_`lsb_release -is`_`lsb_release -rs`_${VERSION}_$ARCHITECTURE.deb" +PACKAGE_NAME=`echo "$PACKAGE_NAME" | awk '{print tolower($0)}'` -dpkg -b "$BASE_WORKING_DIR" "$PACKAGE_BUILD_DIR/linux/$DEBIAN_PACKAGE_NAME" +dpkg -b "$BASE_WORKING_DIR" "$PACKAGE_BUILD_DIR/linux/$PACKAGE_NAME" #clean up mess #rm -rf $BASE_WORKING_DIR From 1eb22f1a6745ffe1af83fe77701365b9368ff606 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 19 Apr 2016 10:16:14 +0200 Subject: [PATCH 4/9] Clean-up and minor changes: - "Importer" folder renamed "importer" - corrected detecting of 64bit architecture - build context file is created in build.sh --- release_scripts/linux/build.sh | 11 ++++-- release_scripts/linux/package.sh | 58 ++++++++++++++++++++++++------ src/core/UBOpenSankoreImporter.cpp | 2 +- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/release_scripts/linux/build.sh b/release_scripts/linux/build.sh index 05d96d1f..f88f3ee9 100755 --- a/release_scripts/linux/build.sh +++ b/release_scripts/linux/build.sh @@ -103,6 +103,10 @@ buildImporter(){ cd - } +createBuildContext() { + BUILD_CONTEXT="buildContext" + echo $ARCHITECTURE > $BUILD_CONTEXT +} @@ -110,10 +114,10 @@ buildImporter(){ for var in "$@" do - if [ $var == "i686" ]; then + if [ $var == "i386" ]; then ARCHITECTURE="i386" fi - if [ $var == "x86_64" ]; then + if [ $var == "amd64" ]; then ARCHITECTURE="amd64" fi done @@ -121,6 +125,7 @@ done initializeVariables #buildWithStandardQt +createBuildContext cd $PROJECT_ROOT @@ -150,7 +155,7 @@ cd - notifyProgress "${APPLICATION_NAME}" "Building ${APPLICATION_NAME}" -if [ "$ARCHITECTURE" == "amd64" ]; then +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++ diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index 19a0db28..2ee30e96 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -1,14 +1,51 @@ #!/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 . +# --------------------------------------------------------------------- + # ---------------------------------------------------------------------------- -# Packaging script for OpenBoard, for debian-compatible distributions. +# Packaging script for OpenBoard, for Debian-compatible distributions. # # This should be run after `build.sh`. +# +# The generated package structure is as follows : +# +# DEBIAN/ +# | control +# | md5sums +# | prerm +# | postinst +# usr/ +# | bin/ +# | | openboard <-- actually a symlink to run.sh +# | share/ +# | | applications/ +# | | | OpenBoard.desktop +# opt/ +# | openboard/ +# | | importer/ +# | | library/ +# | | etc/ +# | | qtlib/ +# | | plugins/ +# | | OpenBoard +# | | OpenBoard.png +# | | qt.conf +# | | run.sh +# # ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Function definitions -# ---------------------------------------------------------------------------- checkUser() { if [ `id -u` -ne 0 ]; then @@ -46,6 +83,7 @@ copyQtLibrary(){ cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.? "$QT_LIBRARY_DEST_PATH/" cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.? "$QT_LIBRARY_DEST_PATH/" cp -P $QT_LIBRARY_SOURCE_PATH/$1.so.?.?.? "$QT_LIBRARY_DEST_PATH/" + strip $QT_LIBRARY_DEST_PATH/$1.so.?.?.? chmod 644 $QT_LIBRARY_DEST_PATH/$1.so.?.?.? # 644 = rw-r-r else @@ -57,6 +95,7 @@ copyQtPlugin(){ echo -e "\t $1" if ls "$QT_PLUGINS_SOURCE_PATH/$1" &> /dev/null; then cp -r $QT_PLUGINS_SOURCE_PATH/$1 $QT_PLUGINS_DEST_PATH/ + strip $QT_PLUGINS_DEST_PATH/$1/* chmod 644 $QT_PLUGINS_DEST_PATH/$1/* # 644 = rw-r-r @@ -89,7 +128,6 @@ initializeVariables() APPLICATION_CODE="openboard" APPLICATION_PATH="opt" - # Where most of the files end up in the package PACKAGE_DIRECTORY=$BASE_WORKING_DIR/$APPLICATION_PATH/$APPLICATION_CODE QT_PLUGINS_DEST_PATH="$PACKAGE_DIRECTORY/plugins" QT_LIBRARY_DEST_PATH="$PACKAGE_DIRECTORY/qtlib" @@ -112,7 +150,7 @@ initializeVariables() } # ---------------------------------------------------------------------------- -# Script +# Copying the application, libs etc. to the temporary working directory # ---------------------------------------------------------------------------- initializeVariables @@ -139,12 +177,12 @@ cp -R resources/customizations $PACKAGE_DIRECTORY/ cp -R resources/linux/qtlinux/* $PACKAGE_DIRECTORY/ notifyProgress "Copying importer" -mkdir -p $PACKAGE_DIRECTORY/Importer -cp -R "$IMPORTER_DIR/$IMPORTER_NAME" "$PACKAGE_DIRECTORY/Importer" +mkdir -p $PACKAGE_DIRECTORY/importer +cp -R "$IMPORTER_DIR/$IMPORTER_NAME" "$PACKAGE_DIRECTORY/importer" notifyProgress "Stripping importer and main executable" strip $PACKAGE_DIRECTORY/$APPLICATION_NAME -strip $PACKAGE_DIRECTORY/Importer/$IMPORTER_NAME +strip $PACKAGE_DIRECTORY/importer/$IMPORTER_NAME notifyProgress "Copying and stripping Qt plugins" mkdir -p $QT_PLUGINS_DEST_PATH diff --git a/src/core/UBOpenSankoreImporter.cpp b/src/core/UBOpenSankoreImporter.cpp index 21220bb5..1f0c2db5 100644 --- a/src/core/UBOpenSankoreImporter.cpp +++ b/src/core/UBOpenSankoreImporter.cpp @@ -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 From 0233d674d539517896f9ef979d41beb28ea47615 Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 19 Apr 2016 11:35:45 +0200 Subject: [PATCH 5/9] Corrected .desktop package name and icon; corrected architecture for control file --- release_scripts/linux/build.sh | 3 +++ release_scripts/linux/package.sh | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/release_scripts/linux/build.sh b/release_scripts/linux/build.sh index f88f3ee9..81ab8780 100755 --- a/release_scripts/linux/build.sh +++ b/release_scripts/linux/build.sh @@ -38,6 +38,9 @@ initializeVariables() if [ -z $ARCHITECTURE ]; then ARCHITECTURE=`uname -m` + if [ $ARCHITECTURE == "x86_64" ]; then + ARCHITECTURE="amd64" + fi fi } diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index 2ee30e96..5960ab58 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -135,7 +135,7 @@ initializeVariables() DESKTOP_FILE_PATH="$BASE_WORKING_DIR/usr/share/applications" APPLICATION_SHORTCUT="$DESKTOP_FILE_PATH/${APPLICATION_CODE}.desktop" - DESCRIPTION="Interactive white board software" + DESCRIPTION="OpenBoard, an interactive white board application" VERSION=`cat $BUILD_DIR/version` ARCHITECTURE=`cat buildContext` @@ -227,6 +227,8 @@ cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm $PACKAGE_DIRECTORY/i18n/ # ---------------------------------------------------------------------------- # DEBIAN directory of package (control, md5sums, postinst etc) # ---------------------------------------------------------------------------- +notifyProgress "Generating control files for package" + mkdir -p "$BASE_WORKING_DIR/DEBIAN" # Copy prerm, postinst scripts @@ -242,7 +244,7 @@ find $DESKTOP_FILE_PATH/ -exec md5sum {} > $BASE_WORKING_DIR/DEBIAN/md5sums 2>/d # Generate control file CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control" -echo "Package: ${APPLICATION_NAME}" > "$CONTROL_FILE" +echo "Package: ${APPLICATION_CODE}" > "$CONTROL_FILE" echo "Version: $VERSION" >> "$CONTROL_FILE" echo "Section: education" >> "$CONTROL_FILE" echo "Priority: optional" >> "$CONTROL_FILE" @@ -287,11 +289,11 @@ mkdir -p $DESKTOP_FILE_PATH echo "[Desktop Entry]" > $APPLICATION_SHORTCUT echo "Version=$VERSION" >> $APPLICATION_SHORTCUT echo "Encoding=UTF-8" >> $APPLICATION_SHORTCUT -echo "Name=${APPLICATION_NAME} ($VERSION)" >> $APPLICATION_SHORTCUT +echo "Name=${APPLICATION_NAME}" >> $APPLICATION_SHORTCUT echo "Comment=$DESCRIPTION" >> $APPLICATION_SHORTCUT #echo "Exec=$APPLICATION_PATH/$APPLICATION_CODE/run.sh" >> $APPLICATION_SHORTCUT echo "Exec=$APPLICATION_CODE %f" >> $APPLICATION_SHORTCUT -echo "Icon=$APPLICATION_PATH/$APPLICATION_CODE/${APPLICATION_NAME}.png" >> $APPLICATION_SHORTCUT +echo "Icon=/$APPLICATION_PATH/$APPLICATION_CODE/${APPLICATION_NAME}.png" >> $APPLICATION_SHORTCUT echo "StartupNotify=true" >> $APPLICATION_SHORTCUT echo "Terminal=false" >> $APPLICATION_SHORTCUT echo "Type=Application" >> $APPLICATION_SHORTCUT @@ -311,7 +313,7 @@ PACKAGE_NAME=`echo "$PACKAGE_NAME" | awk '{print tolower($0)}'` dpkg -b "$BASE_WORKING_DIR" "$PACKAGE_BUILD_DIR/linux/$PACKAGE_NAME" #clean up mess -#rm -rf $BASE_WORKING_DIR +rm -rf $BASE_WORKING_DIR notifyProgress "${APPLICATION_NAME}" "Package built" From e5445f2b4382d67c528388e69676dfcd11b1f5fd Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 19 Apr 2016 11:52:29 +0200 Subject: [PATCH 6/9] Add support for opening UBZ files on Linux --- release_scripts/linux/debian_package_files/postinst | 4 ++++ release_scripts/linux/package.sh | 1 + resources/linux/openboard-ubz.xml | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 resources/linux/openboard-ubz.xml diff --git a/release_scripts/linux/debian_package_files/postinst b/release_scripts/linux/debian_package_files/postinst index f3152d3b..c1e93d0e 100644 --- a/release_scripts/linux/debian_package_files/postinst +++ b/release_scripts/linux/debian_package_files/postinst @@ -15,5 +15,9 @@ # --------------------------------------------------------------------- xdg-desktop-menu install --novendor /usr/share/applications/openboard.desktop +xdg-mime install /opt/openboard/etc/openboard-ubz.xml +xdg-mime default /usr/share/applications/openboard.desktop application/ubz + ln -s /opt/openboard/run.sh /usr/bin/openboard + exit 0 diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index 5960ab58..dfb57d8e 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -297,6 +297,7 @@ echo "Icon=/$APPLICATION_PATH/$APPLICATION_CODE/${APPLICATION_NAME}.png" >> $APP echo "StartupNotify=true" >> $APPLICATION_SHORTCUT echo "Terminal=false" >> $APPLICATION_SHORTCUT echo "Type=Application" >> $APPLICATION_SHORTCUT +echo "MimeType=application/ubz" echo "Categories=Education;" >> $APPLICATION_SHORTCUT cp "resources/images/${APPLICATION_NAME}.png" "$PACKAGE_DIRECTORY/${APPLICATION_NAME}.png" diff --git a/resources/linux/openboard-ubz.xml b/resources/linux/openboard-ubz.xml new file mode 100644 index 00000000..cda36e1d --- /dev/null +++ b/resources/linux/openboard-ubz.xml @@ -0,0 +1,8 @@ + + + + OpenBoard document file + Document OpenBoard + + + From 85d5d6c3a29fb13c281fff75613db8e97d493529 Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 19 Apr 2016 13:28:04 +0200 Subject: [PATCH 7/9] corrected ubz association on linux --- release_scripts/linux/debian_package_files/postinst | 2 +- release_scripts/linux/package.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/release_scripts/linux/debian_package_files/postinst b/release_scripts/linux/debian_package_files/postinst index c1e93d0e..dd388664 100644 --- a/release_scripts/linux/debian_package_files/postinst +++ b/release_scripts/linux/debian_package_files/postinst @@ -14,8 +14,8 @@ # along with this program. If not, see . # --------------------------------------------------------------------- +xdg-mime install --mode system /opt/openboard/etc/openboard-ubz.xml xdg-desktop-menu install --novendor /usr/share/applications/openboard.desktop -xdg-mime install /opt/openboard/etc/openboard-ubz.xml xdg-mime default /usr/share/applications/openboard.desktop application/ubz ln -s /opt/openboard/run.sh /usr/bin/openboard diff --git a/release_scripts/linux/package.sh b/release_scripts/linux/package.sh index dfb57d8e..660ca553 100755 --- a/release_scripts/linux/package.sh +++ b/release_scripts/linux/package.sh @@ -31,7 +31,7 @@ # | | openboard <-- actually a symlink to run.sh # | share/ # | | applications/ -# | | | OpenBoard.desktop +# | | | openboard.desktop # opt/ # | openboard/ # | | importer/ @@ -175,6 +175,7 @@ chmod a+x $PACKAGE_DIRECTORY/run.sh cp -R resources/customizations $PACKAGE_DIRECTORY/ cp -R resources/linux/qtlinux/* $PACKAGE_DIRECTORY/ +cp resources/linux/openboard-ubz.xml $PACKAGE_DIRECTORY/etc/ notifyProgress "Copying importer" mkdir -p $PACKAGE_DIRECTORY/importer @@ -297,7 +298,7 @@ echo "Icon=/$APPLICATION_PATH/$APPLICATION_CODE/${APPLICATION_NAME}.png" >> $APP echo "StartupNotify=true" >> $APPLICATION_SHORTCUT echo "Terminal=false" >> $APPLICATION_SHORTCUT echo "Type=Application" >> $APPLICATION_SHORTCUT -echo "MimeType=application/ubz" +echo "MimeType=application/ubz;" >> $APPLICATION_SHORTCUT echo "Categories=Education;" >> $APPLICATION_SHORTCUT cp "resources/images/${APPLICATION_NAME}.png" "$PACKAGE_DIRECTORY/${APPLICATION_NAME}.png" From 5be27ff3c0497897debc9d6f730f6f198fb2db98 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 19 Apr 2016 14:08:51 +0200 Subject: [PATCH 8/9] Corrected release script for OSX following its relocation --- release_scripts/osx/release.macx.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/release_scripts/osx/release.macx.sh b/release_scripts/osx/release.macx.sh index b3a0d3a4..4d0b1ea3 100755 --- a/release_scripts/osx/release.macx.sh +++ b/release_scripts/osx/release.macx.sh @@ -14,13 +14,16 @@ # along with this program. If not, see . # --------------------------------------------------------------------- +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 From 88c1feaf3084de0b3a3ef968ae71328115e19b52 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 19 Apr 2016 14:27:21 +0200 Subject: [PATCH 9/9] Fixed release script on Windows following its relocation --- release_scripts/windows/release.win7.vc9.bat | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/release_scripts/windows/release.win7.vc9.bat b/release_scripts/windows/release.win7.vc9.bat index 0052307f..2f2c1efd 100644 --- a/release_scripts/windows/release.win7.vc9.bat +++ b/release_scripts/windows/release.win7.vc9.bat @@ -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 . 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