From 029fb3ee1758ed945135e44b051079e47fe44990 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 12 May 2023 12:57:55 -0400 Subject: [PATCH] Fix java arch conditional evaluated at SRPM build time --- protobuf.spec | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/protobuf.spec b/protobuf.spec index 68d02c5..184fe53 100644 --- a/protobuf.spec +++ b/protobuf.spec @@ -7,11 +7,7 @@ %if %{defined rhel} %bcond_with java %else -%ifarch %{java_arches} %bcond_without java -%else -%bcond_with java -%endif %endif #global rcver rc2 @@ -108,6 +104,7 @@ BuildRequires: gcc-c++ BuildRequires: emacs BuildRequires: zlib-devel +%if %{with java} %ifnarch %{java_arches} Obsoletes: protobuf-java-util < 3.19.4-4 Obsoletes: protobuf-javadoc < 3.19.4-4 @@ -115,6 +112,7 @@ Obsoletes: protobuf-parent < 3.19.4-4 Obsoletes: protobuf-bom < 3.19.4-4 Obsoletes: protobuf-javalite < 3.19.4-4 %endif +%endif %description Protocol Buffers are a way of encoding structured data in an efficient @@ -207,6 +205,8 @@ descriptions in Vim editor %if %{with java} +%ifarch %{java_arches} + %package java Summary: Java Protocol Buffers runtime library BuildArch: noarch @@ -264,6 +264,7 @@ BuildArch: noarch %description bom Protocol Buffer BOM POM. +%endif %endif %package emacs @@ -296,6 +297,7 @@ mv '../%{gtest_dir}' 'third_party/googletest' find -name \*.cc -o -name \*.h | xargs chmod -x chmod 644 examples/* %if %{with java} +%ifarch %{java_arches} %pom_remove_dep com.google.errorprone:error_prone_annotations java/util/pom.xml %pom_remove_dep com.google.j2objc:j2objc-annotations java/util/pom.xml @@ -315,6 +317,7 @@ find -name '*.java' | xargs sed -ri \ # Backward compatibility symlink %mvn_file :protobuf-java:jar: protobuf/protobuf-java protobuf %endif +%endif rm -f src/solaris/libstdc++.la @@ -339,6 +342,7 @@ popd %endif %if %{with java} +%ifarch %{java_arches} %ifarch %{ix86} s390x export MAVEN_OPTS=-Xmx1024m %endif @@ -346,6 +350,7 @@ export MAVEN_OPTS=-Xmx1024m %pom_disable_module kotlin-lite java/pom.xml %mvn_build -s -- -f java/pom.xml %endif +%endif %{_emacs_bytecompile} editors/protobuf-mode.el @@ -373,8 +378,10 @@ install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/pr install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim %if %{with java} +%ifarch %{java_arches} %mvn_install %endif +%endif mkdir -p %{buildroot}%{_emacs_sitelispdir}/protobuf install -p -m 0644 editors/protobuf-mode.el %{buildroot}%{_emacs_sitelispdir}/protobuf @@ -439,6 +446,8 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir} %{_datadir}/vim/vimfiles/syntax/proto.vim %if %{with java} +%ifarch %{java_arches} + %files java -f .mfiles-protobuf-java %doc examples/AddPerson.java examples/ListPeople.java %doc java/README.md @@ -458,6 +467,8 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir} %files javalite -f .mfiles-protobuf-javalite %license LICENSE + +%endif %endif