##
##  lzma.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_opkg      9.07
%define       V_sdk       907

#   package information
Name:         lzma
Summary:      Lempel-Ziv-Markov Algorithm (LZMA) Compression
URL:          http://tukaani.org/lzma/
Vendor:       Igor Pavlov, Lasse Collin
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Compression
License:      LGPL
Version:      %{V_opkg}
Release:      20090830

#   list of sources
Source0:      http://download.sourceforge.net/sevenzip/7z%{V_sdk}.tar.bz2

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, make, gcc, gcc::with_cxx = yes
PreReq:       OpenPKG, openpkg >= 20160101

%description
    Simple command line implementation of LZMA compression algorithm.
    This tool uses raw LZMA format as opposed to 7z container format,
    which uses LZMA as the default compression algorithm, but has
    many additional features and a header incompatible to that of raw
    LZMA streams. If you need to create highly-compatible archives,
    you probably want to use p7zip(1). lzma(1) is taken from the LZMA
    SDK. Compression ratio is about 25-30% better than bzip2(1) and
    decompression speed is about two times faster. The downside is
    higher CPU and RAM requirements for compression.

%track
    prog lzma = {
        version   = %{V_sdk}
        url       = http://sourceforge.net/projects/sevenzip/files/
        regex     = 7z(__VER__)\.tar\.bz2
    }

%prep
    %setup -q -c

%build
    ( cd CPP/7zip/Compress/LZMA_Alone
      %{l_make} %{l_mflags} -f makefile.gcc \
          CXX="%{l_cxx} %{l_cxxflags -O} -D_LZMA_SYSTEM_SIZE_T" \
          CXX_C="%{l_cc} %{l_cflags -O} -D_LZMA_SYSTEM_SIZE_T"
    ) || exit $?

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin
    %{l_shtool} install -c -s -m 755 \
        CPP/7zip/Compress/LZMA_Alone/lzma \
        $RPM_BUILD_ROOT%{l_prefix}/bin/lzma-7z
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

