File protobuf-c.spec of Package protobuf-c
%define realname protobuf-c
%define realver 1.4.1
%define srcext tar.gz
%define so_ver 1
# Common info
Name: lib%{realname}%{?so_ver}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-2-Clause
Group: Development/Libraries/Other
URL: https://github.com/protobuf-c/protobuf-c
Summary: Protocol Buffers implementation in C
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkg-config
BuildRequires: gcc-c++
BuildRequires: pkgconfig(protobuf) >= 3.0
BuildRoot: %{_tmppath}/%{name}-root
Source: https://codeload.github.com/protobuf-c/protobuf-c/%{srcext}/refs/tags/v%{realver}#/%{realname}-%{version}%{?extraver}.%{srcext}
%description
This is protobuf-c, a C implementation of the Google Protocol Buffers data
serialization format. It includes libprotobuf-c, a pure C library that
implements protobuf encoding and decoding, and protoc-c, a code generator
that converts Protocol Buffer .proto files to C descriptor code, based on
the original protoc. protobuf-c formerly included an RPC implementation;
that code has been split out into the protobuf-c-rpc project.
%package -n lib%{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for Protocol Buffers library implemented in C
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Provides: %{realname}-devel = %{version}-%{release}
Provides: %{realname}-compiler = %{version}-%{release}
Obsoletes: %{realname}-devel < %{version}-%{release}
Obsoletes: %{realname}-compiler < %{version}-%{release}
%description -n lib%{realname}-devel
This is protobuf-c, a C implementation of the Google Protocol Buffers data
serialization format. It includes libprotobuf-c, a pure C library that
implements protobuf encoding and decoding, and protoc-c, a code generator
that converts Protocol Buffer .proto files to C descriptor code, based on
the original protoc. protobuf-c formerly included an RPC implementation;
that code has been split out into the protobuf-c-rpc project.
This package provides stuff required to build software against %{name}.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
test -x configure || autoreconf -i
%build
_CFLAGS="%{optflags} %{?gcc_lto} -I%{_includedir}"
_LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"
%configure \
--disable-static \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc LICENSE README.md
%{_libdir}/libprotobuf-c.so.%{?so_ver}*
# Development stuff
%files -n lib%{realname}-devel
%defattr(-,root,root)
%doc LICENSE README.md
%{_bindir}/protoc-*
%{_libdir}/pkgconfig/libprotobuf-c.pc
%{_libdir}/libprotobuf-c.so
%dir %{_includedir}/google/
%{_includedir}/google/%{realname}/
%{_includedir}/%{realname}/
%exclude %{_libdir}/libprotobuf-c.la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog