Преглед на файлове

build: Allow changing the default dpkg-deb compressor on configure

This will allow downstreams to choose something better than gzip as
their default compressor, for example xz. Or when xz becomes the
default to revert back to something else.
Guillem Jover преди 14 години
родител
ревизия
68a1f4682b
променени са 4 файла, в които са добавени 23 реда и са изтрити 1 реда
  1. 3 0
      configure.ac
  2. 2 0
      debian/changelog
  3. 1 1
      dpkg-deb/main.c
  4. 17 0
      m4/dpkg-build.m4

+ 3 - 0
configure.ac

@@ -31,6 +31,9 @@ DPKG_WITH_DIR([admindir], [${localstatedir}/lib/${PACKAGE_NAME}],
 DPKG_WITH_DIR([logdir], [${localstatedir}/log],
               [system logging directory [LOCALSTATEDIR/log]])
 
+# Set default dpkg-deb compressor
+DPKG_DEB_COMPRESSOR([gzip])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_CXX

+ 2 - 0
debian/changelog

@@ -121,6 +121,8 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Add support for mipsn32(el) and mips64(el) to arch tables.
     Thanks to YunQiang Su <wzssyqa@gmail.com>. Closes: #685096, #707323
   * Document --file and --label parser options in dpkg-parsechangelog(1).
+  * Add a new configure --with-dpkg-deb-compressor option to allow selecting
+    the default dpkg-deb compressor, mainly for downstreams.
 
   [ Updated programs translations ]
   * Fix typo in Spanish translation of update-alternatives.

+ 1 - 1
dpkg-deb/main.c

@@ -180,7 +180,7 @@ set_deb_new(const struct cmdinfo *cip, const char *value)
 }
 
 struct compress_params compress_params = {
-  .type = compressor_type_gzip,
+  .type = DPKG_DEB_DEFAULT_COMPRESSOR,
   .strategy = compressor_strategy_none,
   .level = -1,
 };

+ 17 - 0
m4/dpkg-build.m4

@@ -35,6 +35,23 @@ AC_DEFUN([DPKG_WITH_DIR], [
   AC_MSG_NOTICE([using directory $1 = '$$1'])
 ])# DPKG_WITH_DIR
 
+# DPKG_DEB_COMPRESSOR(COMP)
+# -------------------
+# Change default «dpkg-deb --build» compressor.
+AC_DEFUN([DPKG_DEB_COMPRESSOR], [
+  AC_ARG_WITH([dpkg-deb-compressor],
+    [AS_HELP_STRING([--with-dpkg-deb-compressor=COMP],
+                    [change default dpkg-deb build compressor])],
+    [with_dpkg_deb_compressor=$withval], [with_dpkg_deb_compressor=$1])
+  AS_CASE([$with_dpkg_deb_compressor],
+    [gzip|xz|bzip2], [:],
+    [AC_MSG_ERROR([unsupported default compressor $with_dpkg_deb_compressor])])
+  AC_DEFINE_UNQUOTED([DPKG_DEB_DEFAULT_COMPRESSOR],
+                     [compressor_type_${with_dpkg_deb_compressor}],
+                     [default dpkg-deb build compressor])
+  AC_MSG_NOTICE([using default dpkg-deb compressor = $with_dpkg_deb_compressor])
+]) # DPKG_DEB_COMPRESSOR
+
 # DPKG_DIST_CHECK(COND, ERROR)
 # ---------------
 # Check if the condition is fulfilled when preparing a distribution tarball.