diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 00000000..7a34e0c5
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,144 @@
+load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+
+bool_flag(
+    name = "use_mbedtls",
+    build_setting_default = False,
+)
+
+config_setting(
+    name = "use_mbedtls_setting",
+    flag_values = {":use_mbedtls": "true"},
+    visibility = ["//:__subpackages__"],
+)
+
+cc_library(
+    name = "config_h",
+    hdrs = ["xplat_config.h"],
+    defines = select({
+        "@platforms//os:linux": [
+            "HAVE_FUTIMESAT",
+            "HAVE_LINUX_FS_H",
+            "HAVE_LINUX_MAGIC_H",
+            "HAVE_LINUX_TYPES_H",
+            "HAVE_PATHS_H",
+            "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC",
+            "HAVE_SYS_XATTR_H",
+        ],
+        "//conditions:default": [],
+    }) + select({
+        "@platforms//os:windows": [
+            "gid_t=short",
+            "id_t=\"unsigned long\"",
+            "uid_t=short",
+        ],
+        "//conditions:default": [
+            "HAVE_SYS_TYPES_H",
+        ],
+    }) + select({
+        "@platforms//os:windows": [
+            "HAVE__FSEEKI64",
+            "HAVE_CTIME_S",
+            "HAVE_IO_H",
+            "HAVE_LOCALTIME_S",
+            "HAVE_LSTAT_EMPTY_STRING_BUG",
+            "HAVE_STAT_EMPTY_STRING_BUG",
+            "HAVE_STRNCPY_S",
+            "HAVE_SYS_UTIME_H",
+            "HAVE_WINCRYPT_H",
+            "HAVE_WINDOWS_H",
+            "HAVE_WINIOCTL_H",
+        ],
+        "//conditions:default": [],
+    }) + select({
+        "@platforms//os:windows": [],
+        "//conditions:default": [
+            "HAVE_CHROOT",
+            "HAVE_CTIME_R",
+            "HAVE_DIRFD",
+            "HAVE_FCHDIR",
+            "HAVE_FCHMOD",
+            "HAVE_FCHOWN",
+            "HAVE_FCNTL",
+            "HAVE_FDOPENDIR",
+            "HAVE_FGETXATTR",
+            "HAVE_FLISTXATTR",
+            "HAVE_FORK",
+            "HAVE_FSETXATTR",
+            "HAVE_FSTATAT",
+            "HAVE_FSTATFS",
+            "HAVE_FSTATVFS",
+            "HAVE_FUTIMENS",
+            "HAVE_FUTIMES",
+            "HAVE_GETEUID",
+            "HAVE_GETGRGID_R",
+            "HAVE_GETGRNAM_R",
+            "HAVE_GETPWNAM_R",
+            "HAVE_GETPWUID_R",
+            "HAVE_GETXATTR",
+            "HAVE_GMTIME_R",
+            "HAVE_GRP_H",
+            "HAVE_LANGINFO_H",
+            "HAVE_LCHOWN",
+            "HAVE_LGETXATTR",
+            "HAVE_LINK",
+            "HAVE_LISTXATTR",
+            "HAVE_LLISTXATTR",
+            "HAVE_LOCALTIME_R",
+            "HAVE_LSETXATTR",
+            "HAVE_LSTAT",
+            "HAVE_LUTIMES",
+            "HAVE_MKFIFO",
+            "HAVE_MKNOD",
+            "HAVE_MKSTEMP",
+            "HAVE_NL_LANGINFO",
+            "HAVE_OPENAT",
+            "HAVE_PIPE",
+            "HAVE_POLL",
+            "HAVE_POLL_H",
+            "HAVE_POSIX_SPAWNP",
+            "HAVE_PWD_H",
+            "HAVE_READLINK",
+            "HAVE_READLINKAT",
+            "HAVE_REGEX_H",
+            "HAVE_SELECT",
+            "HAVE_SIGACTION",
+            "HAVE_SPAWN_H",
+            "HAVE_STATFS",
+            "HAVE_STAVTFS",
+            "HAVE_STRERROR_R",
+            "HAVE_STRUCT_STAT_ST_BLKSIZE",
+            "HAVE_STRUCT_TM_TM_GMTOFF",
+            "HAVE_SYMLINK",
+            "HAVE_SYS_IOCTL_H",
+            "HAVE_SYS_MOUNT_H",
+            "HAVE_SYS_POLL_H",
+            "HAVE_SYS_SELECT_H",
+            "HAVE_SYS_UTSNAME_H",
+            "HAVE_SYS_VFS_H",
+            "HAVE_SYS_WAIT_H",
+            "HAVE_TIMEGM",
+            "HAVE_UNISTD_H",
+            "HAVE_UNSETENV",
+            "HAVE_UTIMENSAT",
+            "HAVE_UTIMES",
+            "HAVE_VFORK",
+            "LSTAT_FOLLOWS_SLASHED_SYMLINK",
+            "STRERROR_R_CHAR_P",
+        ],
+    }) + select({
+        "@platforms//os:osx": [
+            "HAVE_STRUCT_STAT_ST_BIRTHTIME",
+            "HAVE_SYS_CDEFS_H",
+        ],
+        "//conditions:default": [],
+    }) + select({
+        "//:use_mbedtls_setting": [
+            "HAVE_LIBMBEDCRYPTO",
+            "HAVE_MBEDTLS_AES_H",
+            "HAVE_MBEDTLS_MD_H",
+            "HAVE_MBEDTLS_PKCS5_H",
+        ],
+        "//conditions:default": [],
+    }),
+    visibility = ["//visibility:public"],
+)
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 00000000..6435fb5d
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,14 @@
+module(
+    name = "libarchive",
+    version = "3.7.2.bcr.4",
+    compatibility_level = 1,
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.5.0")
+bazel_dep(name = "bzip2", version = "1.0.8.bcr.1")
+bazel_dep(name = "lz4", version = "1.9.4")
+bazel_dep(name = "mbedtls", version = "3.6.0")
+bazel_dep(name = "platforms", version = "0.0.9")
+bazel_dep(name = "xz", version = "5.4.5.bcr.2")
+bazel_dep(name = "zlib", version = "1.3.1.bcr.1")
+bazel_dep(name = "zstd", version = "1.5.6")
diff --git a/libarchive/BUILD.bazel b/libarchive/BUILD.bazel
new file mode 100644
index 00000000..116d46bc
--- /dev/null
+++ b/libarchive/BUILD.bazel
@@ -0,0 +1,56 @@
+PUBLIC_HEADERS = [
+    "archive.h",
+    "archive_entry.h",
+]
+
+WINDOWS_SRCS = glob(["*_windows.*"]) + ["archive_entry_copy_bhfi.c"]
+
+cc_library(
+    name = "libarchive",
+    srcs = glob(
+        [
+            "*.c",
+            "*.h",
+        ],
+        exclude = PUBLIC_HEADERS + WINDOWS_SRCS + [
+            "archive_disk_acl_*.c",
+        ],
+    ) + select({
+        "@platforms//os:windows": WINDOWS_SRCS,
+        "@platforms//os:macos": ["archive_disk_acl_darwin.c"],
+        "@platforms//os:linux": ["archive_disk_acl_linux.c"],
+        "//conditions:default": [],
+    }),
+    hdrs = PUBLIC_HEADERS,
+    local_defines = [
+        "HAVE_CONFIG_H",
+        # ZLIB support
+        "HAVE_ZLIB_H",
+        # ZSTD support
+        "HAVE_ZSTD_H",
+        "HAVE_LIBZSTD",
+        "HAVE_LIBZSTD_COMPRESSOR",
+        # LZMA support
+        "HAVE_LIBLZMA",
+        "HAVE_LZMA_H",
+        "HAVE_LZMA_STREAM_ENCODER_MT",
+        # BZIP2 support
+        "HAVE_LIBBZ2",
+        "HAVE_BZLIB_H",
+        # LZ4 support
+        "HAVE_LIBLZ4",
+        "HAVE_LZ4_H",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//:config_h",
+        "@bzip2//:bz2",
+        "@lz4",
+        "@xz//:lzma",
+        "@zlib",
+        "@zstd",
+    ] + select({
+        "//:use_mbedtls_setting": ["@mbedtls"],
+        "//conditions:default": [],
+    }),
+)
diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h
index d0fda7f9..e41c944d 100644
--- a/libarchive/archive_hmac_private.h
+++ b/libarchive/archive_hmac_private.h
@@ -40,12 +40,13 @@
  */
 int __libarchive_hmac_build_hack(void);
 
-#ifdef __APPLE__
-# include <AvailabilityMacros.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
-#  define ARCHIVE_HMAC_USE_Apple_CommonCrypto
-# endif
-#endif
+// Don't compile against CommonCrypto.
+// #ifdef __APPLE__
+// # include <AvailabilityMacros.h>
+// # if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+// #  define ARCHIVE_HMAC_USE_Apple_CommonCrypto
+// # endif
+// #endif
 
 #ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto
 #include <CommonCrypto/CommonHMAC.h>
diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h
index b2a2cda2..34050e16 100644
--- a/libarchive/archive_private.h
+++ b/libarchive/archive_private.h
@@ -39,12 +39,12 @@
 #include "archive.h"
 #include "archive_string.h"
 
-#if defined(__GNUC__) && (__GNUC__ > 2 || \
-			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
-#define	__LA_DEAD	__attribute__((__noreturn__))
-#else
+//#if defined(__GNUC__) && (__GNUC__ > 2 || \
+//			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+//#define	__LA_DEAD	__attribute__((__noreturn__))
+//#else
 #define	__LA_DEAD
-#endif
+//#endif
 
 #if defined(__GNUC__) && (__GNUC__ > 2 || \
 			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
diff --git a/libarchive/config.h b/libarchive/config.h
new file mode 100644
index 00000000..0902d8f5
--- /dev/null
+++ b/libarchive/config.h
@@ -0,0 +1,12 @@
+#ifndef LIBARCHIVE_CONFIG_H
+#define LIBARCHIVE_CONFIG_H
+
+#include <ctype.h>
+#include <wchar.h>
+
+#include "xplat_config.h"
+
+#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
+
+#endif // LIBARCHIVE_CONFIG_H
+
diff --git a/libarchive_fe/BUILD.bazel b/libarchive_fe/BUILD.bazel
new file mode 100644
index 00000000..51a75a64
--- /dev/null
+++ b/libarchive_fe/BUILD.bazel
@@ -0,0 +1,9 @@
+cc_library(
+    name = "libarchive_fe",
+    srcs = glob(["*.c"]),
+    hdrs = glob(["*.h"]),
+    visibility = ["//visibility:public"],
+    deps = [
+        "//:config_h",
+    ],
+)
diff --git a/libarchive_fe/config.h b/libarchive_fe/config.h
new file mode 100644
index 00000000..1f484ee0
--- /dev/null
+++ b/libarchive_fe/config.h
@@ -0,0 +1,6 @@
+#ifndef LIBARCHIVE_FE_CONFIG_H
+#define LIBARCHIVE_FE_CONFIG_H
+
+#include "xplat_config.h"
+
+#endif // LIBARCHIVE_FE_CONFIG_H
\ No newline at end of file
diff --git a/libarchive_fe/err.h b/libarchive_fe/err.h
index c663103b..0417b834 100644
--- a/libarchive_fe/err.h
+++ b/libarchive_fe/err.h
@@ -26,12 +26,12 @@
 #ifndef LAFE_ERR_H
 #define LAFE_ERR_H
 
-#if defined(__GNUC__) && (__GNUC__ > 2 || \
-                          (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
-#define __LA_DEAD       __attribute__((__noreturn__))
-#else
+//#if defined(__GNUC__) && (__GNUC__ > 2 || \
+//                          (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+//#define __LA_DEAD       __attribute__((__noreturn__))
+//#else
 #define __LA_DEAD
-#endif
+//#endif
 
 #if defined(__GNUC__) && (__GNUC__ > 2 || \
 			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
diff --git a/tar/BUILD.bazel b/tar/BUILD.bazel
new file mode 100644
index 00000000..39fc5330
--- /dev/null
+++ b/tar/BUILD.bazel
@@ -0,0 +1,33 @@
+cc_binary(
+    name = "tar",
+    srcs = select({
+        "@platforms//os:windows": glob([
+            "*.c",
+            "*.h",
+        ]),
+        "//conditions:default": glob(
+            [
+                "*.c",
+                "*.h",
+            ],
+            exclude = ["bsdtar_windows.*"],
+        ),
+    }),
+    copts = [
+        "-Wno-implicit-function-declaration",
+        "-Wno-int-conversion",
+    ],
+    defines = [
+        'BSDTAR_VERSION_STRING=\\"3.7.2\\"',
+    ],
+    includes = [
+        "../libarchive",
+        "../libarchive_fe",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//:config_h",
+        "//libarchive",
+        "//libarchive_fe",
+    ],
+)
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index 75249d10..a8f79db4 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -197,7 +197,7 @@ main(int argc, char **argv)
 #endif
 
 	/* Set lafe_progname before calling lafe_warnc. */
-	lafe_setprogname(*argv, "bsdtar");
+	lafe_setprogname("tar", "bsdtar");
 
 #if HAVE_SETLOCALE
 	if (setlocale(LC_ALL, "") == NULL)
@@ -1013,7 +1013,7 @@ static const char *long_help_msg =
 	"  -c Create  -r Add/Replace  -t List  -u Update  -x Extract\n"
 	"Common Options:\n"
 	"  -b #  Use # 512-byte records per I/O block\n"
-	"  -f <filename>  Location of archive (default " _PATH_DEFTAPE ")\n"
+	"  -f <filename>  Location of archive\n"
 	"  -v    Verbose\n"
 	"  -w    Interactive\n"
 	"Create: %p -c [options] [<file> | <dir> | @<archive> | -C <dir> ]\n"
diff --git a/tar/bsdtar_platform.h b/tar/bsdtar_platform.h
index e73f9828..e4a08f44 100644
--- a/tar/bsdtar_platform.h
+++ b/tar/bsdtar_platform.h
@@ -121,12 +121,12 @@
 
 /* How to mark functions that don't return. */
 /* This facilitates use of some newer static code analysis tools. */
-#undef __LA_DEAD
-#if defined(__GNUC__) && (__GNUC__ > 2 || \
-			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
-#define	__LA_DEAD	__attribute__((__noreturn__))
-#else
+//#undef __LA_DEAD
+//#if defined(__GNUC__) && (__GNUC__ > 2 || \
+//			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+//#define	__LA_DEAD	__attribute__((__noreturn__))
+//#else
 #define	__LA_DEAD
-#endif
+//#endif
 
 #endif /* !BSDTAR_PLATFORM_H_INCLUDED */
diff --git a/tar/config.h b/tar/config.h
new file mode 100644
index 00000000..f0a39c7e
--- /dev/null
+++ b/tar/config.h
@@ -0,0 +1,7 @@
+#ifndef TAR_CONFIG_H
+#define TAR_CONFIG_H
+
+#include "xplat_config.h"
+
+#endif // TAR_CONFIG_H
+
diff --git a/xplat_config.h b/xplat_config.h
new file mode 100644
index 00000000..d7b551eb
--- /dev/null
+++ b/xplat_config.h
@@ -0,0 +1,80 @@
+#ifndef XPLAT_CONFIG_H
+#define XPLAT_CONFIG_H
+
+#define HAVE_DECL_SIZE_MAX 1
+#define HAVE_DECL_SSIZE_MAX 1
+#define HAVE_DECL_UINT32_MAX 1
+#define HAVE_DECL_INT32_MAX 1
+#define HAVE_DECL_INT32_MIN 1
+#define HAVE_DECL_UINT64_MAX 1
+#define HAVE_DECL_INT64_MAX 1
+#define HAVE_DECL_INT64_MIN 1
+#define HAVE_DECL_UINTMAX_MAX 1
+#define HAVE_DECL_INTMAX_MAX 1
+#define HAVE_DECL_INTMAX_MIN 1
+
+#define HAVE_CHOWN 1
+#define HAVE_CTYPE_H 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_EILSEQ 1
+#define HAVE_ERRNO_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSTAT 1
+#define HAVE_FTRUNCATE 1
+#define HAVE_GETPID 1
+#define HAVE_INTMAX_T 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LOCALE_H 1
+#define HAVE_LONG_LONG_INT 1
+#define HAVE_MBRTOWC 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMORY_H 1
+#define HAVE_MEMSET 1
+#define HAVE_MKDIR 1
+#define HAVE_PTHREAD_H 1
+#define HAVE_READDIR_R 1
+#define HAVE_SETLOCALE 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCHR 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRRCHR 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_TIME_H
+#define HAVE_TZSET 1
+#define HAVE_UINTMAX_T 1
+#define HAVE_UNSIGNED_LONG_LONG 1
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+#define HAVE_UTIME 1
+#define HAVE_UTIME_H 1
+#define HAVE_VPRINTF 1
+#define HAVE_WCHAR_H 1
+#define HAVE_WCHAR_T 1
+#define HAVE_WCRTOMB 1
+#define HAVE_WCSCMP 1
+#define HAVE_WCSCPY 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCTOMB 1
+#define HAVE_WCTYPE_H 1
+#define HAVE_WMEMCMP 1
+#define HAVE_WMEMCPY 1
+
+#define STDC_HEADERS 1
+#define HAVE_SYS_TIME_H 1
+
+#define MAC_OS_X_VERSION_MIN_REQUIRED 1060
+#define MAC_OS_X_VERSION_MAX_ALLOWED 1070
+
+#endif  // XPLAT_CONFIG_H
