SHA256
1
0
forked from pool/lzma-sdk

Accepting request 487925 from home:alois:branches:Archiving

OBS-URL: https://build.opensuse.org/request/show/487925
OBS-URL: https://build.opensuse.org/package/show/Archiving/lzma-sdk?expand=0&rev=1
This commit is contained in:
Martin Pluskal 2017-04-14 07:43:12 +00:00 committed by Git OBS Bridge
commit 587b0a97f0
7 changed files with 615 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,419 @@
Index: lzma1604/C/LzmaDec.c
===================================================================
--- lzma1604.orig/C/LzmaDec.c
+++ lzma1604/C/LzmaDec.c
@@ -7,123 +7,10 @@
#include <string.h>
-#define kNumTopBits 24
-#define kTopValue ((UInt32)1 << kNumTopBits)
-
-#define kNumBitModelTotalBits 11
-#define kBitModelTotal (1 << kNumBitModelTotalBits)
-#define kNumMoveBits 5
-
-#define RC_INIT_SIZE 5
-
-#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
-#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
-#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
- { UPDATE_0(p); i = (i + i); A0; } else \
- { UPDATE_1(p); i = (i + i) + 1; A1; }
-#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
-
-#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
-#define TREE_DECODE(probs, limit, i) \
- { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
-
-/* #define _LZMA_SIZE_OPT */
-
-#ifdef _LZMA_SIZE_OPT
-#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
-#else
-#define TREE_6_DECODE(probs, i) \
- { i = 1; \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- TREE_GET_BIT(probs, i); \
- i -= 0x40; }
-#endif
-
-#define NORMAL_LITER_DEC GET_BIT(prob + symbol, symbol)
-#define MATCHED_LITER_DEC \
- matchByte <<= 1; \
- bit = (matchByte & offs); \
- probLit = prob + offs + bit + symbol; \
- GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
-
-#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
-
-#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-#define UPDATE_0_CHECK range = bound;
-#define UPDATE_1_CHECK range -= bound; code -= bound;
-#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
- { UPDATE_0_CHECK; i = (i + i); A0; } else \
- { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
-#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
-#define TREE_DECODE_CHECK(probs, limit, i) \
- { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
-
-
-#define kNumPosBitsMax 4
-#define kNumPosStatesMax (1 << kNumPosBitsMax)
-
-#define kLenNumLowBits 3
-#define kLenNumLowSymbols (1 << kLenNumLowBits)
-#define kLenNumMidBits 3
-#define kLenNumMidSymbols (1 << kLenNumMidBits)
-#define kLenNumHighBits 8
-#define kLenNumHighSymbols (1 << kLenNumHighBits)
-
-#define LenChoice 0
-#define LenChoice2 (LenChoice + 1)
-#define LenLow (LenChoice2 + 1)
-#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
-
-
-#define kNumStates 12
-#define kNumLitStates 7
-
-#define kStartPosModelIndex 4
-#define kEndPosModelIndex 14
-#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-
-#define kNumPosSlotBits 6
-#define kNumLenToPosStates 4
-
-#define kNumAlignBits 4
-#define kAlignTableSize (1 << kNumAlignBits)
-
-#define kMatchMinLen 2
-#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-
-#define IsMatch 0
-#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-#define IsRepG0 (IsRep + kNumStates)
-#define IsRepG1 (IsRepG0 + kNumStates)
-#define IsRepG2 (IsRepG1 + kNumStates)
-#define IsRep0Long (IsRepG2 + kNumStates)
-#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-#define LenCoder (Align + kAlignTableSize)
-#define RepLenCoder (LenCoder + kNumLenProbs)
-#define Literal (RepLenCoder + kNumLenProbs)
-
-#define LZMA_BASE_SIZE 1846
-#define LZMA_LIT_SIZE 0x300
-
#if Literal != LZMA_BASE_SIZE
StopCompilingDueBUG
#endif
-#define LzmaProps_GetNumProbs(p) (Literal + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
-
-#define LZMA_DIC_MIN (1 << 12)
-
/* First LZMA-symbol is always decoded.
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
Out:
@@ -782,7 +669,7 @@ void LzmaDec_InitDicAndState(CLzmaDec *p
p->needInitState = 1;
}
-void LzmaDec_Init(CLzmaDec *p)
+MY_EXTERN_C void LzmaDec_Init(CLzmaDec *p)
{
p->dicPos = 0;
LzmaDec_InitDicAndState(p, True, True);
@@ -800,7 +687,7 @@ static void LzmaDec_InitStateReal(CLzmaD
p->needInitState = 0;
}
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
+MY_EXTERN_C SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
ELzmaFinishMode finishMode, ELzmaStatus *status)
{
SizeT inSize = *srcLen;
@@ -975,7 +862,7 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, By
}
}
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
+MY_EXTERN_C void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
{
alloc->Free(alloc, p->probs);
p->probs = NULL;
@@ -1019,7 +906,7 @@ SRes LzmaProps_Decode(CLzmaProps *p, con
return SZ_OK;
}
-static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
+MY_EXTERN_C SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
{
UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
if (!p->probs || numProbs != p->numProbs)
Index: lzma1604/C/LzmaDec.h
===================================================================
--- lzma1604.orig/C/LzmaDec.h
+++ lzma1604/C/LzmaDec.h
@@ -6,6 +6,8 @@
#include "7zTypes.h"
+#include "../CPP/Common/MyGuidDef.h"
+
EXTERN_C_BEGIN
/* #define _LZMA_PROB32 */
@@ -18,6 +20,118 @@ EXTERN_C_BEGIN
#define CLzmaProb UInt16
#endif
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+#define RC_INIT_SIZE 5
+
+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
+ { UPDATE_0(p); i = (i + i); A0; } else \
+ { UPDATE_1(p); i = (i + i) + 1; A1; }
+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
+
+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
+#define TREE_DECODE(probs, limit, i) \
+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
+
+/* #define _LZMA_SIZE_OPT */
+
+#ifdef _LZMA_SIZE_OPT
+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
+#else
+#define TREE_6_DECODE(probs, i) \
+ { i = 1; \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ TREE_GET_BIT(probs, i); \
+ i -= 0x40; }
+#endif
+
+#define NORMAL_LITER_DEC GET_BIT(prob + symbol, symbol)
+#define MATCHED_LITER_DEC \
+ matchByte <<= 1; \
+ bit = (matchByte & offs); \
+ probLit = prob + offs + bit + symbol; \
+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
+
+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0_CHECK range = bound;
+#define UPDATE_1_CHECK range -= bound; code -= bound;
+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
+ { UPDATE_0_CHECK; i = (i + i); A0; } else \
+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
+#define TREE_DECODE_CHECK(probs, limit, i) \
+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
+
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
+
+
+#define kNumStates 12
+#define kNumLitStates 7
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 0x300
+
+#define LzmaProps_GetNumProbs(p) (Literal + ((UInt32)LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
+
+#define LZMA_DIC_MIN (1 << 12)
/* ---------- LZMA Properties ---------- */
@@ -68,7 +182,7 @@ typedef struct
#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
-void LzmaDec_Init(CLzmaDec *p);
+MY_EXTERN_C void LzmaDec_Init(CLzmaDec *p);
/* There are two types of LZMA streams:
0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
@@ -128,9 +242,11 @@ LzmaDec_Allocate* can return:
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_UNSUPPORTED - Unsupported properties
*/
-
+
+MY_EXTERN_C SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc);
+
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
-void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
+MY_EXTERN_C void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
@@ -176,7 +292,7 @@ Returns:
SZ_ERROR_DATA - Data error
*/
-SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
+MY_EXTERN_C SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
Index: lzma1604/C/LzmaEnc.c
===================================================================
--- lzma1604.orig/C/LzmaEnc.c
+++ lzma1604/C/LzmaEnc.c
@@ -47,7 +47,7 @@ static unsigned g_STAT_OFFSET = 0;
#define kNumBitPriceShiftBits 4
#define kBitPrice (1 << kNumBitPriceShiftBits)
-void LzmaEncProps_Init(CLzmaEncProps *p)
+MY_EXTERN_C void LzmaEncProps_Init(CLzmaEncProps *p)
{
p->level = 5;
p->dictSize = p->mc = 0;
@@ -2328,7 +2328,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
}
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+MY_EXTERN_C SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
{
Index: lzma1604/C/LzmaEnc.h
===================================================================
--- lzma1604.orig/C/LzmaEnc.h
+++ lzma1604/C/LzmaEnc.h
@@ -6,6 +6,8 @@
#include "7zTypes.h"
+#include "../CPP/Common/MyGuidDef.h"
+
EXTERN_C_BEGIN
#define LZMA_PROPS_SIZE 5
@@ -30,7 +32,7 @@ typedef struct _CLzmaEncProps
int numThreads; /* 1 or 2, default = 2 */
} CLzmaEncProps;
-void LzmaEncProps_Init(CLzmaEncProps *p);
+MY_EXTERN_C void LzmaEncProps_Init(CLzmaEncProps *p);
void LzmaEncProps_Normalize(CLzmaEncProps *p);
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
@@ -69,7 +71,7 @@ Return code:
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
-SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+MY_EXTERN_C SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
Index: lzma1604/CPP/7zip/Bundles/LzmaCon/makefile.gcc
===================================================================
--- lzma1604.orig/CPP/7zip/Bundles/LzmaCon/makefile.gcc
+++ lzma1604/CPP/7zip/Bundles/LzmaCon/makefile.gcc
@@ -1,7 +1,8 @@
-PROG = lzma
-CXX = g++ -O2
-# -Wall -Werror -Wno-delete-non-virtual-dtor
-CXX_C = gcc -O2 -Wall -Werror
+LIBRARY = liblzmasdk.so
+LIBRARYMINOR = $(LIBRARY).__LIBMAJ__
+LIBRARYMAJOR = $(LIBRARYMINOR).__LIBMIN__
+CXX = g++ $(RPM_OPT_FLAGS) -Wall -fPIC
+CXX_C = g++ $(RPM_OPT_FLAGS) -Wall -fPIC
ifdef SystemDrive
IS_MINGW = 1
@@ -72,10 +73,10 @@ OBJS = \
Lzma86Enc.o \
-all: $(PROG)
+all: $(LIBRARYMAJOR)
-$(PROG): $(OBJS)
- $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB2)
+$(LIBRARYMAJOR): $(OBJS)
+ $(CXX) -o $(LIBRARYMAJOR) -shared -Wl,-soname=$(LIBRARYMINOR) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
LzmaAlone.o: LzmaAlone.cpp
$(CXX) $(CFLAGS) LzmaAlone.cpp
@@ -192,4 +193,5 @@ Lzma86Enc.o: ../../../../C/Lzma86Enc.c
$(CXX_C) $(CFLAGS) ../../../../C/Lzma86Enc.c
clean:
- -$(RM) $(PROG) $(OBJS)
+ -$(RM) $(LIBRARYMAJOR) $(OBJS)
+

41
lzma-sdk-LICENSE.fedora Normal file
View File

@ -0,0 +1,41 @@
Subject: Re: Licensing of lzma-sdk
From: "Igor Pavlov" <supp@7-zip.org>
Date: Tue, 5 Apr 2011 23:11:30 +0600
To: "Tom Callaway" <tcallawa@redhat.com>
Hello!
I use LGPL 2.1 for 7-Zip.
Thanks!
--
Igor Pavlov
http://www.7-zip.org
Compression software
----- Original Message -----
From: "Tom Callaway" <tcallawa@redhat.com>
To: "Igor Pavlov" <supp@7-zip.org>
Sent: Tuesday, April 05, 2011 9:47 PM
Subject: Re: Licensing of lzma-sdk
> On 04/05/2011 11:28 AM, Igor Pavlov wrote:
>> Hello!
>>
>> 1) Russian law probably can have many problems.
>> Maybe there is some "public domain" limitation there. If so, I hope the
>> law will be fixed in future.
>> Now I just don't care about it.
>>
>> 2) I used GNU LGPL in old versions of LZMA SDK.
>> If you are OK with GNU LGPL rules, you can use it.
>> I can add the note to my site.
>
> GNU LGPL is fine, do you have any preference on version?
>
> ~tom
>
> ==
> Fedora Project

5
lzma-sdk.changes Normal file
View File

@ -0,0 +1,5 @@
-------------------------------------------------------------------
Fri Mar 17 09:25:07 UTC 2017 - aloisio@gmx.com
- Initial package (version 16.04)

123
lzma-sdk.spec Normal file
View File

@ -0,0 +1,123 @@
#
# spec file for package lzma-sdk
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define _sver 1604
%define _maver 16
%define _miver 04
Name: lzma-sdk
Version: 16.04
Release: 0
Summary: SDK for lzma compression
# Actually the site says "Public Domain". See license file.
License: LGPL-2.1
Group: Productivity/Archiving/Compression
Url: http://www.7-zip.org/sdk.html
Source0: http://www.7-zip.org/a/lzma%{_sver}.7z
Source1: lzma-sdk-LICENSE.fedora
Patch0: lzma-sdk-16.04-sharedlib.patch
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: p7zip
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
LZMA SDK provides the documentation, samples, header files, libraries,
and tools you need to develop applications that use LZMA compression.
LZMA is default and general compression method of 7z format
in 7-Zip compression program (www.7-zip.org). LZMA provides high
compression ratio and very fast decompression.
LZMA is an improved version of famous LZ77 compression algorithm.
It was improved in way of maximum increasing of compression ratio,
keeping high decompression speed and low memory requirements for
decompressing.
%package devel
Summary: Development libraries and headers for %{name}
Group: Development/Languages/C and C++
Requires: liblzmasdk%{_maver} = %{version}
%description devel
This package contains development libraries and headers for %{name}.
%package -n liblzmasdk%{_maver}
Summary: 7zip lzma library
Group: Productivity/Archiving/Compression
%description -n liblzmasdk%{_maver}
Library for encoding/decoding lzma files from the 7zip project.
%prep
%setup -q -c -n lzma%{_sver}
%patch0 -p1
sed -e 's/__LIBMAJ__/%{_maver}/' \
-e 's/__LIBMIN__/%{_miver}/' \
-i CPP/7zip/Bundles/LzmaCon/makefile.gcc
dos2unix DOC/*.txt
install -p -m 0644 %{SOURCE1} .
%build
cd CPP/7zip/Bundles/LzmaCon
make %{?_smp_mflags} -f makefile.gcc clean all
%install
mkdir -p %{buildroot}%{_libdir}
install -m0755 CPP/7zip/Bundles/LzmaCon/liblzmasdk.so.%{_maver}.%{_miver} %{buildroot}%{_libdir}
pushd %{buildroot}%{_libdir}
ln -s liblzmasdk.so.%{version} liblzmasdk.so.%{_maver}
ln -s liblzmasdk.so.%{version} liblzmasdk.so
popd
mkdir -p %{buildroot}/%{_includedir}/lzma%{_sver}/
find -iname '*.h' | xargs -I {} install -m0644 -D {} %{buildroot}/%{_includedir}/lzma-sdk/{}
# creates support file for pkg-config
mkdir %{buildroot}/%{_libdir}/pkgconfig
tee %{buildroot}/%{_libdir}/pkgconfig/lzma-sdk.pc << "EOF"
prefix=%{_prefix}
exec_prefix=${prefix}
libdir=${exec_prefix}/%{_lib}
includedir=${prefix}/include
Name: lzma-sdk
Description: SDK for lzma compression
Version: %{version}
Libs: -L${libdir} -llzmasdk
Cflags: -I${includedir}/lzma-sdk
EOF
%fdupes -s %{buildroot}/%{_includedir}/lzma-sdk
%post -n liblzmasdk%{_maver} -p /sbin/ldconfig
%postun -n liblzmasdk%{_maver} -p /sbin/ldconfig
%files -n liblzmasdk%{_maver}
%defattr(-,root,root)
%doc DOC/lzma.txt DOC/lzma-history.txt lzma-sdk-LICENSE.fedora
%{_libdir}/liblzmasdk.so.%{_maver}.%{_miver}
%{_libdir}/liblzmasdk.so.%{_maver}
%files devel
%defattr(-,root,root)
%doc DOC/7z*.txt DOC/Methods.txt lzma-sdk-LICENSE.fedora
%{_includedir}/lzma-sdk/
%{_libdir}/liblzmasdk.so
%{_libdir}/pkgconfig/lzma-sdk.pc
%changelog

3
lzma1604.7z Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:edf8690e9d5ae0dbe80751e3df247bb4e1b497b100c4af5b95fc50a5c2e5b04f
size 971074