last cosmetics on this script

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 4027a6e7b5
commit 5212f4e222
  1. 194
      buildDebianPackage

@ -14,22 +14,37 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------
MAKE_TAG=true
CREATE_DIENA_DISTRIBUTION_ZIP=false
#**********************
# functions
#**********************
initializeVariables()
{
MAKE_TAG=true
CREATE_DIENA_DISTRIBUTION_ZIP=false
PRODUCT_PATH="build/linux/release/product"
QT_PATH="/usr/local/Trolltech/Qt-4.8.0"
PLUGINS_PATH="$QT_PATH/plugins"
GUI_TRANSLATIONS_DIRECTORY_PATH="../Qt-4.8/translations"
QT_LIBRARY_DEST_PATH="$PRODUCT_PATH/qtlib"
QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib"
ARCHITECTURE=`uname -m`
if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64"
fi
if [ "$ARCHITECTURE" == "i686" ]; then
ARCHITECTURE="i386"
fi
NOTIFY_CMD=`which notify-send`
QMAKE_PATH="$QT_PATH/bin/qmake"
LRELEASES="$QT_PATH/bin/lrelease"
ZIP_PATH=`which zip`
for var in "$@"
do
if [ $var == "notag" ]; then
MAKE_TAG=false;
fi
if [ $var == "diena" ]; then
CREATE_DIENA_DISTRIBUTION_ZIP=true;
fi
done
}
NOTIFY_CMD=`which notify-send`
notifyError(){
if [ -e "$NOTIFY_CMD" ]; then
@ -60,30 +75,70 @@ alertIfPreviousVersionInstalled(){
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 $QT_LIBRARY_SOURCE_PATH/$1.so.? "$QT_LIBRARY_DEST_PATH/"
cp $QT_LIBRARY_SOURCE_PATH/$1.so.?.?.? "$QT_LIBRARY_DEST_PATH/"
else
notifyError "$1 library not found in path: $QT_LIBRARY_SOURCE_PATH"
fi
}
#**********************
# script
#**********************
initializeVariables
for var in "$@"
do
if [ $var == "notag" ]; then
MAKE_TAG=false;
fi
if [ $var == "diena" ]; then
CREATE_DIENA_DISTRIBUTION_ZIP=true;
fi
done
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
# cleaning the build directory
rm -rf "build/linux/release"
rm -rf install
QT_PATH="/usr/local/Trolltech/Qt-4.8.0"
PLUGINS_PATH="$QT_PATH/plugins"
QMAKE_PATH="$QT_PATH/bin/qmake"
LRELEASES="$QT_PATH/bin/lrelease"
GUI_TRANSLATIONS_DIRECTORY_PATH="../Qt-4.8/translations"
ARCHITECTURE=`uname -m`
if [ ! -e "$QMAKE_PATH" ]; then
notifyError "qmake command not found at $QMAKE_PATH"
fi
if [ ! -e "$PLUGINS_PATH" ]; then
notifyError "plugins path not found at $PLUGINS_PATH"
fi
notifyProgress "QT" "Internalization"
$LRELEASES Sankore_3.1.pro
cd $GUI_TRANSLATIONS_DIRECTORY_PATH
$LRELEASES translations.pro
cd -
notifyProgress "Open-Sankore" "Building Open-Sankore ..."
notifyProgress "Open-Sankore" "Building Open-Sankore"
if [ "$ARCHITECTURE" == "x86_64" ]; then
if [ "$ARCHITECTURE" == "amd64" ]; then
$QMAKE_PATH Sankore_3.1.pro -spec linux-g++-64
else
$QMAKE_PATH Sankore_3.1.pro -spec linux-g++
@ -91,7 +146,7 @@ fi
make -j 4 release-install
if [ ! -e "build/linux/release/product/Open-Sankore" ]; then
if [ ! -e "$PRODUCT_PATH/Open-Sankore" ]; then
notifyError "Open-Sankore build failed"
fi
@ -104,35 +159,23 @@ if [ ! -f build/linux/release/version ]; then
else
LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`"
if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then
notifyProgress creating a tag with the version $VERSION
if [ $MAKE_TAG == true ]; then
if [ $MAKE_TAG == true ]; then
git tag -a "v$VERSION" -m "Generating setup for v$VERSION"
git push origin --tags
fi
fi
fi
cp resources/linux/run.sh build/linux/release/product
chmod +x build/linux/release/product/run.sh
cp resources/linux/run.sh $PRODUCT_PATH
chmod a+x $PRODUCT_PATH/run.sh
cp -R resources/linux/qtlinux/* build/linux/release/product/
cp -R resources/linux/qtlinux/* $PRODUCT_PATH/
notifyProgress "QT" "Coping plugins and library ..."
cp -R $PLUGINS_PATH build/linux/release/product/
cp -R $PLUGINS_PATH $PRODUCT_PATH/
#copying custom qt library
QT_LIBRARY_DEST_PATH="build/linux/release/product/qtlib"
mkdir $QT_LIBRARY_DEST_PATH
QT_LIBRARY_SOURCE_PATH="$QT_PATH/lib"
copyQtLibrary(){
if [ ! -e "$QT_LIBRARY_SOURCE_PATH/$1.so.4.8.0" ]; then
notifyError "$1 library not found in path: $QT_LIBRARY_SOURCE_PATH"
fi
cp "$QT_LIBRARY_SOURCE_PATH/$1.so.4" "$QT_LIBRARY_DEST_PATH/"
cp "$QT_LIBRARY_SOURCE_PATH/$1.so.4.8.0" "$QT_LIBRARY_DEST_PATH/"
}
mkdir -p $QT_LIBRARY_DEST_PATH
copyQtLibrary libQtDBus
copyQtLibrary libQtScript
copyQtLibrary libQtSvg
@ -141,49 +184,25 @@ copyQtLibrary libQtNetwork
copyQtLibrary libQtXml
copyQtLibrary libQtGui
copyQtLibrary libQtCore
copyQtLibrary libphonon
copyQtLibrary libQtWebKit
if [ ! -e "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4.4.0" ]; then
notifyError "phonon library not found in path: $QT_LIBRARY_SOURCE_PATH"
else
cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4" "$QT_LIBRARY_DEST_PATH/"
cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4.4.0" "$QT_LIBRARY_DEST_PATH/"
notifyProgress "QT" "Internalization"
if [ ! -e $PRODUCT_PATH/i18n ]; then
mkdir $PRODUCT_PATH/i18n
fi
if [ ! -e "$QT_LIBRARY_SOURCE_PATH/libQtWebKit.so.4.9.0" ]; then
notifyError "webkit library not found in path: $QT_LIBRARY_SOURCE_PATH"
else
cp "$QT_LIBRARY_SOURCE_PATH/libQtWebKit.so.4" "$QT_LIBRARY_DEST_PATH/"
cp "$QT_LIBRARY_SOURCE_PATH/libQtWebKit.so.4.9.0" "$QT_LIBRARY_DEST_PATH/"
fi
notifyProgress "QT" "Internalization ..."
if [ ! -e $GUI_TRANSLATIONS_DIRECTORY_PATH ]; then
notifyError "gui translations pro file not found at: $GUI_TRANSLATIONS_DIRECTORY_PATH"
else
cd $GUI_TRANSLATIONS_DIRECTORY_PATH
$LRELEASES translations.pro
cd -
if [ ! -e build/linux/release/product/i18n ]; then
mkdir build/linux/release/product/i18n
fi
#copying qt gui translation
cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm build/linux/release/product/i18n/
fi
$LRELEASES Sankore_3.1.pro
cp resources/i18n/*.qm build/linux/release/product/i18n/
#copying qt gui translation
cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm $PRODUCT_PATH/i18n/
rm -rf install/linux
mkdir -p install/linux
cd build/linux/release/product
#Removing .svn directories ...
cd $PRODUCT_PATH
find . -name .svn -exec rm -rf {} \; 2> /dev/null
cd -
notifyProgress "Building Sankore" "Finished to build Sankore building the package"
notifyProgress "Building Sankore" "Finished to build Sankore building the package"
BASE_WORKING_DIR="packageBuildDir"
@ -242,7 +261,7 @@ EOF
SANKORE_DIRECTORY_NAME="Open-Sankore-$VERSION"
SANKORE_PACKAGE_DIRECTORY="$BASE_WORKING_DIR/usr/local/$SANKORE_DIRECTORY_NAME"
#move sankore build directory to packages directory
cp -R build/linux/release/product $SANKORE_PACKAGE_DIRECTORY
cp -R $PRODUCT_PATH $SANKORE_PACKAGE_DIRECTORY
cat > $BASE_WORKING_DIR/usr/local/$SANKORE_DIRECTORY_NAME/run.sh << EOF
@ -270,14 +289,6 @@ CHANGE_LOG_FILE="$BASE_WORKING_DIR/DEBIAN/changelog-sankore-$VERSION.txt"
CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control"
CHANGE_LOG_TEXT="changelog.txt"
if [ "$ARCHITECTURE" == "x86_64" ]; then
ARCHITECTURE="amd64"
fi
if [ "$ARCHITECTURE" == "i686" ]; then
ARCHITECTURE="i386"
fi
echo "Open-Sankore ($VERSION) $ARCHITECTURE; urgency=low" > "$CHANGE_LOG_FILE"
echo >> "$CHANGE_LOG_FILE"
cat $CHANGE_LOG_TEXT >> "$CHANGE_LOG_FILE"
@ -352,9 +363,8 @@ if [ $CREATE_DIENA_DISTRIBUTION_ZIP == true ]; then
ZIP_NAME="Open-Sankoré_`lsb_release -is`_`lsb_release -rs`_${VERSION}_${ARCHITECTURE}.zip"
cd install/linux
`which zip` -1 --junk-paths ${ZIP_NAME} ${DEBIAN_PACKAGE_NAME} ../../ReleaseNotes.pdf ../../JournalDesModifications.pdf
$ZIP_PATH -1 --junk-paths ${ZIP_NAME} ${DEBIAN_PACKAGE_NAME} ../../ReleaseNotes.pdf ../../JournalDesModifications.pdf
cd -
notifyProgress "Open-Sankore" "Build Diena zip file for distribution"
fi

Loading…
Cancel
Save