Browse Source

Add "minsrc" target to build tarball

This adds a new target that will build the "minsrc" tarball.

It can be created on any platform now, either from the command
line or from within the Window's and Mac's project files.

The output tarball will be in the build directory.

And it's very easy to update the list of files/directories to
exclude...see scripts/CMakeLists.txt
au-ny-api
Leland Lucius 2 years ago
parent
commit
1a2b407e89
  1. 53
      CMakeLists.txt
  2. 56
      scripts/CMakeLists.txt
  3. 57
      scripts/maketarball.cmake
  4. 35
      src/CMakeLists.txt

53
CMakeLists.txt

@ -311,8 +311,7 @@ find_package( PkgConfig QUIET )
# Mostly just to make the CMP0072 policy happy
find_package( OpenGL QUIET )
# When called will define several useful directory paths for the
# current context.
# Defines several useful directory paths for the active context.
macro( def_vars )
set( _SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}" )
set( _INTDIR "${CMAKE_CURRENT_BINARY_DIR}" )
@ -360,6 +359,55 @@ if( NOT CMAKE_INSTALL_LIBDIR STREQUAL "lib" AND NOT EXISTS "${CMAKE_BINARY_DIR}/
file( CREATE_LINK "${CMAKE_BINARY_DIR}/lib" "${CMAKE_BINARY_DIR}/lib64" SYMBOLIC )
endif()
# Extract the Audacity version information
file(
STRINGS
${topdir}/src/Audacity.h output
REGEX
"^#define +AUDACITY_(VERSION|RELEASE|REVISION|MODLEVEL|BUILD_LEVEL) +"
)
# And store as variables
foreach( line ${output} )
string( REGEX MATCHALL "[A-Za-z0-9_]+" line "${line}" )
list( GET line 1 name )
list( GET line 2 value )
set( ${name} ${value} )
endforeach()
# 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} )
# Define the version suffix (duplicates what happens in src/Audacity.h)
string( TIMESTAMP __TDATE__ "%Y%m%d" )
if( AUDACITY_BUILD_LEVEL EQUAL 0 )
set( AUDACITY_SUFFIX "-alpha-${__TDATE__}" )
elseif( AUDACITY_BUILD_LEVEL EQUAL 1 )
set( AUDACITY_SUFFIX "-beta-${__TDATE__}" )
else()
set( AUDACITY_SUFFIX "" )
endif()
# Extract the current commit information
if (GIT_FOUND)
execute_process(
COMMAND
${GIT_EXECUTABLE} show -s "--format=\"%H\";\"%cd\";"
WORKING_DIRECTORY
${topdir}
OUTPUT_VARIABLE
output
)
list( GET output 0 long )
list( GET output 1 time )
list( APPEND DEFINES
REV_LONG=${long}
REV_TIME=${time}
)
endif()
# Helper to organize sources into folders for the IDEs
macro( organize_source root prefix sources )
set( cleaned )
@ -546,6 +594,7 @@ add_subdirectory( "src" )
add_subdirectory( "cmake-proxies/mod-null" )
add_subdirectory( "cmake-proxies/mod-nyq-bench" )
add_subdirectory( "cmake-proxies/mod-script-pipe" )
add_subdirectory( "scripts" )
# Only need the sc4_1882 Ladspa plug-in on Windows and Mac
if( CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )

56
scripts/CMakeLists.txt

@ -0,0 +1,56 @@
set( TARGET minsrc )
set( TARGET_ROOT ${topdir} )
message( STATUS "========== Configuring ${TARGET} ==========" )
def_vars()
# Add regular expressions of files/directories to exclude from the tarball
#
# NOTE: Each item will be wrapped with "^" and ".*$"
list( APPEND EXCLUDES
.git
.gitattributes
.gitignore
lib-src/expat
lib-src/libid3tag
lib-src/libmad
lib-src/libogg
lib-src/libscorealign
lib-src/portaudio-v19/bindings
lib-src/portaudio-v19/doc
lib-src/portaudio-v19/testcvs
lib-src/portmidi/pm_csharp
lib-src/portmidi/pm_dylib
lib-src/portmidi/pm_java
lib-src/portmidi/pm_mingw
lib-src/portmidi/pm_python
lib-src/portmidi/pm_qt
lib-src/portmidi/pm_test
lib-src/portmidi/portmidi_cdt.zip
lib-src/soundtouch
lib-src/libvorbis
mac
plug-ins/analyze.ny
plug-ins/fadein.ny
plug-ins/fadeout.ny
plug-ins/undcbias.ny
qa
scripts
tests/ProjectCheckTests
todo.txt
win
)
set( TARBALL "${PROJECT_BINARY_DIR}/audacity-minsrc-${AUDACITY_DIST_VERSION}${AUDACITY_SUFFIX}.tar.xz" )
add_custom_target( ${TARGET}
COMMAND
${CMAKE_COMMAND} -D GIT_EXECUTABLE="${GIT_EXECUTABLE}"
-D TARGET_ROOT="${TARGET_ROOT}"
-D EXCLUDES="${EXCLUDES}"
-D TARBALL="${TARBALL}"
-P "${_SRCDIR}/maketarball.cmake"
)

57
scripts/maketarball.cmake

@ -0,0 +1,57 @@
set( TARGET minsrc )
# list command no longer ignores empty elements.
cmake_policy( SET CMP0007 NEW )
# Check to make sure the source tree has no uncommitted changes
execute_process(
COMMAND
${GIT_EXECUTABLE} status -s --untracked-files=no
WORKING_DIRECTORY
${TARGET_ROOT}
OUTPUT_VARIABLE
output
)
if( output )
# message( FATAL_ERROR "You have uncommited changes\n${output}" )
endif()
# Get the list of files in the repo
execute_process(
COMMAND
${GIT_EXECUTABLE} ls-tree -r --name-only HEAD ${TARGET_ROOT}
WORKING_DIRECTORY
${TARGET_ROOT}
OUTPUT_VARIABLE
output
)
# Convert the output to a list
string( REPLACE "\n" ";" output "${output}" )
# Convert excludes to regular expressions
string( REPLACE " " ".*$|^" EXCLUDES "${EXCLUDES}" )
# Remove unwanted files from the list
list( FILTER output EXCLUDE REGEX "^${EXCLUDES}.*$" )
message( STATUS "Creating the minsrc archive at:" )
message( STATUS )
message( STATUS " ${TARBALL}" )
message( STATUS )
# Write the list to a file to circumvent command line length limits
set( filelist "${CMAKE_CURRENT_BINARY_DIR}/filelist" )
string( REPLACE ";" "\n" output "${output}" )
file( WRITE "${filelist}" ${output} )
# Create the tarball
execute_process(
COMMAND
${CMAKE_COMMAND} -E tar cfJ ${TARBALL} --files-from=${filelist}
WORKING_DIRECTORY
${TARGET_ROOT}
)

35
src/CMakeLists.txt

@ -1235,23 +1235,6 @@ elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set( HAVE_VISIBILITY 1 )
configure_file( audacity_config.h.in private/configmac.h )
# Extract the version information
file( STRINGS ${_SRCDIR}/Audacity.h output
REGEX
"^#define +AUDACITY_(VERSION|RELEASE|REVISION|MODLEVEL) +"
)
# And store as variables
foreach( line ${output} )
string( REGEX MATCHALL "[A-Za-z0-9_]+" line "${line}" )
list( GET line 1 name )
list( GET line 2 value )
set( ${name} ${value} )
endforeach()
set( AUDACITY_DIST_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION} )
set( AUDACITY_INFO_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}.${AUDACITY_MODLEVEL} )
# Copy the wxWidgets libraries into the bundle
if( "${CMAKE_GENERATOR}" MATCHES "Xcode" )
add_custom_command(
@ -1337,24 +1320,6 @@ endif()
set_target_property_all( ${TARGET} RUNTIME_OUTPUT_NAME ${_EXE} )
if (GIT_FOUND)
execute_process(
COMMAND
${GIT_EXECUTABLE} show -s "--format=\"%H\";\"%cd\";"
WORKING_DIRECTORY
${TARGET_ROOT}
OUTPUT_VARIABLE
output
)
list( GET output 0 long )
list( GET output 1 time )
list( APPEND DEFINES
REV_LONG=${long}
REV_TIME=${time}
)
endif()
organize_source( "${TARGET_ROOT}/.." "include" "${HEADERS}" )
organize_source( "${TARGET_ROOT}/../presets" "presets" "${RESOURCES}" )
organize_source( "${TARGET_ROOT}" "src" "${SOURCES}" )

Loading…
Cancel
Save