mirror of
https://github.com/nlohmann/json.git
synced 2026-10-05 06:00:29 +00:00
Make the json.tar.xz release archive configure standalone
The json.tar.xz rule packed neither src/modules nor tests, but the top-level CMakeLists.txt needs src/modules for NLOHMANN_JSON_BUILD_MODULES=ON and defaulted JSON_BuildTests to ON for a main project. A standalone configure of the extracted archive failed at add_subdirectory(tests), and enabling the module failed at add_subdirectory(src/modules). Add src/modules to the archive, and default JSON_BuildTests to ON only if tests/CMakeLists.txt exists, so a repository checkout still builds the tests by default while the archive configures out of the box. Use GNU tar via a TAR variable (gtar if present, else tar), the same way SED is found, instead of hard-coding gtar. The library, its public API, and its ABI are unchanged. Part of #5716 Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
# find GNU sed to use `-i` parameter
|
||||
SED:=$(shell command -v gsed || which sed)
|
||||
|
||||
# find GNU tar to use `--sort` and `--pax-option` parameters
|
||||
TAR:=$(shell command -v gtar || which tar)
|
||||
|
||||
|
||||
##########################################################################
|
||||
# source files
|
||||
@@ -215,8 +218,8 @@ ChangeLog.md:
|
||||
# archive is created according to the advices of <https://reproducible-builds.org/docs/archives/>.
|
||||
json.tar.xz:
|
||||
mkdir json
|
||||
rsync -R $(shell find LICENSE.MIT nlohmann_json.natvis CMakeLists.txt cmake/*.in include single_include -type f) json
|
||||
gtar --sort=name --mtime="@$(shell git log -1 --pretty=%ct)" --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime --create --file - json | xz --compress -9e --threads=2 - > json.tar.xz
|
||||
rsync -R $(shell find LICENSE.MIT nlohmann_json.natvis CMakeLists.txt cmake/*.in include single_include src/modules -type f) json
|
||||
$(TAR) --sort=name --mtime="@$(shell git log -1 --pretty=%ct)" --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime --create --file - json | xz --compress -9e --threads=2 - > json.tar.xz
|
||||
rm -fr json
|
||||
|
||||
# We use `-X` to make the resulting ZIP file reproducible, see
|
||||
|
||||
Reference in New Issue
Block a user