From 9c47ceeef79caa02c5ee810659d8f784676b3f71 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 29 Jul 2018 14:08:27 +0200 Subject: Update build instructions --- BUILDING.md | 62 +++++++++++++++++++++++++++++--------------------- CMakeLists.txt | 4 +--- linux/makepkg/PKGBUILD | 6 ++--- vendor.cmake | 6 +++-- 4 files changed, 44 insertions(+), 34 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 50ca3ea..51fb333 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,17 +1,22 @@ ## Requirements -### [Qt](https://www.qt.io/) 5.11 +### [Qt](https://www.qt.io/) + - Version 5.11 Even though most of the browser might work with the last LTS Qt release, always use an up-to-date version of QtWebEngine. Security fixes to Blink do _not_ get backported. QtWebEngine can be built with older versions of Qt, if upgrading Qt is not a possibility. -### [boost](http://www.boost.org/) program_options +### [boost](http://www.boost.org/) + - Version 1.66 + - Components: program_options -### cmake 3.10 +### cmake + - Version 3.10 -### Compiler with C++17 support +### Compiler + - C++17 support - gcc 7+; clang 4+ - Windows: only MSVC is supported due to QtWebEngine @@ -21,18 +26,26 @@ generate a makefile, build the program and install it. ~~~ sh # clone the repository -hg clone https://neueland.iserlohn-fortress.net/smolbote.hg +git clone https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote.git # generate makefile mkdir build && cd build -cmake -DCMAKE_CXX_FLAGS="-O2 [other cxx flags]" -DCMAKE_BUILD_TYPE=Release ../smolbote.hg +cmake -DCMAKE_BUILD_TYPE=Release ../smolbote # make && make install make -j4 make install ~~~ -### -DCMAKE_CXX_FLAGS +## Configuring + +### vendor.cmake +vendor.cmake contains all settings but the build type. It can be used to easily +create a build profile. + +When changing vendor.cmake, make sure to have all values defined in the preset. + +### Compiler flags cmake does not set any C++ flags by default, including no optimization flags. You need to set these yourself if your build system doesn't set any either. @@ -40,14 +53,28 @@ On gcc/clang, no optimize flags are set by default, resulting in rather bloated code being generated. Recommend setting at least -O2. MSVC has optimze flags set by default. -### -DCMAKE_BUILD_TYPE +You can set the compiler using +~~~sh +-DCMAKE_CXX_COMPILER=/path/to/c++ +~~~ +You can set additional compiler flags using -DCMAKE_CXX_FLAGS. + +### Build type Install paths are only set on Release builds. -### -DCMAKE_INSTALL_PREFIX +~~~sh +-DCMAKE_BUILD_TYPE=Debug|Release +~~~ + +### Install prefix Sets the install location prefix. win32: Binary is written to bin/, and plugins to bin/plugins. others: Binary will be written to bin/, and plugins to lib/smolbote/. +~~~sh +-DCMAKE_INSTALL_PREFIX=/usr/local +~~~ + ### Using libc++ You can use libc++ over stdlibc++ by setting UseLibCpp to On. Requires clang. @@ -55,20 +82,3 @@ You can use libc++ over stdlibc++ by setting UseLibCpp to On. Requires clang. -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DUseLibCpp=On ~~~ -### Verifying source code integrity -Since mercurial doesn't have any method for signing commits, some commits have -signed sha512 checksums available. - -~~~ sh -# get node for the current commit -node="$(hg log -r tip --template='{node}')" - -# get sha512 checksums and signature -curl -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$node -curl -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$node.sig - -# verify signature and files -gpg --verify $node.sig -sha512sum --check --quiet $node -~~~ - diff --git a/CMakeLists.txt b/CMakeLists.txt index ba57c85..a09a589 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ option(Plasma "Enable some fancy effects on Plasma" OFF) # Libraries find_package(Qt5 COMPONENTS Core Widgets Concurrent REQUIRED) find_package(Qt5 5.11.0 COMPONENTS WebEngineWidgets REQUIRED) -find_package(Boost COMPONENTS program_options REQUIRED) +find_package(Boost 1.66 COMPONENTS program_options REQUIRED) if(Plasma) find_package(ECM 1.6.0 REQUIRED NO_MODULE) @@ -37,8 +37,6 @@ if (UseLibCpp) endif (UseLibCpp) # configure a header file to pass version information -# if repo is missing or option is turned off, version.h.in can be configured -# with static values configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_BINARY_DIR}/src/version.h") add_subdirectory(3rd-party/SingleApplication) diff --git a/linux/makepkg/PKGBUILD b/linux/makepkg/PKGBUILD index ba8f893..e6973dd 100644 --- a/linux/makepkg/PKGBUILD +++ b/linux/makepkg/PKGBUILD @@ -28,15 +28,15 @@ validgpgkeys=(# Aqua-sama prepare() { cd smolbote - _tag=$(git describe --tags --abbrev=0) - _describe=$(git describe --tags) + _tag="r$(git rev-list --count HEAD)" + _describe="r$(git rev-list --count HEAD)-$(git rev-parse --short HEAD)" _commit=$(git rev-parse HEAD) _branch=$(git rev-parse --abbrev-ref HEAD) } pkgver() { cd smolbote - git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' + echo $_describe | sed 's/\([^-]*-g\)/r\1/;s/-/./g' } build() { diff --git a/vendor.cmake b/vendor.cmake index 296eb16..0e59149 100644 --- a/vendor.cmake +++ b/vendor.cmake @@ -13,8 +13,10 @@ set(poi_NAME poi) # version information if (EXISTS "${PROJECT_SOURCE_DIR}/.git") - execute_process(COMMAND git describe --tags --abbrev=0 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerTag OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerDescribe OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId OUTPUT_STRIP_TRAILING_WHITESPACE) + set(VerTag "r${VerRevision}") + set(VerDescribe "r${VerRevision}-${VerShortId}") execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) else() -- cgit v1.2.1