1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 22:28:57 +02:00

Use git-describe in versions

Reference-to: https://github.com/tenacityteam/tenacity/pull/396

Signed-off-by: Sol Fisher Romanoff <sol@solfisher.com>
This commit is contained in:
Sol Fisher Romanoff 2021-08-03 13:52:23 +03:00 committed by GitHub
parent 4f1d9f6f63
commit 56c953a14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 64 deletions

View File

@ -21,22 +21,6 @@ endif ()
# Set this value to 0 for alpha, 1 for beta, 2 for release builds # Set this value to 0 for alpha, 1 for beta, 2 for release builds
set( AUDACITY_BUILD_LEVEL 0 ) set( AUDACITY_BUILD_LEVEL 0 )
# The Audacity version
# Increment as appropriate after release of a new version, and set back
# AUDACITY_BUILD_LEVEL to 0
set( AUDACITY_VERSION 3 )
set( AUDACITY_RELEASE 0 )
set( AUDACITY_REVISION 4 )
set( AUDACITY_MODLEVEL 0 )
if( AUDACITY_BUILD_LEVEL EQUAL 0 )
set( AUDACITY_SUFFIX "-alpha" )
elseif( AUDACITY_BUILD_LEVEL EQUAL 1 )
set( AUDACITY_SUFFIX "-beta" )
else()
set( AUDACITY_SUFFIX "" )
endif()
# Don't allow in-source builds...no real reason, just # Don't allow in-source builds...no real reason, just
# keeping those source trees nice and tidy. :-) # keeping those source trees nice and tidy. :-)
# (This can be removed if it becomes an issue.) # (This can be removed if it becomes an issue.)
@ -238,32 +222,45 @@ elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
endif() endif()
# Try to get the current commit information # Current version and commit info
set( GIT_COMMIT_SHORT "unknown" ) set( AUDACITY_VERSION 0 )
set( GIT_COMMIT_LONG "unknown" ) set( AUDACITY_RELEASE 0 )
set( GIT_COMMIT_TIME "unknown" ) set( AUDACITY_REVISION 0 )
set( GIT_DESCRIBE "unknown" )
find_package( Git QUIET ) find_package( Git QUIET )
if( GIT_FOUND ) if( GIT_FOUND )
execute_process( execute_process(
COMMAND COMMAND
${GIT_EXECUTABLE} show -s "--format=%h;%H;%cd" --no-show-signature --no-notes ${GIT_EXECUTABLE} describe --abbrev=7
WORKING_DIRECTORY WORKING_DIRECTORY
${topdir} ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE OUTPUT_VARIABLE
git_output GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
) )
if( git_output ) if( GIT_DESCRIBE )
list( GET git_output 0 GIT_COMMIT_SHORT ) # Copy to new variable for string manipulation
list( GET git_output 1 GIT_COMMIT_LONG ) set( git_output ${GIT_DESCRIBE} )
list( GET git_output 2 GIT_COMMIT_TIME )
# TODO: Remove this after first Tenacity release
string(REPLACE "Audacity-" "" git_output "${git_output}")
string( REGEX REPLACE "-.*" "" git_output "${git_output}" )
string( REPLACE "." ";" git_output "${git_output}" )
list( GET git_output 0 AUDACITY_VERSION )
list( GET git_output 1 AUDACITY_RELEASE )
list( GET git_output 2 AUDACITY_REVISION )
endif() endif()
endif() endif()
message( STATUS " Current Commit: ${GIT_COMMIT_SHORT}" ) message( STATUS " Current Commit: ${GIT_DESCRIBE}" )
message( STATUS ) message( STATUS )
# Not sure what this even does
set( AUDACITY_MODLEVEL 0 )
# Organize subdirectories/targets into folders for the IDEs # Organize subdirectories/targets into folders for the IDEs
set_property( GLOBAL PROPERTY USE_FOLDERS ON ) set_property( GLOBAL PROPERTY USE_FOLDERS ON )
@ -495,10 +492,6 @@ else()
set( AUDACITY_NAME "tenacity" ) set( AUDACITY_NAME "tenacity" )
endif() endif()
# Create short and full version strings
set( AUDACITY_DIST_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION} )
set( AUDACITY_INFO_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}.${AUDACITY_MODLEVEL} )
# Python is used for the manual and (possibly) message catalogs # Python is used for the manual and (possibly) message catalogs
find_package( Python3 ) find_package( Python3 )
if( Python3_FOUND ) if( Python3_FOUND )

View File

@ -232,7 +232,7 @@ function( audacity_append_common_compiler_options var use_pch )
-DAUDACITY_MODLEVEL=${AUDACITY_MODLEVEL} -DAUDACITY_MODLEVEL=${AUDACITY_MODLEVEL}
# Version string for visual display # Version string for visual display
-DAUDACITY_VERSION_STRING=L"${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}${AUDACITY_SUFFIX}" -DAUDACITY_VERSION_STRING=L"${GIT_DESCRIBE}"
# This value is used in the resource compiler for Windows # This value is used in the resource compiler for Windows
-DAUDACITY_FILE_VERSION=L"${AUDACITY_VERSION},${AUDACITY_RELEASE},${AUDACITY_REVISION},${AUDACITY_MODLEVEL}" -DAUDACITY_FILE_VERSION=L"${AUDACITY_VERSION},${AUDACITY_RELEASE},${AUDACITY_REVISION},${AUDACITY_MODLEVEL}"

View File

@ -206,7 +206,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>Wrapper</string> <string>Wrapper</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>Audacity version ${AUDACITY_INFO_VERSION}</string> <string>Audacity version ${GIT_DESCRIBE}</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>Audacity.icns</string> <string>Audacity.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -214,17 +214,17 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleLongVersionString</key> <key>CFBundleLongVersionString</key>
<string>Version ${AUDACITY_INFO_VERSION}</string> <string>Version ${GIT_DESCRIBE}</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>Audacity</string> <string>Audacity</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>${AUDACITY_INFO_VERSION}</string> <string>${GIT_DESCRIBE}</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>auDy</string> <string>auDy</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>${AUDACITY_INFO_VERSION}</string> <string>${GIT_DESCRIBE}</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.music</string> <string>public.app-category.music</string>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
@ -232,7 +232,7 @@
<key>NSRequiresAquaSystemAppearance</key> <key>NSRequiresAquaSystemAppearance</key>
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Audacity version ${AUDACITY_INFO_VERSION}</string> <string>Audacity version ${GIT_DESCRIBE}</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>Audacity requires access to the microphone only if you intend to record from it.</string> <string>Audacity requires access to the microphone only if you intend to record from it.</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>

View File

@ -1,16 +1,8 @@
set(CPACK_PACKAGE_VERSION_MAJOR "${AUDACITY_VERSION}") # X
set(CPACK_PACKAGE_VERSION_MINOR "${AUDACITY_RELEASE}") # Y
set(CPACK_PACKAGE_VERSION_PATCH "${AUDACITY_REVISION}") # Z
set(CPACK_PACKAGE_VENDOR "Tenacity") set(CPACK_PACKAGE_VENDOR "Tenacity")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://tenacityaudio.org") set(CPACK_PACKAGE_HOMEPAGE_URL "https://tenacityaudio.org")
# X.Y.Z-alpha-20210615 # X.Y.Z-alpha-1337-gdeadbee
set(CPACK_PACKAGE_VERSION "${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}${AUDACITY_SUFFIX}") set(CPACK_PACKAGE_VERSION "${GIT_DESCRIBE}")
if(NOT AUDACITY_BUILD_LEVEL EQUAL 2)
# X.Y.Z-alpha-20210615+a1b2c3d
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}+${GIT_COMMIT_SHORT}")
endif()
# Custom variables use CPACK_AUDACITY_ prefix. CPACK_ to expose to CPack, # Custom variables use CPACK_AUDACITY_ prefix. CPACK_ to expose to CPack,
# AUDACITY_ to show it is custom and avoid conflicts with other projects. # AUDACITY_ to show it is custom and avoid conflicts with other projects.
@ -24,12 +16,12 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(os "linux") set(os "linux")
endif() endif()
# tenacity-linux-X.Y.Z-alpha-20210615 # tenacity-linux-X.Y.Z-alpha-1337-gdeadbee
set(CPACK_PACKAGE_FILE_NAME "tenacity-${os}-${CPACK_PACKAGE_VERSION}") set(CPACK_PACKAGE_FILE_NAME "tenacity-${os}-${CPACK_PACKAGE_VERSION}")
set(zsync_name "tenacity-${os}-*") # '*' is wildcard (here it means any version) set(zsync_name "tenacity-${os}-*") # '*' is wildcard (here it means any version)
if(DEFINED AUDACITY_ARCH_LABEL) if(DEFINED AUDACITY_ARCH_LABEL)
# tenacity-linux-X.Y.Z-alpha-20210615-x86_64 # tenacity-linux-X.Y.Z-alpha-1337-gdeadbee-x86_64
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${AUDACITY_ARCH_LABEL}") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${AUDACITY_ARCH_LABEL}")
set(zsync_name "${zsync_name}-${AUDACITY_ARCH_LABEL}") set(zsync_name "${zsync_name}-${AUDACITY_ARCH_LABEL}")
set(CPACK_AUDACITY_ARCH_LABEL "${AUDACITY_ARCH_LABEL}") set(CPACK_AUDACITY_ARCH_LABEL "${AUDACITY_ARCH_LABEL}")

View File

@ -46,7 +46,7 @@ list( APPEND EXCLUDES
win win
) )
set( TLD "tenacity-minsrc-${AUDACITY_DIST_VERSION}${AUDACITY_SUFFIX}" ) set( TLD "tenacity-minsrc-${GIT_DESCRIBE}" )
set( TARBALL "${PROJECT_BINARY_DIR}/${TLD}.tar.xz" ) set( TARBALL "${PROJECT_BINARY_DIR}/${TLD}.tar.xz" )
add_custom_target( ${TARGET} add_custom_target( ${TARGET}

View File

@ -269,14 +269,10 @@ eval $(cpp -E <<CPPEOF | sed -e 's/wxT("//g' \
-e '/^v_/p' \ -e '/^v_/p' \
-e 'd' -e 'd'
#include "src/Audacity.h" #include "src/Audacity.h"
v_major=AUDACITY_VERSION
v_minor=AUDACITY_RELEASE
v_micro=AUDACITY_REVISION
v_suffix=AUDACITY_SUFFIX
CPPEOF CPPEOF
) )
version="${v_major}.${v_minor}.${v_micro}${v_suffix}" version="${GIT_DESCRIBE}"
printf "${version}\n" printf "${version}\n"
# now clean out the directory of all the things we don't need in the # now clean out the directory of all the things we don't need in the