1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 14:50:17 +01:00

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
This commit is contained in:
Leland Lucius
2020-02-28 01:40:16 -06:00
parent e760809b7b
commit 1a2b407e89
4 changed files with 164 additions and 37 deletions

56
scripts/CMakeLists.txt Executable file
View File

@@ -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 Normal file
View File

@@ -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}
)