File hawtjni-runtime.spec of Package hawtjni-runtime
#
# spec file for package hawtjni-runtime
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: hawtjni-runtime
Version: 1.18
Release: 0
Summary: HawtJNI Runtime
License: Apache-2.0 AND EPL-1.0 AND BSD-3-Clause
URL: https://github.com/fusesource/hawtjni
Source0: https://github.com/fusesource/hawtjni/archive/hawtjni-project-%{version}.tar.gz
Patch0: use-commons-lang3.patch
BuildRequires: apache-commons-cli
BuildRequires: apache-commons-lang3
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local >= 6
BuildRequires: objectweb-asm
BuildRequires: xbean
%description
This package provides API that projects using HawtJNI should build
against.
%package -n hawtjni-javadoc
Summary: Javadocs for hawtjni
BuildArch: noarch
%description -n hawtjni-javadoc
This package contains the API documentation for hawtjni.
%package -n hawtjni
Summary: Code generator that produces the JNI code
Requires: %{name} = %{version}
Requires: apache-commons-cli
Requires: apache-commons-lang3
Requires: hawtjni-runtime >= %{version}
Requires: javapackages-tools
Requires: objectweb-asm
Requires: xbean
BuildArch: noarch
%description -n hawtjni
HawtJNI is a code generator that produces the JNI code needed to
implement java native methods. It is based on the jnigen code generator
that is part of the SWT Tools project which is used to generate all the
JNI code which powers the eclipse platform.
%prep
%setup -q -n hawtjni-hawtjni-project-%{version}
%patch -P 0 -p1
# this dependency seems to be missing
%pom_add_dep org.apache.commons:commons-lang3 hawtjni-generator
%build
mkdir -p hawtjni-runtime/build/classes
javac -d hawtjni-runtime/build/classes \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
--release 8 \
%else
-source 8 -target 8 \
%endif
$(find hawtjni-runtime/src/main/java/ -name *.java | xargs)
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
--date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
--create --file=hawtjni-runtime.jar -C hawtjni-runtime/build/classes .
mkdir -p hawtjni-generator/build/classes
javac -d hawtjni-generator/build/classes \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
--release 8 \
%else
-source 8 -target 8 \
%endif
-cp $(build-classpath commons-cli commons-lang3 objectweb-asm/asm-all xbean/xbean-finder xbean/xbean-asm-util):hawtjni-runtime.jar \
$(find hawtjni-generator/src/main/java/ -name *.java | xargs)
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
--date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
--create --file=hawtjni-generator.jar -C hawtjni-generator/build/classes .
jar \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0}
--date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \
%endif
--update --file=hawtjni-generator.jar -C hawtjni-generator/src/main/resources .
mkdir -p hawtjni-runtime/build/apidoc
javadoc -d hawtjni-runtime/build/apidoc -source 8 \
-classpath $(build-classpath commons-cli commons-lang3 objectweb-asm/asm-all xbean/xbean-finder xbean/xbean-asm-util) \
$(find hawtjni-runtime/src/main/java/ -name *.java && \
find hawtjni-generator/src/main/java/ -name *.java| xargs)
%install
# jars
install -dm 755 %{buildroot}%{_javadir}/hawtjni
install -dm 755 %{buildroot}%{_jnidir}/hawtjni
install -m 0644 hawtjni-runtime.jar %{buildroot}%{_jnidir}/hawtjni/
install -m 0644 hawtjni-generator.jar %{buildroot}%{_javadir}/hawtjni/
# poms
install -dm 755 %{buildroot}%{_mavenpomdir}/hawtjni
%{mvn_install_pom} hawtjni-runtime/pom.xml %{buildroot}%{_mavenpomdir}/hawtjni/hawtjni-runtime.pom
%{mvn_install_pom} hawtjni-generator/pom.xml %{buildroot}%{_mavenpomdir}/hawtjni/hawtjni-generator.pom
%add_maven_depmap hawtjni/hawtjni-generator.pom hawtjni/hawtjni-generator.jar -f generator
%add_maven_depmap hawtjni/hawtjni-runtime.pom hawtjni/hawtjni-runtime.jar
# javadoc
install -dm 755 %{buildroot}%{_javadocdir}/hawtjni
cp -pr hawtjni-runtime/build/apidoc/* %{buildroot}%{_javadocdir}/hawtjni/
%fdupes -s %{buildroot}%{_javadocdir}/hawtjni/
%{jpackage_script org.fusesource.hawtjni.generator.HawtJNI "" "" commons-cli:commons-lang3:objectweb-asm/asm-all:xbean/xbean-finder:xbean/xbean-asm-util:hawtjni/hawtjni-runtime:hawtjni/hawtjni-generator hawtjni-generator}
%files -f .mfiles
%license license.txt
%doc readme.md changelog.md
%files -n hawtjni -f .mfiles-generator
%{_bindir}/hawtjni-generator
%files -n hawtjni-javadoc
%{_javadocdir}/hawtjni
%license license.txt
%changelog