Files
grpc-java/grpc-java-protoc-gen.spec

111 lines
3.1 KiB
RPMSpec

#
# spec file for package grpc-java-protoc-gen
#
# 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/
#
%global base_name grpc-java
%global protoc_arch %{_arch}
%ifarch x86_64 %{?x86_64}
%global protoc_arch x86_64
%endif
%ifarch ppc
%global protoc_arch ppc_32
%endif
%ifarch ppc64
%global protoc_arch ppc_64
%endif
%ifarch ppc64le
%global protoc_arch ppcle_64
%endif
%ifarch %{ix86}
%global protoc_arch x86_32
%endif
%ifarch ia64
%global protoc_arch itanium_64
%endif
%ifarch s390
%global protoc_arch s390_32
%endif
%ifarch s390x
%global protoc_arch s390_64
%endif
%ifarch %{arm}
%global protoc_arch arm_32
%endif
%ifarch aarch64 %{arm64}
%global protoc_arch aarch_64
%endif
# 32 bit sparc, optimized for v9
%ifarch sparcv9
%global protoc_arch sparc_32
%endif
# 64 bit sparc
%ifarch sparc64
%global protoc_arch sparc_64
%endif
Name: %{base_name}-protoc-gen
Version: 1.68.1
Release: 0
Summary: gRPC Java Codegen Plugin for Protobuf Compiler
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://github.com/grpc
Source0: https://github.com/grpc/%{base_name}/archive/refs/tags/v%{version}.tar.gz
Patch0: grpc-compiler-build.patch
BuildRequires: gcc-c++
BuildRequires: javapackages-local
BuildRequires: protobuf21-devel
%description
This generates the Java interfaces out of the service definition
from a .proto file. It works with the Protobuf Compiler (protoc).
%prep
%setup -q -n %{base_name}-%{version}
%patch -P 0 -p1
%build
g++ -o protoc-gen-%{base_name} %{optflags} -DGRPC_VERSION=%{version} compiler/src/java_plugin/cpp/*.cpp -lprotoc -lprotobuf
%install
install -dm 0755 %{buildroot}%{_bindir}
install -pm 0755 protoc-gen-%{base_name} %{buildroot}%{_bindir}/protoc-gen-%{base_name}-%{version}
ln -sf protoc-gen-%{base_name}-%{version} %{buildroot}%{_bindir}/protoc-gen-%{base_name}
# create maven metadata for the protoc executable
install -dm 0755 %{buildroot}%{_datadir}/maven-metadata
cat <<__PROTOBUF__ >>%{buildroot}%{_datadir}/maven-metadata/%{name}.xml
<metadata xmlns="http://fedorahosted.org/xmvn/METADATA/2.3.0">
<artifacts>
<artifact>
<groupId>io.grpc</groupId>
<artifactId>protoc-gen-grpc-java</artifactId>
<extension>exe</extension>
<classifier>linux-%{protoc_arch}</classifier>
<version>%{version}</version>
<path>%{_bindir}/protoc-gen-%{base_name}</path>
</artifact>
</artifacts>
</metadata>
__PROTOBUF__
%files
%{_bindir}/protoc-gen-%{base_name}*
%{_datadir}/maven-metadata/%{name}.xml
%license LICENSE
%doc compiler/README.md
%changelog