##
##  mkisofs.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 versions
%define       V_mkisofs  2.0.3
%define       V_cdrtools 3.00

#   package information
Name:         mkisofs
Summary:      ISO 9660 Filesystem Image Generation Tool
URL:          http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/mkisofs.html
Vendor:       Joerg Schilling
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        BASE
Group:        Filesystem
License:      GPL
Version:      %{V_mkisofs}
Release:      20101219

#   list of sources
Source0:      ftp://ftp.berlios.de/pub/cdrecord/cdrtools-%{V_cdrtools}.tar.gz
Patch0:       mkisofs.patch

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

%description
    Mkisofs is used for premastering ISO9660 filesystems which are used
    on CDROMs. The output of mkisofs can then be sent to a CDROM writer
    with a utility such as cdrecord. It has support for many formats,
    including Rock Ridge, Joliet, and Apple HFS (beta).

%track
    prog mkisofs:cdrtools = {
        version   = %{V_cdrtools}
        url       = ftp://ftp.berlios.de/pub/cdrecord/
        regex     = cdrtools-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -n cdrtools-%{V_cdrtools}
    %patch -p0
    %{l_shtool} subst -e 's/; gcc/; cc/' -e 's/; cc -xM/; cc -M/' RULES/*-cc.rul

%build
    case "%{l_platform -t}" in
        *-freebsd* )
            arch=`uname -m`
            if [ ".$arch" != .i386 -a ! -f RULES/$arch-freebsd-cc.rul ]; then
                ln -s i386-freebsd-cc.rul RULES/$arch-freebsd-cc.rul
            fi
            ;;
    esac
    %{l_make} %{l_mflags} \
        CC="%{l_cc}" \
        CFLAGS="%{l_cflags}"

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/man/man8
    %{l_shtool} install -c -s -m 755 \
        mkisofs/OBJ/*/mkisofs $RPM_BUILD_ROOT%{l_prefix}/bin/
    %{l_shtool} install -c -m 644 \
        mkisofs/mkisofs.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

