Skip to content

Commit

Permalink
build: Rename PACKAGE_* variables to BITCOIN_PACKAGE_*
Browse files Browse the repository at this point in the history
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 prefixing all `PACKAGE_*` variables
with `BITCOIN_`.
  • Loading branch information
hebasto committed Oct 6, 2024
1 parent 5fe6878 commit 5f5f3e8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()
#=============================
# Project / Package metadata
#=============================
set(PACKAGE_NAME "Bitcoin Core")
set(BITCOIN_PACKAGE_NAME "Bitcoin Core")
set(CLIENT_VERSION_MAJOR 28)
set(CLIENT_VERSION_MINOR 99)
set(CLIENT_VERSION_BUILD 0)
Expand Down Expand Up @@ -47,14 +47,14 @@ project(BitcoinCore
LANGUAGES NONE
)

set(PACKAGE_VERSION ${PROJECT_VERSION})
set(BITCOIN_PACKAGE_VERSION ${PROJECT_VERSION})
if(CLIENT_VERSION_RC GREATER 0)
string(APPEND PACKAGE_VERSION "rc${CLIENT_VERSION_RC}")
string(APPEND BITCOIN_PACKAGE_VERSION "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 ${BITCOIN_PACKAGE_NAME} developers")
set(BITCOIN_PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues")

#=============================
# Language setup
Expand Down
8 changes: 4 additions & 4 deletions cmake/bitcoin-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 "@BITCOIN_PACKAGE_NAME@"

/* Copyright year */
#define COPYRIGHT_YEAR @COPYRIGHT_YEAR@
Expand Down Expand Up @@ -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 "@BITCOIN_PACKAGE_BUGREPORT@"

/* Define to the full name of this package. */
#define PACKAGE_NAME "@PACKAGE_NAME@"
#define PACKAGE_NAME "@BITCOIN_PACKAGE_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 "@BITCOIN_PACKAGE_VERSION@"

/* Define to 1 if strerror_r returns char *. */
#cmakedefine STRERROR_R_CHAR_P 1
Expand Down
4 changes: 2 additions & 2 deletions cmake/module/Maintenance.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \"@BITCOIN_PACKAGE_NAME@\"; CFBundleName = \"@BITCOIN_PACKAGE_NAME@\"; }"
)

add_custom_command(
Expand All @@ -109,7 +109,7 @@ function(add_macos_deploy_target)
VERBATIM
)

string(REPLACE " " "-" osx_volname ${PACKAGE_NAME})
string(REPLACE " " "-" osx_volname ${BITCOIN_PACKAGE_NAME})
if(CMAKE_HOST_APPLE)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @BITCOIN_PACKAGE_VERSION@

# 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
Expand Down
4 changes: 2 additions & 2 deletions libbitcoinkernel.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Name: @PACKAGE_NAME@ kernel library
Name: @BITCOIN_PACKAGE_NAME@ kernel library
Description: Experimental library for the Bitcoin Core validation engine.
Version: @PACKAGE_VERSION@
Version: @BITCOIN_PACKAGE_VERSION@
Libs: -L${libdir} -lbitcoinkernel
Libs.private: -L${libdir} @LIBS_PRIVATE@
Cflags: -I${includedir}
20 changes: 10 additions & 10 deletions share/setup.nsi.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name "@PACKAGE_NAME@ (64-bit)"
Name "@BITCOIN_PACKAGE_NAME@ (64-bit)"

RequestExecutionLevel highest
SetCompressor /SOLID lzma
Expand All @@ -11,7 +11,7 @@ Unicode true

# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define COMPANY "@PACKAGE_NAME@ project"
!define COMPANY "@BITCOIN_PACKAGE_NAME@ project"
!define URL @PACKAGE_URL@

# MUI Symbol Definitions
Expand All @@ -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 "@BITCOIN_PACKAGE_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"
Expand Down Expand Up @@ -58,12 +58,12 @@ XPStyle on
BrandingText " "
ShowInstDetails show
VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@[email protected]
VIAddVersionKey ProductName "@PACKAGE_NAME@"
VIAddVersionKey ProductVersion "@PACKAGE_VERSION@"
VIAddVersionKey ProductName "@BITCOIN_PACKAGE_NAME@"
VIAddVersionKey ProductVersion "@BITCOIN_PACKAGE_VERSION@"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "@PACKAGE_VERSION@"
VIAddVersionKey FileDescription "Installer for @PACKAGE_NAME@"
VIAddVersionKey FileVersion "@BITCOIN_PACKAGE_VERSION@"
VIAddVersionKey FileDescription "Installer for @BITCOIN_PACKAGE_NAME@"
VIAddVersionKey LegalCopyright "Copyright (C) 2009-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@"
InstallDirRegKey HKCU "${REGKEY}" Path
ShowUninstDetails show
Expand Down Expand Up @@ -95,11 +95,11 @@ 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, 64-bit).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@BITCOIN_PACKAGE_NAME@ (testnet, 64-bit).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1
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 "@BITCOIN_PACKAGE_VERSION@"
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
Expand Down Expand Up @@ -140,7 +140,7 @@ 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, 64-bit).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@BITCOIN_PACKAGE_NAME@ (testnet, 64-bit).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
Delete /REBOOTOK $INSTDIR\debug.log
Expand Down
4 changes: 2 additions & 2 deletions test/config.ini.in
Original file line number Diff line number Diff line change
Expand Up @@ -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=@BITCOIN_PACKAGE_NAME@
PACKAGE_BUGREPORT=@BITCOIN_PACKAGE_BUGREPORT@
SRCDIR=@abs_top_srcdir@
BUILDDIR=@abs_top_builddir@
EXEEXT=@EXEEXT@
Expand Down

0 comments on commit 5f5f3e8

Please sign in to comment.