Skip to content

Commit

Permalink
netcat: switch to BSD netcat
Browse files Browse the repository at this point in the history
Currently used GNU netcat is from 2004, let's switch to BSD netcat.

libmd, libbsd, libretls are requred by BSD netcat.

Change-Id: Ic61e9005f002ccb9022c4d78ad9037d2fa49141a
Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Reviewed-on: http://photon-gerrit.lvn.broadcom.net/c/photon/+/24598
Tested-by: gerrit-photon <svc.photon-ci@broadcom.com>
Reviewed-by: Srinidhi Rao <srinidhi.rao@broadcom.com>
  • Loading branch information
sshedi committed Feb 20, 2025
1 parent 06f44e6 commit 733b51d
Show file tree
Hide file tree
Showing 8 changed files with 823 additions and 22 deletions.
17 changes: 17 additions & 0 deletions SPECS/libbsd/libbsd-cdefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <bits/wordsize.h>

#if __WORDSIZE == 32
# ifdef LIBBSD_OVERLAY
# include "sys/cdefs-32.h"
# else
# include "cdefs-32.h"
# endif
#elif __WORDSIZE == 64
# ifdef LIBBSD_OVERLAY
# include "sys/cdefs-64.h"
# else
# include "cdefs-64.h"
# endif
#else
# error "Unknown word size"
#endif
76 changes: 76 additions & 0 deletions SPECS/libbsd/libbsd.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Name: libbsd
Version: 0.12.2
Release: 1%{?dist}
Summary: Library providing BSD-compatible functions for portability
URL: https://libbsd.freedesktop.org
# Breakdown in COPYING file of libbsd release tarball, see also:
# - https://gitlab.com/fedora/legal/fedora-license-data/-/issues/71
# - https://gitlab.com/fedora/legal/fedora-license-data/-/issues/73
License: Beerware AND BSD-2-Clause AND BSD-3-Clause AND ISC AND libutil-David-Nugent AND MIT AND LicenseRef-Fedora-Public-Domain
Group: Development/Libraries
Vendor: VMware, Inc.
Distribution: Photon

Source0: https://libbsd.freedesktop.org/releases/libbsd-%{version}.tar.xz
%define sha512 %{name}=ce43e4f0486d5f00d4a8119ee863eaaa2f968cae4aa3d622976bb31ad601dfc565afacef7ebade5eba33fff1c329b5296c6387c008d1e1805d878431038f8b21

# Taken from:
# https://src.fedoraproject.org/rpms/libbsd/blob/f41/f/libbsd-cdefs.h
Source3: libbsd-cdefs.h

BuildRequires: libmd-devel

Requires: libmd

%description
libbsd provides useful functions commonly found on BSD systems, and
lacking on others like GNU systems, thus making it easier to port
projects with strong BSD origins, without needing to embed the same
code over and over again on each project.

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

%description devel
Development files for the libbsd library.

%prep
%autosetup -p1

%build
%configure
%make_build

%install
%make_install %{?_smp_mflags}

rm -rf %{buildroot}%{_mandir}

# avoid file conflicts in multilib installations of -devel subpackage
mv -f %{buildroot}%{_includedir}/bsd/sys/cdefs{,-%{__isa_bits}}.h
install -p -m 0644 %{SOURCE3} %{buildroot}%{_includedir}/bsd/sys/cdefs.h

find %{buildroot}%{_libdir} -name "*.a" -delete
rm -f %{buildroot}%{_libdir}/pkgconfig/libbsd-ctor.pc

%check
%make_build check

%ldconfig_scriptlets

%files
%defattr(-,root,root)
%{_libdir}/%{name}.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/bsd
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/%{name}-overlay.pc

%changelog
* Tue Sep 10 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 0.12.2-1
- Initial version. Needed by libretls.
58 changes: 58 additions & 0 deletions SPECS/libmd/libmd.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Summary: Library that provides message digest functions from BSD systems
Name: libmd
Version: 1.1.0
Release: 1%{?dist}
# Breakdown in COPYING file of libmd release tarball
License: BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
URL: https://www.hadrons.org/software/libmd/
Group: Development/Libraries
Vendor: VMware, Inc.
Distribution: Photon

Source0: https://libbsd.freedesktop.org/releases/%{name}-%{version}.tar.xz
%define sha512 %{name}=5d0da3337038e474fae7377bbc646d17214e72dc848a7aadc157f49333ce7b5ac1456e45d13674bd410ea08477c6115fc4282fed6c8e6a0bf63537a418c0df96

%description
The libmd library provides a few message digest ("hash") functions, as
found on various BSD systems, either on their libc or on a library with
the same name, and with a compatible API.

%package devel
Summary: Development files for the message digest library
Requires: %{name} = %{version}-%{release}
Requires: pkg-config

%description devel
The libmd-devel package includes header files and libraries necessary
for developing programs which use the message digest library.

%prep
%autosetup -p1

%build
%configure --disable-static
%make_build

%install
%make_install

rm -rf %{buildroot}%{_mandir}

%check
%make_build check

%ldconfig_scriptlets

%files
%defattr(-,root,root)
%{_libdir}/%{name}.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/*.h

%changelog
* Wed Sep 18 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 1.1.0-1
- Initial version, needed by libbsd.
65 changes: 65 additions & 0 deletions SPECS/libretls/libretls.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Summary: Port of libtls from LibreSSL to OpenSSL
Name: libretls
Version: 3.8.1
Release: 1%{?dist}
# libretls itself is ISC but uses other source codes, breakdown:
# BSD-3-Clause: compat/strsep.c
# MIT: compat/timegm.c
# LicenseRef-Fedora-Public-Domain: compat/{{explicit_bzero,ftruncate,pread,pwrite}.c,chacha_private.h}
License: ISC AND BSD-3-Clause AND MIT AND LicenseRef-Fedora-Public-Domain
URL: https://git.causal.agency/libretls/about
Group: Development/Libraries
Vendor: VMware, Inc.
Distribution: Photon

Source0: https://causal.agency/libretls/%{name}-%{version}.tar.gz
%define sha512 %{name}=bbf4854622401bfc8662016a73202467714b603425dea2012e72846f0a22412018448fda8befa777d67c5dae44839b81e3b039130cf4970a4026c178d3a43ce2

BuildRequires: openssl-devel

Requires: openssl

%description
LibreTLS is a port of libtls from LibreSSL to OpenSSL. OpenBSD's libtls is a
new TLS library, designed to make it easier to write foolproof applications.

%package devel
Summary: Development files for libretls
Requires: %{name} = %{version}-%{release}
Requires: pkg-config

%description devel
The libretls-devel package contains libraries and header files for developing
applications that use libtls.

%prep
%autosetup -p1

%build
%configure --disable-static
%make_build

%install
%make_install %{?_smp_mflags}

rm -rf %{buildroot}%{_mandir}

%check
# this currently does nothing
%make_build check

%ldconfig_scriptlets

%files
%defattr(-,root,root)
%{_libdir}/libtls.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/libtls.so
%{_libdir}/pkgconfig/libtls.pc
%{_includedir}/tls.h

%changelog
* Tue Sep 10 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 3.8.1-1
- Initial version. Needed by bsd-netcat.
Loading

0 comments on commit 733b51d

Please sign in to comment.