mirror of
https://abf.rosa.ru/djam/lzma.git
synced 2025-02-23 04:02:46 +00:00
Automatic import for version 4.43
This commit is contained in:
commit
55491cf8aa
12 changed files with 1442 additions and 0 deletions
3
.abf.yml
Normal file
3
.abf.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
sources:
|
||||
"lzma-4.32.7.tar.lzma": f06af62ac399722cb0e9f861397c55d2e8c479b8
|
||||
"lzma443.tar.bz2": 1667abfb40da82d53fa2690f3cd58a0e7e751e55
|
57
lzma-4.32.2-sdk-changes.patch
Normal file
57
lzma-4.32.2-sdk-changes.patch
Normal file
|
@ -0,0 +1,57 @@
|
|||
--- lzma-4.32.2/src/sdk/7zip/Common/FileStreams.cpp.4.32.2 2007-10-27 17:39:23.000000000 +0200
|
||||
+++ lzma-4.32.2/src/sdk/7zip/Common/FileStreams.cpp 2007-10-27 17:41:54.000000000 +0200
|
||||
@@ -205,6 +205,13 @@ STDMETHODIMP COutFileStream::SetSize(Int
|
||||
#endif
|
||||
}
|
||||
|
||||
+STDMETHODIMP COutFileStream::Close()
|
||||
+{
|
||||
+ if (!File.Close())
|
||||
+ return E_FAIL;
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
#ifndef _WIN32_WCE
|
||||
STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
@@ -247,5 +254,10 @@ STDMETHODIMP CStdOutFileStream::Write(co
|
||||
return S_OK;
|
||||
#endif
|
||||
}
|
||||
-
|
||||
+
|
||||
+STDMETHODIMP CStdOutFileStream::Close()
|
||||
+{
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
#endif
|
||||
--- lzma-4.32.2/src/sdk/7zip/Common/FileStreams.h.4.32.2 2007-10-27 17:47:42.000000000 +0200
|
||||
+++ lzma-4.32.2/src/sdk/7zip/Common/FileStreams.h 2007-10-27 17:48:05.000000000 +0200
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
|
||||
STDMETHOD(SetSize)(Int64 newSize);
|
||||
+ STDMETHOD(Close)();
|
||||
};
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
@@ -92,6 +93,7 @@ public:
|
||||
|
||||
virtual ~CStdOutFileStream() {}
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
+ STDMETHOD(Close)();
|
||||
};
|
||||
#endif
|
||||
|
||||
--- lzma-4.32.2/src/sdk/7zip/IStream.h.4.32.2 2007-10-27 17:57:54.000000000 +0200
|
||||
+++ lzma-4.32.2/src/sdk/7zip/IStream.h 2007-10-27 17:58:00.000000000 +0200
|
||||
@@ -36,6 +36,8 @@ STREAM_INTERFACE(ISequentialOutStream, 0
|
||||
This function is allowed to write less than "size".
|
||||
You must call Write function in loop, if you need to write exact amount of data
|
||||
*/
|
||||
+
|
||||
+ STDMETHOD(Close)() PURE;
|
||||
};
|
||||
|
||||
STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
|
693
lzma-4.32.4-sqlzma.patch
Normal file
693
lzma-4.32.4-sqlzma.patch
Normal file
|
@ -0,0 +1,693 @@
|
|||
--- lzma-4.32.4/C/7zip/Compress/LZMA_Alone/comp.cc.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_Alone/comp.cc 2007-12-12 20:27:12.000000000 +0100
|
||||
@@ -0,0 +1,257 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2006-2007 Junjiro Okajima
|
||||
+ * Copyright (C) 2006-2007 Tomas Matejicek, slax.org
|
||||
+ *
|
||||
+ * LICENSE follows the described one in lzma.txt.
|
||||
+ */
|
||||
+
|
||||
+/* $Id: comp.cc,v 1.3 2007/11/13 13:27:23 jro Exp $ */
|
||||
+
|
||||
+// extract some parts from lzma443/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <assert.h>
|
||||
+#include <errno.h>
|
||||
+
|
||||
+#include "StdAfx.h"
|
||||
+#include "../../../Common/MyInitGuid.h"
|
||||
+//#include "../../../Common/MyWindows.h"
|
||||
+#include "../../../Common/StringConvert.h"
|
||||
+//#include "../../../Common/StringToInt.h"
|
||||
+//#include "../../Common/StreamUtils.h"
|
||||
+#include "../LZMA/LZMAEncoder.h"
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <zlib.h>
|
||||
+#include "sqlzma.h"
|
||||
+
|
||||
+//////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+class CMemoryStream {
|
||||
+protected:
|
||||
+ Bytef *m_data;
|
||||
+ UInt64 m_limit;
|
||||
+ UInt64 m_pos;
|
||||
+
|
||||
+public:
|
||||
+ CMemoryStream(Bytef *data, UInt64 size)
|
||||
+ : m_data(data), m_limit(size), m_pos(0) {}
|
||||
+
|
||||
+ virtual ~CMemoryStream() {}
|
||||
+};
|
||||
+
|
||||
+class CInMemoryStream : public CMemoryStream, public IInStream,
|
||||
+ public CMyUnknownImp {
|
||||
+//protected:
|
||||
+ CMyComPtr<ISequentialInStream> m_stream;
|
||||
+
|
||||
+public:
|
||||
+ MY_UNKNOWN_IMP1(IInStream);
|
||||
+
|
||||
+ CInMemoryStream(Bytef *data, UInt64 size)
|
||||
+ : CMemoryStream(data, size), m_stream(this) {}
|
||||
+
|
||||
+ virtual ~CInMemoryStream() {}
|
||||
+
|
||||
+ STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize)
|
||||
+ {
|
||||
+ UInt64 room = m_limit - m_pos;
|
||||
+ if (size > room)
|
||||
+ size = room;
|
||||
+ if (size) {
|
||||
+ memcpy(data, m_data + m_pos, size);
|
||||
+ m_pos += size;
|
||||
+ }
|
||||
+ if (processedSize)
|
||||
+ *processedSize = size;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+
|
||||
+ // disabled all
|
||||
+ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) {
|
||||
+ assert(0);
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class COutMemoryStream : public CMemoryStream, public IOutStream,
|
||||
+ public CMyUnknownImp {
|
||||
+//protected:
|
||||
+ CMyComPtr<ISequentialOutStream> m_stream;
|
||||
+
|
||||
+public:
|
||||
+ MY_UNKNOWN_IMP1(IOutStream);
|
||||
+
|
||||
+ COutMemoryStream(Bytef *data, UInt64 size)
|
||||
+ : CMemoryStream(data, size), m_stream(this) {}
|
||||
+
|
||||
+ virtual ~COutMemoryStream() {}
|
||||
+
|
||||
+ UInt32 GetSize() {return m_pos;}
|
||||
+
|
||||
+ STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) {
|
||||
+ if (m_pos + size > m_limit)
|
||||
+ return -ENOSPC;
|
||||
+ memcpy(m_data + m_pos, data, size);
|
||||
+ m_pos += size;
|
||||
+ if (processedSize)
|
||||
+ *processedSize = size;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+
|
||||
+ // disabled all
|
||||
+ STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) {
|
||||
+ assert(0);
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+ STDMETHOD(SetSize)(Int64 newSize) {
|
||||
+ assert(0);
|
||||
+ return E_NOTIMPL;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+//////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+static int
|
||||
+LzmaCompress(Bytef *next_in, uInt avail_in, Bytef *next_out, uInt avail_out,
|
||||
+ struct sqlzma_opts *opts, uLong *total_out)
|
||||
+{
|
||||
+ int err;
|
||||
+ HRESULT res;
|
||||
+ const Byte a[] = {
|
||||
+ avail_in, avail_in >> 8, avail_in >> 16, avail_in >> 24,
|
||||
+ 0, 0, 0, 0
|
||||
+ };
|
||||
+
|
||||
+ NCompress::NLZMA::CEncoder encoderSpec;
|
||||
+ CMyComPtr<ICompressCoder> encoder = &encoderSpec;
|
||||
+ encoder->AddRef();
|
||||
+ CInMemoryStream inStreamSpec(next_in, avail_in);
|
||||
+ CMyComPtr<ISequentialInStream> inStream = &inStreamSpec;
|
||||
+ inStream->AddRef();
|
||||
+ COutMemoryStream outStreamSpec(next_out, avail_out);
|
||||
+ CMyComPtr<ISequentialOutStream> outStream = &outStreamSpec;
|
||||
+ outStream->AddRef();
|
||||
+
|
||||
+ // these values are dpending upon is_lzma() macro in sqlzma.h
|
||||
+ const UInt32 dictionary = opts->dicsize;
|
||||
+ //fprintf(stderr, "dic %u\n", dictionary);
|
||||
+ const UString mf = L"BT4";
|
||||
+ const UInt32 posStateBits = 2;
|
||||
+ const UInt32 litContextBits = 3; // for normal files
|
||||
+ // UInt32 litContextBits = 0; // for 32-bit data
|
||||
+ const UInt32 litPosBits = 0;
|
||||
+ // UInt32 litPosBits = 2; // for 32-bit data
|
||||
+ //const UInt32 algorithm = 2;
|
||||
+ const UInt32 algorithm = 1;
|
||||
+ const UInt32 numFastBytes = 128;
|
||||
+ const UInt32 matchFinderCycles = 16 + numFastBytes / 2;
|
||||
+ //const bool matchFinderCyclesDefined = false;
|
||||
+ const PROPID propIDs[] = {
|
||||
+ NCoderPropID::kDictionarySize,
|
||||
+ NCoderPropID::kPosStateBits,
|
||||
+ NCoderPropID::kLitContextBits,
|
||||
+ NCoderPropID::kLitPosBits,
|
||||
+ NCoderPropID::kAlgorithm,
|
||||
+ NCoderPropID::kNumFastBytes,
|
||||
+ NCoderPropID::kMatchFinder,
|
||||
+ NCoderPropID::kEndMarker,
|
||||
+ NCoderPropID::kMatchFinderCycles
|
||||
+ };
|
||||
+ const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
|
||||
+ PROPVARIANT properties[kNumPropsMax];
|
||||
+ for (int p = 0; p < 6; p++)
|
||||
+ properties[p].vt = VT_UI4;
|
||||
+ properties[0].ulVal = UInt32(dictionary);
|
||||
+ properties[1].ulVal = UInt32(posStateBits);
|
||||
+ properties[2].ulVal = UInt32(litContextBits);
|
||||
+ properties[3].ulVal = UInt32(litPosBits);
|
||||
+ properties[4].ulVal = UInt32(algorithm);
|
||||
+ properties[5].ulVal = UInt32(numFastBytes);
|
||||
+
|
||||
+ properties[6].vt = VT_BSTR;
|
||||
+ properties[6].bstrVal = (BSTR)(const wchar_t *)mf;
|
||||
+ properties[7].vt = VT_BOOL;
|
||||
+ properties[7].boolVal = VARIANT_FALSE; // EOS
|
||||
+ properties[8].vt = VT_UI4;
|
||||
+ properties[8].ulVal = UInt32(matchFinderCycles);
|
||||
+
|
||||
+ err = -EINVAL;
|
||||
+ res = encoderSpec.SetCoderProperties(propIDs, properties,
|
||||
+ kNumPropsMax - 1);
|
||||
+ if (res)
|
||||
+ goto out;
|
||||
+ res = encoderSpec.WriteCoderProperties(outStream);
|
||||
+ if (res)
|
||||
+ goto out;
|
||||
+
|
||||
+ UInt32 r;
|
||||
+ res = outStream->Write(a, sizeof(a), &r);
|
||||
+ if (res || r != sizeof(a))
|
||||
+ goto out;
|
||||
+
|
||||
+ err = encoder->Code(inStream, outStream, 0, /*broken*/0, 0);
|
||||
+ if (err)
|
||||
+ goto out;
|
||||
+ *total_out = outStreamSpec.GetSize();
|
||||
+
|
||||
+ out:
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+//////////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+#define Failure(p) do { \
|
||||
+ fprintf(stderr, "%s:%d: please report to jro " \
|
||||
+ "{%02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x}\n", \
|
||||
+ __func__, __LINE__, \
|
||||
+ p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); \
|
||||
+ abort(); \
|
||||
+} while(0)
|
||||
+
|
||||
+extern "C" int
|
||||
+sqlzma_cm(struct sqlzma_opts *opts, z_stream *stream, Bytef *next_in, uInt
|
||||
+ avail_in, Bytef *next_out, uInt avail_out)
|
||||
+{
|
||||
+ int err;
|
||||
+ Bytef *p = next_out;
|
||||
+ uInt l = avail_out;
|
||||
+
|
||||
+ stream->next_in = next_in;
|
||||
+ stream->avail_in = avail_in;
|
||||
+ stream->next_out = p;
|
||||
+ stream->avail_out = l;
|
||||
+ err = deflate(stream, Z_FINISH);
|
||||
+ if (err != Z_STREAM_END && err != Z_OK)
|
||||
+ goto out_err;
|
||||
+ if (avail_in < stream->total_out)
|
||||
+ return err;
|
||||
+ if (is_lzma(*p))
|
||||
+ Failure(p);
|
||||
+
|
||||
+ if (opts->try_lzma) {
|
||||
+ unsigned char a[stream->total_out];
|
||||
+ uLong processed;
|
||||
+
|
||||
+ memcpy(a, p, stream->total_out);
|
||||
+
|
||||
+ // malloc family in glibc and stdc++ seems to be thread-safe
|
||||
+ err = LzmaCompress(next_in, avail_in, p, l, opts, &processed);
|
||||
+ if (!err && processed <= stream->total_out) {
|
||||
+ if (!is_lzma(*next_out))
|
||||
+ Failure(next_out);
|
||||
+ stream->total_out = processed;
|
||||
+ err = Z_STREAM_END;
|
||||
+ } else {
|
||||
+ //puts("by zlib");
|
||||
+ memcpy(p, a, stream->total_out);
|
||||
+ err = Z_STREAM_END;
|
||||
+ }
|
||||
+ }
|
||||
+ return err;
|
||||
+
|
||||
+ out_err:
|
||||
+ fprintf(stderr, "%s: ZLIB err %s\n", __func__, zError(err));
|
||||
+ return err;
|
||||
+}
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_Alone/sqlzma.mk.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_Alone/sqlzma.mk 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,54 @@
|
||||
+
|
||||
+# Copyright (C) 2006 Junjiro Okajima
|
||||
+# Copyright (C) 2006 Tomas Matejicek, slax.org
|
||||
+#
|
||||
+# LICENSE follows the described one in lzma.txt.
|
||||
+
|
||||
+# $Id: sqlzma.mk,v 1.23 2006/11/27 03:54:58 jro Exp $
|
||||
+
|
||||
+ifndef Sqlzma
|
||||
+$(error Sqlzma is not defined)
|
||||
+endif
|
||||
+
|
||||
+include makefile.gcc
|
||||
+
|
||||
+ifdef UseDebugFlags
|
||||
+DebugFlags = -Wall -O0 -g -UNDEBUG
|
||||
+endif
|
||||
+# -pthread
|
||||
+CXXFLAGS = ${CFLAGS} -D_REENTRANT -include pthread.h -DNDEBUG ${DebugFlags}
|
||||
+Tgt = liblzma_r.a
|
||||
+
|
||||
+all: ${Tgt}
|
||||
+
|
||||
+RObjs = LZMAEncoder_r.o Alloc_r.o LZInWindow_r.o CRC_r.o StreamUtils_r.o \
|
||||
+ OutBuffer_r.o RangeCoderBit_r.o
|
||||
+%_r.cc: ../LZMA/%.cpp
|
||||
+ ln $< $@
|
||||
+%_r.cc: ../LZ/%.cpp
|
||||
+ ln $< $@
|
||||
+%_r.cc: ../RangeCoder/%.cpp
|
||||
+ ln $< $@
|
||||
+%_r.cc: ../../Common/%.cpp
|
||||
+ ln $< $@
|
||||
+%_r.cc: ../../../Common/%.cpp
|
||||
+ ln $< $@
|
||||
+LZMAEncoder_r.o: CXXFLAGS += -I../LZMA
|
||||
+LZInWindow_r.o: CXXFLAGS += -I../LZ
|
||||
+RangeCoderBit_r.o: CXXFLAGS += -I../RangeCoder
|
||||
+OutBuffer_r.o StreamUtils_r.o: CXXFLAGS += -I../../Common
|
||||
+Alloc_r.o CRC_r.o: CXXFLAGS += -I../../../Common
|
||||
+
|
||||
+comp.o: CXXFLAGS += -I${Sqlzma}
|
||||
+comp.o: comp.cc ${Sqlzma}/sqlzma.h
|
||||
+
|
||||
+liblzma_r.a: ${RObjs} comp.o
|
||||
+ ${AR} cr $@ $^
|
||||
+
|
||||
+clean: clean_sqlzma
|
||||
+clean_sqlzma:
|
||||
+ $(RM) comp.o *_r.o ${Tgt} *~
|
||||
+
|
||||
+# Local variables: ;
|
||||
+# compile-command: (concat "make Sqlzma=../../../../.. -f " (file-name-nondirectory (buffer-file-name)));
|
||||
+# End: ;
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod.mk.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod.mk 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,40 @@
|
||||
+
|
||||
+# Copyright (C) 2006-2007 Junjiro Okajima
|
||||
+# Copyright (C) 2006-2007 Tomas Matejicek, slax.org
|
||||
+#
|
||||
+# LICENSE follows the described one in lzma.txt.
|
||||
+
|
||||
+# $Id: kmod.mk,v 1.1 2007/11/05 05:43:35 jro Exp $
|
||||
+
|
||||
+ifndef Sqlzma
|
||||
+$(error Sqlzma is not defined)
|
||||
+endif
|
||||
+ifndef KDir
|
||||
+$(error KDir is not defined)
|
||||
+endif
|
||||
+
|
||||
+#include makefile.gcc
|
||||
+
|
||||
+Kmod = kmod
|
||||
+EXTRA_CFLAGS += -Wall -Werror -I${CURDIR} -I${Sqlzma}
|
||||
+# -D_LZMA_PROB32
|
||||
+EXTRA_CFLAGS += $(shell ${CPP} ${CFLAGS} -P testflags.c)
|
||||
+
|
||||
+all: ${Kmod}/uncomp.c
|
||||
+ ${MAKE} EXTRA_CFLAGS="${EXTRA_CFLAGS}" M=${CURDIR}/${Kmod} \
|
||||
+ -C ${KDir} C=0 V=0 modules
|
||||
+
|
||||
+${Kmod}/uncomp.c: uncomp.c
|
||||
+ ln $< $@
|
||||
+
|
||||
+clean: clean_kmod
|
||||
+clean_kmod:
|
||||
+ ${MAKE} -C ${KDir} M=${CURDIR}/${Kmod} V=0 clean
|
||||
+ ${RM} ${Kmod}/*~
|
||||
+ -@test -e ${Kmod}/uncomp.c && \
|
||||
+ diff -q ${Kmod}/uncomp.c uncomp.c > /dev/null && \
|
||||
+ find ${Kmod}/uncomp.c -links +1 | xargs -r ${RM}
|
||||
+
|
||||
+# Local variables: ;
|
||||
+# compile-command: (concat "make Sqlzma=../../../../.. KDir=/lib/modules/`uname -r`/build -f " (file-name-nondirectory (buffer-file-name)));
|
||||
+# End: ;
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/sqlzma.mk.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/sqlzma.mk 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,45 @@
|
||||
+
|
||||
+# Copyright (C) 2006 Junjiro Okajima
|
||||
+# Copyright (C) 2006 Tomas Matejicek, slax.org
|
||||
+#
|
||||
+# LICENSE follows the described one in lzma.txt.
|
||||
+
|
||||
+# $Id: sqlzma.mk,v 1.20 2007/01/07 15:12:48 jro Exp $
|
||||
+
|
||||
+ifndef Sqlzma
|
||||
+$(error Sqlzma is not defined)
|
||||
+endif
|
||||
+
|
||||
+include makefile.gcc
|
||||
+ifdef KDir
|
||||
+include kmod.mk
|
||||
+endif
|
||||
+
|
||||
+ifdef UseDebugFlags
|
||||
+DebugFlags = -O0 -g -UNDEBUG
|
||||
+endif
|
||||
+CFLAGS += -DNDEBUG ${DebugFlags}
|
||||
+Tgt = libunlzma.a libunlzma_r.a
|
||||
+
|
||||
+all: ${Tgt}
|
||||
+
|
||||
+%_r.c: %.c
|
||||
+ ln $< $@
|
||||
+# -pthread
|
||||
+%_r.o: CFLAGS += -D_REENTRANT -include pthread.h
|
||||
+
|
||||
+uncomp.o uncomp_r.o: CFLAGS += -I${Sqlzma}
|
||||
+uncomp.o: uncomp.c ${Sqlzma}/sqlzma.h
|
||||
+
|
||||
+libunlzma.a: uncomp.o LzmaDecode.o
|
||||
+ ${AR} cr $@ $^
|
||||
+libunlzma_r.a: uncomp_r.o LzmaDecode_r.o
|
||||
+ ${AR} cr $@ $^
|
||||
+
|
||||
+clean: clean_sqlzma
|
||||
+clean_sqlzma:
|
||||
+ $(RM) ${Tgt} uncomp.o uncomp_r.o LzmaDecode_r.o *~
|
||||
+
|
||||
+# Local variables: ;
|
||||
+# compile-command: (concat "make Sqlzma=../../../../.. -f " (file-name-nondirectory (buffer-file-name)));
|
||||
+# End: ;
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/testflags.c.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/testflags.c 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,5 @@
|
||||
+#ifdef _LZMA_PROB32
|
||||
+-D_LZMA_PROB32
|
||||
+#else
|
||||
+-U_LZMA_PROB32
|
||||
+#endif
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/uncomp.c.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/uncomp.c 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,221 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2006, 2007 Junjiro Okajima
|
||||
+ * Copyright (C) 2006, 2007 Tomas Matejicek, slax.org
|
||||
+ *
|
||||
+ * LICENSE follows the described one in lzma.txt.
|
||||
+ */
|
||||
+
|
||||
+/* $Id: uncomp.c,v 1.1 2007/11/05 05:43:36 jro Exp $ */
|
||||
+
|
||||
+/* extract some parts from lzma443/C/7zip/Compress/LZMA_C/LzmaTest.c */
|
||||
+
|
||||
+#ifndef __KERNEL__
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#include <assert.h>
|
||||
+#include <pthread.h>
|
||||
+#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
+#define BUG_ON(x) assert(!(x))
|
||||
+/* sqlzma buffers are always larger than a page. true? */
|
||||
+#define kmalloc(sz,gfp) malloc(sz)
|
||||
+#define kfree(p) free(p)
|
||||
+#define zlib_inflate(s, f) inflate(s, f)
|
||||
+#define zlib_inflateInit(s) inflateInit(s)
|
||||
+#define zlib_inflateReset(s) inflateReset(s)
|
||||
+#define zlib_inflateEnd(s) inflateEnd(s)
|
||||
+#else
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/vmalloc.h>
|
||||
+#ifndef WARN_ON_ONCE
|
||||
+#define WARN_ON_ONCE(b) WARN_ON(b)
|
||||
+#endif
|
||||
+#endif /* __KERNEL__ */
|
||||
+
|
||||
+#include "sqlzma.h"
|
||||
+#include "LzmaDecode.h"
|
||||
+
|
||||
+static int LzmaUncompress(struct sqlzma_un *un)
|
||||
+{
|
||||
+ int err, i, ret;
|
||||
+ SizeT outSize, inProcessed, outProcessed, srclen;
|
||||
+ /* it's about 24-80 bytes structure, if int is 32-bit */
|
||||
+ CLzmaDecoderState state;
|
||||
+ unsigned char *dst, *src, a[8];
|
||||
+ struct sized_buf *sbuf;
|
||||
+
|
||||
+ /* Decode LZMA properties and allocate memory */
|
||||
+ err = -EINVAL;
|
||||
+ src = un->un_cmbuf;
|
||||
+ ret = LzmaDecodeProperties(&state.Properties, src, LZMA_PROPERTIES_SIZE);
|
||||
+ src += LZMA_PROPERTIES_SIZE;
|
||||
+ if (unlikely(ret != LZMA_RESULT_OK))
|
||||
+ goto out;
|
||||
+ i = LzmaGetNumProbs(&state.Properties);
|
||||
+ if (unlikely(i <= 0))
|
||||
+ i = 1;
|
||||
+ i *= sizeof(CProb);
|
||||
+ sbuf = un->un_a + SQUN_PROB;
|
||||
+ if (unlikely(sbuf->sz < i)) {
|
||||
+ if (sbuf->buf && sbuf->buf != un->un_prob)
|
||||
+ kfree(sbuf->buf);
|
||||
+#ifdef __KERNEL__
|
||||
+ printk("%s:%d: %d --> %d\n", __func__, __LINE__, sbuf->sz, i);
|
||||
+#else
|
||||
+ printf("%d --> %d\n", sbuf->sz, i);
|
||||
+#endif
|
||||
+ err = -ENOMEM;
|
||||
+ sbuf->sz = 0;
|
||||
+ sbuf->buf = kmalloc(i, GFP_ATOMIC);
|
||||
+ if (unlikely(!sbuf->buf))
|
||||
+ goto out;
|
||||
+ sbuf->sz = i;
|
||||
+ }
|
||||
+ state.Probs = (void*)sbuf->buf;
|
||||
+
|
||||
+ /* Read uncompressed size */
|
||||
+ memcpy(a, src, sizeof(a));
|
||||
+ src += sizeof(a);
|
||||
+ outSize = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24);
|
||||
+
|
||||
+ err = -EINVAL;
|
||||
+ dst = un->un_resbuf;
|
||||
+ if (unlikely(!dst || outSize > un->un_reslen))
|
||||
+ goto out;
|
||||
+ un->un_reslen = outSize;
|
||||
+ srclen = un->un_cmlen - (src - un->un_cmbuf);
|
||||
+
|
||||
+ /* Decompress */
|
||||
+ err = LzmaDecode(&state, src, srclen, &inProcessed, dst, outSize,
|
||||
+ &outProcessed);
|
||||
+ if (err)
|
||||
+ err = -EINVAL;
|
||||
+
|
||||
+ out:
|
||||
+#ifndef __KERNEL__
|
||||
+ if (err)
|
||||
+ fprintf(stderr, "err %d\n", err);
|
||||
+#endif
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+int sqlzma_un(struct sqlzma_un *un, struct sized_buf *src,
|
||||
+ struct sized_buf *dst)
|
||||
+{
|
||||
+ int err, by_lzma = 0;
|
||||
+ if (un->un_lzma && is_lzma(*src->buf)) {
|
||||
+ by_lzma = 1;
|
||||
+ un->un_cmbuf = src->buf;
|
||||
+ un->un_cmlen = src->sz;
|
||||
+ un->un_resbuf = dst->buf;
|
||||
+ un->un_reslen = dst->sz;
|
||||
+
|
||||
+ /* this library is thread-safe */
|
||||
+ err = LzmaUncompress(un);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ err = zlib_inflateReset(&un->un_stream);
|
||||
+ if (unlikely(err != Z_OK))
|
||||
+ goto out;
|
||||
+ un->un_stream.next_in = src->buf;
|
||||
+ un->un_stream.avail_in = src->sz;
|
||||
+ un->un_stream.next_out = dst->buf;
|
||||
+ un->un_stream.avail_out = dst->sz;
|
||||
+ err = zlib_inflate(&un->un_stream, Z_FINISH);
|
||||
+ if (err == Z_STREAM_END)
|
||||
+ err = 0;
|
||||
+
|
||||
+ out:
|
||||
+ if (err) {
|
||||
+#ifdef __KERNEL__
|
||||
+ WARN_ON_ONCE(1);
|
||||
+#else
|
||||
+ char a[64] = "ZLIB ";
|
||||
+ if (by_lzma) {
|
||||
+ strcpy(a, "LZMA ");
|
||||
+#ifdef _REENTRANT
|
||||
+ strerror_r(err, a + 5, sizeof(a) - 5);
|
||||
+#else
|
||||
+ strncat(a, strerror(err), sizeof(a) - 5);
|
||||
+#endif
|
||||
+ } else
|
||||
+ strncat(a, zError(err), sizeof(a) - 5);
|
||||
+ fprintf(stderr, "%s: %.*s\n", __func__, sizeof(a), a);
|
||||
+#endif
|
||||
+ }
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+int sqlzma_init(struct sqlzma_un *un, int do_lzma, unsigned int res_sz)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = -ENOMEM;
|
||||
+ un->un_lzma = do_lzma;
|
||||
+ memset(un->un_a, 0, sizeof(un->un_a));
|
||||
+ un->un_a[SQUN_PROB].buf = un->un_prob;
|
||||
+ un->un_a[SQUN_PROB].sz = sizeof(un->un_prob);
|
||||
+ if (res_sz) {
|
||||
+ un->un_a[SQUN_RESULT].buf = kmalloc(res_sz, GFP_KERNEL);
|
||||
+ if (unlikely(!un->un_a[SQUN_RESULT].buf))
|
||||
+ return err;
|
||||
+ un->un_a[SQUN_RESULT].sz = res_sz;
|
||||
+ }
|
||||
+
|
||||
+ un->un_stream.next_in = NULL;
|
||||
+ un->un_stream.avail_in = 0;
|
||||
+#ifdef __KERNEL__
|
||||
+ un->un_stream.workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
|
||||
+ if (unlikely(!un->un_stream.workspace))
|
||||
+ return err;
|
||||
+#else
|
||||
+ un->un_stream.opaque = NULL;
|
||||
+ un->un_stream.zalloc = Z_NULL;
|
||||
+ un->un_stream.zfree = Z_NULL;
|
||||
+#endif
|
||||
+ err = zlib_inflateInit(&un->un_stream);
|
||||
+ if (unlikely(err == Z_MEM_ERROR))
|
||||
+ return -ENOMEM;
|
||||
+ BUG_ON(err);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+void sqlzma_fin(struct sqlzma_un *un)
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i = 0; i < SQUN_LAST; i++)
|
||||
+ if (un->un_a[i].buf && un->un_a[i].buf != un->un_prob)
|
||||
+ kfree(un->un_a[i].buf);
|
||||
+ BUG_ON(zlib_inflateEnd(&un->un_stream) != Z_OK);
|
||||
+}
|
||||
+
|
||||
+#ifdef __KERNEL__
|
||||
+EXPORT_SYMBOL(sqlzma_un);
|
||||
+EXPORT_SYMBOL(sqlzma_init);
|
||||
+EXPORT_SYMBOL(sqlzma_fin);
|
||||
+
|
||||
+#if 0
|
||||
+static int __init sqlzma_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit sqlzma_exit(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+module_init(sqlzma_init);
|
||||
+module_exit(sqlzma_exit);
|
||||
+#endif
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Junjiro Okajima <sfjro at users dot sf dot net>");
|
||||
+MODULE_VERSION("$Id: uncomp.c,v 1.1 2007/11/05 05:43:36 jro Exp $");
|
||||
+MODULE_DESCRIPTION("LZMA uncompress for squashfs. "
|
||||
+ "Some functions for squashfs to support LZMA and "
|
||||
+ "a tiny wrapper for LzmaDecode.c in LZMA SDK from www.7-zip.org.");
|
||||
+#endif
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod/Makefile.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod/Makefile 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,11 @@
|
||||
+
|
||||
+# Copyright (C) 2006-2007 Junjiro Okajima
|
||||
+# Copyright (C) 2006-2007 Tomas Matejicek, slax.org
|
||||
+#
|
||||
+# LICENSE follows the described one in lzma.txt.
|
||||
+
|
||||
+# $Id: Makefile,v 1.1 2007/11/05 05:43:36 jro Exp $
|
||||
+
|
||||
+obj-m += unlzma.o sqlzma.o
|
||||
+unlzma-y := module.o
|
||||
+sqlzma-y := uncomp.o
|
||||
--- lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod/module.c.sqlzma 2007-12-12 20:23:31.000000000 +0100
|
||||
+++ lzma-4.32.4/C/7zip/Compress/LZMA_C/kmod/module.c 2007-12-12 20:23:31.000000000 +0100
|
||||
@@ -0,0 +1,36 @@
|
||||
+
|
||||
+/*
|
||||
+ * Copyright (C) 2006-2007 Junjiro Okajima
|
||||
+ * Copyright (C) 2006-2007 Tomas Matejicek, slax.org
|
||||
+ *
|
||||
+ * LICENSE follows the described one in lzma.txt.
|
||||
+ */
|
||||
+
|
||||
+/* $Id: module.c,v 1.1 2007/11/05 05:43:36 jro Exp $ */
|
||||
+
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+
|
||||
+#include "../LzmaDecode.c"
|
||||
+
|
||||
+EXPORT_SYMBOL(LzmaDecodeProperties);
|
||||
+EXPORT_SYMBOL(LzmaDecode);
|
||||
+
|
||||
+#if 0
|
||||
+static int __init unlzma_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit unlzma_exit(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+module_init(unlzma_init);
|
||||
+module_exit(unlzma_exit);
|
||||
+#endif
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_VERSION("$Id: module.c,v 1.1 2007/11/05 05:43:36 jro Exp $");
|
||||
+MODULE_DESCRIPTION("LZMA uncompress. "
|
||||
+ "A tiny wrapper for LzmaDecode.c in LZMA SDK from www.7-zip.org.");
|
42
lzma-4.32.4-text-tune.patch
Normal file
42
lzma-4.32.4-text-tune.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
--- lzma-4.32.4/src/lzma/lzmp.cpp.text 2007-12-10 18:22:27.000000000 +0100
|
||||
+++ lzma-4.32.4/src/lzma/lzmp.cpp 2007-12-10 18:28:03.000000000 +0100
|
||||
@@ -107,7 +107,7 @@ struct lzma_option {
|
||||
* to the corresponding LZMA compression modes. Thanks, Larhzu, for coining
|
||||
* these. */
|
||||
const lzma_option option_mapping[] = {
|
||||
- { 0, 0, 0, NULL, 0, 0, 0}, // -0 (needed for indexing)
|
||||
+ { 1, 18, 112, L"bt4", 3, 0, 0}, // -0
|
||||
{ 0, 16, 64, L"hc4", 3, 0, 2}, // -1
|
||||
{ 0, 20, 64, L"hc4", 3, 0, 2}, // -2
|
||||
{ 1, 19, 64, L"bt4", 3, 0, 2}, // -3
|
||||
@@ -167,11 +167,12 @@ const struct option long_options[] = {
|
||||
{ "fast", 0, 0, '1' },
|
||||
{ "best", 0, 0, '9' },
|
||||
{ "format", 1, 0, OPT_FORMAT },
|
||||
+ { "text", 0, 0, '0' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/* getopt option string (for the above options). */
|
||||
-const char option_string[] = "cdzkftS:qvhLV123456789A:D:F:";
|
||||
+const char option_string[] = "cdzkftS:qvhLV0123456789A:D:F:";
|
||||
|
||||
/* Defaults. */
|
||||
PROGRAM_MODE program_mode = PM_COMPRESS;
|
||||
@@ -208,6 +209,7 @@ void print_help(const char *const argv0)
|
||||
" -V --version display version numbers of LZMA SDK and lzma\n"
|
||||
" -1 .. -2 fast compression\n"
|
||||
" -3 .. -9 good to excellent compression. -7 is the default.\n"
|
||||
+" --text betted tuned for text compression\n"
|
||||
" --fast alias for -1\n"
|
||||
" --best alias for -9 (usually *not* what you want)\n\n"
|
||||
" Memory usage depends a lot on the chosen compression mode -1 .. -9.\n"
|
||||
@@ -337,7 +339,7 @@ void parse_options(int argc, char **argv
|
||||
break;
|
||||
|
||||
case '1': case '2': case '3': case '4': case '5':
|
||||
- case '6': case '7': case '8': case '9':
|
||||
+ case '6': case '7': case '8': case '9': case '0':
|
||||
compression_mode = c - '0';
|
||||
break;
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
diff -Naurp lzma-4.32.7/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp lzma-4.32.7.oden/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
|
||||
--- lzma-4.32.7/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp 2008-12-21 18:47:23.000000000 +0100
|
||||
+++ lzma-4.32.7.oden/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp 2008-12-21 18:47:45.000000000 +0100
|
||||
@@ -444,7 +444,7 @@ int main2(int n, const char *args[])
|
||||
Byte b = Byte(fileSize >> (8 * i));
|
||||
if (outStream->Write(&b, 1, 0) != S_OK)
|
||||
{
|
||||
- fprintf(stderr, kWriteError);
|
||||
+ fprintf(stderr, "%s", kWriteError);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -470,12 +470,12 @@ int main2(int n, const char *args[])
|
||||
UInt32 processedSize;
|
||||
if (ReadStream(inStream, properties, kPropertiesSize, &processedSize) != S_OK)
|
||||
{
|
||||
- fprintf(stderr, kReadError);
|
||||
+ fprintf(stderr, "%s", kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (processedSize != kPropertiesSize)
|
||||
{
|
||||
- fprintf(stderr, kReadError);
|
||||
+ fprintf(stderr, "%s", kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK)
|
||||
@@ -489,12 +489,12 @@ int main2(int n, const char *args[])
|
||||
Byte b;
|
||||
if (inStream->Read(&b, 1, &processedSize) != S_OK)
|
||||
{
|
||||
- fprintf(stderr, kReadError);
|
||||
+ fprintf(stderr, "%s", kReadError);
|
||||
return 1;
|
||||
}
|
||||
if (processedSize != 1)
|
||||
{
|
||||
- fprintf(stderr, kReadError);
|
||||
+ fprintf(stderr, "%s", kReadError);
|
||||
return 1;
|
||||
}
|
||||
fileSize |= ((UInt64)b) << (8 * i);
|
||||
diff -Naurp lzma-4.32.7/C/7zip/Compress/LZMA_Alone/LzmaBench.cpp lzma-4.32.7.oden/C/7zip/Compress/LZMA_Alone/LzmaBench.cpp
|
||||
--- lzma-4.32.7/C/7zip/Compress/LZMA_Alone/LzmaBench.cpp 2006-04-27 07:57:31.000000000 +0200
|
||||
+++ lzma-4.32.7.oden/C/7zip/Compress/LZMA_Alone/LzmaBench.cpp 2008-12-21 18:47:45.000000000 +0100
|
||||
@@ -363,7 +363,7 @@ static void ThrowError(FILE *f, HRESULT
|
||||
if (result == E_OUTOFMEMORY)
|
||||
fprintf(f, "Can not allocate memory");
|
||||
else
|
||||
- fprintf(f, s);
|
||||
+ fprintf(f, "%s", s);
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
diff -Naurp lzma-4.32.7/C/7zip/Compress/LZMA_C/LzmaTest.c lzma-4.32.7.oden/C/7zip/Compress/LZMA_C/LzmaTest.c
|
||||
--- lzma-4.32.7/C/7zip/Compress/LZMA_C/LzmaTest.c 2005-08-05 12:17:06.000000000 +0200
|
||||
+++ lzma-4.32.7.oden/C/7zip/Compress/LZMA_C/LzmaTest.c 2008-12-21 18:47:45.000000000 +0100
|
||||
@@ -64,7 +64,7 @@ unsigned char g_OutBuffer[kOutBufferSize
|
||||
int PrintError(char *buffer, const char *message)
|
||||
{
|
||||
sprintf(buffer + strlen(buffer), "\nError: ");
|
||||
- sprintf(buffer + strlen(buffer), message);
|
||||
+ sprintf(buffer + strlen(buffer), "%s", message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -337,6 +337,6 @@ int main(int numArgs, const char *args[]
|
||||
{
|
||||
char rs[800] = { 0 };
|
||||
int res = main2(numArgs, args, rs);
|
||||
- printf(rs);
|
||||
+ printf("%s", rs);
|
||||
return res;
|
||||
}
|
20
lzma-4.43-add-missing-gethandle.patch
Normal file
20
lzma-4.43-add-missing-gethandle.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- C/Common/C_FileIO.h~ 2004-07-24 13:35:06.000000000 +0200
|
||||
+++ C/Common/C_FileIO.h 2007-06-08 18:20:36.000000000 +0200
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
bool Close();
|
||||
bool GetLength(UInt64 &length) const;
|
||||
off_t Seek(off_t distanceToMove, int moveMethod) const;
|
||||
+ int GetHandle() const { return _handle; }
|
||||
};
|
||||
|
||||
class CInFile: public CFileBase
|
||||
--- src/sdk/Common/C_FileIO.h.orig 2007-06-08 18:30:57.000000000 +0200
|
||||
+++ src/sdk/Common/C_FileIO.h 2007-06-08 18:31:00.000000000 +0200
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
bool Close();
|
||||
bool GetLength(UInt64 &length) const;
|
||||
off_t Seek(off_t distanceToMove, int moveMethod) const;
|
||||
+ int GetHandle() const { return _handle; }
|
||||
};
|
||||
|
||||
class CInFile: public CFileBase
|
23
lzma-4.43-add-missing-header.patch
Normal file
23
lzma-4.43-add-missing-header.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
--- lzma-4.32.0beta3/src/sdk/Common/Types.h~ 2007-05-31 16:40:42.158205520 +0200
|
||||
+++ lzma-4.32.0beta3/src/sdk/Common/Types.h 2007-05-31 17:22:13.745737867 +0200
|
||||
@@ -3,6 +3,10 @@
|
||||
#ifndef __COMMON_TYPES_H
|
||||
#define __COMMON_TYPES_H
|
||||
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+#include <config.h>
|
||||
+#endif
|
||||
+
|
||||
#ifndef _7ZIP_BYTE_DEFINED
|
||||
#define _7ZIP_BYTE_DEFINED
|
||||
typedef unsigned char Byte;
|
||||
--- lzma-4.32.0beta3/src/sdk/Common/MyWindows.h~ 2007-05-31 16:40:42.151206784 +0200
|
||||
+++ lzma-4.32.0beta3/src/sdk/Common/MyWindows.h 2007-05-31 17:21:07.398761868 +0200
|
||||
@@ -19,6 +19,7 @@
|
||||
#define STRING_PATH_SEPARATOR "/"
|
||||
#define WSTRING_PATH_SEPARATOR L"/"
|
||||
|
||||
+#include <config.h>
|
||||
#include <stddef.h> // for wchar_t
|
||||
#include <string.h>
|
||||
|
11
lzma-4.43-fix-fast-compression.patch
Normal file
11
lzma-4.43-fix-fast-compression.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- ./src/lzma/lzmp.cpp 2006-07-06 23:58:46.000000000 +0200
|
||||
+++ ./C/7zip/Compress/LZMA_Alone/lzmp.cpp 2007-06-08 18:09:25.000000000 +0200
|
||||
@@ -100,7 +101,7 @@ struct lzma_option {
|
||||
* these. */
|
||||
const lzma_option option_mapping[] = {
|
||||
{ 0, 0, 0, NULL, 0, 0, 0}, // -0 (needed for indexing)
|
||||
- { 0, 16, 64, L"hc3", 3, 0, 2}, // -1
|
||||
+ { 0, 16, 64, L"hc4", 3, 0, 2}, // -1
|
||||
{ 0, 20, 64, L"hc4", 3, 0, 2}, // -2
|
||||
{ 1, 19, 64, L"bt4", 3, 0, 2}, // -3
|
||||
{ 2, 20, 64, L"bt4", 3, 0, 2}, // -4
|
14
lzma-4.43-quiet.patch
Normal file
14
lzma-4.43-quiet.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
--- lzma-4.43/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp.1 2006-06-14 22:00:04.433513750 +0000
|
||||
+++ lzma-4.43/C/7zip/Compress/LZMA_Alone/LzmaAlone.cpp 2006-06-14 22:00:45.900105250 +0000
|
||||
@@ -152,10 +152,10 @@
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
|
||||
- fprintf(stderr, "\nLZMA 4.43 Copyright (c) 1999-2006 Igor Pavlov 2006-06-04\n");
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
+ fprintf(stderr, "\nLZMA 4.43 Copyright (c) 1999-2006 Igor Pavlov 2006-06-04\n");
|
||||
PrintHelp();
|
||||
return 0;
|
||||
}
|
39
lzma-4.43-update-version.patch
Normal file
39
lzma-4.43-update-version.patch
Normal file
|
@ -0,0 +1,39 @@
|
|||
--- src/lzma_version.h 2006-07-06 23:58:21.000000000 +0200
|
||||
+++ src/sdk/7zip/Compress/LZMA_Alone/lzma_version.h 2007-06-08 18:09:25.000000000 +0200
|
||||
@@ -5,21 +5,21 @@
|
||||
Version and copyright information used by LZMA utils.
|
||||
*/
|
||||
|
||||
-static const char *LZMA_SDK_VERSION_STRING = "4.32";
|
||||
+static const char *LZMA_SDK_VERSION_STRING = "4.43";
|
||||
|
||||
static const char *LZMA_SDK_COPYRIGHT_STRING =
|
||||
- "Copyright (C) 1999-2005 Igor Pavlov";
|
||||
+ "Copyright (C) 1999-2006 Igor Pavlov";
|
||||
|
||||
static const char *LZMA_SDK_COPYRIGHT_INFO =
|
||||
" See http://7-zip.org/sdk.html or the documentation of LZMA SDK for\n"
|
||||
- " the license. For reference, the version 4.32 is free software\n"
|
||||
+ " the license. For reference, the version 4.43 is free software\n"
|
||||
" licensed under the GNU LGPL.";
|
||||
|
||||
|
||||
static const char *LZMA_UTILS_VERSION_STRING = PACKAGE_VERSION;
|
||||
|
||||
static const char *LZMA_UTILS_COPYRIGHT_STRING =
|
||||
- "Copyright (C) 2005 Lasse Collin";
|
||||
+ "Copyright (C) 2006 Lasse Collin";
|
||||
|
||||
static const char *LZMA_UTILS_COPYRIGHT_INFO =
|
||||
"This program comes with ABSOLUTELY NO WARRANTY.\n"
|
||||
--- src/lzma/lzmp.cpp 2006-07-06 23:58:46.000000000 +0200
|
||||
+++ C/7zip/Compress/LZMA_Alone/lzmp.cpp 2007-06-08 18:09:25.000000000 +0200
|
||||
@@ -72,7 +73,7 @@ typedef vector<string> stringVector;
|
||||
namespace lzma {
|
||||
|
||||
const char *PROGRAM_VERSION = PACKAGE_VERSION;
|
||||
-const char *PROGRAM_COPYRIGHT = "Copyright (C) 2005 Ville Koskinen";
|
||||
+const char *PROGRAM_COPYRIGHT = "Copyright (C) 2006 Ville Koskinen";
|
||||
|
||||
/* LZMA_Alone switches:
|
||||
-a{N}: set compression mode - [0, 2], default: 2 (max)
|
383
lzma.spec
Normal file
383
lzma.spec
Normal file
|
@ -0,0 +1,383 @@
|
|||
%define name lzma
|
||||
%define version 4.43
|
||||
%define oldlzmaver 4.32.7
|
||||
%define release %mkrel 31
|
||||
%define major 0
|
||||
%define libname %mklibname lzmadec %{major}
|
||||
%define libdev %mklibname -d lzmadec
|
||||
|
||||
Summary: LZMA utils
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL
|
||||
Group: Archiving/Compression
|
||||
Source0: http://tukaani.org/lzma/lzma-%{oldlzmaver}.tar.lzma
|
||||
Source1: http://ovh.dl.sourceforge.net/sourceforge/sevenzip/lzma443.tar.bz2
|
||||
#Source2: lzme
|
||||
Source3: sqlzma.h
|
||||
#Patch0: lzma-432-makefile.patch.bz2
|
||||
#Patch1: lzma-432-makefile-sdknew.patch.bz2
|
||||
#Patch2: lzma-4.43-lzmp.patch
|
||||
|
||||
# (blino) modified for 443, from sqlzma1-449.patch:
|
||||
# * adapted to lzma443 dist structure: s,/C/Compress/Lzma/,/C/7zip/Compress/LZMA_C/,; s,/CPP/7zip/Compress/LZMA_Alone/,/C/7zip/Compress/LZMA_Alone/,
|
||||
# * use sqlzma.mk makefiles for 443 (from from sqlzma1-443.patch)
|
||||
# * remove NCoderPropID::kNumThreads in comp.cc, it is invalid since we don't build LZMAEncoder.cpp with COMPRESS_MF_MT multithread support
|
||||
Patch3: lzma-4.32.4-sqlzma.patch
|
||||
|
||||
Patch4: lzma-4.43-add-missing-header.patch
|
||||
Patch5: lzma-4.43-quiet.patch
|
||||
Patch6: lzma-4.43-update-version.patch
|
||||
Patch7: lzma-4.43-fix-fast-compression.patch
|
||||
Patch8: lzma-4.43-add-missing-gethandle.patch
|
||||
Patch9: lzma-4.32.4-text-tune.patch
|
||||
#Patch10: lzma-4.32.0beta3-fix-stdout.patch
|
||||
#Patch11: lzma-4.43-fix-liblzmadec-header-includes.patch
|
||||
# 4.32.2 has changes to sdk that we replace with newer, we apply these to the new
|
||||
Patch12: lzma-4.32.2-sdk-changes.patch
|
||||
#Patch13: lzma-4.32.2-file_modes.patch
|
||||
#Patch14: lzma-4.32.3-liblzmadec-fix.patch
|
||||
#Patch15: lzma-4.32.5-fix-deprecated-string-conversion.patch
|
||||
Patch16: lzma-4.32.7-format_not_a_string_literal_and_no_format_arguments.diff
|
||||
# for squashfs-lzma library
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: dos2unix diffutils
|
||||
URL: http://tukaani.org/lzma/
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
%description
|
||||
LZMA provides very high compression ratio and fast decompression. The
|
||||
core of the LZMA utils is Igor Pavlov's LZMA SDK containing the actual
|
||||
LZMA encoder/decoder. LZMA utils add a few scripts which provide
|
||||
gzip-like command line interface and a couple of other LZMA related
|
||||
tools. Also provides:
|
||||
|
||||
- Average compression ratio 30% better than that of gzip and 15%
|
||||
better than that of bzip2.
|
||||
|
||||
- Decompression speed is only little slower than that of gzip, being
|
||||
two to five times faster than bzip2.
|
||||
|
||||
- In fast mode, compresses faster than bzip2 with a comparable
|
||||
compression ratio.
|
||||
|
||||
- Achieving the best compression ratios takes four to even twelve
|
||||
times longer than with bzip2. However. this doesn't affect
|
||||
decompressing speed.
|
||||
|
||||
- Very similar command line interface than what gzip and bzip2 have.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: Libraries for decoding LZMA compression
|
||||
Group: System/Libraries
|
||||
License: LGPL
|
||||
Provides: %{_lib}%{name}%{major} = %{version}-%{release}
|
||||
Obsoletes: %{_lib}%{name}%{major} <= %{version}-%{release}
|
||||
|
||||
%description -n %{libname}
|
||||
Libraries for decoding LZMA compression.
|
||||
|
||||
%package -n %{libdev}
|
||||
Summary: Devel libraries & headers for liblzmadec
|
||||
Group: Development/C
|
||||
License: LGPL
|
||||
Provides: liblzmadec-devel = %{version}-%{release}
|
||||
Provides: %{_lib}%{name}%{major}-devel = %{version}-%{release}
|
||||
Obsoletes: %{_lib}%{name}%{major}-devel <= %{version}-%{release}
|
||||
Provides: %{name}-devel = %{version}-%{release}
|
||||
Requires: %{libname} = %{version}
|
||||
|
||||
%description -n %{libdev}
|
||||
Devel libraries & headers for liblzmadec.
|
||||
|
||||
%package -n dkms-%{name}
|
||||
Summary: Kernel modules for decoding LZMA compression
|
||||
Group: System/Kernel and hardware
|
||||
License: GPL
|
||||
Requires(post): dkms
|
||||
Requires(preun): dkms
|
||||
|
||||
%description -n dkms-%{name}
|
||||
Kernel modules for decoding LZMA compression.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{oldlzmaver} -a1
|
||||
#%patch0 -p1 -b .427
|
||||
#%patch1 -p1 -b .427_sdk
|
||||
#%patch2 -p1
|
||||
%patch3 -p1 -b .sqlzma
|
||||
cp %{SOURCE3} .
|
||||
dos2unix *.txt
|
||||
|
||||
# ugly syncing with latest sdk
|
||||
mv src/sdk src/sdk.old
|
||||
cp -r C src/sdk
|
||||
for i in `find src/sdk.old -name Makefile.\*`; do
|
||||
cp $i `echo $i|sed -e 's#sdk.old#sdk#g'`;
|
||||
done
|
||||
|
||||
find src/sdk -name makefile|xargs rm -f
|
||||
|
||||
%patch4 -p1 -b .config_h
|
||||
%patch5 -p1 -b .quiet
|
||||
%patch6 -p0 -b .version
|
||||
%patch7 -p0 -b .fast
|
||||
%patch8 -p0 -b .gethandle
|
||||
%patch9 -p1 -b .text
|
||||
#%patch10 -p1 -b .stdout
|
||||
#%patch11 -p1 -b .lzmadec_systypes
|
||||
%patch12 -p1 -b .4.32.2
|
||||
#%patch13 -p1 -b .file_modes
|
||||
#%patch14 -p1 -b .liblzmadec_fix
|
||||
#%%patch15 -p0 -b .fix_string_conversion
|
||||
%patch16 -p1 -b .format_not_a_string_literal_and_no_format_arguments
|
||||
|
||||
pushd C/7zip/Compress/LZMA_C
|
||||
cp %{SOURCE3} kmod/
|
||||
cp uncomp.c LzmaDecode.{c,h} LzmaTypes.h kmod/
|
||||
perl -pi -e 's,^#include "\.\./(Lzma.*)",#include "$1",' kmod/*.{c,h}
|
||||
cat > kmod/dkms.conf <<EOF
|
||||
PACKAGE_NAME=%{name}
|
||||
PACKAGE_VERSION=%{version}-%{release}
|
||||
DEST_MODULE_LOCATION[0]="/kernel/lib/%{name}"
|
||||
DEST_MODULE_LOCATION[1]="/kernel/lib/%{name}"
|
||||
BUILT_MODULE_NAME[0]="sqlzma"
|
||||
BUILT_MODULE_NAME[1]="unlzma"
|
||||
AUTOINSTALL=yes
|
||||
EOF
|
||||
popd
|
||||
|
||||
%build
|
||||
CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -O3" \
|
||||
CXXFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -O3" \
|
||||
%configure2_5x
|
||||
%make
|
||||
%make CFLAGS="%{optflags} -c -Wall -pedantic -D _LZMA_PROB32 -DNDEBUG -include pthread.h -I../../../.." -C C/7zip/Compress/LZMA_C -f sqlzma.mk Sqlzma=../../../..
|
||||
%make CFLAGS="%{optflags} -c -I ../../../" -C C/7zip/Compress/LZMA_Alone -f sqlzma.mk Sqlzma=../../../..
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
%makeinstall_std
|
||||
#install -m755 %{SOURCE2} -D %{buildroot}%{_bindir}/lzme
|
||||
|
||||
rm -f %{buildroot}%{_libdir}/*.la
|
||||
|
||||
#symlink to provide backward compatibility for stuff still using old 'lzmash' script
|
||||
#ln -s lzma %{buildroot}%{_bindir}/lzmash
|
||||
install C/7zip/Compress/LZMA_*/*.a %{buildroot}%{_libdir}
|
||||
|
||||
mkdir -p %{buildroot}/usr/src/%{name}-%{version}-%{release}/
|
||||
tar c -C C/7zip/Compress/LZMA_C/kmod . | tar x -C %{buildroot}/usr/src/%{name}-%{version}-%{release}/
|
||||
|
||||
rm -rf %{buildroot}{%{_bindir},%{_mandir}}
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%if %mdkversion < 200900
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
%endif
|
||||
%if %mdkversion < 200900
|
||||
%postun -n %{libname} -p /sbin/ldconfig
|
||||
%endif
|
||||
|
||||
%post -n dkms-%{name}
|
||||
set -x
|
||||
/usr/sbin/dkms --rpm_safe_upgrade add -m %{name} -v %{version}-%{release}
|
||||
/usr/sbin/dkms --rpm_safe_upgrade build -m %{name} -v %{version}-%{release}
|
||||
/usr/sbin/dkms --rpm_safe_upgrade install -m %{name} -v %{version}-%{release}
|
||||
:
|
||||
|
||||
%preun -n dkms-%{name}
|
||||
set -x
|
||||
/usr/sbin/dkms --rpm_safe_upgrade remove -m %{name} -v %{version}-%{release} --all
|
||||
:
|
||||
|
||||
%files -n %{libname}
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/lib*.so.*
|
||||
|
||||
%files -n %{libdev}
|
||||
%defattr(644,root,root,755)
|
||||
%doc *.txt
|
||||
%defattr(-,root,root)
|
||||
%{_includedir}/*.h
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/*.a
|
||||
|
||||
%files -n dkms-%{name}
|
||||
%defattr(-,root,root)
|
||||
/usr/src/%{name}-%{version}-%{release}
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed May 04 2011 Oden Eriksson <oeriksson@mandriva.com> 4.43-31mdv2011.0
|
||||
+ Revision: 666119
|
||||
- mass rebuild
|
||||
|
||||
* Fri Dec 03 2010 Oden Eriksson <oeriksson@mandriva.com> 4.43-30mdv2011.0
|
||||
+ Revision: 606452
|
||||
- rebuild
|
||||
|
||||
* Sun Mar 14 2010 Oden Eriksson <oeriksson@mandriva.com> 4.43-29mdv2010.1
|
||||
+ Revision: 519035
|
||||
- rebuild
|
||||
|
||||
* Thu Sep 03 2009 Christophe Fergeau <cfergeau@mandriva.com> 4.43-28mdv2010.0
|
||||
+ Revision: 426022
|
||||
- rebuild
|
||||
|
||||
* Fri Feb 27 2009 Olivier Blin <oblin@mandriva.com> 4.43-27mdv2009.1
|
||||
+ Revision: 345446
|
||||
- require dkms for dkms subpackage post scripts (fix installation in iurt chroot)
|
||||
|
||||
* Tue Dec 30 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-26mdv2009.1
|
||||
+ Revision: 321390
|
||||
- ditch lzma util since it's now obsoleted by new xz util
|
||||
|
||||
* Sun Dec 21 2008 Oden Eriksson <oeriksson@mandriva.com> 4.43-25mdv2009.1
|
||||
+ Revision: 317045
|
||||
- fix build with -Werror=format-security (P16)
|
||||
|
||||
* Mon Aug 04 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-24mdv2009.0
|
||||
+ Revision: 262910
|
||||
- update to lzma utils 4.32.7
|
||||
|
||||
+ Pixel <pixel@mandriva.com>
|
||||
- do not call ldconfig in %%post/%%postun, it is now handled by filetriggers
|
||||
|
||||
* Thu Apr 24 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-23mdv2009.0
|
||||
+ Revision: 197102
|
||||
- rename library package to name consistent with library name (to
|
||||
make room for new liblzma from new lzma utils)
|
||||
|
||||
* Tue Apr 15 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-22mdv2009.0
|
||||
+ Revision: 194317
|
||||
- fix deprecated string conversion (P15 from OpenSuSE)
|
||||
- build lzma utils with -O3
|
||||
- add diffutils to buildrequires (needed by test suite)
|
||||
- switch to new lzma tarball from upstream
|
||||
|
||||
* Mon Jan 28 2008 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-21mdv2008.1
|
||||
+ Revision: 159136
|
||||
- lzma utils updated to 4.32.5
|
||||
- use zcat in stead of gzcat in lzme (tv)
|
||||
|
||||
+ Olivier Blin <oblin@mandriva.com>
|
||||
- restore BuildRoot
|
||||
|
||||
+ Thierry Vignaud <tv@mandriva.org>
|
||||
- kill re-definition of %%buildroot on Pixel's request
|
||||
|
||||
* Wed Dec 12 2007 Olivier Blin <oblin@mandriva.com> 4.43-20mdv2008.1
|
||||
+ Revision: 119008
|
||||
- fix sqlzma patch to really use lzma instead of zlib when possible, by not passing invalid multithread option since multithread support is disabled
|
||||
- merge additional sqlzma makefiles in main sqlzma patch
|
||||
- regenerate sqlzma patch with gendiff
|
||||
|
||||
* Wed Dec 12 2007 Olivier Blin <oblin@mandriva.com> 4.43-19mdv2008.1
|
||||
+ Revision: 118764
|
||||
- update sqlzma patch and header to be in sync with squashfs-tools (with workarounds to build with lzma443)
|
||||
|
||||
* Mon Dec 10 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-18mdv2008.1
|
||||
+ Revision: 117014
|
||||
- new release: lzma utils 4.32.4
|
||||
- rediff text tune patch (P9)
|
||||
- drop liblzmadec fix patch (P14, merged upstream)
|
||||
- bashism in script requires bash as interpreter for lzme, also fix to
|
||||
work with BSD 'du' (thx to Anders F Bj?\195?\182rklund)
|
||||
|
||||
* Mon Dec 03 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-17mdv2008.1
|
||||
+ Revision: 114648
|
||||
- fix a bug in liblzmadec that could lead to crashes with KDE (P14)
|
||||
|
||||
* Fri Nov 30 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-16mdv2008.1
|
||||
+ Revision: 114105
|
||||
- update to lzma utils 4.32.3
|
||||
- compile all with %%{optflags}
|
||||
- run checks
|
||||
|
||||
+ Thierry Vignaud <tv@mandriva.org>
|
||||
- description is not about _patches_ on _anoter_ package
|
||||
|
||||
* Wed Nov 14 2007 Olivier Blin <oblin@mandriva.com> 4.43-15mdv2008.1
|
||||
+ Revision: 108859
|
||||
- build dkms-lzma
|
||||
- run ldconfig in post/postun of library package
|
||||
|
||||
* Mon Nov 05 2007 Herton Ronaldo Krzesinski <herton@mandriva.com.br> 4.43-14mdv2008.1
|
||||
+ Revision: 106110
|
||||
- Added patch from Andrey Borzenkov that fixes #35309 (lzma always
|
||||
creates output with 0600 permissions).
|
||||
|
||||
* Sat Oct 27 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-13mdv2008.1
|
||||
+ Revision: 102612
|
||||
- update lzma utils to 4.32.2 (P12 is to sync newer sdk with changes to the
|
||||
old shipped with 4.32.2)
|
||||
- drop P11 (merged upstream)
|
||||
- fix include of sys/types.h in lzmadec.h for build without stdio (P11)
|
||||
|
||||
* Tue Jul 24 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-12mdv2008.0
|
||||
+ Revision: 54873
|
||||
- update to lzma utils 4.32.0beta4
|
||||
- drop P10 (merged upstream)
|
||||
|
||||
* Mon Jul 23 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-11mdv2008.0
|
||||
+ Revision: 54869
|
||||
- fix output to stdout (P11, fixes #32058)
|
||||
|
||||
* Fri Jun 22 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-10mdv2008.0
|
||||
+ Revision: 43072
|
||||
- add special tuning for text files, parameter: '--text' (P9)
|
||||
|
||||
* Sun Jun 10 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-9mdv2008.0
|
||||
+ Revision: 37873
|
||||
- put back library as some tools provided relying on it still migth be of
|
||||
interest for some
|
||||
|
||||
* Sun Jun 10 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-7mdv2008.0
|
||||
+ Revision: 37742
|
||||
- drop liblzmadec as adviced by upstream, it'll be replaced by another lib anyways
|
||||
- use default ratio (-7) for compression with lzma in stead of (-9) due to the huge
|
||||
amount of additional time and resources needed without much benefit added
|
||||
|
||||
* Fri Jun 08 2007 Per Øyvind Karlsen <peroyvind@mandriva.org> 4.43-6mdv2008.0
|
||||
+ Revision: 37504
|
||||
- kill of debian patch, move relevant parts into separate patches and make them work
|
||||
- fix version defined
|
||||
|
||||
* Thu Jun 07 2007 Anssi Hannula <anssi@mandriva.org> 4.43-5mdv2008.0
|
||||
+ Revision: 36225
|
||||
- rebuild with correct optflags
|
||||
|
||||
+ Per Øyvind Karlsen <peroyvind@mandriva.org>
|
||||
- sync lzmp patch with debian:
|
||||
o include <cstdlib> to be able to build with GCC 4.3. (Martin Michlmayr)
|
||||
o use hc4 for -1 option, as hc3 is no more built in the SDK. (Lasse Collin)
|
||||
- don't always output copyright notice (P5 from PLD)
|
||||
- add missing config.h header to sdk (missing due to my fugly merge with latest sdk ;)
|
||||
|
||||
|
||||
* Wed Mar 07 2007 Olivier Blin <oblin@mandriva.com> 4.43-2mdv2007.0
|
||||
+ Revision: 134182
|
||||
- buildrequires zlib-devel for squashfs-lzma library
|
||||
- add uncompression static library (from squashfs-lzma.org)
|
||||
|
||||
* Mon Feb 12 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 4.43-1mdv2007.1
|
||||
+ Revision: 118885
|
||||
- update to 4.43 of sdk and 4.32.0beta3 of tools
|
||||
lzmash is now dead, replace with 'lzma'
|
||||
new lib for decoding
|
||||
- Import lzma
|
||||
|
||||
* Sun Jan 08 2006 Giuseppe Ghibò <ghibo@mandriva.com> 4.32-1mdk
|
||||
- updated lzma sdk to 4.32.
|
||||
- added lzme (based on Thierry Vignaud's bzme).
|
||||
|
||||
* Sat Jan 07 2006 Giuseppe Ghibò <ghibo@mandriva.com> 4.27.1-1mdk
|
||||
- initial Mandriva release.
|
||||
|
83
sqlzma.h
Normal file
83
sqlzma.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright (C) 2006 Junjiro Okajima
|
||||
* Copyright (C) 2006 Tomas Matejicek, slax.org
|
||||
*
|
||||
* LICENSE follows the described one in lzma.
|
||||
*/
|
||||
|
||||
/* $Id: sqlzma.h,v 1.15 2007/11/09 14:42:12 jro Exp $ */
|
||||
|
||||
#ifndef __sqlzma_h__
|
||||
#define __sqlzma_h__
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
#ifdef _REENTRANT
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#else
|
||||
#include <linux/zlib.h>
|
||||
#endif
|
||||
#define _7ZIP_BYTE_DEFINED
|
||||
|
||||
/*
|
||||
* detect the compression method automatically by the first byte of compressed
|
||||
* data.
|
||||
* according to rfc1950, the first byte of zlib compression must be 0x?8.
|
||||
*/
|
||||
#define is_lzma(c) (c == 0x5d)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/* for mksquashfs only */
|
||||
struct sqlzma_opts {
|
||||
unsigned int try_lzma:1;
|
||||
unsigned int dicsize;
|
||||
};
|
||||
int sqlzma_cm(struct sqlzma_opts *opts, z_stream *stream, Bytef *next_in, uInt
|
||||
avail_in, Bytef *next_out, uInt avail_out);
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/*
|
||||
* Three patterns for sqlzma uncompression. very dirty code.
|
||||
* - kernel space (squashfs kernel module)
|
||||
* - user space with pthread (mksquashfs)
|
||||
* - user space without pthread (unsquashfs)
|
||||
*/
|
||||
|
||||
struct sized_buf {
|
||||
unsigned int sz;
|
||||
unsigned char *buf;
|
||||
};
|
||||
|
||||
enum {SQUN_PROB, SQUN_RESULT, SQUN_LAST};
|
||||
struct sqlzma_un {
|
||||
int un_lzma;
|
||||
struct sized_buf un_a[SQUN_LAST];
|
||||
unsigned char un_prob[31960]; /* unlzma 64KB - 1MB */
|
||||
z_stream un_stream;
|
||||
#define un_cmbuf un_stream.next_in
|
||||
#define un_cmlen un_stream.avail_in
|
||||
#define un_resbuf un_stream.next_out
|
||||
#define un_resroom un_stream.avail_out
|
||||
#define un_reslen un_stream.total_out
|
||||
};
|
||||
|
||||
int sqlzma_init(struct sqlzma_un *un, int do_lzma, unsigned int res_sz);
|
||||
int sqlzma_un(struct sqlzma_un *un, struct sized_buf *src, struct sized_buf *dst);
|
||||
void sqlzma_fin(struct sqlzma_un *un);
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
#endif
|
Loading…
Add table
Reference in a new issue