File dietlibc.spec of Package dietlibc

#
# spec file for package dietlibc
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


ExcludeArch:    %arm ppc64le

Name:           dietlibc
Provides:       diet
Version:        0.34
Release:        0
Source0:        http://www.fefe.de/dietlibc/%{name}-%{version}.tar.xz
Source1:        http://www.fefe.de/dietlibc/%{name}-%{version}.tar.xz.sig
# See README.maintainers to understand next four source files
Source9:        README.maintainers
Source12:       %{name}.keyring
Source23:       %{name}-0.30-setjmp-longjmpg.diff
Patch1:         %{name}-0.30-tcsetattr.diff
Patch7:         %{name}-0.30-features.diff
Patch31:        %{name}-0.30-ppc-syscall.diff
Patch32:        %{name}-0.30-pause.diff
#BuildRequires:  gpg-offline
Url:            http://www.fefe.de/dietlibc/
Summary:        A Libc Optimized for Small Size
License:        GPL-2.0+
Group:          Development/Languages/C and C++
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Diet libc is optimized for small size. It can be used to create small
statically-linked binaries for Linux on many platforms.

%define prefix   %{_libdir}/dietlibc

%prep
%setup -q
%patch1
%patch7
%patch31
%patch32

%build
MY_RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's,-O2,-Os,' \
   -e 's/\(-Wp,\)*-D_FORTIFY_SOURCE[=0-9]*//' \
   -e 's/-fstack-protector\(-strong\)*//' \
   -e 's/-ffortify[=0-9]*//' \
   -e 's/-flto[=a-z]*//' \
)
# Makefile relies on `uname -m` to determine bitness (bad),
# so need extra args to rectify.
make %{?_smp_mflags} DEBUG=1 \
%ifarch sparc sparcv9
	MYARCH=sparc ARCH=sparc \
%endif
	prefix=%{prefix} CFLAGS="$CFLAGS $MY_RPM_OPT_FLAGS -fno-strict-aliasing"

%install
%ifarch hppa
export RPM_ARCH=parisc
%endif
%ifarch %arm
export RPM_ARCH=arm
%endif
%ifarch sparc sparcv9
export RPM_ARCH=sparc
%endif
mkdir -p $RPM_BUILD_ROOT{%{_bindir},%{prefix}/{bin-$RPM_ARCH,lib-$RPM_ARCH},%{_mandir}/man1}
cd bin-$RPM_ARCH
mv -f dietlibc.a libc.a
mv -f diet-i diet
install -m644 start.o lib*.a $RPM_BUILD_ROOT/%{prefix}/lib-$RPM_ARCH
install -m755 diet elftrunc $RPM_BUILD_ROOT/%{prefix}/bin-$RPM_ARCH
install -m644 ../diet.1 $RPM_BUILD_ROOT/%{_mandir}/man1
cp -a ../include $RPM_BUILD_ROOT/%{prefix}
ln -sfv lib-$RPM_ARCH $RPM_BUILD_ROOT/%{prefix}/lib
ln -sfv bin-$RPM_ARCH $RPM_BUILD_ROOT/%{prefix}/bin
ln -sfv %{prefix}/bin-$RPM_ARCH/{diet,elftrunc} $RPM_BUILD_ROOT%{_bindir}
%__debug_install_post

%files
%defattr(-, root, root)
%doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README SECURITY TODO THANKS
%doc %{_mandir}/man?/*
%{prefix}
%{_bindir}/*

%changelog
openSUSE Build Service is sponsored by