File ip2unix.spec of Package ip2unix

#
# spec file for package ip2unix
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           ip2unix
Version:        2.2.1
Release:        0
Summary:        Turn IP sockets into Unix domain sockets
License:        LGPL-3.0-only
URL:            https://github.com/nixcloud/ip2unix/
Source0:        https://github.com/nixcloud/ip2unix/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0:         https://patch-diff.githubusercontent.com/raw/nixcloud/ip2unix/pull/35.patch#/ip2unix-2.2.1-fix_out_of_range_string_view_access.patch
Patch1:         strace.patch
BuildRequires:  asciidoc
# gcc-8 provides std::filesystem
BuildRequires:  gcc-c++ >= 8
BuildRequires:  meson >= 0.47.0
BuildRequires:  python3
BuildRequires:  python3-pytest
BuildRequires:  pkgconfig(yaml-cpp) >= 0.5.0
# systemd-socket-activate is used in tests
BuildRequires:  pkgconfig(systemd)
BuildRequires:  strace

%description
Executes a program and converts IP to Unix domain sockets at runtime based on a
list of rules, either given via short command line options or via a file with a
list of rules. The first matching rule causes ip2unix to replace the current IP
socket with a Unix domain socket based on the options given. For example if a
socketPath is specified, the Unix domain socket will bind or listen to the given
path.

%prep
%autosetup -p1

%build
# Building with LTO enabled causes crashes. https://github.com/nixcloud/ip2unix/issues/33
%define _lto_cflags %{nil}
%meson
%meson_build

%install
%meson_install

%check
%meson_test || cat %{_vpath_builddir}/meson-logs/testlog.txt

%files
%{_bindir}/%{name}
%{_libdir}/lib%{name}.so
%{_mandir}/man1/%{name}.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by