##
##  stuffit.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_real 5.2.0.611
%define       V_dist 520.611

#   package information
Name:         stuffit
Summary:      StuffIt Expander
URL:          http://www.stuffit.com/
Vendor:       Aladdin Systems, Inc.
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Archiver
License:      Commercial/Free-Trial
Version:      %{V_real}
Release:      20080101

#   list of sources
Source0:      http://www.aladdinsys.com/downloads/files/stuffit%{V_dist}solaris-i386.tar.gz
Source1:      http://www.aladdinsys.com/downloads/files/stuffit%{V_dist}solaris-sparc.tar.gz
Source2:      http://www.aladdinsys.com/downloads/files/stuffit%{V_dist}linux-i386.tar.gz
%NoSource     0
%NoSource     1
%NoSource     2

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101

%description
    Stuffit is a compression technology that archives or unarchives
    encoded files in multiple compressed and encoded formats. The stuff
    command takes a list of files and directories on its command line
    and compresses them into an archive or encodes them. The unstuff
    command expands archives and decodes encoded files in multiple
    compressed and encoded formats.

%track
    prog stuffit = {
        disabled
        comment   = "ms: HTTP server disallows directory listing"
        version   = %{version}
        url       = http://www.aladdinsys.com/downloads/files/
        regex     = stuffit(__VER__)linux-i386\.tar\.gz
    }

%prep
    %setup -q -T -c
    case "%{l_platform -t}" in
        ix86-sunos*           ) %{l_gzip} -dc %{SOURCE0} | %{l_tar} xf - ;;
        sun*-sunos*           ) %{l_gzip} -dc %{SOURCE1} | %{l_tar} xf - ;;
        *-linux* | *-freebsd* ) %{l_gzip} -dc %{SOURCE2} | %{l_tar} xf - ;;
        * ) echo "Sorry, platform %{l_platform -t} not supported" 1>&2; exit 1 ;;
    esac

%build
    #   optionally brand executables
    case "%{l_platform -t}" in
        *-freebsd* ) brandelf -t Linux bin/* ;;
    esac

%install

    #   construct installation hierarchy
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/man/man1

    #   install files to their target locations
    %{l_shtool} install -c -m 755 \
        bin/* $RPM_BUILD_ROOT%{l_prefix}/bin/
    %{l_shtool} install -c -m 644 \
        man/man1/* $RPM_BUILD_ROOT%{l_prefix}/man/man1/

    #   remove the too generic register command
    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/register

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

