File upx.spec of Package upx

#
# spec file for package upx
#
# Copyright (c) 2013 SUSE LINUX Products 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/
#


Name:           upx
Version:        3.09
Release:        0
Summary:        The Ultimate Packer for eXecutables
License:        GPL-2.0+
Group:          Development/Tools/Other
Url:            http://upx.sourceforge.net/
Source:         http://upx.sourceforge.net/download/%{name}-%{version}-src.tar.bz2
Source1:        http://sourceforge.net/projects/sevenzip/files/LZMA%20SDK/4.43/lzma443.tar.bz2
Patch0:         %{name}-3.03_ia64-endianity.patch
# PATCH-FIX-UPSTREAM upx-aarch64.patch schwab@suse.de -- Support for AArch64
Patch1:         upx-aarch64.patch
BuildRequires:  gcc-c++
BuildRequires:  libucl1-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
UPX is a free, portable, extendable, high-performance executable packer
for several different executable formats. It achieves an excellent
compression ratio and offers very fast decompression. Your executables
suffer no memory overhead or other drawbacks.

%prep
%setup -q -n %{name}-%{version}-src
%patch0
%patch1 -p1

pushd %{_builddir}
mkdir lzma-4.43
pushd lzma-4.43
tar xf %{S:1}
popd
popd

# BSD-4 clause licensed file, remove just in case bnc#753791
rm src/stub/src/i386-dos32.djgpp2-stubify.asm

%build
export UPX_LZMADIR=%{_builddir}/lzma-4.43
export UPX_LZMA_VERSION=0x443
export UPX_UCLDIR=%{_prefix}

make -C src CXXFLAGS="%{optflags}"
make -C doc

%install
install -D -m 0755 src/upx.out %{buildroot}%{_bindir}/upx
install -D -m 0644 doc/upx.1 %{buildroot}%{_mandir}/man1/upx.1

%files
%defattr(-, root, root)
%doc BUGS COPYING LICENSE NEWS PROJECTS README README.SRC THANKS
%doc doc/upx.html
%doc %{_mandir}/man1/*
%{_bindir}/*

%changelog
openSUSE Build Service is sponsored by