Date: Mon, 22 Feb 2010 08:09:52 +0200 From: Alex Kozlov <spam@rm-rf.kiev.ua> To: Tim Kientzle <kientzle@freebsd.org>, freebsd-arch@freebsd.org, spam@rm-rf.kiev.ua Subject: Re: Importing liblzma, xz Message-ID: <20100222060952.GA29507@ravenloft.kiev.ua>
next in thread | raw e-mail | index | archive | help
--a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Feb 20, 2010 at 09:53:27PM -0800, Tim Kientzle wrote: > Since there were some more questions about this > recently on -hackers, I figured I should go ahead > and start the process on this. > > I believe -arch is the correct place to ask: > > Does anyone have any concerns about importing > the liblzma libraries and associated command-line > tools from Lasse Collin's "xz utils" > package into FreeBSD's base system? > > The code in question is all currently in the > public domain, so there should be no problems > with licensing. > > More information about the xz project: > http://tukaani.org/xz/ > > According to that page, the final 5.0 production > version should be released pretty soon. Good idea. I even make a rough draft of liblzma port some time ago (see attach). -- Adios --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Index: liblzma/Makefile @@ -0,0 +1,35 @@ +LIB= lzma +SHLIB_MAJOR= 0 + +WARNS?=3 # XXX + +LDADD= -lpthread + +CFLAGS+= -I${.CURDIR} \ + -I${.CURDIR}/api \ + -I${.CURDIR}/check \ + -I${.CURDIR}/common \ + -I${.CURDIR}/delta \ + -I${.CURDIR}/lz \ + -I${.CURDIR}/lzma \ + -I${.CURDIR}/rangecoder \ + -I${.CURDIR}/simple \ + -I${.CURDIR}/subblock \ + -I/usr/src/include \ + -DHAVE_CONFIG_H -D_THREAD_SAFE -fvisibility=hidden -std=gnu99 + +.include "${.CURDIR}/api/Makefile.inc" +.include "${.CURDIR}/check/Makefile.inc" +.include "${.CURDIR}/common/Makefile.inc" +.include "${.CURDIR}/delta/Makefile.inc" +.include "${.CURDIR}/lz/Makefile.inc" +.include "${.CURDIR}/lzma/Makefile.inc" +.include "${.CURDIR}/rangecoder/Makefile.inc" +.include "${.CURDIR}/simple/Makefile.inc" +.include "${.CURDIR}/subblock/Makefile.inc" + +CLEANFILES= ${SOBJS} + +all: ${SOBJS} + +.include <bsd.lib.mk> Index: liblzma/api/Makefile.inc @@ -0,0 +1,12 @@ +.PATH: ${.CURDIR}/api + +INCSGROUPS= INCS INCSLZMA + +INCS= lzma.h + +INCSLZMADIR= ${INCLUDEDIR}/lzma +INCSLZMA= lzma/base.h lzma/check.h lzma/filter.h lzma/lzma.h \ + lzma/version.h lzma/bcj.h lzma/container.h \ + lzma/index.h lzma/stream_flags.h lzma/vli.h \ + lzma/block.h lzma/delta.h lzma/index_hash.h \ + lzma/subblock.h Index: liblzma/check/Makefile.inc @@ -1,51 +1,12 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/check -EXTRA_DIST += \ - check/crc32_tablegen.c \ - check/crc64_tablegen.c +SRCS+= check.c -liblzma_la_SOURCES += \ - check/check.c \ - check/check.h \ - check/crc_macros.h +# CHECK_CRC32 +SRCS+= crc32_table.c crc32_fast.c -if COND_CHECK_CRC32 -if COND_SMALL -liblzma_la_SOURCES += check/crc32_small.c -else -liblzma_la_SOURCES += \ - check/crc32_table.c \ - check/crc32_table_le.h \ - check/crc32_table_be.h -if COND_ASM_X86 -liblzma_la_SOURCES += check/crc32_x86.S -else -liblzma_la_SOURCES += check/crc32_fast.c -endif -endif -endif +# CHECK_CRC64 +SRCS+= crc64_table.c crc64_fast.c -if COND_CHECK_CRC64 -if COND_SMALL -liblzma_la_SOURCES += check/crc64_small.c -else -liblzma_la_SOURCES += \ - check/crc64_table.c \ - check/crc64_table_le.h \ - check/crc64_table_be.h -if COND_ASM_X86 -liblzma_la_SOURCES += check/crc64_x86.S -else -liblzma_la_SOURCES += check/crc64_fast.c -endif -endif -endif - -if COND_CHECK_SHA256 -liblzma_la_SOURCES += check/sha256.c -endif +# CHECK_SHA256 +SRCS+= sha256.c Index: liblzma/check/crc32_fast.c @@ -49,7 +49,7 @@ // Calculate the CRC32 using the slice-by-eight algorithm. while (buf < limit) { - crc ^= *(uint32_t *)(buf); + crc ^= *(const uint32_t *)(buf); buf += 4; crc = lzma_crc32_table[7][A(crc)] @@ -57,7 +57,7 @@ ^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[4][D(crc)]; - const uint32_t tmp = *(uint32_t *)(buf); + const uint32_t tmp = *(const uint32_t *)(buf); buf += 4; // At least with some compilers, it is critical for Index: liblzma/check/crc64_fast.c @@ -48,7 +48,7 @@ #ifdef WORDS_BIGENDIAN const uint32_t tmp = (crc >> 32) ^ *(uint32_t *)(buf); #else - const uint32_t tmp = crc ^ *(uint32_t *)(buf); + const uint32_t tmp = crc ^ *(const uint32_t *)(buf); #endif buf += 4; Index: liblzma/check/sha256.c @@ -30,7 +30,7 @@ #include "check.h" #ifndef WORDS_BIGENDIAN -# include "../../common/bswap.h" +# include "bswap.h" #endif // At least on x86, GCC is able to optimize this to a rotate instruction. @@ -87,7 +87,7 @@ static void transform(uint32_t state[static 8], const uint32_t data[static 16]) { - uint32_t W[16]; + uint32_t W[16] = {0}; //XXX Silence gcc uint32_t T[8]; // Copy state[] to working vars. Index: liblzma/common/Makefile.inc @@ -1,67 +1,18 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/common -liblzma_la_SOURCES += \ - common/common.c \ - common/common.h \ - common/bsr.h \ - common/block_util.c \ - common/easy_preset.c \ - common/easy_preset.h \ - common/filter_common.c \ - common/filter_common.h \ - common/index.c \ - common/index.h \ - common/stream_flags_common.c \ - common/stream_flags_common.h \ - common/vli_size.c +SRCS+= common.c block_util.c easy_preset.c filter_common.c index.c \ + stream_flags_common.c vli_size.c -if COND_MAIN_ENCODER -liblzma_la_SOURCES += \ - common/alone_encoder.c \ - common/block_buffer_encoder.c \ - common/block_encoder.c \ - common/block_encoder.h \ - common/block_header_encoder.c \ - common/easy_buffer_encoder.c \ - common/easy_encoder.c \ - common/easy_encoder_memusage.c \ - common/filter_buffer_encoder.c \ - common/filter_encoder.c \ - common/filter_encoder.h \ - common/filter_flags_encoder.c \ - common/index_encoder.c \ - common/index_encoder.h \ - common/stream_buffer_encoder.c \ - common/stream_encoder.c \ - common/stream_encoder.h \ - common/stream_flags_encoder.c \ - common/vli_encoder.c -endif +# MAIN_ENCODER +SRCS+= alone_encoder.c block_buffer_encoder.c block_encoder.c \ + block_header_encoder.c easy_encoder.c easy_encoder_memusage.c \ + filter_buffer_encoder.c filter_encoder.c filter_flags_encoder.c \ + index_encoder.c stream_buffer_encoder.c stream_encoder.c \ + stream_flags_encoder.c vli_encoder.c -if COND_MAIN_DECODER -liblzma_la_SOURCES += \ - common/alone_decoder.c \ - common/alone_decoder.h \ - common/auto_decoder.c \ - common/block_buffer_decoder.c \ - common/block_decoder.c \ - common/block_decoder.h \ - common/block_header_decoder.c \ - common/easy_decoder_memusage.c \ - common/filter_buffer_decoder.c \ - common/filter_decoder.c \ - common/filter_decoder.h \ - common/filter_flags_decoder.c \ - common/index_decoder.c \ - common/index_hash.c \ - common/stream_buffer_decoder.c \ - common/stream_decoder.c \ - common/stream_decoder.h \ - common/stream_flags_decoder.c \ - common/vli_decoder.c -endif +# MAIN_DECODER +SRCS+= alone_decoder.c auto_decoder.c block_buffer_decoder.c \ + block_decoder.c block_header_decoder.c easy_decoder_memusage.c \ + filter_buffer_decoder.c filter_decoder.c filter_flags_decoder.c \ + index_decoder.c index_hash.c stream_buffer_decoder.c stream_decoder.c \ + stream_flags_decoder.c vli_decoder.c Index: liblzma/common/config.h @@ -0,0 +1,71 @@ +#if defined(__i386__) +# define HAVE_ASM_X86 1 +#elif defined(__amd64__) +# define HAVE_ASM_X86_64 1 +#endif + +#define HAVE_CHECK_CRC32 1 +#define HAVE_CHECK_CRC64 1 +#define HAVE_CHECK_SHA256 1 +#define HAVE_DECODER 1 +#define HAVE_DECODER_ARM 1 +#define HAVE_DECODER_ARMTHUMB 1 +#define HAVE_DECODER_DELTA 1 +#define HAVE_DECODER_IA64 1 +#define HAVE_DECODER_LZMA1 1 +#define HAVE_DECODER_LZMA2 1 +#define HAVE_DECODER_POWERPC 1 +#define HAVE_DECODER_SPARC 1 +/* Define to 1 if subblock decoder is enabled. */ +/* #undef HAVE_DECODER_SUBBLOCK */ +#define HAVE_DECODER_X86 1 +#define HAVE_ENCODER 1 +#define HAVE_ENCODER_ARM 1 +#define HAVE_ENCODER_ARMTHUMB 1 +#define HAVE_ENCODER_DELTA 1 +#define HAVE_ENCODER_IA64 1 +#define HAVE_ENCODER_LZMA1 1 +#define HAVE_ENCODER_LZMA2 1 +#define HAVE_ENCODER_POWERPC 1 +#define HAVE_ENCODER_SPARC 1 +/* Define to 1 if subblock encoder is enabled. */ +/* #undef HAVE_ENCODER_SUBBLOCK */ +#define HAVE_ENCODER_X86 1 + +/* XXX test on other platforms */ +#if defined(__i386__) || defined(__amd64__) +# define HAVE_FAST_UNALIGNED_ACCESS 1 +#endif + +#define HAVE_MF_BT2 1 +#define HAVE_MF_BT3 1 +#define HAVE_MF_BT4 1 +#define HAVE_MF_HC3 1 +#define HAVE_MF_HC4 1 + +/* Define to 1 to disable debugging code. */ +#define NDEBUG 1 + +#define HAVE_PTHREAD 1 + +/* Define to 1 if optimizing for size. */ +/* #undef HAVE_SMALL */ +#define HAVE_INTTYPES_H 1 +#define HAVE_STDBOOL_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_ENDIAN_H 1 +#define HAVE_VISIBILITY 1 +#define STDC_HEADERS 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +/* # undef WORDS_BIGENDIAN */ +#endif + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif Index: liblzma/delta/Makefile.inc @@ -1,23 +1,9 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/delta -liblzma_la_SOURCES += \ - delta/delta_common.c \ - delta/delta_common.h \ - delta/delta_private.h +SRCS+= delta_common.c -if COND_ENCODER_DELTA -liblzma_la_SOURCES += \ - delta/delta_encoder.c \ - delta/delta_encoder.h -endif +# ENCODER_DELTA +SRCS+= delta_encoder.c -if COND_DECODER_DELTA -liblzma_la_SOURCES += \ - delta/delta_decoder.c \ - delta/delta_decoder.h -endif +# DECODER_DELTA +SRCS+= delta_decoder.c Index: liblzma/lz/Makefile.inc @@ -1,21 +1,7 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/lz -if COND_ENCODER_LZ -liblzma_la_SOURCES += \ - lz/lz_encoder.c \ - lz/lz_encoder.h \ - lz/lz_encoder_hash.h \ - lz/lz_encoder_mf.c -endif +# ENCODER_LZ +SRCS+= lz_encoder.c lz_encoder_mf.c - -if COND_DECODER_LZ -liblzma_la_SOURCES += \ - lz/lz_decoder.c \ - lz/lz_decoder.h -endif +# DECODER_LZ +SRCS+= lz_decoder.c Index: liblzma/lzma/Makefile.inc @@ -1,43 +1,16 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/lzma -EXTRA_DIST += lzma/fastpos_tablegen.c +SRCS+= fastpos_table.c -liblzma_la_SOURCES += lzma/lzma_common.h +# ENCODER_LZMA1 +SRCS+= lzma_encoder.c lzma_encoder_presets.c lzma_encoder_optimum_fast.c \ + lzma_encoder_optimum_normal.c -if COND_ENCODER_LZMA1 -liblzma_la_SOURCES += \ - lzma/fastpos.h \ - lzma/lzma_encoder.h \ - lzma/lzma_encoder.c \ - lzma/lzma_encoder_presets.c \ - lzma/lzma_encoder_private.h \ - lzma/lzma_encoder_optimum_fast.c \ - lzma/lzma_encoder_optimum_normal.c +# DECODER_LZMA1 +SRCS+= lzma_decoder.c -if !COND_SMALL -liblzma_la_SOURCES += lzma/fastpos_table.c -endif -endif +# ENCODER_LZMA2 +SRCS+= lzma2_encoder.c -if COND_DECODER_LZMA1 -liblzma_la_SOURCES += \ - lzma/lzma_decoder.c \ - lzma/lzma_decoder.h -endif - -if COND_ENCODER_LZMA2 -liblzma_la_SOURCES += \ - lzma/lzma2_encoder.c \ - lzma/lzma2_encoder.h -endif - -if COND_DECODER_LZMA2 -liblzma_la_SOURCES += \ - lzma/lzma2_decoder.c \ - lzma/lzma2_decoder.h -endif +# DECODER_LZMA2 +SRCS+= lzma2_decoder.c Index: liblzma/rangecoder/Makefile.inc @@ -1,21 +1,4 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/rangecoder -EXTRA_DIST += rangecoder/price_tablegen.c - -liblzma_la_SOURCES += rangecoder/range_common.h - -if COND_ENCODER_LZMA1 -liblzma_la_SOURCES += \ - rangecoder/range_encoder.h \ - rangecoder/price.h \ - rangecoder/price_table.c -endif - -if COND_DECODER_LZMA1 -liblzma_la_SOURCES += rangecoder/range_decoder.h -endif +#ENCODER_LZMA1 +SRCS+= price_table.c Index: liblzma/simple/Makefile.inc @@ -1,47 +1,27 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## - -liblzma_la_SOURCES += \ - simple/simple_coder.c \ - simple/simple_coder.h \ - simple/simple_private.h - -if COND_ENCODER_SIMPLE -liblzma_la_SOURCES += \ - simple/simple_encoder.c \ - simple/simple_encoder.h -endif - -if COND_DECODER_SIMPLE -liblzma_la_SOURCES += \ - simple/simple_decoder.c \ - simple/simple_decoder.h -endif - -if COND_FILTER_X86 -liblzma_la_SOURCES += simple/x86.c -endif - -if COND_FILTER_POWERPC -liblzma_la_SOURCES += simple/powerpc.c -endif - -if COND_FILTER_IA64 -liblzma_la_SOURCES += simple/ia64.c -endif - -if COND_FILTER_ARM -liblzma_la_SOURCES += simple/arm.c -endif - -if COND_FILTER_ARMTHUMB -liblzma_la_SOURCES += simple/armthumb.c -endif - -if COND_FILTER_SPARC -liblzma_la_SOURCES += simple/sparc.c -endif +.PATH: ${.CURDIR}/simple + +SRCS+= simple_coder.c + +# ENCODER_SIMPLE +SRCS+= simple_encoder.c + +# DECODER_SIMPLE +SRCS+= simple_decoder.c + +# FILTER_X86 +SRCS+= x86.c + +# FILTER_POWERPC +SRCS+= powerpc.c + +# FILTER_IA64 +SRCS+= ia64.c + +# FILTER_ARM +SRCS+= arm.c + +# FILTER_ARMTHUMB +SRCS+= armthumb.c + +# FILTER_SPARC +SRCS+= sparc.c Index: liblzma/subblock/Makefile.inc @@ -1,20 +1,7 @@ -## -## Author: Lasse Collin -## -## This file has been put into the public domain. -## You can do whatever you want with this file. -## +.PATH: ${.CURDIR}/subblock -if COND_ENCODER_SUBBLOCK -liblzma_la_SOURCES += \ - subblock/subblock_encoder.c \ - subblock/subblock_encoder.h -endif +# ENCODER_SUBBLOCK +SRCS+= subblock_encoder.c -if COND_DECODER_SUBBLOCK -liblzma_la_SOURCES += \ - subblock/subblock_decoder.c \ - subblock/subblock_decoder.h \ - subblock/subblock_decoder_helper.c \ - subblock/subblock_decoder_helper.h -endif +# DECODER_SUBBLOCK +SRCS+= subblock_decoder.c subblock_decoder_helper.c --a8Wt8u1KmwUX3Y2C--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100222060952.GA29507>