summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2017-09-20 07:48:19 -0500
committerGitHub <noreply@github.com>2017-09-20 07:48:19 -0500
commit524c1d3c9eef1f63d058ca5d4a61af7d5588ebfb (patch)
tree56d70372f3cc1fa48d21878e70b5d898a60bc756
parent212da30dbf18924cb8878348657a048698856be3 (diff)
parentd630887bb6ab91a55e72fddc65db93ee6abcd984 (diff)
downloadlibgit2-524c1d3c9eef1f63d058ca5d4a61af7d5588ebfb.tar.gz
Merge pull request #4334 from pks-t/pks/reproducible-builds
Reproducible builds
-rw-r--r--CMakeLists.txt9
-rw-r--r--tests/generate.py8
2 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 713b2b713..af4c34e3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,9 @@ OPTION( CURL "Use curl for HTTP if available" ON)
OPTION( USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
OPTION( ENABLE_WERROR "Enable compilation with -Werror" OFF )
+IF (UNIX AND NOT APPLE)
+ OPTION( ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF )
+ENDIF()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET( USE_ICONV ON )
@@ -222,6 +225,12 @@ IF (MSVC)
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
ELSE ()
+ IF (ENABLE_REPRODUCIBLE_BUILDS)
+ SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
+ SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
+ SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
+ ENDIF()
+
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
MACRO(ENABLE_WARNINGS flag)
diff --git a/tests/generate.py b/tests/generate.py
index 6a6228f25..0a94d4952 100644
--- a/tests/generate.py
+++ b/tests/generate.py
@@ -207,16 +207,18 @@ class TestSuite(object):
return False
with open(output, 'w') as data:
- for module in self.modules.values():
+ modules = sorted(self.modules.values(), key=lambda module: module.name)
+
+ for module in modules:
t = Module.DeclarationTemplate(module)
data.write(t.render())
- for module in self.modules.values():
+ for module in modules:
t = Module.CallbacksTemplate(module)
data.write(t.render())
suites = "static struct clar_suite _clar_suites[] = {" + ','.join(
- Module.InfoTemplate(module).render() for module in sorted(self.modules.values(), key=lambda module: module.name)
+ Module.InfoTemplate(module).render() for module in modules
) + "\n};\n"
data.write(suites)