diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-17 15:35:43 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-17 15:35:43 +0200 |
commit | f143900bd3db40a5e908f8e0e40557346f908592 (patch) | |
tree | 1c41776f670e1e8db1d22726f07b418e4808fded | |
parent | Add vendor.cmake (diff) | |
download | smolbote-f143900bd3db40a5e908f8e0e40557346f908592.tar.xz |
Switch vcs to git
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | linux/makepkg/PKGBUILD | 105 | ||||
-rw-r--r-- | src/version.h.in | 13 | ||||
-rw-r--r-- | vendor.cmake | 35 |
4 files changed, 70 insertions, 109 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f7c74..ed80038 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.0) -project(smolbote) +project(smolbote CXX) include(FeatureSummary) @@ -7,8 +7,6 @@ set(VENDOR "${CMAKE_SOURCE_DIR}/vendor.cmake" CACHE FILEPATH "vendor configurati include(${VENDOR}) # Options -option(MercurialRepo "Get version information from .hg" ON) -option(CompilerWarnings "Compiler warnings" ON) option(QtDeprecatedWarnings "Qt deprecated warnings" ON) option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF) option(Tests "Enable/disable some basic autotests" OFF) @@ -28,15 +26,6 @@ endif(Plasma) # Global C++ settings set(CMAKE_CXX_STANDARD 17) -if(CompilerWarnings) - if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - endif() - if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - endif() -endif(CompilerWarnings) - if(QtDeprecatedWarnings) add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900) endif(QtDeprecatedWarnings) @@ -47,8 +36,6 @@ if (UseLibCpp) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") 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 @@ -76,9 +63,10 @@ if (Tests) endif() # Summarize -message("=== Configuration summary ===") +message(STATUS "=== Configuration summary ===") feature_summary(WHAT ALL) -message("Building ${poi_NAME}") -message("Version='${VerInfo}' bookmark='${VerBookmark}' commit='${VerCommit}'") -message("vendor.cmake: ${VENDOR}") -message("C++ flags: ${CMAKE_CXX_FLAGS}") +message(STATUS "Building ${poi_NAME} ${VerInfo}; version ${VerDescribe} ${VerBranch}:${VerCommit}") +message(STATUS "vendor.cmake: ${VENDOR}") +message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER_ID}") +message(STATUS "C++ flags: ${CMAKE_CXX_FLAGS}") + diff --git a/linux/makepkg/PKGBUILD b/linux/makepkg/PKGBUILD index cd21909..872476e 100644 --- a/linux/makepkg/PKGBUILD +++ b/linux/makepkg/PKGBUILD @@ -1,9 +1,15 @@ # Maintainer: Aqua-sama <aqua@iserlohn-fortress.net> pkgname=smolbote-hg +pkgdesc='Yet another no-frills browser' + pkgver=0 pkgrel=1 -pkgdesc='Yet another no-frills browser' +_tag="" +_describe="" +_commit="" +_branch="" + url="https://neueland.iserlohn-fortress.net/smolbote" arch=('x86_64') @@ -12,94 +18,65 @@ license=('GPL3') # -hg replace the old -git package replaces=('smolbote-git') -depends=('qt5-webengine>=5.10.1' 'boost-libs>=1.66.0') +depends=('qt5-webengine>=5.11.0' 'boost-libs>=1.66.0') optdepends=('firejail: launch a sandboxed instance') -makedepends=('mercurial' 'cmake' 'pkg-config' 'go-md2man') +makedepends=('git' 'cmake' 'pkg-config' 'go-md2man') # this is the central repository -source=("smolbote-hg::hg+https://neueland.iserlohn-fortress.net/smolbote.hg") -# if you're test building, you might want to hg serve your own repo -#source=("smolbote-hg::hg+http://localhost:8000") +source=("git+https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote.git") sha512sums=('SKIP') validgpgkeys=(# Aqua-sama <aqua@iserlohn-fortress.net> BB1C090188E3E32B375C13FD095DE26BC16D2E98) prepare() { - # go into src/smolbote-hg - cd smolbote-hg - - msg2 "Verifying integrity" - # get commit id - _node="$(hg log -r tip --template='{node}')" - # download checksums and signature - curl -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$_node \ - -O https://neueland.iserlohn-fortress.net/smolbote/integrity/$_node.sig - # verify signature and files - gpg --verify $_node.sig - sha512sum --check --quiet $_node + cd smolbote + _tag=$(git describe --tags --abbrev=0) + _describe=$(git describe --tags) + _commit=$(git rev-parse HEAD) + _branch=$(git rev-parse --abbrev-ref HEAD) } pkgver() { - cd smolbote-hg - printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)" + cd smolbote + git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' } build() { - # clean build folder - # src/smolbote-hg-r000.123456789012 - rm -rf "$pkgname-$pkgver" - mkdir "$pkgname-$pkgver" - cd "$pkgname-$pkgver" - - msg2 "Building smolbote" - # CMake Options - # Build Type - # Debug builds don't have install rules. - _cmake_options="-DCMAKE_BUILD_TYPE=Release" - - # Install Prefix - # Where should the binary be installed? In this case /usr/local. - _cmake_options="$_cmake_options -DCMAKE_INSTALL_PREFIX=$pkgdir/usr/local" - - # Compiler - # Flavour: no need to change the compiler, gcc works just fine - _cmake_options="$_cmake_options -DCMAKE_C_COMPILER=/usr/bin/clang" - _cmake_options="$_cmake_options -DCMAKE_CXX_COMPILER=/usr/bin/clang++" - - # Use libc++ instead of libstdc++ - # Flavour, also requires clang - #_cmake_options="$_cmake_options -DUseLibCpp=On" - - # Flavour: add some KF5 effects - # this requires 'extra-cmake-modules' - #_cmake_options="$_cmake_options -DPlasma=On" - - # Generate Makefile - cmake $_cmake_options "$srcdir/smolbote-hg" + # generate makefile + + # option default + # -DQtDeprecatedWarnings On + # -DUseLibCpp Off + # -DTests Off + # -DPlasma Off + + cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$pkgdir/usr/local \ + -DVerTag=$_tag \ + -DVerDescribe=$_describe \ + -DVerCommit=$_commit \ + -DVerBranch=$_branch \ + $srcdir/smolbote # Build - make - - msg2 "Generating manpage" - go-md2man -in $srcdir/smolbote-hg/linux/man/smolbote.md -out smolbote.7 - gzip smolbote.7 + #make } package() { - cd "$pkgname-$pkgver" - # Install - make install + #make install # icon and .desktop - install -Dm644 "${srcdir}/smolbote-hg/data/poi.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/poi.svg" - install -Dm644 "${srcdir}/smolbote-hg/linux/poi.desktop" "${pkgdir}/usr/share/applications/poi.desktop" + #install -Dm644 "${srcdir}/smolbote-hg/data/poi.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/poi.svg" + #install -Dm644 "${srcdir}/smolbote-hg/linux/poi.desktop" "${pkgdir}/usr/share/applications/poi.desktop" # firejail profile - install -Dm644 "${srcdir}/smolbote-hg/data/poi.profile" "${pkgdir}/usr/local/lib/smolbote/poi.profile" + #install -Dm644 "${srcdir}/smolbote-hg/data/poi.profile" "${pkgdir}/usr/local/lib/smolbote/poi.profile" - # man page - install -Dm644 smolbote.7.gz $pkgdir/usr/local/man/man7/smolbote.7.gz + msg2 "Install manpage" + go-md2man -in $srcdir/linux/man/smolbote.md -out smolbote.7 + gzip smolbote.7 + #install -Dm644 smolbote.7.gz $pkgdir/usr/local/man/man7/smolbote.7.gz } diff --git a/src/version.h.in b/src/version.h.in index 055c84b..74db72a 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,20 +1,11 @@ #ifndef SMOLBOTE_VERSION_H #define SMOLBOTE_VERSION_H -#cmakedefine VerBookmark - -#ifdef VerBookmark -// Version: tag.tagdistance-activebookmark -#define SMOLBOTE_VERSION "@VerInfo@-@VerBookmark@" - -#else -// Version: tag.tagdistance +// Version: 1.2.3 #define SMOLBOTE_VERSION "@VerInfo@" -#endif // Bookmark - // Describe: 1.2.3-r123-0123456789ab -#define SMOLBOTE_DESCRIBE "@VerInfo@-r@VerRevision@-@VerCommit@" +#define SMOLBOTE_DESCRIBE "@VerDescribe@" // Build #define SMOLBOTE_BUILD "@VerBranch@:@VerCommit@" diff --git a/vendor.cmake b/vendor.cmake index 17191e5..296eb16 100644 --- a/vendor.cmake +++ b/vendor.cmake @@ -11,22 +11,27 @@ endif() # executable name set(poi_NAME poi) -# detect version and commit from mercurial -if (MercurialRepo AND EXISTS "${PROJECT_SOURCE_DIR}/.hg") - execute_process(COMMAND hg log -r '.' --template={latesttag}.{latesttagdistance} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerInfo OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) - # remove bookmark if it's not set - if(VcsBookmark STREQUAL "") - unset(VcsBookmark) - endif() - - execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) +# 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-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() - set(VerInfo "0.2.2") - #set(VerBookmark "stable") + set(VerTag "0.2.2") + set(VerDescribe "0.2.2-unknown") set(VerCommit "00000000") - set(VerRevision "0") set(VerBranch "unknown") endif() + +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2") + +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2 -march=native") + +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + +endif() + |