Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: added rpm spec file #513

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions packaging/rpm/README.md
@@ -0,0 +1,8 @@
To build RPM package need to execute
```sh
mkdir -p ~/rpmbuild/SOURCES
rpmbuild --undefine=_disable_source_fetch -ba libnats.spec
```

If you need specific package version, please edit "Version" value inside spec file.

55 changes: 55 additions & 0 deletions packaging/rpm/libnats.spec
@@ -0,0 +1,55 @@
%global source_name nats.c
%define debug_package %{nil}

Name: libnats
Version: 3.1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are currently at version 3.2.0. Also, would be nice if that could be updated when generating version, otherwise it will need to be manually updated before I do a new release..

Release: 1%{?dist}
Summary: NATS & NATS Streaming - C Client
License: ASL 2.0
URL: https://github.com/nats-io/nats.c
Source0: https://github.com/nats-io/nats.c/archive/v%{version}/%{source_name}-v%{version}.tar.gz
Requires: openssl-libs
BuildRequires: cmake
BuildRequires: openssl-devel
BuildRequires: protobuf-c-devel

%description
A C client for the NATS messaging system.
Go here for the online documentation, and check the frequently asked questions.
This NATS Client implementation is heavily based on the NATS GO Client.
There is support for Mac OS/X, Linux and Windows (although we don't have specific platform support matrix).

%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{source_name}.

%prep
%setup -q -n %{source_name}-%{version}

%build
%{cmake}
%{cmake_build} -j 1

%install
%{cmake_install}
find %{buildroot} -name '*.a' -delete

%files
%{_libdir}/%{name}.so*

%files devel
%dir %{_includedir}/nats
%dir %{_includedir}/nats/adapters
%{_includedir}/nats.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we don't install nats.h in the root of include directory, instead it is installed under nats directory inside the include directory. We used to put it in top-level include directory, but we no longer do.
To be precise, we put under the include directory the file deprnats.h that is renamed nats.h, to indicate that users should use nats/nats.h instead.
So maybe we should not add it here? (unless I completely misunderstand what this is doing).

%{_includedir}/nats/*.h
%{_includedir}/nats/adapters/*.h
%{_libdir}/pkgconfig/%{name}.pc
%{_prefix}/lib/cmake/cnats/*.cmake

%changelog
* Sat Nov 06 2021 Sergey Safarov <s.safarov@gmail.com> 3.1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe refresh the date here and change the version?

- initial packaging