From: tobtoht Date: Fri, 21 Feb 2025 08:35:16 +0000 (+0100) Subject: build: set -DOFFICIAL_BUILD X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=13daf73c039249d24653146cc1140837186581ca;p=gamesguru%2Ffeather.git build: set -DOFFICIAL_BUILD --- diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index 3a07986c..31f95471 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -446,8 +446,10 @@ EOF ${ADDITIONAL_GUIX_COMMON_FLAGS} ${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS} \ -- env HOST="$HOST" \ DISTNAME="$DISTNAME" \ - RELEASE="$RELEASE" \ JOBS="$JOBS" \ + VERSION="$VERSION" \ + COMMIT="$COMMIT" \ + TAG="$TAG" \ COMMIT_TIMESTAMP="${COMMIT_TIMESTAMP:?unable to determine value}" \ ${V:+V=1} \ ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} \ diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 8f33fb32..2b3982b3 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -35,7 +35,8 @@ cat << EOF Required environment variables as seen inside the container: DIST_ARCHIVE_BASE: ${DIST_ARCHIVE_BASE:?not set} DISTNAME: ${DISTNAME:?not set} - RELEASE: ${RELEASE:?not set} + VERSION: ${VERSION:?not set} + COMMIT: ${COMMIT:?not set} HOST: ${HOST:?not set} COMMIT_TIMESTAMP: ${COMMIT_TIMESTAMP:?not set} JOBS: ${JOBS:?not set} @@ -293,6 +294,11 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}" # Set appropriate CMake options for build type CMAKEVARS="-DWITH_SCANNER=On -DCHECK_UPDATES=On -DSELF_CONTAINED=On -DDONATE_BEG=On -DFEATHER_TARGET_TRIPLET=${HOST} -DWITH_PLUGIN_REDDIT=Off" + + if [[ -n "${TAG}" ]]; then + CMAKEVARS+=" -DOFFICIAL_BUILD=On" + fi + ANONDIST="" case "$HOST" in *mingw32) @@ -415,12 +421,14 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}" esac # Code-signing - if [ "$RELEASE" -ne 0 ]; then - case "$HOST" in - *darwin*) - signapple apply Feather.app "/distsrc/external/feather-codesigning/signatures/${HOST}/Feather.app" - ;; - esac + if [[ -n "${TAG}" ]]; then + if [[ "${TAG}" != *"-rc"* ]]; then + case "$HOST" in + *darwin*) + signapple apply Feather.app "/distsrc/external/feather-codesigning/signatures/${HOST}/Feather.app" + ;; + esac + fi fi # Finally, deterministically produce {non-,}debug binary tarballs ready diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index 5f1947a2..15859fda 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -65,9 +65,17 @@ time-machine() { # Set common variables ################ -VERSION="${FORCE_VERSION:-$(git_head_version)}" +COMMIT="$(git_head_commit)" +TAG="$(git_head_tag)" + +if [[ -n "${TAG}" ]]; then + VERSION="${TAG}" +else + VERSION="${COMMIT}" +fi + +VERSION="${FORCE_VERSION:-${VERSION}}" DISTNAME="${DISTNAME:-feather-${VERSION}}" -RELEASE="$(is_release)" VERSION_BASE_DIR="${VERSION_BASE_DIR:-${PWD}}" version_base_prefix="${VERSION_BASE_DIR}/guix/guix-build-" diff --git a/contrib/shell/git-utils.bash b/contrib/shell/git-utils.bash index 08f039e9..9d1de64f 100644 --- a/contrib/shell/git-utils.bash +++ b/contrib/shell/git-utils.bash @@ -4,23 +4,10 @@ git_root() { git rev-parse --show-toplevel 2> /dev/null } -git_head_version() { - local recent_tag - if recent_tag="$(git describe --exact-match HEAD 2> /dev/null)"; then - echo "${recent_tag%-rc}" - else - git rev-parse --short=12 HEAD - fi +git_head_commit() { + git rev-parse --short=12 HEAD } -is_release() { - local recent_tag - if recent_tag="$(git describe --exact-match HEAD 2> /dev/null)"; then - if [[ "$recent_tag" == *"-rc" ]]; then - echo -n "0" - fi - echo -n "1" - else - echo -n "0" - fi +git_head_tag() { + echo -n $(git describe --exact-match HEAD 2> /dev/null) } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3f48b78..faf9beda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -229,6 +229,10 @@ if(STATIC) target_compile_definitions(feather PRIVATE STATIC=1) endif() +if(OFFICIAL_BUILD) + target_compile_definitions(feather PRIVATE OFFICIAL_BUILD=1) +endif() + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_definitions(feather PRIVATE QT_NO_DEBUG=1) endif() diff --git a/src/dialog/AboutDialog.cpp b/src/dialog/AboutDialog.cpp index 4e7e74b9..778f8d10 100644 --- a/src/dialog/AboutDialog.cpp +++ b/src/dialog/AboutDialog.cpp @@ -20,7 +20,7 @@ AboutDialog::AboutDialog(QWidget *parent) ui->aboutImage->setPixmap(p.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)); auto about = Utils::fileOpenQRC(":assets/about.txt"); auto about_text = Utils::barrayToString(about); - about_text = about_text.replace("", FEATHER_VERSION); + about_text = about_text.replace("", Utils::getVersion()); ui->copyrightText->setPlainText(about_text); auto ack = Utils::fileOpenQRC(":assets/ack.txt"); diff --git a/src/dialog/DebugInfoDialog.cpp b/src/dialog/DebugInfoDialog.cpp index 5861c56d..3a6118e9 100644 --- a/src/dialog/DebugInfoDialog.cpp +++ b/src/dialog/DebugInfoDialog.cpp @@ -48,7 +48,7 @@ void DebugInfoDialog::updateInfo() { else torStatus = "Unknown"; - ui->label_featherVersion->setText(QString("%1").arg(FEATHER_VERSION)); + ui->label_featherVersion->setText(Utils::getVersion()); ui->label_walletHeight->setText(QString::number(m_wallet->blockChainHeight())); ui->label_daemonHeight->setText(QString::number(m_wallet->daemonBlockChainHeight())); diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 399ccbaa..14cad6a9 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -18,6 +18,7 @@ #include #include +#include "config-feather.h" #include "constants.h" #include "networktype.h" #include "utils/ColorScheme.h" @@ -693,4 +694,12 @@ QString formatSyncStatus(quint64 height, quint64 target, bool daemonSync) { return "Synchronized"; } + +QString getVersion() { + QString version = QString("%1").arg(FEATHER_VERSION); +#ifdef OFFICIAL_BUILD + version += " (release)"; +#endif + return version; +} } diff --git a/src/utils/Utils.h b/src/utils/Utils.h index 24be5187..7b6d6f43 100644 --- a/src/utils/Utils.h +++ b/src/utils/Utils.h @@ -119,6 +119,8 @@ namespace Utils void clearLayout(QLayout *layout, bool deleteWidgets = true); QString formatSyncStatus(quint64 height, quint64 target, bool daemonSync = false); + + QString getVersion(); } #endif //FEATHER_UTILS_H