Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
configure: Make the default compression format configurable
Baptiste Daroussin committed 5 years ago
commit 848266c83b0b2ef1d513fb2361329e1629279ce4
parent b2a7f45
4 files changed +20 -4
modified auto.def
@@ -18,6 +18,7 @@ options {
	with-coverage => "build with llvm coverage support"
	with-asan => "build with libasan support"
	with-ubsan => "Build with libubsan support"
+
	default-format:txz => "Default compression format: tzst, txz (default), tbz, tar"
}

if {[opt-str pkgconfigdir dir]} {
@@ -30,6 +31,21 @@ if {[opt-str pkgconfigdir dir]} {
	}
}

+
# default compression format
+

+
if {[opt-str default-format fmt]} {
+
	switch $fmt \
+
	    "tzst" { set comp TZS } \
+
	    "txz" { set comp TXZ } \
+
	    "tbz" { set comp TBZ } \
+
	    "tgz" { set comp TGZ } \
+
	    "tar" { set comp TAR } \
+
	    "default" { user-error "Invalid format $fmt" }
+
	define DEFAULT_COMPRESSION $comp
+
} else {
+
	define DEFAULT_COMPRESSION TXZ
+
}
+

cc-check-tools ar ranlib strip

define EXTRA_LIBS ""
@@ -320,7 +336,7 @@ if {[get-define CCACHE] ne {none}} {
  define CC "[get-define CCACHE] [get-define CC]"
}

-
make-config-header pkg_config.h
+
make-config-header pkg_config.h -bare { DEFAULT_* }
make-config-header external/sqlite/config.h
make-template mk/defs.mk.in
make-template libpkg/pkg.h.in
modified libpkg/packing.c
@@ -446,7 +446,7 @@ pkg_formats
packing_format_from_string(const char *str)
{
	if (str == NULL)
-
		return TXZ;
+
		return DEFAULT_COMPRESSION;
	if (strcmp(str, "tzst") == 0)
		return TZS;
	if (strcmp(str, "txz") == 0)
modified libpkg/pkg_create.c
@@ -240,7 +240,7 @@ pkg_create_new(void)
	struct pkg_create *pc;

	pc = xcalloc(1, sizeof(*pc));
-
	pc->format = TXZ;
+
	pc->format = DEFAULT_COMPRESSION;
	pc->timestamp = (time_t) -1;
	pc->overwrite = true;
	pc->expand_manifest = false;
modified libpkg/pkg_repo_meta.c
@@ -41,7 +41,7 @@ static void
pkg_repo_meta_set_default(struct pkg_repo_meta *meta)
{
	meta->digest_format = PKG_HASH_TYPE_SHA256_BASE32;
-
	meta->packing_format = TXZ;
+
	meta->packing_format = DEFAULT_COMPRESSION;

	/* Not use conflicts for now */
	meta->conflicts = NULL;