[upx] Unbundle lzma-sdk.

Jon Ciesla limb at fedoraproject.org
Wed Nov 30 13:23:37 UTC 2011


commit d93f4dd94798ec22d6aa14b13a972b3f5ba22c3e
Author: Jon Ciesla <limb at jcomserv.net>
Date:   Wed Nov 30 07:23:16 2011 -0600

    Unbundle lzma-sdk.

 upx-3.07-use-lzma-sdk-lib.patch |  100 +++++++++++++++++++++++++++++++++++++++
 upx.spec                        |   14 ++++--
 2 files changed, 109 insertions(+), 5 deletions(-)
---
diff --git a/upx-3.07-use-lzma-sdk-lib.patch b/upx-3.07-use-lzma-sdk-lib.patch
new file mode 100644
index 0000000..13ccfc3
--- /dev/null
+++ b/upx-3.07-use-lzma-sdk-lib.patch
@@ -0,0 +1,100 @@
+diff -up upx-3.07-src/src/compress_lzma.cpp.use-lib upx-3.07-src/src/compress_lzma.cpp
+--- upx-3.07-src/src/compress_lzma.cpp.use-lib	2010-09-08 11:07:00.000000000 -0400
++++ upx-3.07-src/src/compress_lzma.cpp	2011-08-09 14:43:45.097077927 -0400
+@@ -232,8 +232,6 @@ error:
+ #if (WITH_LZMA >= 0x461)
+ #define kLiteralNextStates kLiteralNextStates_enc
+ #include "C/LzmaEnc.h"
+-#include "C/LzmaEnc.c"
+-#include "C/LzFind.c"
+ #undef kLiteralNextStates
+ #undef kNumFullDistances
+ 
+@@ -340,11 +338,9 @@ error:
+ #undef _NO_EXCEPTIONS
+ #if (WITH_LZMA >= 0x449)
+ #  define INITGUID 1
+-//#  include "CPP/7zip/Compress/LZMA/LZMADecoder.h"
+ #  include "CPP/7zip/Compress/LZMA/LZMAEncoder.h"
+ #else
+ #  include "C/Common/MyInitGuid.h"
+-//#  include "C/7zip/Compress/LZMA/LZMADecoder.h"
+ #  include "C/7zip/Compress/LZMA/LZMAEncoder.h"
+ #endif
+ 
+@@ -416,29 +412,6 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(
+ #  pragma warning(disable: 424)         // #424: extra ";" ignored
+ #endif
+ 
+-#if (WITH_LZMA >= 0x449)
+-#  include "C/Alloc.c"
+-#  include "C/7zCrc.c"
+-#  include "C/Compress/Lz/MatchFinder.c"
+-//#  include "CPP/7zip/Common/InBuffer.cpp"
+-#  include "CPP/7zip/Common/OutBuffer.cpp"
+-#  include "CPP/7zip/Common/StreamUtils.cpp"
+-//#  include "CPP/7zip/Compress/LZ/LZOutWindow.cpp"
+-//#  include "CPP/7zip/Compress/LZMA/LZMADecoder.cpp"
+-#  include "CPP/7zip/Compress/LZMA/LZMAEncoder.cpp"
+-#  include "CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
+-#else
+-#  include "C/Common/Alloc.cpp"
+-#  include "C/Common/CRC.cpp"
+-//#  include "C/7zip/Common/InBuffer.cpp"
+-#  include "C/7zip/Common/OutBuffer.cpp"
+-#  include "C/7zip/Common/StreamUtils.cpp"
+-#  include "C/7zip/Compress/LZ/LZInWindow.cpp"
+-//#  include "C/7zip/Compress/LZ/LZOutWindow.cpp"
+-//#  include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
+-#  include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
+-#  include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
+-#endif
+ #undef RC_NORMALIZE
+ 
+ 
+@@ -563,7 +536,6 @@ error:
+ 
+ #undef _LZMA_PROB32
+ #include "C/LzmaDec.h"
+-#include "C/LzmaDec.c"
+ 
+ 
+ int upx_lzma_decompress    ( const upx_bytep src, unsigned  src_len,
+@@ -662,10 +634,8 @@ error:
+ #undef _LZMA_LOC_OPT
+ #if (WITH_LZMA >= 0x449)
+ #  include "C/Compress/Lzma/LzmaDecode.h"
+-#  include "C/Compress/Lzma/LzmaDecode.c"
+ #else
+ #  include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
+-#  include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
+ #endif
+ 
+ int upx_lzma_decompress    ( const upx_bytep src, unsigned  src_len,
+diff -up upx-3.07-src/src/Makefile.use-lib upx-3.07-src/src/Makefile
+--- upx-3.07-src/src/Makefile.use-lib	2011-08-09 14:44:35.619476678 -0400
++++ upx-3.07-src/src/Makefile	2011-08-09 14:44:10.731772723 -0400
+@@ -57,7 +57,7 @@ ifneq ($(wildcard $(UPX_UCLDIR)/include/
+ INCLUDES += -I$(UPX_UCLDIR)/include
+ LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
+ endif
+-LIBS += -lucl -lz
++LIBS += -lucl -lz -llzmasdk
+ # you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK
+ include $(top_srcdir)/src/stub/src/c/Makevars.lzma
+ ifneq ($(UPX_LZMA_VERSION),)
+diff -up upx-3.07-src/src/stub/src/c/lzma_d_c.c.use-lib upx-3.07-src/src/stub/src/c/lzma_d_c.c
+--- upx-3.07-src/src/stub/src/c/lzma_d_c.c.use-lib	2010-09-08 11:07:00.000000000 -0400
++++ upx-3.07-src/src/stub/src/c/lzma_d_c.c	2011-08-09 14:43:45.098077915 -0400
+@@ -100,11 +100,6 @@ int LzmaDecode(CLzmaDecoderState *, cons
+ #if (ACC_CC_BORLANDC)
+ #include "LzmaDecode.c"
+ #else
+-#if (WITH_LZMA >= 0x449)
+-#  include "C/Compress/Lzma/LzmaDecode.c"
+-#else
+-#  include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
+-#endif
+ #endif
+ #undef char
+ #undef CLzmaDecoderState
diff --git a/upx.spec b/upx.spec
index ecdc13c..491faa9 100644
--- a/upx.spec
+++ b/upx.spec
@@ -1,18 +1,20 @@
 Name:           upx
 Version:        3.07
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Ultimate Packer for eXecutables
 
 Group:          Applications/Archiving
 License:        GPLv2+ and Public Domain
 URL:            http://upx.sourceforge.net/
 Source0:        http://upx.sourceforge.net/download/%{name}-%{version}-src.tar.bz2
-Source1:	http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2
 #Patch0:		upx-3.03-pefile-strictproto.patch
+Patch1:		upx-3.07-use-lzma-sdk-lib.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+
 BuildRequires:  ucl-devel >= 1.01
 BuildRequires:  zlib-devel
+BuildRequires:	lzma-sdk-devel
 
 %description
 UPX is a free, portable, extendable, high-performance executable
@@ -24,14 +26,13 @@ executables suffer no memory overhead or other drawbacks.
 %prep
 %setup -q -n %{name}-%{version}-src
 sed -i -e 's/ -O2/ /' -e 's/ -Werror//' src/Makefile
-mkdir lzma465
-tar xfj  ../../SOURCES/lzma465.tar.bz2 -C lzma465
 
 #%patch0 -p0
+%patch1 -p1 -b .use-lib
 
 %build
 export CXXFLAGS="$RPM_OPT_FLAGS" # export, not to make so it won't trump all
-UPX_LZMA_VERSION=0x465 UPX_LZMADIR=../lzma465 make %{?_smp_mflags} -C src
+UPX_LZMA_VERSION=0x465 UPX_LZMADIR=%{_includedir}/lzma465 make %{?_smp_mflags} -C src
 make -C doc
 
 
@@ -53,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Aug 09 2011 Tom Callaway <spot at fedoraproject.org> - 3.07-3
+- use lzma-sdk system library/headers
+
 * Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.07-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list