From cdca62a64e748880a5a489cadfbb863853b02f86 Mon Sep 17 00:00:00 2001 From: Lukas Kollmer Date: Mon, 2 Feb 2026 13:24:01 +0100 Subject: [PATCH 1/2] SPM: ZSTDLIB_STATIC_API --- Package.swift | 3 ++- lib/spm/module.modulemap | 14 ++++++++++++++ lib/spm/zdict_shim.h | 17 +++++++++++++++++ lib/spm/zstd_shim.h | 17 +++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lib/spm/module.modulemap create mode 100644 lib/spm/zdict_shim.h create mode 100644 lib/spm/zstd_shim.h diff --git a/Package.swift b/Package.swift index 97f2c6a5251..44127612b60 100644 --- a/Package.swift +++ b/Package.swift @@ -12,6 +12,7 @@ let package = Package( // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "libzstd", + type: .static, targets: [ "libzstd" ]) ], dependencies: [ @@ -25,7 +26,7 @@ let package = Package( name: "libzstd", path: "lib", sources: [ "common", "compress", "decompress", "dictBuilder" ], - publicHeadersPath: ".", + publicHeadersPath: "spm", cSettings: [ .headerSearchPath(".") ]) diff --git a/lib/spm/module.modulemap b/lib/spm/module.modulemap new file mode 100644 index 00000000000..0f1051efbfc --- /dev/null +++ b/lib/spm/module.modulemap @@ -0,0 +1,14 @@ +module libzstd [extern_c] { + header "zstd_shim.h" + export * + + module dictbuilder [extern_c] { + header "zdict_shim.h" + export * + } + + module errors [extern_c] { + header "../zstd_errors.h" + export * + } +} diff --git a/lib/spm/zdict_shim.h b/lib/spm/zdict_shim.h new file mode 100644 index 00000000000..06521184ba7 --- /dev/null +++ b/lib/spm/zdict_shim.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_ZDICT_SHIM_H +#define ZSTD_ZDICT_SHIM_H + +#define ZSTD_STATIC_LINKING_ONLY +#include "../zdict.h" + +#endif /* ZSTD_SHIM_H */ diff --git a/lib/spm/zstd_shim.h b/lib/spm/zstd_shim.h new file mode 100644 index 00000000000..ede95c51f72 --- /dev/null +++ b/lib/spm/zstd_shim.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_SHIM_H +#define ZSTD_SHIM_H + +#define ZSTD_STATIC_LINKING_ONLY +#include "../zstd.h" + +#endif /* ZSTD_SHIM_H */ From 1fc714af07468554b4c452662fd33ec3870f0312 Mon Sep 17 00:00:00 2001 From: Lukas Kollmer Date: Mon, 2 Feb 2026 13:58:14 +0100 Subject: [PATCH 2/2] x --- lib/spm/zdict_shim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spm/zdict_shim.h b/lib/spm/zdict_shim.h index 06521184ba7..48d6cbd950a 100644 --- a/lib/spm/zdict_shim.h +++ b/lib/spm/zdict_shim.h @@ -14,4 +14,4 @@ #define ZSTD_STATIC_LINKING_ONLY #include "../zdict.h" -#endif /* ZSTD_SHIM_H */ +#endif /* ZSTD_ZDICT_SHIM_H */