Skip to content

Commit 5e89fe5

Browse files
committed
1 parent 546a3a2 commit 5e89fe5

File tree

6 files changed

+370
-0
lines changed

6 files changed

+370
-0
lines changed

libarchive.20240321-143919.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"build_file": null,
3+
"build_targets": [
4+
"@libarchive//tar"
5+
],
6+
"compatibility_level": "1",
7+
"deps": [
8+
[
9+
"xz",
10+
"5.4.5.bcr.1"
11+
],
12+
[
13+
"zlib",
14+
"1.3.1"
15+
],
16+
[
17+
"zstd",
18+
"1.5.5.bcr.1"
19+
]
20+
],
21+
"module_dot_bazel": null,
22+
"name": "libarchive",
23+
"patch_strip": 1,
24+
"patches": [
25+
"/tmp/patch"
26+
],
27+
"presubmit_yml": null,
28+
"strip_prefix": "libarchive-3.7.2",
29+
"test_module_build_targets": [],
30+
"test_module_path": null,
31+
"test_module_test_targets": [],
32+
"url": "https://www.libarchive.org/downloads/libarchive-3.7.2.tar.xz",
33+
"version": "3.7.2"
34+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module(
2+
name = "libarchive",
3+
version = "3.7.2",
4+
compatibility_level = 1,
5+
)
6+
bazel_dep(name = "xz", version = "5.4.5.bcr.1")
7+
bazel_dep(name = "zlib", version = "1.3.1")
8+
bazel_dep(name = "zstd", version = "1.5.5.bcr.1")
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
diff --git a/BUILD.bazel b/BUILD.bazel
2+
new file mode 100644
3+
index 00000000..a8f0858c
4+
--- /dev/null
5+
+++ b/BUILD.bazel
6+
@@ -0,0 +1,37 @@
7+
+cc_library(
8+
+ name = "config_h",
9+
+ hdrs = ["xplat_config.h"],
10+
+ defines = select({
11+
+ "@platforms//os:linux": [
12+
+ "HAVE_PATHS_H",
13+
+ "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC",
14+
+ ],
15+
+ "//conditions:default": [],
16+
+ }) + select({
17+
+ "@platforms//os:windows": [
18+
+ "gid_t=short",
19+
+ "id_t=\"unsigned long\"",
20+
+ "uid_t=short",
21+
+ ],
22+
+ "//conditions:default": [
23+
+ "HAVE_SYS_TYPES_H",
24+
+ ],
25+
+ }) + select({
26+
+ "@platforms//os:windows": ["HAVE_WINCRYPT_H"],
27+
+ "//conditions:default": [],
28+
+ }) + select({
29+
+ "@platforms//os:windows": [],
30+
+ "//conditions:default": [
31+
+ "HAVE_FORK",
32+
+ "HAVE_PIPE",
33+
+ "HAVE_POLL",
34+
+ "HAVE_POLL_H",
35+
+ "HAVE_PWD_H",
36+
+ "HAVE_SYS_WAIT_H",
37+
+ ],
38+
+ }) + select({
39+
+ "@platforms//os:windows": [],
40+
+ "//conditions:default": ["HAVE_GRP_H"],
41+
+ }),
42+
+ visibility = ["//visibility:public"],
43+
+)
44+
diff --git a/WORKSPACE b/WORKSPACE
45+
new file mode 100644
46+
index 00000000..e69de29b
47+
diff --git a/libarchive/BUILD.bazel b/libarchive/BUILD.bazel
48+
new file mode 100644
49+
index 00000000..85b9b37b
50+
--- /dev/null
51+
+++ b/libarchive/BUILD.bazel
52+
@@ -0,0 +1,41 @@
53+
+PUBLIC_HEADERS = [
54+
+ "archive.h",
55+
+ "archive_entry.h",
56+
+]
57+
+
58+
+WINDOWS_SRCS = glob(["*_windows.*"]) + ["archive_entry_copy_bhfi.c"]
59+
+
60+
+cc_library(
61+
+ name = "libarchive",
62+
+ srcs = glob(
63+
+ [
64+
+ "*.c",
65+
+ "*.h",
66+
+ ],
67+
+ exclude = PUBLIC_HEADERS + WINDOWS_SRCS + [
68+
+ "archive_disk_acl_*.c",
69+
+ ],
70+
+ ) + select({
71+
+ "@platforms//os:windows": WINDOWS_SRCS,
72+
+ "@platforms//os:macos": ["archive_disk_acl_darwin.c"],
73+
+ "@platforms//os:linux": ["archive_disk_acl_linux.c"],
74+
+ "//conditions:default": [],
75+
+ }),
76+
+ hdrs = PUBLIC_HEADERS,
77+
+ local_defines = [
78+
+ "HAVE_CONFIG_H",
79+
+ # ZSTD support
80+
+ "HAVE_ZSTD_H",
81+
+ "HAVE_LIBZSTD",
82+
+ "HAVE_LIBZSTD_COMPRESSOR",
83+
+ # LZMA support
84+
+ "HAVE_LZMA_H",
85+
+ "HAVE_LZMA_STREAM_ENCODER_MT",
86+
+ ],
87+
+ visibility = ["//visibility:public"],
88+
+ deps = [
89+
+ "//:config_h",
90+
+ "@xz//:lzma",
91+
+ "@zstd",
92+
+ ],
93+
+)
94+
diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h
95+
index d0fda7f9..e41c944d 100644
96+
--- a/libarchive/archive_hmac_private.h
97+
+++ b/libarchive/archive_hmac_private.h
98+
@@ -40,12 +40,13 @@
99+
*/
100+
int __libarchive_hmac_build_hack(void);
101+
102+
-#ifdef __APPLE__
103+
-# include <AvailabilityMacros.h>
104+
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
105+
-# define ARCHIVE_HMAC_USE_Apple_CommonCrypto
106+
-# endif
107+
-#endif
108+
+// Don't compile against CommonCrypto.
109+
+// #ifdef __APPLE__
110+
+// # include <AvailabilityMacros.h>
111+
+// # if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
112+
+// # define ARCHIVE_HMAC_USE_Apple_CommonCrypto
113+
+// # endif
114+
+// #endif
115+
116+
#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto
117+
#include <CommonCrypto/CommonHMAC.h>
118+
diff --git a/libarchive/config.h b/libarchive/config.h
119+
new file mode 100644
120+
index 00000000..1bb06802
121+
--- /dev/null
122+
+++ b/libarchive/config.h
123+
@@ -0,0 +1,13 @@
124+
+
125+
+#ifndef LIBARCHIVE_CONFIG_H
126+
+#define LIBARCHIVE_CONFIG_H
127+
+
128+
+#include <ctype.h>
129+
+#include <wchar.h>
130+
+
131+
+#include "xplat_config.h"
132+
+
133+
+#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
134+
+
135+
+#endif // LIBARCHIVE_CONFIG_H
136+
+
137+
diff --git a/libarchive_fe/BUILD.bazel b/libarchive_fe/BUILD.bazel
138+
new file mode 100644
139+
index 00000000..51a75a64
140+
--- /dev/null
141+
+++ b/libarchive_fe/BUILD.bazel
142+
@@ -0,0 +1,9 @@
143+
+cc_library(
144+
+ name = "libarchive_fe",
145+
+ srcs = glob(["*.c"]),
146+
+ hdrs = glob(["*.h"]),
147+
+ visibility = ["//visibility:public"],
148+
+ deps = [
149+
+ "//:config_h",
150+
+ ],
151+
+)
152+
diff --git a/libarchive_fe/config.h b/libarchive_fe/config.h
153+
new file mode 100644
154+
index 00000000..1f484ee0
155+
--- /dev/null
156+
+++ b/libarchive_fe/config.h
157+
@@ -0,0 +1,6 @@
158+
+#ifndef LIBARCHIVE_FE_CONFIG_H
159+
+#define LIBARCHIVE_FE_CONFIG_H
160+
+
161+
+#include "xplat_config.h"
162+
+
163+
+#endif // LIBARCHIVE_FE_CONFIG_H
164+
\ No newline at end of file
165+
diff --git a/tar/BUILD.bazel b/tar/BUILD.bazel
166+
new file mode 100644
167+
index 00000000..39fc5330
168+
--- /dev/null
169+
+++ b/tar/BUILD.bazel
170+
@@ -0,0 +1,33 @@
171+
+cc_binary(
172+
+ name = "tar",
173+
+ srcs = select({
174+
+ "@platforms//os:windows": glob([
175+
+ "*.c",
176+
+ "*.h",
177+
+ ]),
178+
+ "//conditions:default": glob(
179+
+ [
180+
+ "*.c",
181+
+ "*.h",
182+
+ ],
183+
+ exclude = ["bsdtar_windows.*"],
184+
+ ),
185+
+ }),
186+
+ copts = [
187+
+ "-Wno-implicit-function-declaration",
188+
+ "-Wno-int-conversion",
189+
+ ],
190+
+ defines = [
191+
+ 'BSDTAR_VERSION_STRING=\\"3.7.2\\"',
192+
+ ],
193+
+ includes = [
194+
+ "../libarchive",
195+
+ "../libarchive_fe",
196+
+ ],
197+
+ visibility = ["//visibility:public"],
198+
+ deps = [
199+
+ "//:config_h",
200+
+ "//libarchive",
201+
+ "//libarchive_fe",
202+
+ ],
203+
+)
204+
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
205+
index 64115198..c6698a08 100644
206+
--- a/tar/bsdtar.c
207+
+++ b/tar/bsdtar.c
208+
@@ -196,7 +196,7 @@ main(int argc, char **argv)
209+
#endif
210+
211+
/* Set lafe_progname before calling lafe_warnc. */
212+
- lafe_setprogname(*argv, "bsdtar");
213+
+ lafe_setprogname("tar", "bsdtar");
214+
215+
#if HAVE_SETLOCALE
216+
if (setlocale(LC_ALL, "") == NULL)
217+
@@ -1070,7 +1070,7 @@ static const char *long_help_msg =
218+
" -c Create -r Add/Replace -t List -u Update -x Extract\n"
219+
"Common Options:\n"
220+
" -b # Use # 512-byte records per I/O block\n"
221+
- " -f <filename> Location of archive (default " _PATH_DEFTAPE ")\n"
222+
+ " -f <filename> Location of archive\n"
223+
" -v Verbose\n"
224+
" -w Interactive\n"
225+
"Create: %p -c [options] [<file> | <dir> | @<archive> | -C <dir> ]\n"
226+
diff --git a/tar/config.h b/tar/config.h
227+
new file mode 100644
228+
index 00000000..f0a39c7e
229+
--- /dev/null
230+
+++ b/tar/config.h
231+
@@ -0,0 +1,7 @@
232+
+#ifndef TAR_CONFIG_H
233+
+#define TAR_CONFIG_H
234+
+
235+
+#include "xplat_config.h"
236+
+
237+
+#endif // TAR_CONFIG_H
238+
+
239+
diff --git a/xplat_config.h b/xplat_config.h
240+
new file mode 100644
241+
index 00000000..7598c496
242+
--- /dev/null
243+
+++ b/xplat_config.h
244+
@@ -0,0 +1,41 @@
245+
+#ifndef XPLAT_CONFIG_H
246+
+#define XPLAT_CONFIG_H
247+
+
248+
+#define HAVE_DECL_SIZE_MAX 1
249+
+#define HAVE_DECL_SSIZE_MAX 1
250+
+#define HAVE_DECL_UINT32_MAX 1
251+
+#define HAVE_DECL_INT32_MAX 1
252+
+#define HAVE_DECL_INT32_MIN 1
253+
+#define HAVE_DECL_UINT64_MAX 1
254+
+#define HAVE_DECL_INT64_MAX 1
255+
+#define HAVE_DECL_INT64_MIN 1
256+
+#define HAVE_DECL_UINTMAX_MAX 1
257+
+#define HAVE_DECL_INTMAX_MAX 1
258+
+#define HAVE_DECL_INTMAX_MIN 1
259+
+
260+
+#define HAVE_DIRENT_H 1
261+
+#define HAVE_ERRNO_H 1
262+
+#define HAVE_FCHDIR 1
263+
+#define HAVE_FCNTL 1
264+
+#define HAVE_FCNTL_H 1
265+
+#define HAVE_INTTYPES_H 1
266+
+#define HAVE_LIMITS_H 1
267+
+#define HAVE_PTHREAD_H 1
268+
+#define HAVE_STDARG_H 1
269+
+#define HAVE_STDLIB_H 1
270+
+#define HAVE_STDINT_H 1
271+
+#define HAVE_STRING_H 1
272+
+#define HAVE_SYS_STAT_H 1
273+
+#define HAVE_SYS_TIME_H 1
274+
+#define HAVE_TIME_H
275+
+#define HAVE_UINTMAX_T 1
276+
+#define HAVE_UNISTD_H 1
277+
+#define HAVE_UNSIGNED_LONG_LONG 1
278+
+#define HAVE_WCTYPE_H 1
279+
+#define HAVE_WCSCPY 1
280+
+#define HAVE_WCSLEN 1
281+
+
282+
+#define MAC_OS_X_VERSION_MIN_REQUIRED 1060
283+
+#define MAC_OS_X_VERSION_MAX_ALLOWED 1070
284+
+
285+
+#endif // XPLAT_CONFIG_H
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
matrix:
2+
platform:
3+
- debian10
4+
- debian11
5+
- ubuntu2004
6+
- ubuntu2004_arm64
7+
- ubuntu2204
8+
- ubuntu2204_arm64
9+
- macos
10+
- macos_arm64
11+
- windows
12+
bazel: [6.x, 7.x, rolling]
13+
tasks:
14+
verify_targets:
15+
name: Verify build targets
16+
platform: ${{ platform }}
17+
bazel: ${{ bazel }}
18+
build_targets:
19+
- '@libarchive//tar'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"url": "https://www.libarchive.org/downloads/libarchive-3.7.2.tar.xz",
3+
"integrity": "sha256-BDV2YeZxe2lBaCzeAq10GuSBnGeiYFk9+yQxhhslGss=",
4+
"strip_prefix": "libarchive-3.7.2",
5+
"patches": {
6+
"patch": "sha256-5akZ6b4gZf0GkU7I9JFWnvQwVL7jcZAIm+XTAQBy0k4="
7+
},
8+
"patch_strip": 1
9+
}

modules/libarchive/metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"homepage": "https://www.libarchive.org/",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "dzbarsky",
7+
"name": "David Zbarsky"
8+
}
9+
],
10+
"repository": [],
11+
"versions": [
12+
"3.7.2"
13+
],
14+
"yanked_versions": {}
15+
}

0 commit comments

Comments
 (0)