]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
build: set -DOFFICIAL_BUILD
authortobtoht <tob@featherwallet.org>
Fri, 21 Feb 2025 08:35:16 +0000 (09:35 +0100)
committertobtoht <tob@featherwallet.org>
Fri, 21 Feb 2025 09:07:59 +0000 (10:07 +0100)
contrib/guix/guix-build
contrib/guix/libexec/build.sh
contrib/guix/libexec/prelude.bash
contrib/shell/git-utils.bash
src/CMakeLists.txt
src/dialog/AboutDialog.cpp
src/dialog/DebugInfoDialog.cpp
src/utils/Utils.cpp
src/utils/Utils.h

index 3a07986ca4027fe74b7ad330ca9382e64a3e4b7c..31f95471b2b8100dc9ea51536d1014ab6996e530 100755 (executable)
@@ -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"} \
index 8f33fb32f17942bc4c52676d65e909aeff9bbd90..2b3982b390d9276efbdb39fd7239394431ab75c5 100755 (executable)
@@ -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
index 5f1947a26281baa91821337e3f87b2b1d3e9e2f5..15859fda57c21d75feae488be9bb760da8578fe7 100644 (file)
@@ -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-"
index 08f039e99f698d62a7124983e0dbb259687d4554..9d1de64fe7ebfeded232258c92fd33c3320631a4 100644 (file)
@@ -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)
 }
index e3f48b78aba7f90dd949ec654728d0ac084794c0..faf9beda5a1c3a4229d886794d883bbe25ef8c41 100644 (file)
@@ -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()
index 4e7e74b9fc9da06205694a7fde12f78a68344d79..778f8d105bdde524e49336786aaf07078911c557 100644 (file)
@@ -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>", FEATHER_VERSION);
+    about_text = about_text.replace("<feather_version>", Utils::getVersion());
     ui->copyrightText->setPlainText(about_text);
 
     auto ack = Utils::fileOpenQRC(":assets/ack.txt");
index 5861c56dd72da1041b7ced08a810c161e994a713..3a6118e9a0610d82ae292db91355cf2c225791a2 100644 (file)
@@ -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()));
index 399ccbaacecb85e76d684cd6151e46ebbc4dfe31..14cad6a9b0eb22c213cdd9835732020a6fc47f2c 100644 (file)
@@ -18,6 +18,7 @@
 #include <QStandardPaths>
 #include <QProcess>
 
+#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;
+}
 }
index 24be5187fb4a1018325da94e0b970a07ee442e10..7b6d6f43d1c2d7d6a0e235e762d6a54ba4ee273b 100644 (file)
@@ -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