Only build java on supported platforms

This commit is contained in:
Gwyn Ciesla 2022-08-02 11:11:43 -05:00
parent 9140180aae
commit 67c232b34c

View File

@ -32,6 +32,12 @@
%global with_ocaml 1 %global with_ocaml 1
%ifarch %{java_arches}
%global JAVA 1
%else
%global JAVA 0
%endif
# Filter private libraries # Filter private libraries
%global _privatelibs libbrltty.+\.so.* %global _privatelibs libbrltty.+\.so.*
%global __provides_exclude ^(%{_privatelibs})$ %global __provides_exclude ^(%{_privatelibs})$
@ -39,7 +45,7 @@
Name: brltty Name: brltty
Version: %{pkg_version} Version: %{pkg_version}
Release: 6%{?dist} Release: 7%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: http://brltty.app/ URL: http://brltty.app/
Source0: http://brltty.app/archive/%{name}-%{version}.tar.xz Source0: http://brltty.app/archive/%{name}-%{version}.tar.xz
@ -217,6 +223,7 @@ Summary: Python 3 binding for BrlAPI
This package provides the Python 3 binding for BrlAPI. This package provides the Python 3 binding for BrlAPI.
%endif %endif
%if %{JAVA}
%package -n brlapi-java %package -n brlapi-java
Version: %{api_version} Version: %{api_version}
License: LGPLv2+ License: LGPLv2+
@ -226,6 +233,7 @@ BuildRequires: java-devel
Summary: Java binding for BrlAPI Summary: Java binding for BrlAPI
%description -n brlapi-java %description -n brlapi-java
This package provides the Java binding for BrlAPI. This package provides the Java binding for BrlAPI.
%endif
%if 0%{?with_ocaml} %if 0%{?with_ocaml}
%package -n ocaml-brlapi %package -n ocaml-brlapi
@ -282,11 +290,13 @@ cp -a python2 minimal
# If MAKEFLAGS=-jN is set it would break local builds. # If MAKEFLAGS=-jN is set it would break local builds.
unset MAKEFLAGS unset MAKEFLAGS
%if %{JAVA}
# Add the openjdk include directories to CPPFLAGS # Add the openjdk include directories to CPPFLAGS
for i in -I/usr/lib/jvm/java/include{,/linux}; do for i in -I/usr/lib/jvm/java/include{,/linux}; do
java_inc="$java_inc $i" java_inc="$java_inc $i"
done done
export CPPFLAGS="$java_inc" export CPPFLAGS="$java_inc"
%endif
export LDFLAGS="%{?build_ldflags}" export LDFLAGS="%{?build_ldflags}"
export CFLAGS="%{optflags} -fno-strict-aliasing $LDFLAGS" export CFLAGS="%{optflags} -fno-strict-aliasing $LDFLAGS"
@ -303,10 +313,14 @@ configure_opts=" \
%if ! %{with_espeak} %if ! %{with_espeak}
--without-espeak \ --without-espeak \
%endif %endif
%if %{JAVA}
--with-install-root=%{buildroot} \ --with-install-root=%{buildroot} \
JAVA_JAR_DIR=%{_jnidir} \ JAVA_JAR_DIR=%{_jnidir} \
JAVA_JNI_DIR=%{_libdir}/brltty \ JAVA_JNI_DIR=%{_libdir}/brltty \
JAVA_JNI=yes" JAVA_JNI=yes"
%else
--with-install-root=%{buildroot}"
%endif
configure_opts_minimal=" \ configure_opts_minimal=" \
--disable-stripping \ --disable-stripping \
@ -522,6 +536,12 @@ popd
rm -f doc/Initramfs/Dracut/README* rm -f doc/Initramfs/Dracut/README*
rmdir doc/Initramfs/Dracut doc/Initramfs rmdir doc/Initramfs/Dracut doc/Initramfs
%if %{!JAVA}
find . -type d -name 'Java' | xargs rm -rf
find %{buildroot}%{_datadir} -type d -name 'Java' | xargs rm -rf
%endif
%post %post
%systemd_post brltty.service %systemd_post brltty.service
@ -554,6 +574,7 @@ fi
%{_bindir}/brltty-* %{_bindir}/brltty-*
%exclude %{_bindir}/brltty-minimal %exclude %{_bindir}/brltty-minimal
%{_libdir}/brltty/ %{_libdir}/brltty/
%if %{!JAVA}
%exclude %{_libdir}/brltty/libbrlttybba.so %exclude %{_libdir}/brltty/libbrlttybba.so
%exclude %{_libdir}/brltty/libbrlttybxw.so %exclude %{_libdir}/brltty/libbrlttybxw.so
%exclude %{_libdir}/brltty/libbrlttyxa2.so %exclude %{_libdir}/brltty/libbrlttyxa2.so
@ -563,6 +584,7 @@ fi
%if %{with_speech_dispatcher} %if %{with_speech_dispatcher}
%exclude %{_libdir}/brltty/libbrlttyssd.so %exclude %{_libdir}/brltty/libbrlttyssd.so
%endif %endif
%endif
%license LICENSE-LGPL %license LICENSE-LGPL
%doc %{_mandir}/man[15]/brltty.* %doc %{_mandir}/man[15]/brltty.*
%{_sysconfdir}/X11/Xsession.d/90xbrlapi %{_sysconfdir}/X11/Xsession.d/90xbrlapi
@ -587,7 +609,7 @@ fi
%files docs %files docs
%doc Documents/ChangeLog Documents/TODO %doc Documents/ChangeLog Documents/TODO
%doc Documents/Manual-BRLTTY/ %doc Documents/Manual-BRLTTY/
%doc doc/* #%doc doc/*
%files xw %files xw
%doc Drivers/Braille/XWindow/README %doc Drivers/Braille/XWindow/README
@ -640,9 +662,11 @@ fi
%{python3_sitearch}/Brlapi-%{api_version}-*.egg-info %{python3_sitearch}/Brlapi-%{api_version}-*.egg-info
%endif %endif
%if %{JAVA}
%files -n brlapi-java %files -n brlapi-java
%{_libdir}/brltty/libbrlapi_java.so %{_libdir}/brltty/libbrlapi_java.so
%{_jnidir}/brlapi.jar %{_jnidir}/brlapi.jar
%endif
%if 0%{?with_ocaml} %if 0%{?with_ocaml}
%files -n ocaml-brlapi %files -n ocaml-brlapi
@ -657,6 +681,9 @@ fi
%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/cmdline %config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/cmdline
%changelog %changelog
* Mon Aug 01 2022 Gwyn Ciesla <gwync@protonmail.com> - 6.5-7
- Build Java only on supported platforms.
* Mon Aug 01 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 6.5-6 * Mon Aug 01 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 6.5-6
- Rebuilt for ICU 71.1 - Rebuilt for ICU 71.1