From c8bc89d0fa93937a6729a95fa04c3c011bc749d4 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 14 Feb 2020 00:32:08 +0100 Subject: [PATCH] try out flatpak nightly build --- .ci/install.sh | 6 + .ci/script.sh | 13 +++ .travis.yml | 13 +++ CMakeLists.txt | 13 +-- cmake/FindLMDB.cmake | 15 +++ io.github.NhekoReborn.Nheko.json | 187 +++++++++++++++++++++++++++++++ 6 files changed, 238 insertions(+), 9 deletions(-) create mode 100644 cmake/FindLMDB.cmake create mode 100644 io.github.NhekoReborn.Nheko.json diff --git a/.ci/install.sh b/.ci/install.sh index f700f303..d1bff54b 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -2,6 +2,12 @@ set -ex +if [ "$FLATPAK" ]; then + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak --noninteractive install --user flathub org.kde.Platform//5.14 + flatpak --noninteractive install --user flathub org.kde.Sdk//5.14 + exit +fi if [ "$TRAVIS_OS_NAME" = "osx" ]; then curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python get-pip.py diff --git a/.ci/script.sh b/.ci/script.sh index 0c6e3746..9438a652 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -2,6 +2,19 @@ set -ex +if [ "$FLATPAK" ]; then + mkdir -p build-flatpak + cd build-flatpak + + flatpak-builder --ccache --repo=repo --subject="Build of Nheko ${VERSION} `date`" app ../io.github.NhekoReborn.Nheko.json + flatpak build-bundle repo nheko-${VERSION}-${ARCH}.flatpak io.github.NhekoReborn.Nheko 0.7.0-dev + + mkdir ../artifacts + mv nheko-*.flatpak ../artifacts + + exit +fi + if [ "$TRAVIS_OS_NAME" = "linux" ]; then # make build use all available cores export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) diff --git a/.travis.yml b/.travis.yml index ce189749..5e25f567 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,6 +101,19 @@ matrix: - qt59graphicaleffects - liblmdb-dev - libgl1-mesa-dev # needed for missing gl.h + - os: linux + env: + - DEPLOY=1 + - FLATPAK=1 + - ARCH=amd64 + addons: + apt: + sources: + - sourceline: 'ppa:alexlarsson/flatpak' + packages: + - flatpak + - flatpak-builder + - elfutils before_install: # Use TRAVIS_TAG if defined, or the short commit SHA otherwise diff --git a/CMakeLists.txt b/CMakeLists.txt index a2c4a5b5..eebac250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,8 +129,7 @@ if(USE_BUNDLED_LMDB) hunter_add_package(lmdb) find_package(liblmdb CONFIG REQUIRED) else() - include(FindPkgConfig) - pkg_search_module(lmdb REQUIRED IMPORTED_TARGET lmdb) + find_package(LMDB) endif() # @@ -561,15 +560,11 @@ target_link_libraries(nheko PRIVATE Qt5::QuickWidgets nlohmann_json::nlohmann_json lmdbxx::lmdbxx + liblmdb::lmdb tweeny) -if(USE_BUNDLED_LMDB) - target_link_libraries(nheko PRIVATE liblmdb::lmdb) - if(MSVC) - target_link_libraries(nheko PRIVATE ntdll) - endif() -else() - target_link_libraries(nheko PRIVATE PkgConfig::lmdb) +if(MSVC) + target_link_libraries(nheko PRIVATE ntdll) endif() diff --git a/cmake/FindLMDB.cmake b/cmake/FindLMDB.cmake new file mode 100644 index 00000000..372dc7a5 --- /dev/null +++ b/cmake/FindLMDB.cmake @@ -0,0 +1,15 @@ +# +# Find the lmdb library & include dir. +# + +find_path (LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include") +find_library (LMDB_LIBRARY NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARY) + + +add_library(lmdb INTERFACE IMPORTED GLOBAL) +target_include_directories(lmdb INTERFACE ${LMDB_INCLUDE_DIR}) +target_link_libraries(lmdb INTERFACE ${LMDB_LIBRARY}) + +add_library(liblmdb::lmdb ALIAS lmdb) diff --git a/io.github.NhekoReborn.Nheko.json b/io.github.NhekoReborn.Nheko.json new file mode 100644 index 00000000..f6beaeb9 --- /dev/null +++ b/io.github.NhekoReborn.Nheko.json @@ -0,0 +1,187 @@ +{ + "id": "io.github.NhekoReborn.Nheko", + "command": "nheko", + "branch": "0.7.0-dev", + "runtime": "org.kde.Platform", + "runtime-version": "5.14", + "sdk": "org.kde.Sdk", + "rename-icon": "nheko", + "rename-desktop-file": "nheko.desktop", + "rename-appdata-file": "nheko.appdata.xml", + "finish-args": [ + "--device=dri", + "--filesystem=home", + "--share=ipc", + "--share=network", + "--socket=pulseaudio", + "--socket=wayland", + "--socket=x11", + "--talk-name=org.freedesktop.Notifications", + "--talk-name=org.kde.StatusNotifierWatcher" + ], + "cleanup": [ + "/include", + "/bin/mdb*", + "*.a" + ], + "modules": [ + { + "name": "lmdb", + "sources": [ + { + "sha256": "f3927859882eb608868c8c31586bb7eb84562a40a6bf5cc3e13b6b564641ea28", + "type": "archive", + "url": "https://github.com/LMDB/lmdb/archive/LMDB_0.9.22.tar.gz" + } + ], + "make-install-args": [ + "prefix=/app" + ], + "no-autogen": true, + "subdir": "libraries/liblmdb" + }, + { + "name": "cmark", + "buildsystem": "cmake-ninja", + "builddir": true, + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DCMARK_TESTS=OFF" + ], + "sources": [ + { + "sha256": "2558ace3cbeff85610de3bda32858f722b359acdadf0c4691851865bb84924a6", + "type": "archive", + "url": "https://github.com/commonmark/cmark/archive/0.29.0.tar.gz" + } + ] + }, + { + "name": "spdlog", + "buildsystem": "cmake-ninja", + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DSPDLOG_BUILD_EXAMPLES=0", + "-DSPDLOG_BUILD_BENCH=0", + "-DSPDLOG_BUILD_TESTING=0" + ], + "sources": [ + { + "sha256": "3dbcbfd8c07e25f5e0d662b194d3a7772ef214358c49ada23c044c4747ce8b19", + "type": "archive", + "url": "https://github.com/gabime/spdlog/archive/v1.1.0.tar.gz" + } + ] + }, + { + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release" + ], + "buildsystem": "cmake-ninja", + "name": "olm", + "sources": [ + { + "commit": "6753595300767dd70150831dbbe6f92d64e75038", + "disable-shallow-clone": true, + "tag": "3.1.4", + "type": "git", + "url": "https://gitlab.matrix.org/matrix-org/olm.git" + } + ] + }, + { + "config-opts":[ + "-DJSON_BuildTests=OFF" + ], + "buildsystem":"cmake", + "name": "nlohmann", + "sources":[ + { + "sha256": "d51a3a8d3efbb1139d7608e28782ea9efea7e7933157e8ff8184901efd8ee760", + "type": "archive", + "url": "https://github.com/nlohmann/json/archive/v3.7.0.tar.gz" + } + ] + }, + { + "name": "sodium", + "sources": [ + { + "sha256": "6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1", + "type": "archive", + "url": "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18.tar.gz" + } + ] + }, + { + "build-commands": [ + "./bootstrap.sh --with-libraries=thread,system,iostreams --prefix=/app", + "./b2 -d0 variant=release link=static threading=multi --layout=system", + "./b2 -d0 install" + ], + "buildsystem": "simple", + "name": "boost", + "sources": [ + { + "sha256": "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778", + "type": "archive", + "url": "https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.bz2" + } + ] + }, + { + "config-opts": [ + "-DBUILD_LIB_TESTS=OFF", + "-DBUILD_LIB_EXAMPLES=OFF", + "-DCMAKE_BUILD_TYPE=Release", + "-DBUILD_SHARED_LIBS=OFF" + ], + "buildsystem": "cmake-ninja", + "name": "mtxclient", + "sources": [ + { + "sha256": "8cf5470570d2ed6affc0bbe0f4b6be9b0a2e2372e9f920b504126841bb73036f", + "type": "archive", + "url": "https://github.com/Nheko-Reborn/mtxclient/archive/5fbee216e640da45c05f25b1f84f03c88bca5910.tar.gz" + } + ] + }, + { + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DTWEENY_BUILD_DOCUMENTATION=OFF", + "-DTWEENY_BUILD_EXAMPLES=OFF" + ], + "buildsystem": "cmake-ninja", + "name": "tweeny", + "sources": [ + { + "sha256": "482857256a7235646004682912badb6521d361ed6987c8ebdae7986bf64ce694", + "type": "archive", + "url": "https://github.com/mobius3/tweeny/archive/43f4130f7e4a67c19d870b60864bc2862c19b81f.tar.gz" + } + ] + }, + { + "config-opts": [ + "-DCMAKE_BUILD_TYPE=Release", + "-DLMDBXX_INCLUDE_DIR=.deps/lmdbxx" + ], + "buildsystem": "cmake-ninja", + "name": "nheko", + "sources": [ + { + "path": ".", + "type": "dir", + "skip": ["build-flatpak"] + }, + { + "dest": ".deps/lmdbxx", + "sha256": "93721132bbf5045d38ad62de2997655e9984c48ea5c9886746d42128f4b26fbd", + "type": "archive", + "url": "https://github.com/bendiken/lmdbxx/archive/0b43ca87d8cfabba392dfe884eb1edb83874de02.tar.gz" + } + ] + } + ] +}