#3 Add mingw subpackages
Closed 2 years ago by remi. Opened 2 years ago by mkoncek.
rpms/ mkoncek/libsodium rawhide  into  rawhide

file modified
+76 -4
@@ -8,9 +8,15 @@ 

  %global libname libsodium

  %global soname  23

  

+ %if 0%{?fedora}

+ %bcond_without mingw

+ %else

+ %bcond_with mingw

+ %endif

+ 

  Name:           libsodium

  Version:        1.0.18

- Release:        13%{?dist}

+ Release:        14%{?dist}

  Summary:        The Sodium crypto library

  License:        ISC

  URL:            https://libsodium.org/
@@ -25,6 +31,14 @@ 

  BuildRequires: gcc

  BuildRequires: make

  

+ %if %{with mingw}

+ BuildRequires: mingw32-filesystem

+ BuildRequires: mingw32-gcc

+ 

+ BuildRequires: mingw64-gcc

+ BuildRequires: mingw64-filesystem

+ %endif

+ 

  # manage update from 3rd party repository

  Obsoletes:      %{libname}%{soname} <= %{version}

  
@@ -61,6 +75,24 @@ 

  This package contains the static library for statically

  linking applications to use %{name}.

  

+ %if %{with mingw}

+ %package -n     mingw32-%{name}

+ Summary:        MinGW compiled %{name} library for Win32 target

+ 

+ %description -n mingw32-%{name}

+ This package contains the MinGW compiled library of %{name}

+ for Win32 target.

+ 

+ %package -n     mingw64-%{name}

+ Summary:        MinGW compiled %{name} library for Win64 target

+ 

+ %description -n mingw64-%{name}

+ This package contains the MinGW compiled library of %{name}

+ for Win64 target.

+ 

+ %{?mingw_debug_package}

+ %endif

+ 

  

  %prep

  %{?gpgverify:%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'}
@@ -78,21 +110,40 @@ 

  # F34, so we use it here explicitly

  %define _lto_cflags -flto=auto -ffat-lto-objects

  

+ mkdir build_native

+ pushd build_native

+ %global _configure ../configure

  %configure \

    --disable-silent-rules \

    --disable-opt

  

  %make_build

+ popd

+ 

+ %if %{with mingw}

+ %mingw_configure \

+   --disable-silent-rules \

+   --disable-opt

+ 

+ %mingw_make_build

+ %endif

  

  

  %install

- %make_install

+ %make_install -C build_native

  

- rm -f %{buildroot}%{_libdir}/%{libname}.la

+ rm %{buildroot}%{_libdir}/%{libname}.la

+ 

+ %if %{with mingw}

+ %mingw_make_install

+ rm %{buildroot}%{mingw32_libdir}/libsodium.a

+ rm %{buildroot}%{mingw64_libdir}/libsodium.a

+ %mingw_debug_install_post

+ %endif

  

  

  %check

- make check

+ make -C build_native check

  

  

  %files
@@ -111,8 +162,29 @@ 

  %files static

  %{_libdir}/libsodium.a

  

+ %if %{with mingw}

+ %files -n mingw32-%{name}

+ %license LICENSE

+ %{mingw32_bindir}/*.{dll,def}

+ %{mingw32_includedir}/sodium.h

+ %{mingw32_includedir}/sodium/

+ %{mingw32_libdir}/pkgconfig/libsodium.pc

+ %{mingw32_libdir}/libsodium.dll.a

+ 

+ %files -n mingw64-%{name}

+ %license LICENSE

+ %{mingw64_bindir}/*.{dll,def}

+ %{mingw64_includedir}/sodium.h

+ %{mingw64_includedir}/sodium/

+ %{mingw64_libdir}/pkgconfig/libsodium.pc

+ %{mingw64_libdir}/libsodium.dll.a

+ %endif

+ 

  

  %changelog

+ * Mon Aug 21 2023 Marian Koncek <mkoncek@redhat.com> - 1.0.18-14

+ - Add mingw subpackages

+ 

  * Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.18-13

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

  

This is a working example, feel free to reject it if you don't want to maintain the additional complexity.

Guidelines require that the parts related to the mingw sub-packages are conditionalized to only apply on Fedora, so that it is possible to build the packages in RHEL/EPEL context where most of mingw is generally excluded:

https://docs.fedoraproject.org/en-US/packaging-guidelines/MinGW/#_disabling_mingw_packages

rebased onto 755377c

2 years ago

LGTM, but feedback from a mingw aware contributor will be nice

You can drop the >= 113, it has been dropped from the latest mingw guidelines.

The libsodium.a file is a static library - not to be confused with libsodium.dll.a which is part of the dynamic library. if libsodium.a is desired to be present, then it is recommended to put it in a sub-package, ie mingw32-libsodium-static / mingw64-libsodium-static.

Aside from the one nitpick, LGTM

rebased onto e1c3c75

2 years ago

@smani @berrange Addressed both points, I don't believe static library is needed so I remove it from the buildroot.

Pull-Request has been closed by remi

2 years ago
Metadata