File musl.spec of Package musl

%define realname musl
%define realver  1.1.23
%define srcext   tar.gz

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Libraries
URL:           https://www.musl-libc.org/
Summary:       C standard library implementation

# Build-time parameters
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       https://www.musl-libc.org/releases/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
musl is an implementation of the userspace portion of the standard library
functionality described in the ISO C and POSIX standards, plus common extensions.
It can be used both as the system-wide C library for operating system
installations and distributions, and as a tool for building individual
application binaries deployable on a wide range of systems compatible with
the Linux system calls API.

%package devel
Group:         Development/Languages/C and C++
Summary:       Development stuff for the MUSL - C standard library implementation
Provides:      %{name}-devel-static

%description devel
musl is an implementation of the userspace portion of the standard library
functionality described in the ISO C and POSIX standards, plus common extensions.
It can be used both as the system-wide C library for operating system
installations and distributions, and as a tool for building individual
application binaries deployable on a wide range of systems compatible with
the Linux system calls API.

This package provides development stuff for building software using MUSL.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

# Build step (compile/build binaries, documentation, etc)
%build
./configure \
  --prefix=%{_prefix} \
  --libdir=%{_libdir}/musl \
  --includedir=%{_includedir}/musl \
  --syslibdir=%{_libdir}/musl \
  --disable-wrapper \
  --disable-shared \
  CFLAGS='%{optflags} -Os'
%{__make} %{?_smp_mflags}

# Install built stuff
%install
%{__make} install DESTDIR=%{buildroot}
%if 0%{?suse_version}
%fdupes %{buildroot}%{_libdir}
%endif

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

# Files list(s)
%files devel
%defattr(-,root,root)
%doc COPYRIGHT README WHATSNEW
%{_libdir}/musl
%{_includedir}/musl

%changelog