summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.ci/macos/deploy.sh8
-rw-r--r--.ci/windows/nheko.nsi225
-rw-r--r--.travis.yml2
-rw-r--r--CMakeLists.txt35
-rw-r--r--Makefile21
-rw-r--r--appveyor.yml69
-rw-r--r--cmake/MacOSXBundleInfo.plist.in36
-rw-r--r--cmake/QtCommon.cmake76
-rw-r--r--cmake/windows_metafile.rc.in28
-rw-r--r--deploy/installer/cleanup/installscript.qs28
-rw-r--r--deploy/installer/cleanup/package.xml10
-rw-r--r--deploy/installer/config.xml15
-rw-r--r--deploy/installer/controlscript.qs25
-rw-r--r--deploy/installer/gui/installscript.qs32
-rw-r--r--deploy/installer/gui/package.xml14
-rw-r--r--deploy/installer/uninstall.qs18
-rw-r--r--dist/MacOS/nheko.app/Contents/Info.plist33
-rw-r--r--dist/MacOS/nheko.app/Contents/MacOS/.gitkeep0
-rw-r--r--dist/MacOS/nheko.app/Contents/Resources/nheko.icnsbin118837 -> 0 bytes
-rw-r--r--include/events/Event.h26
-rw-r--r--src/events/Event.cc26
-rw-r--r--tests/events.cc246
22 files changed, 555 insertions, 418 deletions
diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh
index 7e551e9d..76346d47 100755
--- a/.ci/macos/deploy.sh
+++ b/.ci/macos/deploy.sh
@@ -5,9 +5,7 @@ set -e
# Add Qt binaries to path
PATH=/usr/local/opt/qt/bin/:${PATH}
-cp -fp ./build/nheko dist/MacOS/Nheko.app/Contents/MacOS
-
-sudo macdeployqt dist/MacOS/Nheko.app -dmg
+sudo macdeployqt build/nheko.app -dmg
user=$(id -nu)
-sudo chown ${user} dist/MacOS/Nheko.dmg
-mv dist/MacOS/Nheko.dmg .
+sudo chown ${user} build/nheko.dmg
+mv build/nheko.dmg .
diff --git a/.ci/windows/nheko.nsi b/.ci/windows/nheko.nsi
deleted file mode 100644
index cc674249..00000000
--- a/.ci/windows/nheko.nsi
+++ /dev/null
@@ -1,225 +0,0 @@
-############################################################################################
-# NSIS Installation Script created by NSIS Quick Setup Script Generator v1.09.18
-# Entirely Edited with NullSoft Scriptable Installation System
-# by Vlasis K. Barkas aka Red Wine red_wine@freemail.gr Sep 2006
-############################################################################################
-
-!define APP_NAME "nheko"
-!define COMP_NAME "mujx"
-!define WEB_SITE "https://github.com/mujx/nheko"
-!define VERSION "0.1.0.0"
-!define COPYRIGHT "mujx � 2017"
-!define DESCRIPTION "Desktop client for the Matrix protocol"
-!define LICENSE_TXT "LICENSE.txt"
-!define INSTALLER_NAME "..\..\nheko_setup.exe"
-!define INPUT_DIR "..\..\NhekoRelease"
-!define MAIN_APP_EXE "nheko.exe"
-!define INSTALL_TYPE "SetShellVarContext all"
-!define REG_ROOT "HKLM"
-!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
-!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
-
-!define REG_START_MENU "Start Menu Folder"
-
-var SM_Folder
-
-######################################################################
-
-VIProductVersion "${VERSION}"
-VIAddVersionKey "ProductName" "${APP_NAME}"
-VIAddVersionKey "CompanyName" "${COMP_NAME}"
-VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
-VIAddVersionKey "FileDescription" "${DESCRIPTION}"
-VIAddVersionKey "FileVersion" "${VERSION}"
-
-######################################################################
-
-SetCompressor ZLIB
-Name "${APP_NAME}"
-Caption "${APP_NAME}"
-OutFile "${INSTALLER_NAME}"
-BrandingText "${APP_NAME}"
-XPStyle on
-InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
-InstallDir "$PROGRAMFILES\nheko"
-
-######################################################################
-
-!include "MUI.nsh"
-
-!define MUI_ICON "..\..\resources\nheko.ico"
-!define MUI_HEADERIMAGE
-!define MUI_HEADERIMAGE_BITMAP "..\..\resources\nheko.bmp"
-!define MUI_HEADERIMAGE_RIGHT
-
-!define MUI_ABORTWARNING
-!define MUI_UNABORTWARNING
-
-!insertmacro MUI_PAGE_WELCOME
-
-!ifdef LICENSE_TXT
-!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
-!endif
-
-!insertmacro MUI_PAGE_DIRECTORY
-
-!ifdef REG_START_MENU
-!define MUI_STARTMENUPAGE_DEFAULTFOLDER "nheko"
-!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
-!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
-!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
-!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
-!endif
-
-!insertmacro MUI_PAGE_INSTFILES
-
-!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}"
-!insertmacro MUI_PAGE_FINISH
-
-!insertmacro MUI_UNPAGE_CONFIRM
-
-!insertmacro MUI_UNPAGE_INSTFILES
-
-!insertmacro MUI_UNPAGE_FINISH
-
-!insertmacro MUI_LANGUAGE "English"
-
-######################################################################
-
-Section -MainProgram
-${INSTALL_TYPE}
-SetOverwrite ifnewer
-SetOutPath "$INSTDIR"
-File /r "${INPUT_DIR}\*"
-SectionEnd
-
-######################################################################
-
-Section -Icons_Reg
-SetOutPath "$INSTDIR"
-WriteUninstaller "$INSTDIR\uninstall.exe"
-
-!ifdef REG_START_MENU
-!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
-CreateDirectory "$SMPROGRAMS\$SM_Folder"
-CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
-CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
-CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
-
-!ifdef WEB_SITE
-WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
-CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
-!endif
-!insertmacro MUI_STARTMENU_WRITE_END
-!endif
-
-!ifndef REG_START_MENU
-CreateDirectory "$SMPROGRAMS\nheko"
-CreateShortCut "$SMPROGRAMS\nheko\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
-CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
-CreateShortCut "$SMPROGRAMS\nheko\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
-
-!ifdef WEB_SITE
-WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
-CreateShortCut "$SMPROGRAMS\nheko\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
-!endif
-!endif
-
-WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
-
-!ifdef WEB_SITE
-WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
-!endif
-SectionEnd
-
-######################################################################
-
-Section Uninstall
-${INSTALL_TYPE}
-
-########
-
-!macro BadPathsCheck
-StrCpy $R0 $INSTDIR "" -2
-StrCmp $R0 ":\" bad
-StrCpy $R0 $INSTDIR "" -14
-StrCmp $R0 "\Program Files" bad
-StrCpy $R0 $INSTDIR "" -8
-StrCmp $R0 "\Windows" bad
-StrCpy $R0 $INSTDIR "" -6
-StrCmp $R0 "\WinNT" bad
-StrCpy $R0 $INSTDIR "" -9
-StrCmp $R0 "\system32" bad
-StrCpy $R0 $INSTDIR "" -8
-StrCmp $R0 "\Desktop" bad
-StrCpy $R0 $INSTDIR "" -23
-StrCmp $R0 "\Documents and Settings" bad
-StrCpy $R0 $INSTDIR "" -13
-StrCmp $R0 "\My Documents" bad done
-bad:
- MessageBox MB_OK|MB_ICONSTOP "Install path invalid!"
- Abort
-done:
-!macroend
-
-StrCmp $INSTDIR "" 0 +2
- StrCpy $INSTDIR $EXEDIR
-
-# Check that the uninstall isn't dangerous.
-!insertmacro BadPathsCheck
-
-# Does path end with "\nheko"?
-!define CHECK_PATH "\nheko"
-StrLen $R1 "${CHECK_PATH}"
-StrCpy $R0 $INSTDIR "" -$R1
-StrCmp $R0 "${CHECK_PATH}" +3
- MessageBox MB_YESNO|MB_ICONQUESTION "Unrecognised uninstall path. Continue anyway?" IDYES +2
- Abort
-
-IfFileExists "$INSTDIR\*.*" 0 +2
-IfFileExists "$INSTDIR\nheko.exe" +3
- MessageBox MB_OK|MB_ICONSTOP "Install path invalid!"
- Abort
-
-########
-
-RMDir /r /REBOOTOK $INSTDIR
-
-Delete "$INSTDIR\uninstall.exe"
-!ifdef WEB_SITE
-Delete "$INSTDIR\${APP_NAME} website.url"
-!endif
-
-!ifdef REG_START_MENU
-!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
-Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
-Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk"
-!ifdef WEB_SITE
-Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk"
-!endif
-Delete "$DESKTOP\${APP_NAME}.lnk"
-
-RmDir "$SMPROGRAMS\$SM_Folder"
-!endif
-
-!ifndef REG_START_MENU
-Delete "$SMPROGRAMS\nheko\${APP_NAME}.lnk"
-Delete "$SMPROGRAMS\nheko\Uninstall ${APP_NAME}.lnk"
-!ifdef WEB_SITE
-Delete "$SMPROGRAMS\nheko\${APP_NAME} Website.lnk"
-!endif
-Delete "$DESKTOP\${APP_NAME}.lnk"
-
-RmDir "$SMPROGRAMS\nheko"
-!endif
-
-DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
-DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
-SectionEnd
-
-######################################################################
diff --git a/.travis.yml b/.travis.yml
index 22e28c7f..78d7ee73 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,7 +46,7 @@ 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.dmg
+ file: nheko.dmg
on:
condition: $TRAVIS_OS_NAME == osx
repo: mujx/nheko
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8c1e347..a5a0e28a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,25 @@
cmake_minimum_required(VERSION 3.1)
-project(nheko C CXX)
-
option(BUILD_TESTS "Build all tests" OFF)
option(APPVEYOR_BUILD "Build on appveyor" OFF)
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+# Include Qt basic functions
+include(QtCommon)
+
+project(nheko LANGUAGES C CXX VERSION 0.1.0)
+
+# Set PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK to 0 if not present, needed by add_project_meta
+fix_project_version()
+
+# Set additional project information
+set(COMPANY "Nheko")
+set(COPYRIGHT "Copyright (c) 2017 Mujx")
+set(IDENTIFIER "com.mujx.nheko")
+
+add_project_meta(META_FILES_TO_INCLUDE)
+
#
# LMDB
#
@@ -296,14 +311,6 @@ qt5_add_resources(QRC resources/res.qrc)
add_library(matrix_events ${MATRIX_EVENTS} src/Deserializable.cc)
target_link_libraries(matrix_events Qt5::Core)
-#
-# Bundle icons.
-#
-if (APPLE)
- set(ICON_FILE resources/nheko.icns)
- set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-endif()
-
if (BUILD_TESTS)
enable_testing()
@@ -330,15 +337,15 @@ else()
set (NHEKO_LIBS matrix_events Qt5::Widgets Qt5::Network Qt5::Concurrent ${LMDB_LIBRARY})
endif()
-set (NHEKO_DEPS ${OS_BUNDLE} ${SRC_FILES} ${UI_HEADERS} ${MOC_HEADERS} ${QRC} ${LANG_QRC} ${QM_SRC})
+set (NHEKO_DEPS ${SRC_FILES} ${UI_HEADERS} ${MOC_HEADERS} ${QRC} ${LANG_QRC} ${QM_SRC} ${META_FILES_TO_INCLUDE})
if(APPLE)
- add_executable (nheko ${NHEKO_DEPS})
+ add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras)
elseif(WIN32)
- add_executable (nheko ${ICON_FILE} ${NHEKO_DEPS})
+ add_executable (nheko ${OS_BUNDLE} ${ICON_FILE} ${NHEKO_DEPS})
target_link_libraries (nheko ${NTDLIB} ${NHEKO_LIBS} Qt5::WinMain)
else()
- add_executable (nheko ${NHEKO_DEPS})
+ add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
target_link_libraries (nheko ${NHEKO_LIBS})
endif()
diff --git a/Makefile b/Makefile
index a7565ee5..cb0e6d1b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,4 @@
-APP_NAME = nheko
-MAC_DIST_DIR = dist/MacOS
-APP_TEMPLATE = $(MAC_DIST_DIR)/Nheko.app
-
-# Linux specific helpers
debug:
@cmake -DBUILD_TESTS=OFF -H. -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug
@cmake --build build
@@ -20,19 +15,11 @@ test:
linux-appimage:
@./.ci/linux/deploy.sh
-app: release-debug $(APP_TEMPLATE)
- @cp -fp ./build/$(APP_NAME) $(APP_TEMPLATE)/Contents/MacOS
- @echo "Created '$(APP_NAME).app' in '$(APP_TEMPLATE)'"
-
-app-install: app
- cp -Rf $(APP_TEMPLATE) /Applications/
+macos-app: release-debug
+ @./.ci/macos/deploy.sh
-dmg: app
- hdiutil create $(MAC_DIST_DIR)/Nheko.dmg \
- -volname "$(APP_NAME)" \
- -fs HFS+ \
- -srcfolder $(MAC_DIST_DIR) \
- -ov -format UDZO
+macos-app-install:
+ cp -Rf build/nheko.app /Applications
run:
@./build/nheko
diff --git a/appveyor.yml b/appveyor.yml
index 3bd1dcff..9d28d146 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -15,14 +15,32 @@ build:
install:
- set QT_DIR=C:\Qt\5.8\msvc2015_64
- set PATH=%PATH%;%QT_DIR%\bin;C:\MinGW\bin
- - copy LICENSE .ci\windows\LICENSE.txt
- - cinst nsis --version 3.0 -y -installArgs /D=C:\nsis
build_script:
- - cmake -G "Visual Studio 14 2015 Win64" -H. -Bbuild -DAPPVEYOR_BUILD=ON
+ # VERSION format: branch-master/branch-1.2
+ # INSTVERSION format: x.y.z
+ # WINVERSION format: 9999.0.0.123/1.2.0.234
+ - if "%APPVEYOR_REPO_TAG%"=="false" set INSTVERSION=0.1.0
+ - if "%APPVEYOR_REPO_TAG%"=="false" set VERSION=0.1.0
+ - if "%APPVEYOR_REPO_TAG%"=="false" if "%APPVEYOR_REPO_BRANCH%"=="master" set INSTVERSION=9999.0
+ - if "%APPVEYOR_REPO_TAG%"=="false" set WINVERSION=%INSTVERSION%.0.%APPVEYOR_BUILD_NUMBER%
+ # VERSION format: v1.2.3/v1.3.4
+ # INSTVERSION format: 1.2.3/1.3.4
+ # WINVERSION format: 1.2.3.123/1.3.4.234
+ - if "%APPVEYOR_REPO_TAG%"=="true" set VERSION=%APPVEYOR_REPO_TAG_NAME%
+ - if "%APPVEYOR_REPO_TAG%"=="true" set INSTVERSION=%VERSION:~1%
+ - if "%APPVEYOR_REPO_TAG%"=="true" set WINVERSION=%VERSION:~1%.%APPVEYOR_BUILD_NUMBER%
+ - set DATE=%date:~10,4%-%date:~4,2%-%date:~7,2%
+ - echo %VERSION%
+ - echo %INSTVERSION%
+ - echo %DATE%
+ - cmake -G "Visual Studio 14 2015 Win64" -H. -Bbuild -DAPPVEYOR_BUILD=ON -DCMAKE_BUILD_TYPE=Release
- cmake --build build --config Release
after_build:
+ # Variables
+ - set BUILD=%APPVEYOR_BUILD_FOLDER%
+ - echo %BUILD%
- mkdir NhekoRelease
- copy build\Release\nheko.exe NhekoRelease\nheko.exe
- windeployqt --qmldir C:\Qt\5.8\msvc2015_64\qml\ --release NhekoRelease\nheko.exe
@@ -31,14 +49,53 @@ after_build:
- copy C:\OpenSSL-Win64\lib\libeay32.lib .\NhekoRelease\libeay32.lib
- copy C:\OpenSSL-Win64\bin\ssleay32.dll .\NhekoRelease\ssleay32.dll
- 7z a nheko_win_64.zip .\NhekoRelease\*
- - C:\nsis\makensis .ci\windows\nheko.nsi
+ - ls -lh build\Release\
+ - ls -lh NhekoRelease\
+ - mkdir NhekoData
+ - xcopy .\NhekoRelease\*.* NhekoData\*.* /s /e /c /y
+ #
+ # Create the Qt Installer Framework version
+ #
+ - mkdir installer
+ - mkdir installer\config
+ - mkdir installer\packages
+ - mkdir installer\packages\com.mujx.nheko
+ - mkdir installer\packages\com.mujx.nheko\data
+ - mkdir installer\packages\com.mujx.nheko\meta
+ - mkdir installer\packages\com.mujx.nheko.cleanup\meta
+ # Copy installer data
+ - copy %BUILD%\resources\nheko.ico installer\config
+ - copy %BUILD%\resources\nheko.png installer\config
+ - copy %BUILD%\LICENSE installer\packages\com.mujx.nheko\meta\license.txt
+ - copy %BUILD%\LICENSE installer\packages\com.mujx.nheko.cleanup\meta\license.txt
+ - copy %BUILD%\deploy\installer\config.xml installer\config
+ - copy %BUILD%\deploy\installer\controlscript.qs installer\config
+ - copy %BUILD%\deploy\installer\uninstall.qs installer\packages\com.mujx.nheko\data
+ - copy %BUILD%\deploy\installer\gui\package.xml installer\packages\com.mujx.nheko\meta
+ - copy %BUILD%\deploy\installer\gui\installscript.qs installer\packages\com.mujx.nheko\meta
+ - copy %BUILD%\deploy\installer\cleanup\package.xml installer\packages\com.mujx.nheko.cleanup\meta
+ - copy %BUILD%\deploy\installer\cleanup\installscript.qs installer\packages\com.mujx.nheko.cleanup\meta
+ # Amend version and date
+ - sed -i "s/__VERSION__/0.1.0/" installer\config\config.xml
+ - sed -i "s/__VERSION__/0.1.0/" installer\packages\com.mujx.nheko\meta\package.xml
+ - sed -i "s/__VERSION__/0.1.0/" installer\packages\com.mujx.nheko.cleanup\meta\package.xml
+ - sed -i "s/__DATE__/%DATE%/" installer\packages\com.mujx.nheko\meta\package.xml
+ - sed -i "s/__DATE__/%DATE%/" installer\packages\com.mujx.nheko.cleanup\meta\package.xml
+ # Copy nheko data
+ - xcopy NhekoData\*.* installer\packages\com.mujx.nheko\data\*.* /s /e /c /y
+ - move NhekoRelease\nheko.exe installer\packages\com.mujx.nheko\data
+ - mkdir tools
+ - curl -L -O https://download.qt.io/official_releases/qt-installer-framework/3.0.1/QtInstallerFramework-win-x86.exe
+ - 7z x QtInstallerFramework-win-x86.exe -otools -aoa
+ - set PATH=%BUILD%\tools\bin;%PATH%
+ - binarycreator.exe -f -c installer\config\config.xml -p installer\packages nheko-installer.exe
deploy:
description: "Development builds"
provider: GitHub
auth_token:
secure: YqB7hcM+4482eSHhtVR7ZA7N7lE78y8BC897/7UDTBQd+NWdWFW/6S+oKDie9TT7
- artifact: nheko_setup.exe
+ artifact: nheko-installer.exe
force_update: true
prerelease: true
on:
@@ -47,4 +104,4 @@ deploy:
artifacts:
- path: nheko_win_64.zip
- path: NhekoRelease\nheko.exe
- - path: nheko_setup.exe
+ - path: nheko-installer.exe
diff --git a/cmake/MacOSXBundleInfo.plist.in b/cmake/MacOSXBundleInfo.plist.in
new file mode 100644
index 00000000..7391a6fa
--- /dev/null
+++ b/cmake/MacOSXBundleInfo.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
diff --git a/cmake/QtCommon.cmake b/cmake/QtCommon.cmake
new file mode 100644
index 00000000..2145019e
--- /dev/null
+++ b/cmake/QtCommon.cmake
@@ -0,0 +1,76 @@
+macro(fix_project_version)
+if (NOT PROJECT_VERSION_PATCH)
+ set(PROJECT_VERSION_PATCH 0)
+endif()
+
+if (NOT PROJECT_VERSION_TWEAK)
+ set(PROJECT_VERSION_TWEAK 0)
+endif()
+endmacro()
+
+macro(add_project_meta FILES_TO_INCLUDE)
+if (NOT RESOURCE_FOLDER)
+ set(RESOURCE_FOLDER resources)
+endif()
+
+if (NOT ICON_NAME)
+ set(ICON_NAME nheko)
+endif()
+
+if (APPLE)
+ set(ICON_FILE ${RESOURCE_FOLDER}/${ICON_NAME}.icns)
+elseif (WIN32)
+ set(ICON_FILE ${RESOURCE_FOLDER}/${ICON_NAME}.ico)
+endif()
+
+if (WIN32)
+ configure_file("${PROJECT_SOURCE_DIR}/cmake/windows_metafile.rc.in"
+ "windows_metafile.rc"
+ )
+ set(RES_FILES "windows_metafile.rc")
+ set(CMAKE_RC_COMPILER_INIT windres)
+ ENABLE_LANGUAGE(RC)
+ SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
+endif()
+
+if (APPLE)
+ set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+
+ # Identify MacOS bundle
+ set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME})
+ set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
+ set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION})
+ set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
+ set(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
+ set(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER})
+ set(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
+endif()
+
+if (APPLE)
+ set(${FILES_TO_INCLUDE} ${ICON_FILE})
+elseif (WIN32)
+ set(${FILES_TO_INCLUDE} ${RES_FILES})
+endif()
+endmacro()
+
+macro(init_os_bundle)
+if (APPLE)
+ set(OS_BUNDLE MACOSX_BUNDLE)
+elseif (WIN32)
+ IF(CMAKE_BUILD_TYPE MATCHES Release)
+ set(OS_BUNDLE WIN32)
+ endif()
+endif()
+endmacro()
+
+macro(fix_win_compiler)
+if (MSVC)
+ set_target_properties(${PROJECT_NAME} PROPERTIES
+ WIN32_EXECUTABLE YES
+ LINK_FLAGS "/ENTRY:mainCRTStartup"
+ )
+endif()
+endmacro()
+
+init_os_bundle()
+fix_win_compiler()
diff --git a/cmake/windows_metafile.rc.in b/cmake/windows_metafile.rc.in
new file mode 100644
index 00000000..02008697
--- /dev/null
+++ b/cmake/windows_metafile.rc.in
@@ -0,0 +1,28 @@
+#include "winver.h"
+
+IDI_ICON1 ICON DISCARDABLE "@ICON_FILE@"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
+ PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@
+ FILEFLAGS 0x0L
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x00040004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "CompanyName", "@COMPANY@"
+ VALUE "FileDescription", "@PROJECT_NAME@"
+ VALUE "FileVersion", "@PROJECT_VERSION@"
+ VALUE "LegalCopyright", "@COPYRIGHT@"
+ VALUE "InternalName", "@PROJECT_NAME@"
+ VALUE "OriginalFilename", "@PROJECT_NAME@.exe"
+ VALUE "ProductName", "@PROJECT_NAME@"
+ VALUE "ProductVersion", "@PROJECT_VERSION@"
+ END
+ END
+END
diff --git a/deploy/installer/cleanup/installscript.qs b/deploy/installer/cleanup/installscript.qs
new file mode 100644
index 00000000..46f8012c
--- /dev/null
+++ b/deploy/installer/cleanup/installscript.qs
@@ -0,0 +1,28 @@
+function Component()
+{
+}
+
+Component.prototype.createOperations = function()
+{
+ component.createOperations();
+
+ try
+ {
+ if( installer.value("os") === "win" )
+ {
+ /**
+ * Cleanup AppData and registry
+ */
+ component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C reg delete HKEY_CURRENT_USER\Software\nheko\nheko /f");
+ var localappdata = installer.environmentVariable("LOCALAPPDATA");
+ if( localappdata != "" )
+ {
+ component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C rmdir "+localappdata+"\nheko /f");
+ }
+ }
+ }
+ catch( e )
+ {
+ print( e );
+ }
+}
diff --git a/deploy/installer/cleanup/package.xml b/deploy/installer/cleanup/package.xml
new file mode 100644
index 00000000..f43e5b78
--- /dev/null
+++ b/deploy/installer/cleanup/package.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Package>
+ <DisplayName>Cleanup AppData and Registry</DisplayName>
+ <Description>Cleans up AppData and Registry when selected (logs you out) - Broken</Description>
+ <Version>__VERSION__</Version>
+ <ReleaseDate>__DATE__</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <Script>installscript.qs</Script>
+ <Checkable>false</Checkable>
+</Package>
diff --git a/deploy/installer/config.xml b/deploy/installer/config.xml
new file mode 100644
index 00000000..2cf7d99c
--- /dev/null
+++ b/deploy/installer/config.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Nheko</Name>
+ <Version>__VERSION__</Version>
+ <Title>Nheko Installer</Title>
+ <Publisher>Mujx</Publisher>
+ <ProductUrl>https://github.com/mujx/nheko</ProductUrl>
+ <InstallerWindowIcon>nheko</InstallerWindowIcon>
+ <InstallerApplicationIcon>nheko</InstallerApplicationIcon>
+ <Logo>nheko.png</Logo>
+ <StartMenuDir>Nheko</StartMenuDir>
+ <TargetDir>@ApplicationsDir@/nheko</TargetDir>
+ <RunProgram>@TargetDir@/nheko.exe</RunProgram>
+ <ControlScript>controlscript.qs</ControlScript>
+</Installer>
diff --git a/deploy/installer/controlscript.qs b/deploy/installer/controlscript.qs
new file mode 100644
index 00000000..a53c3e99
--- /dev/null
+++ b/deploy/installer/controlscript.qs
@@ -0,0 +1,25 @@
+/**
+ * Source: http://stackoverflow.com/questions/21389105/qt-installer-framework-offline-update-how
+ */
+
+function Controller()
+{
+}
+
+Controller.prototype.TargetDirectoryPageCallback = function()
+{
+ var widget = gui.currentPageWidget();
+ widget.TargetDirectoryLineEdit.textChanged.connect( this, Controller.prototype.targetChanged );
+ Controller.prototype.targetChanged( widget.TargetDirectoryLineEdit.text );
+}
+
+Controller.prototype.targetChanged = function( text )
+{
+ if( text != "" && installer.fileExists(text + "/components.xml") )
+ {
+ if( QMessageBox.question("PreviousInstallation", "Previous installation detected", "Do you want to uninstall the previous installation?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes )
+ {
+ installer.execute( text+"/maintenancetool.exe", new Array("--script", text+"/uninstall.qs") )
+ }
+ }
+}
diff --git a/deploy/installer/gui/installscript.qs b/deploy/installer/gui/installscript.qs
new file mode 100644
index 00000000..4cfa284f
--- /dev/null
+++ b/deploy/installer/gui/installscript.qs
@@ -0,0 +1,32 @@
+function Component()
+{
+}
+
+Component.prototype.createOperations = function()
+{
+ component.createOperations();
+
+ try
+ {
+ if( installer.value("os") === "win" )
+ {
+ /**
+ * Start Menu Shortcut
+ */
+ component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@StartMenuDir@\\nheko.lnk",
+ "workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe",
+ "iconId=0", "description=Desktop client for the Matrix protocol");
+
+ /**
+ * Desktop Shortcut
+ */
+ component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@DesktopDir@\\nheko.lnk",
+ "workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe",
+ "iconId=0", "description=Desktop client for the Matrix protocol");
+ }
+ }
+ catch( e )
+ {
+ print( e );
+ }
+}
diff --git a/deploy/installer/gui/package.xml b/deploy/installer/gui/package.xml
new file mode 100644
index 00000000..c28b7e60
--- /dev/null
+++ b/deploy/installer/gui/package.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Package>
+ <DisplayName>Nheko</DisplayName>
+ <Description>Desktop client for the Matrix protocol</Description>
+ <Version>__VERSION__</Version>
+ <ReleaseDate>__DATE__</ReleaseDate>
+ <Licenses>
+ <License name="Nheko License - GPLv3" file="license.txt" />
+ </Licenses>
+ <Default>true</Default>
+ <ForcedInstallation>true</ForcedInstallation>
+ <SortingPriority>100</SortingPriority>
+ <Script>installscript.qs</Script>
+</Package>
diff --git a/deploy/installer/uninstall.qs b/deploy/installer/uninstall.qs
new file mode 100644
index 00000000..43935d0f
--- /dev/null
+++ b/deploy/installer/uninstall.qs
@@ -0,0 +1,18 @@
+function Controller()
+{
+}
+
+Controller.prototype.IntroductionPageCallback = function()
+{
+ gui.clickButton( buttons.NextButton );
+}
+
+Controller.prototype.ReadyForInstallationPageCallback = function()
+{
+ gui.clickButton( buttons.CommitButton );