##
##  proguard.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 information
Name:         proguard
Summary:      Java Optimizer and Obfuscator
URL:          http://proguard.sourceforge.net/
Vendor:       Eric Lafortune
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Language
License:      GPL
Version:      6.2.2
Release:      20191208

#   list of sources
Source0:      http://download.sourceforge.net/proguard/proguard%{version}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101, java, JAVA-JDK

%description
    ProGuard is a Java class file shrinker, optimizer, obfuscator,
    and preverifier. It detects and removes unused classes, fields,
    methods, and attributes. It optimizes bytecode and removes unused
    instructions. It renames the remaining classes, fields, and methods
    using short meaningless names. Finally, it preverifies the processed
    code for Java 6 or for Java Micro Edition.

%track
    prog proguard = {
        version   = %{version}
        url       = http://sourceforge.net/projects/proguard/files/proguard/
        regex     = proguard(\d+\.\d+\.\d+)
    }

%prep
    %setup -q -n proguard%{version}

%build

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/lib/proguard \
        $RPM_BUILD_ROOT%{l_prefix}/share/proguard
    for prg in proguard proguardgui retrace; do
        (   echo "#!/bin/sh"
            echo "PROGUARD_HOME=\"%{l_prefix}/share/proguard\"; export PROGUARD_HOME"
            echo "exec %{l_prefix}/bin/java -jar %{l_prefix}/lib/proguard/$prg.jar \${1+\"\$@\"}"
        ) >$prg.sh
        %{l_shtool} install -c -m 755 \
            $prg.sh $RPM_BUILD_ROOT%{l_prefix}/bin/$prg
    done
    %{l_shtool} install -c -m 644 \
        lib/*.jar $RPM_BUILD_ROOT%{l_prefix}/lib/proguard/
    cp -r examples \
        $RPM_BUILD_ROOT%{l_prefix}/share/proguard/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

