aboutsummaryrefslogtreecommitdiff
path: root/kde-modules
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2020-12-27 17:53:24 +0100
committerSandro Knauß <sknauss@kde.org>2020-12-27 17:55:31 +0100
commit9dd88963632346093e18bb2dabffc8b57b12f928 (patch)
tree0c2e0dec6f3ed4f8c673dff23e78fa267bb95dcf /kde-modules
parent11ecd86909bd28269ab158c8b291a38e905aea3c (diff)
parent120eba4ab5f1f84d5792eb77a3a754e8a88981c5 (diff)
downloadextra-cmake-modules-9dd88963632346093e18bb2dabffc8b57b12f928.tar.gz
extra-cmake-modules-9dd88963632346093e18bb2dabffc8b57b12f928.tar.bz2
Merge branch 'work/hefee/reproducable'
Diffstat (limited to 'kde-modules')
-rw-r--r--kde-modules/KDEPackageAppTemplates.cmake39
1 files changed, 33 insertions, 6 deletions
diff --git a/kde-modules/KDEPackageAppTemplates.cmake b/kde-modules/KDEPackageAppTemplates.cmake
index 37e989ee..9403d63b 100644
--- a/kde-modules/KDEPackageAppTemplates.cmake
+++ b/kde-modules/KDEPackageAppTemplates.cmake
@@ -83,6 +83,23 @@ function(kde_package_app_templates)
message(FATAL_ERROR "No INSTALL_DIR argument given to kde_package_app_templates")
endif()
+ find_program(_tar_executable NAMES gtar tar)
+ if(_tar_executable)
+ execute_process(
+ COMMAND ${_tar_executable} --version
+ TIMEOUT 3
+ RESULT_VARIABLE _tar_exit
+ OUTPUT_VARIABLE _tar_version
+ )
+ if("${_tar_exit}" EQUAL 0 AND "${_tar_version}" MATCHES "GNU tar")
+ set(GNU_TAR_FOUND ON)
+ else()
+ set(GNU_TAR_FOUND OFF)
+ endif()
+ else()
+ set(GNU_TAR_FOUND OFF)
+ endif()
+
foreach(_templateName ${ARG_TEMPLATES})
get_filename_component(_tmp_file ${_templateName} ABSOLUTE)
get_filename_component(_baseName ${_tmp_file} NAME_WE)
@@ -103,12 +120,22 @@ function(kde_package_app_templates)
endif()
add_custom_target(${_baseName} ALL DEPENDS ${_template})
- add_custom_command(OUTPUT ${_template}
- COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} .
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
- DEPENDS ${_subdirs_entries}
- )
-
+ if(GNU_TAR_FOUND)
+ # Make tar archive reproducible, the arguments are only available with GNU tar
+ add_custom_command(OUTPUT ${_template}
+ COMMAND ${_tar_executable} ARGS -c ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+ --exclude .kdev_ignore --exclude .svn --sort=name --mode=go=rX,u+rw,a-s --owner=root
+ --group=root --numeric-owner -j -v -f ${_template} .
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+ DEPENDS ${_subdirs_entries}
+ )
+ else()
+ add_custom_command(OUTPUT ${_template}
+ COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} .
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+ DEPENDS ${_subdirs_entries}
+ )
+ endif()
install(FILES ${_template} DESTINATION ${ARG_INSTALL_DIR})
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_template}")