##
##  jna.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:         jna
Summary:      Java Native Access
URL:          https://github.com/java-native-access/jna
Vendor:       JNA Development Team
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Language
License:      LGPL/Apache
Version:      5.5.0
Release:      20191030

#   list of sources
Source0:      https://github.com/java-native-access/jna/archive/%{version}.tar.gz
Patch0:       jna.patch

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

%description
    JNA provides Java programs easy access to native shared libraries
    without writing anything but Java code - no JNI or native code
    is required. This functionality is comparable to Windows'
    Platform/Invoke and Python's ctypes. JNA allows you to call directly
    into native functions using natural Java method invocation. The
    Java call looks just like the call does in native code. Most calls
    require no special handling or configuration; no boilerplate or
    generated code is required. JNA uses a small JNI library stub to
    dynamically invoke native code. The developer uses a Java interface
    to describe functions and structures in the target native library.
    This makes it quite easy to take advantage of native platform
    features without incurring the high overhead of configuring and
    building JNI code for multiple platforms.

%track
    prog jna = {
        version   = %{version}
        url       = https://github.com/java-native-access/jna/releases
        regex     = (__VER__)\.tar\.gz
    }

%prep
    %setup -q
    %patch -p0

%build
    eval `java-toolkit -e`
    export CC="%{l_cc} %{l_cflags -O}"
    export CFLAGS="%{l_cflags -O}"
    export ANT_OPTS="-Drelease"
    ant native jar

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/lib
    %{l_shtool} install -c -m 644 \
        build/jna.jar $RPM_BUILD_ROOT%{l_prefix}/lib/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

