File musl.spec of Package musl

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

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Libraries
URL:           https://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
_CFLAGS='%{optflags} -Os'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
./configure \
  --prefix=%{_prefix} \
  --libdir=%{_libdir}/musl \
  --includedir=%{_includedir}/musl \
  --syslibdir=%{_libdir}/musl \
  --disable-wrapper \
  --disable-shared \
  CFLAGS="$_CFLAGS" \
  LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%{__make} %{?_smp_mflags} lib/musl-gcc.specs obj/musl-clang obj/musl-gcc

# Install built stuff
%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -D -m0755 obj/musl-clang %{buildroot}%{_bindir}/musl-clang
%{__install} -D -m0755 obj/musl-gcc %{buildroot}%{_bindir}/musl-gcc
%{__install} -D -m0644 lib/musl-gcc.specs %{buildroot}%{_libdir}/musl/musl-gcc.specs
%if 0%{?suse_version}
%fdupes %{buildroot}%{_libdir}
%endif

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

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

%changelog
openSUSE Build Service is sponsored by