From 332655cb52c8f8ef64b29b09e38ef5d61235ed21 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:39:39 +0100 Subject: [PATCH] build: Rename `PACKAGE_*` variables to `CLIENT_*` The use of `PACKAGE_NAME` for the project's variable name is problematic, as this name is commonly used in CMake's interface variables. If third-party CMake code handles with scopes improperly, our `PACKAGE_NAME` variable could end up with an unexpected value. This change avoids such conflicts by renaming all `PACKAGE_*` variables to `CLIENT_*`. --- CMakeLists.txt | 10 ++++---- cmake/bitcoin-build-config.h.in | 8 +++--- cmake/module/GenerateSetupNsi.cmake | 4 +-- cmake/module/Maintenance.cmake | 4 +-- doc/Doxyfile.in | 2 +- libbitcoinkernel.pc.in | 4 +-- share/setup.nsi.in | 40 ++++++++++++++--------------- test/config.ini.in | 4 +-- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33fb4f64abb..67cb35ddcc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() #============================= # Project / Package metadata #============================= -set(PACKAGE_NAME "Bitcoin Core") +set(CLIENT_NAME "Bitcoin Core") set(CLIENT_VERSION_MAJOR 28) set(CLIENT_VERSION_MINOR 99) set(CLIENT_VERSION_BUILD 0) @@ -47,14 +47,14 @@ project(BitcoinCore LANGUAGES NONE ) -set(PACKAGE_VERSION ${PROJECT_VERSION}) +set(CLIENT_VERSION_STRING ${PROJECT_VERSION}) if(CLIENT_VERSION_RC GREATER 0) - string(APPEND PACKAGE_VERSION "rc${CLIENT_VERSION_RC}") + string(APPEND CLIENT_VERSION_STRING "rc${CLIENT_VERSION_RC}") endif() set(COPYRIGHT_HOLDERS "The %s developers") -set(COPYRIGHT_HOLDERS_FINAL "The ${PACKAGE_NAME} developers") -set(PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues") +set(COPYRIGHT_HOLDERS_FINAL "The ${CLIENT_NAME} developers") +set(CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues") #============================= # Language setup diff --git a/cmake/bitcoin-build-config.h.in b/cmake/bitcoin-build-config.h.in index 094eb8040a3..6524cde1902 100644 --- a/cmake/bitcoin-build-config.h.in +++ b/cmake/bitcoin-build-config.h.in @@ -24,7 +24,7 @@ #define COPYRIGHT_HOLDERS_FINAL "@COPYRIGHT_HOLDERS_FINAL@" /* Replacement for %s in copyright holders string */ -#define COPYRIGHT_HOLDERS_SUBSTITUTION "@PACKAGE_NAME@" +#define COPYRIGHT_HOLDERS_SUBSTITUTION "@CLIENT_NAME@" /* Copyright year */ #define COPYRIGHT_YEAR @COPYRIGHT_YEAR@ @@ -124,16 +124,16 @@ #cmakedefine HAVE_VM_VM_PARAM_H 1 /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" +#define PACKAGE_BUGREPORT "@CLIENT_BUGREPORT@" /* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" +#define PACKAGE_NAME "@CLIENT_NAME@" /* Define to the home page for this package. */ #define PACKAGE_URL "@PROJECT_HOMEPAGE_URL@" /* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" +#define PACKAGE_VERSION "@CLIENT_VERSION_STRING@" /* Define to 1 if strerror_r returns char *. */ #cmakedefine STRERROR_R_CHAR_P 1 diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake index 3c358c54958..97a53b071db 100644 --- a/cmake/module/GenerateSetupNsi.cmake +++ b/cmake/module/GenerateSetupNsi.cmake @@ -5,8 +5,8 @@ function(generate_setup_nsi) set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) set(abs_top_builddir ${PROJECT_BINARY_DIR}) - set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL}) - set(PACKAGE_TARNAME "bitcoin") + set(CLIENT_URL ${PROJECT_HOMEPAGE_URL}) + set(CLIENT_TARNAME "bitcoin") set(BITCOIN_GUI_NAME "bitcoin-qt") set(BITCOIN_DAEMON_NAME "bitcoind") set(BITCOIN_CLI_NAME "bitcoin-cli") diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake index 456419b7222..61251d24397 100644 --- a/cmake/module/Maintenance.cmake +++ b/cmake/module/Maintenance.cmake @@ -98,7 +98,7 @@ function(add_macos_deploy_target) file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/empty.lproj CONTENT "") configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/bitcoin.icns ${macos_app}/Contents/Resources/bitcoin.icns NO_SOURCE_PERMISSIONS COPYONLY) file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/Base.lproj/InfoPlist.strings - CONTENT "{ CFBundleDisplayName = \"@PACKAGE_NAME@\"; CFBundleName = \"@PACKAGE_NAME@\"; }" + CONTENT "{ CFBundleDisplayName = \"@CLIENT_NAME@\"; CFBundleName = \"@CLIENT_NAME@\"; }" ) add_custom_command( @@ -109,7 +109,7 @@ function(add_macos_deploy_target) VERBATIM ) - string(REPLACE " " "-" osx_volname ${PACKAGE_NAME}) + string(REPLACE " " "-" osx_volname ${CLIENT_NAME}) if(CMAKE_HOST_APPLE) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index ccaf31170a1..cbbb6551f1b 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = "Bitcoin Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @CLIENT_VERSION_STRING@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/libbitcoinkernel.pc.in b/libbitcoinkernel.pc.in index a2cb7d3692e..b8f93315874 100644 --- a/libbitcoinkernel.pc.in +++ b/libbitcoinkernel.pc.in @@ -3,9 +3,9 @@ exec_prefix=${prefix} libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ -Name: @PACKAGE_NAME@ kernel library +Name: @CLIENT_NAME@ kernel library Description: Experimental library for the Bitcoin Core validation engine. -Version: @PACKAGE_VERSION@ +Version: @CLIENT_VERSION_STRING@ Libs: -L${libdir} -lbitcoinkernel Libs.private: -L${libdir} @LIBS_PRIVATE@ Cflags: -I${includedir} diff --git a/share/setup.nsi.in b/share/setup.nsi.in index f22e256967e..d1a85cdb7f3 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -1,4 +1,4 @@ -Name "@PACKAGE_NAME@ (64-bit)" +Name "@CLIENT_NAME@ (64-bit)" RequestExecutionLevel highest SetCompressor /SOLID lzma @@ -11,8 +11,8 @@ Unicode true # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define COMPANY "@PACKAGE_NAME@ project" -!define URL @PACKAGE_URL@ +!define COMPANY "@CLIENT_NAME@ project" +!define URL @CLIENT_URL@ # MUI Symbol Definitions !define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico" @@ -24,7 +24,7 @@ Unicode true !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "@PACKAGE_NAME@" +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "@CLIENT_NAME@" !define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe" !define MUI_FINISHPAGE_RUN_PARAMETERS $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" @@ -58,12 +58,12 @@ XPStyle on BrandingText " " ShowInstDetails show VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@.0 -VIAddVersionKey ProductName "@PACKAGE_NAME@" -VIAddVersionKey ProductVersion "@PACKAGE_VERSION@" +VIAddVersionKey ProductName "@CLIENT_NAME@" +VIAddVersionKey ProductVersion "@CLIENT_VERSION_STRING@" VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyWebsite "${URL}" -VIAddVersionKey FileVersion "@PACKAGE_VERSION@" -VIAddVersionKey FileDescription "Installer for @PACKAGE_NAME@" +VIAddVersionKey FileVersion "@CLIENT_VERSION_STRING@" +VIAddVersionKey FileDescription "Installer for @CLIENT_NAME@" VIAddVersionKey LegalCopyright "Copyright (C) 2009-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@" InstallDirRegKey HKCU "${REGKEY}" Path ShowUninstDetails show @@ -95,23 +95,23 @@ Section -post SEC0001 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory $SMPROGRAMS\$StartMenuGroup CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1 - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (test signet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-signet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 2 - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet4).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet4" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 3 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (test signet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-signet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 2 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet4).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet4" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 3 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe !insertmacro MUI_STARTMENU_WRITE_END WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@PACKAGE_VERSION@" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@CLIENT_VERSION_STRING@" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\bitcoin-qt.exe WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 - WriteRegStr HKCR "@PACKAGE_TARNAME@" "URL Protocol" "" - WriteRegStr HKCR "@PACKAGE_TARNAME@" "" "URL:Bitcoin" - WriteRegStr HKCR "@PACKAGE_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ - WriteRegStr HKCR "@PACKAGE_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' + WriteRegStr HKCR "@CLIENT_TARNAME@" "URL Protocol" "" + WriteRegStr HKCR "@CLIENT_TARNAME@" "" "URL:Bitcoin" + WriteRegStr HKCR "@CLIENT_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ + WriteRegStr HKCR "@CLIENT_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' SectionEnd # Macro for selecting uninstaller sections @@ -142,9 +142,9 @@ Section -un.post UNSEC0001 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet4).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (test signet).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet4).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (test signet).lnk" Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" Delete /REBOOTOK $INSTDIR\uninstall.exe Delete /REBOOTOK $INSTDIR\debug.log @@ -153,7 +153,7 @@ Section -un.post UNSEC0001 DeleteRegValue HKCU "${REGKEY}" Path DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" DeleteRegKey /IfEmpty HKCU "${REGKEY}" - DeleteRegKey HKCR "@PACKAGE_TARNAME@" + DeleteRegKey HKCR "@CLIENT_TARNAME@" RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup RmDir /REBOOTOK $INSTDIR Push $R0 diff --git a/test/config.ini.in b/test/config.ini.in index 291599da452..7e658d3a869 100644 --- a/test/config.ini.in +++ b/test/config.ini.in @@ -6,8 +6,8 @@ # test/*/test_runner.py and test/util/rpcauth-test.py [environment] -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_BUGREPORT=@PACKAGE_BUGREPORT@ +PACKAGE_NAME=@CLIENT_NAME@ +PACKAGE_BUGREPORT=@CLIENT_BUGREPORT@ SRCDIR=@abs_top_srcdir@ BUILDDIR=@abs_top_builddir@ EXEEXT=@EXEEXT@