File mingw64-protobuf.spec of Package mingw64-protobuf

#
# spec file for package mingw64-glm
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           mingw64-protobuf
Version:        30.2
Release:        0
Summary:        Protocol Buffers - Google's data interchange format
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            https://protobuf.dev/
Source0:        https://github.com/protocolbuffers/protobuf/releases/download/v%version/protobuf-%version.tar.gz
Source1:        protobuf-libhack
Patch0:         protobuf-no-rpath.patch
BuildRequires:  abseil-cpp-devel
%if %suse_version >= 1600
BuildRequires:  gcc-c++
%else
BuildRequires:  gcc13-c++
%endif
BuildRequires:  git-core
BuildRequires:  mingw64-abseil-cpp-devel
BuildRequires:  mingw64-cross-cmake
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-filesystem
BuildRequires:  mingw64-zlib-devel
BuildRequires:  zlib-devel
%_mingw64_package_header_debug
#!BuildIgnore: post-build-checks

%description
Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.

%package -n mingw64-libprotobuf
Summary:        Protocol Buffers - Google's data interchange format
Group:          Development/Libraries/C and C++

%description -n mingw64-libprotobuf
Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.

%package        devel
Summary:        Protocol Buffers - Google's data interchange format
Group:          Development/Libraries/C and C++
Requires:       mingw64-libprotobuf = %version
Requires:       sed

%description    devel
Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.

%prep
%autosetup -p1 -n protobuf-%version
cd ..
cp -a protobuf-%version protobuf-%version-native

%build
CMAKE_OPTS=-Dprotobuf_BUILD_TESTS=off
pushd ../protobuf-%version-native
mingw64-cmake $CMAKE_OPTS \
%if %suse_version >= 1600
-DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc \
%else
-DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_C_COMPILER=gcc-13 \
%endif
-DCMAKE_LDFLAGS="$(echo %{?build_ldflags}| sed -e 's/ / \\/g')" -DCMAKE_CXX_FLAGS="$(echo %{optflags}| sed -e 's/ / \\/g')" -DCMAKE_C_FLAGS="$(echo %{optflags}| sed -e 's/ / \\/g')" -DCMAKE_SYSTEM_NAME="Linux" -DCMAKE_FIND_ROOT_PATH=/usr
cd build
%make_build
popd
mingw64-cmake $CMAKE_OPTS
cd build
%make_build


%install
pushd ../protobuf-%version-native/build
%make_install
rm -r %{buildroot}%{_mingw64_includedir}
rm -r %{buildroot}%{_mingw64_libdir}/cmake
rm -r %{buildroot}%{_mingw64_libdir}/pkgconfig
find %{buildroot}%{_mingw64_libdir} -name \*.a -or -name \*.so | xargs -t rm
find %{buildroot}%{_mingw64_libdir}
popd
cd build
%make_install
install -m 755 -t %{buildroot}%{_mingw64_bindir} %{SOURCE1}
tgt=$(basename "%{SOURCE1}")
for i in %{buildroot}%{_mingw64_bindir}/*.exe %{buildroot}%{_mingw64_bindir}/*.exe-* ; do
ln -sf $tgt $i
done

%files -n mingw64-libprotobuf
%defattr(-,root,root,-)
%license LICENSE
%doc CONTRIBUTORS.txt *.md
%{_mingw64_bindir}/*.dll

%files devel
%defattr(-,root,root,-)
%license LICENSE
%doc CONTRIBUTORS.txt *.md
%{_mingw64_includedir}
%{_mingw64_libdir}
%{_mingw64_bindir}
%exclude %{_mingw64_bindir}/*.dll

%changelog
openSUSE Build Service is sponsored by