7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:00:13 +00:00

Make tarball creation deterministic

for reproducible builds.

The reproducible code-path assumes GNU tar is used.
If $SOURCE_DATE_EPOCH is not set, it should work the same as before.
This commit is contained in:
Bernhard M. Wiedemann 2024-12-06 08:52:25 +01:00 committed by Ian McInerney
parent 68a00c131d
commit e13df516cb

View File

@ -897,8 +897,12 @@ else()
set( TAR_OUTPUT_FILE "${BITMAP_ARCHIVE_PATH}" )
endif()
set( TARFLAGS cfz )
if( DEFINED ENV{SOURCE_DATE_EPOCH} )
set( TARFLAGS --sort=name --mtime=@$ENV{SOURCE_DATE_EPOCH} --clamp-mtime --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime -czf )
endif()
add_custom_target( bitmap_archive ALL
COMMAND ${TAR} cfz "${TAR_OUTPUT_FILE}" .
COMMAND ${TAR} ${TARFLAGS} "${TAR_OUTPUT_FILE}" .
DEPENDS ${ALL_PNGS}
BYPRODUCTS ${BITMAP_ARCHIVE_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/png