changeset 885:1cc85fd3daa5

(issue70) Handle i386 and amd64 packages
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 08 Aug 2014 10:56:24 +0200
parents 6abf8e77cd5f
children 197c594aad2b
files packaging/create-dist-package.sh.in ui/createinstallerdialog.cpp ui/mainwindow.cpp
diffstat 3 files changed, 55 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/create-dist-package.sh.in	Fri Aug 08 10:49:16 2014 +0200
+++ b/packaging/create-dist-package.sh.in	Fri Aug 08 10:56:24 2014 +0200
@@ -9,13 +9,34 @@
     exit 1
 fi
 
+if [ ! -f @CMAKE_SOURCE_DIR@/build-windows/Makefile ]; then
+    echo "Could not find a windows build in: @CMAKE_SOURCE_DIR@/build-windows "
+    exit 1
+fi
+
+if [ ! -f @CMAKE_SOURCE_DIR@/build-i386/Makefile ]; then
+    echo "Could not find a i386 build in: @CMAKE_SOURCE_DIR@/build-i386 "
+    exit 1
+fi
+
 TMPD=$(mktemp -d)
 TMPDIR=$TMPD/TrustBridge-@PROJECT_VERSION@
+cd @CMAKE_SOURCE_DIR@/build-windows
+echo "Updating windows build"
+make
+cd @CMAKE_SOURCE_DIR@/build-i386
+echo "Building x86 package"
+make
+/bin/bash packaging/linux-createpackage.sh
 cd @CMAKE_BINARY_DIR@
+echo "Building amd64 package"
 /bin/bash packaging/linux-createpackage.sh
 mkdir -p $TMPDIR/linux
 mkdir -p $TMPDIR/windows
-mv @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh $TMPDIR/linux
+mv @CMAKE_BINARY_DIR@/TrustBridge-@PROJECT_VERSION@.sh \
+    $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-amd64.sh
+mv @CMAKE_SOURCE_DIR@/build-i386/TrustBridge-@PROJECT_VERSION@.sh \
+    $TMPDIR/linux/TrustBridge-@PROJECT_VERSION@-i386.sh
 cp @CMAKE_SOURCE_DIR@/build-windows/ui/trustbridge.exe $TMPDIR/windows
 cp @CMAKE_SOURCE_DIR@/build-windows/cinst/cinst.exe $TMPDIR/windows
 cp @CMAKE_SOURCE_DIR@/build-windows/cinst/mozilla.exe $TMPDIR/windows
--- a/ui/createinstallerdialog.cpp	Fri Aug 08 10:49:16 2014 +0200
+++ b/ui/createinstallerdialog.cpp	Fri Aug 08 10:56:24 2014 +0200
@@ -247,22 +247,31 @@
                 .arg(linuxDir.path()));
         return;
     }
-    if (candidates.size() > 1) {
-        showErrorMessage(tr("Unexpected additional .sh files in: %1")
-                .arg(linuxDir.path()));
-        return;
-    }
-    mProgress.setLabelText(tr("Signing Linux package..."));
-    mProgress.cancel();
 
-    QString outFileName = options.value("setupname", "TrustBridge-default.exe"
-            ).toString().replace(".exe", ".sh").arg(QString());
+    foreach (const QString& candidate, candidates) {
+        mProgress.setLabelText(tr("Signing Linux package..."));
+        mProgress.cancel();
 
-    if (!appendTextSignatureToFile(linuxDir.path() + "/" + candidates.first(),
-                outDir.path() + "/" + outFileName)) {
-        qDebug() << "Failed to sign linux package.";
-        mProgress.close();
-        return;
+        bool x86arch;
+        if (candidate.endsWith("-i386.sh")) {
+            x86arch = true;
+        } else if (candidate.endsWith("-amd64.sh")) {
+            x86arch = false;
+        } else {
+            qDebug() << "Could not detrmine architecture of " << candidate;
+            qDebug() << "Skipping.";
+        }
+
+        QString outFileName = options.value("setupname", "TrustBridge-default.exe"
+                ).toString().replace(".exe",
+                    x86arch ? "-x86arch.sh" : "-64bit.sh").arg(QString());
+
+        if (!appendTextSignatureToFile(linuxDir.path() + "/" + candidate,
+                    outDir.path() + "/" + outFileName)) {
+            showErrorMessage(tr("Failed to sign linux package: %1").arg(candidate));
+            mProgress.close();
+            return;
+        }
     }
 
     /* The Windows installer */
--- a/ui/mainwindow.cpp	Fri Aug 08 10:49:16 2014 +0200
+++ b/ui/mainwindow.cpp	Fri Aug 08 10:56:24 2014 +0200
@@ -55,14 +55,20 @@
 
 #define SERVER_URL "https://files.intevation.de:443"
 
+#if defined(_X86_) || defined(__i386__)
+#define TB_ARCH_STRING "-i386"
+#else
+#define TB_ARCH_STRING "-amd64"
+#endif
+
 #ifdef RELEASE_BUILD
 # define LIST_RESOURCE "/users/aheinecke/zertifikatsliste.txt"
 # ifdef Q_OS_WIN
 #  define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.exe"
 #  define SW_RESOURCE "/users/aheinecke/TrustBridge.exe"
 # else
-#  define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.sh"
-#  define SW_RESOURCE "/users/aheinecke/TrustBridge.sh"
+#  define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1" TB_ARCH_STRING ".sh"
+#  define SW_RESOURCE "/users/aheinecke/TrustBridge" TB_ARCH_STRING ".sh"
 # endif
 #else // RELEASE_BUILD
 # define LIST_RESOURCE "/users/aheinecke/development/zertifikatsliste.txt"
@@ -70,8 +76,8 @@
 #  define SW_RESOURCE_VERSION "/users/aheinecke/development/TrustBridge-development.exe"
 #  define SW_RESOURCE "/users/aheinecke/development/TrustBridge.exe"
 # else
-#  define SW_RESOURCE_VERSION "/users/aheinecke/development/TrustBridge-development.sh"
-#  define SW_RESOURCE "/users/aheinecke/development/TrustBridge.sh"
+#  define SW_RESOURCE_VERSION "/users/aheinecke/development/TrustBridge-development" TB_ARCH_STRING ".sh"
+#  define SW_RESOURCE "/users/aheinecke/development/TrustBridge" TB_ARCH_STRING ".sh"
 # endif
 #endif
 

http://wald.intevation.org/projects/trustbridge/