summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-26 19:08:00 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-26 19:08:00 +0200
commit155a9e828defcf350af8df1f79694b01daf6ab5d (patch)
treee8a6540d7d3bd657a34513c81796b2a6f325acf0
parentAdd date separator in the timeline (diff)
downloadnheko-155a9e828defcf350af8df1f79694b01daf6ab5d.tar.xz
Add deb and rpm packages on releases
-rwxr-xr-x.ci/linux/create-packages.sh49
-rw-r--r--.travis.yml12
-rw-r--r--CMakeLists.txt15
-rw-r--r--Dockerfile3
-rw-r--r--Makefile9
5 files changed, 81 insertions, 7 deletions
diff --git a/.ci/linux/create-packages.sh b/.ci/linux/create-packages.sh
new file mode 100755
index 00000000..c814882b
--- /dev/null
+++ b/.ci/linux/create-packages.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+#
+# Create deb & rpm packages from the AppImage.
+#
+
+DIR=package.dir
+VERSION=`git tag -l --points-at HEAD`
+
+# Installing dependencies on travis.
+if [ ! -z "$TRAVIS_OS_NAME" ]; then
+    sudo apt-add-repository -y ppa:brightbox/ruby-ng
+    sudo apt-get update -qq
+    sudo apt-get install -y ruby2.1 ruby-switch
+    sudo ruby-switch --set ruby2.1
+    sudo apt-get install -y ruby2.1-dev rpm libffi-dev
+
+    sudo gem install --no-ri --no-rdoc fpm
+fi
+
+# Set up deb structure.
+mkdir -p ${DIR}/usr/{bin,share/pixmaps,share/applications}
+
+# Copy resources.
+cp nheko*.AppImage ${DIR}/usr/bin/nheko
+cp resources/nheko.desktop ${DIR}/usr/share/applications/nheko.desktop
+cp resources/nheko.png ${DIR}/usr/share/pixmaps/nheko.png
+
+for iconSize in 16 32 48 64 128 256 512; do
+    IconDir=${DIR}/usr/share/icons/hicolor/${iconSize}x${iconSize}/apps
+    mkdir -p ${IconDir}
+    cp resources/nheko-${iconSize}.png ${IconDir}/nheko.png
+done
+
+fpm --force \
+    -s dir \
+    --output-type deb \
+    --name nheko \
+    --description "Desktop client for the Matrix protocol" \
+    --url "https://github.com/mujx/nheko" \
+    --version ${VERSION} \
+    --architecture x86_64 \
+    --maintainer "mujx (https://github.com/mujx)" \
+    --license "GPLv3" \
+    --prefix / \
+    --deb-no-default-config-files \
+    --chdir ${DIR} usr
+
+fpm -s deb -t rpm nheko_${VERSION}_amd64.deb
diff --git a/.travis.yml b/.travis.yml
index d23a67f8..fc12043b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,6 +52,11 @@ script:
     - if [ $TRAVIS_OS_NAME == osx ]; then make lint; fi
     - if [ $TRAVIS_OS_NAME == osx ] && [ $DEPLOYMENT == 1 ]; then ./.ci/macos/deploy.sh; fi
     - if [ $TRAVIS_OS_NAME == linux ] && [ $DEPLOYMENT == 1 ]; then ./.ci/linux/deploy.sh; fi
+    - if [ $TRAVIS_OS_NAME == linux ] && [ $DEPLOYMENT == 1 ]; then ./.ci/linux/create-packages.sh; fi
+
+before_deploy:
+  - export RELEASE_DEB_FILE=$(ls *.deb)
+  - export RELEASE_RPM_FILE=$(ls *.rpm)
 
 deploy:
     - skip_cleanup: true
@@ -59,11 +64,16 @@ deploy:
       provider: releases
       api_key:
           secure: oprXzESukFiXBeF2BXkXUlegsAQc95Ub4kc/OkoNFaYBvqpA+IGpWHmHCx5JPny/OT3Kc2Urpe2JUeGSWDHZ7UCKDjH+NzGP3uN82fHh/HiszG/Srw7+hWEHm1ve+gMK9GS8pr+yUsUrPP0UfVXlPoI4pBWa4zGi2Ndb/SqvjCgIHFLtGyoBo6CydKQ/AyWiXSMKDfJL+Dx4JLIPP4RTCBJy8ZrZ8m/a5Tgy4Ij6+djjrgYCZCEhGxSYw7xDIT/9SV8g9NkrbisqBDrILzAH8Yhe4XMRMXo88OAxV5+Vb9Rw1hrqczez6lpFDbJetv8MjofND+pSoAFwtjaL1wTFK9Ud6w4O9AuHlEQH9cGVdvsxFcosRwJVh58x51JM9ptoktqhx/HHJBTuCHCYYlHwtRwbwqnMYdLzKZG5FnujT8DG+9mcva1fL6tzW/XD505VPMWwXFC/2/pvolgAkTFFXYSALAwZlK3IgoXU8Gok/3B4iHofzQsFf6Yq3BI/88x7tVASUqiYhoKrO50+gb6pNIRCyWgGUiBEVXBp6Ziq3ORQPyQJg7i9HHUGTUu74yvGLHWLwjNQzZP/hxJZK3VlJxzyXntdOxiJc8iOzNrU+rPKBAlAaE6bQDOoniIysEgdD5BXHTLFzPvts4P1n2Ckor5/rNJ+qXR8GU+/y7e1GKU=
-      file: nheko-x86_64.AppImage
+      file_glob: true
+      file:
+        - nheko-x86_64.AppImage
+        - $RELEASE_DEB_FILE
+        - $RELEASE_RPM_FILE
       on:
           condition: $TRAVIS_OS_NAME == linux && $DEPLOYMENT == 1
           repo: mujx/nheko
           tags: true
+
     - skip_cleanup: true
       overwrite: true
       provider: releases
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88750b7d..3085cc76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -291,12 +291,15 @@ add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})
 
 # Generate a qrc file for the translations
 set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
-file(WRITE ${_qrc} "<RCC> <qresource prefix=\"/translations\">")
-foreach(_lang ${QM_SRC})
-    get_filename_component(_filename ${_lang} NAME)
-    file(APPEND ${_qrc} "<file>${_filename}</file>")
-endforeach(_lang)
-file(APPEND ${_qrc} "</qresource> </RCC>")
+
+if(NOT EXISTS ${_qrc})
+    file(WRITE ${_qrc} "<RCC> <qresource prefix=\"/translations\">")
+    foreach(_lang ${QM_SRC})
+        get_filename_component(_filename ${_lang} NAME)
+        file(APPEND ${_qrc} "<file>${_filename}</file>")
+    endforeach(_lang)
+    file(APPEND ${_qrc} "</qresource> </RCC>")
+endif()
 
 qt5_add_resources(LANG_QRC ${_qrc})
 qt5_add_resources(QRC resources/res.qrc)
diff --git a/Dockerfile b/Dockerfile
index 3d94592d..d800a167 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,6 +31,9 @@ RUN update-alternatives --install \
         clang-format \
         /usr/bin/clang-format-5.0 100
 
+RUN apt-get -y install ruby ruby-dev rubygems rpm && \
+    gem install --no-ri --no-rdoc fpm
+
 ENV PATH=/opt/qt59/bin:$PATH
 
 RUN mkdir /build
diff --git a/Makefile b/Makefile
index 2467189f..424f39ac 100644
--- a/Makefile
+++ b/Makefile
@@ -41,5 +41,14 @@ docker-app-image: image
 		--privileged \
 		-v `pwd`:/build nheko-app-image make linux-appimage
 
+docker-packages: image
+	docker run \
+		-e CXX=g++-7 \
+		-e CC=gcc-7 \
+		-v `pwd`:/build nheko-app-image make release
+	docker run \
+		--privileged \
+		-v `pwd`:/build nheko-app-image ./.ci/linux/create-packages.sh
+
 clean:
 	rm -rf build