Make dependency on emacs optional

This is based on the change already in c9s:

32a0119716

Resolves: RHEL-93236

Signed-off-by: POIROTTE Francois <francois.poirotte@cs-soprasteria.com>
This commit is contained in:
POIROTTE Francois 2025-05-22 18:08:49 +02:00
parent 3e99578a7c
commit e59f38bf25
No known key found for this signature in database

View File

@ -9,6 +9,8 @@
%else
%bcond_without java
%endif
# Build -emacs subpackage
%bcond_without emacs
#global rcver rc2
@ -19,7 +21,7 @@ Name: protobuf
# “patch” updates of protobuf.
Version: 3.19.6
%global so_version 30
Release: 11%{?dist}
Release: 12%{?dist}
# The entire source is BSD-3-Clause, except the following files, which belong
# to the build system; are unpackaged maintainer utility scripts; or are used
@ -101,7 +103,9 @@ BuildRequires: libtool
BuildRequires: make
BuildRequires: gcc-c++
%if %{with emacs}
BuildRequires: emacs
%endif
BuildRequires: zlib-devel
%if %{with java}
@ -267,6 +271,7 @@ Protocol Buffer BOM POM.
%endif
%endif
%if %{with emacs}
%package emacs
Summary: Emacs mode for Google Protocol Buffers descriptions
BuildArch: noarch
@ -276,6 +281,7 @@ Obsoletes: protobuf-emacs-el < 3.6.1-4
%description emacs
This package contains syntax highlighting for Google Protocol Buffers
descriptions in the Emacs editor.
%endif
%prep
%setup -q -n protobuf-%{version}%{?rcver} -a 3
@ -352,7 +358,9 @@ export MAVEN_OPTS=-Xmx1024m
%endif
%endif
%if %{with emacs}
%{_emacs_bytecompile} editors/protobuf-mode.el
%endif
%check
@ -383,11 +391,13 @@ install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/synt
%endif
%endif
%if %{with emacs}
mkdir -p %{buildroot}%{_emacs_sitelispdir}/protobuf
install -p -m 0644 editors/protobuf-mode.el %{buildroot}%{_emacs_sitelispdir}/protobuf
install -p -m 0644 editors/protobuf-mode.elc %{buildroot}%{_emacs_sitelispdir}/protobuf
mkdir -p %{buildroot}%{_emacs_sitestartdir}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir}
%endif
%files
%doc CHANGES.txt CONTRIBUTORS.txt README.md
@ -409,10 +419,12 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir}
%{_libdir}/pkgconfig/protobuf.pc
%doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.md
%if %{with emacs}
%files emacs
%license LICENSE
%{_emacs_sitelispdir}/protobuf/
%{_emacs_sitestartdir}/protobuf-init.el
%endif
%files lite
%license LICENSE
@ -473,6 +485,10 @@ install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir}
%changelog
* Thu May 22 2025 François Poirotte <francois.poirotte@cs-soprasteria.com> - 3.19.6-12
- Copy patch from c9s to make emacs dependency optional
Resolves: RHEL-93236
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 3.19.6-11
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018