mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 16:49:41 +02:00
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
58 lines
1.4 KiB
CMake
58 lines
1.4 KiB
CMake
|
|
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}
|
|
)
|
|
|