Bläddra i källkod

package/xz: convert to cmake build

Use direct equivalents where available. The following autoconf options
don't have a direct equivalent in CMakeLists.txt.

- '--enable-checks=crc32': CRC32 is always enabled; the equivalent CMake
  option is therefore calles ADDITIONAL_CHECK_TYPES.

- '--disable-external-sha256': external sha256 is not supported with
  CMake.

- '--enable-assembler': No direct equivalent, though there is an option
  ENABLE_X86_ASM which must be enabled explicitly (no auto-detection).
  Since this only works on x86 and we're not sure if it works on all x86
  variants, leave it disabled.

- '--enable-assume-ram=128': hard coded in the CMakeLists.txt file
  1732     target_compile_definitions(xz PRIVATE ASSUME_RAM=128)

- '--enable-xz', '--enable-xzdec', '--enable-lzmadec',
  '--enable-lzmainfo', --enable-lzma-links': The decoder programs are
  always enabled if they're enabled in the library. The symlinks are
  controlled by two separate options: CREATE_XZ_SYMLINKS and
  CREATE_LZMA_SYMLINKS.

- '--enable-scripts' (see [1]: 'CMake: xzdiff, xzgrep, xzless, xzmore, and
  their symlinks are now installed')

- '--enable-symbol-versions': hard coded in the CMakeLists.txt file
  1297     target_compile_definitions(liblzma PRIVATE HAVE_SYMBOL_VERSIONS_LINUX=1)

- '--enable-rpath': There is no CMake equivalent for this.

- '--enable-largefile': see CMakeLists.txt
  245 # Check for large file support. It's required on some 32-bit platforms and
  246 # even on 64-bit MinGW-w64 to get 64-bit off_t. This can be forced off on
  247 # the CMake command line if needed: -DLARGE_FILE_SUPPORT=OFF
  248 tuklib_large_file_support(ALL)

- '--enable-unaligned-access=auto': see CMakeLists.txt and cmake/tuklib_integer.cmake
   250 # This is needed by liblzma and xz.
   251 tuklib_integer(ALL)

- '--disable-unsafe-type-punning' see CMakeLists.txt and cmake/tuklib_integer.cmake
   250 # This is needed by liblzma and xz.
   251 tuklib_integer(ALL)

- '--disable-werror': There is no option to _enable_ -Werror in
  CMakeLists.txt.

- '--enable-year2038': There is no option to enable Y2038 support in
  CMakeLists.txt, but we anyway do that globally.

host-xz is itself a dependency of host-ccache, so we can't use ccache
for building host-xz. For autotools, this was handled by setting CC and
CXX in the environment for the configure script. This doesn't work for
CMake, however. Instead, we must override the CMAKE_C_COMPILER_LAUNCHER
option. Xz doesn't use C++, but for completeness also override
CMAKE_CXX_COMPILER_LAUNCHER.

[1] https://github.com/tukaani-project/xz/releases/tag/v5.6.0

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
[Arnout: fix ccache bypass for host-xz]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Peter Seiderer 1 år sedan
förälder
incheckning
3f464c2e28
1 ändrade filer med 25 tillägg och 40 borttagningar
  1. 25 40
      package/xz/xz.mk

+ 25 - 40
package/xz/xz.mk

@@ -8,60 +8,45 @@ XZ_VERSION = 5.6.2
 XZ_SOURCE = xz-$(XZ_VERSION).tar.bz2
 XZ_SITE = https://github.com/tukaani-project/xz/releases/download/v$(XZ_VERSION)
 XZ_INSTALL_STAGING = YES
-XZ_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
 XZ_LICENSE = Public Domain, BSD-0-Clause, GPL-2.0+, GPL-3.0+, LGPL-2.1+
 XZ_LICENSE_FILES = COPYING COPYING.0BSD COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1
 XZ_CPE_ID_VENDOR = tukaani
 
 XZ_CONF_OPTS = \
-	--enable-encoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \
-	--enable-decoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \
-	--enable-match-finders=hc3,hc4,bt2,bt3,bt4 \
-	--enable-checks=crc32,crc64,sha256 \
-	--disable-external-sha256 \
-	--enable-microlzma \
-	--enable-lzip-decoder \
-	--enable-assembler \
-	--enable-clmul-crc \
-	--enable-arm64-crc32 \
-	--disable-small \
-	--enable-assume-ram=128 \
-	--enable-xz \
-	--enable-xzdec \
-	--enable-lzmadec \
-	--enable-lzmainfo \
-	--enable-lzma-links \
-	--enable-scripts \
-	--enable-sandbox=auto \
-	--enable-symbol-versions \
-	--enable-rpath \
-	--enable-largfile \
-	--enable-unaligned-access=auto \
-	--disable-unsafe-type-punning \
-	--disable-werror \
-	--enable-year2038
+	-DENCODERS="lzma1;lzma2;delta;x86;powerpc;ia64;arm;armthumb;arm64;sparc;riscv" \
+	-DDECODERS="lzma1;lzma2;delta;x86;powerpc;ia64;arm;armthumb;arm64;sparc;riscv" \
+	-DMATCH_FINDERS="hc3;hc4;bt2;bt3;bt4" \
+	-DADDITIONAL_CHECK_TYPES="crc64;sha256" \
+	-DMICROLZMA_ENCODER=ON \
+	-DMICROLZMA_DECODER=ON \
+	-DLZIP_DECODER=ON \
+	-DALLOW_CLMUL_CRC=ON \
+	-DALLOW_ARM64_CRC32=ON \
+	-DENABLE_SMALL=OFF \
+	-DENABLE_SANDBOX=ON \
+	-DCREATE_XZ_SYMLINKS=ON \
+	-DCREATE_LZMA_SYMLINKS=ON \
+	-DBUILD_SHARED_LIBS=OFF
 
 ifeq ($(BR2_SYSTEM_ENABLE_NLS),y)
-XZ_CONF_OPTS += --enable-nls
+XZ_CONF_OPTS += -DENABLE_NLS=ON
 else
-XZ_CONF_OPTS += --disable-nls
+XZ_CONF_OPTS += -DENABLE_NLS=OFF
 endif
 
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-XZ_CONF_OPTS += --enable-threads
+XZ_CONF_OPTS += -DENABLE_THREADS=ON
 else
-XZ_CONF_OPTS += --disable-threads
+XZ_CONF_OPTS += -DENABLE_THREADS=OFF
 endif
 
+# we are built before ccache
 HOST_XZ_CONF_OPTS = \
 	$(XZ_CONF_OPTS) \
-	--enable-nls \
-	--enable-threads
-
-# we are built before ccache
-HOST_XZ_CONF_ENV = \
-	CC="$(HOSTCC_NOCCACHE)" \
-	CXX="$(HOSTCXX_NOCCACHE)"
+	-DENABLE_NLS=ON \
+	-DENABLE_THREADS=ON \
+	-DCMAKE_C_COMPILER_LAUNCHER="" \
+	-DCMAKE_CXX_COMPILER_LAUNCHER==""
 
-$(eval $(autotools-package))
-$(eval $(host-autotools-package))
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))