File dietlibc.spec of Package dietlibc
#
# spec file for package dietlibc
#
# Copyright (c) 2015 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.31
Release: 0
Source0: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2
Source1: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2.sig
# See README.maintainers to understand next four source files
Source9: README.maintainers
Source10: dietlibc-0.32.tar.bz2
Source11: dietlibc-0.32.tar.bz2.sig
Source12: %{name}.keyring
Source23: %{name}-0.30-setjmp-longjmpg.diff
Patch: %{name}-0.31-tls.diff
Patch1: %{name}-0.30-tcsetattr.diff
Patch6: long-double-workaround.diff
Patch7: %{name}-0.30-features.diff
Patch31: %{name}-0.30-ppc-syscall.diff
Patch32: %{name}-0.30-pause.diff
Patch33: parisc-clone.S-fix-build-failure-on-hppa.diff
Patch34: fix-arm-regex-in-makefile.diff
Patch35: dietlibc-ppc.patch
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 /opt/dietlibc
%prep
%gpg_verify %{S:11}
%setup -q
%patch
%patch1
%patch6
%patch7
%patch31
%patch32
%patch33 -p1
%patch34
%patch35 -p1
%build
MY_RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's,-O2,-Os,' \
-e 's/-D_FORTIFY_SOURCE[=0-9]*//' \
-e 's/-ffortify[=0-9]*//' \
)
# Makefile relies on `uname -m` to determine bitness (bad),
# so need extra args to rectify.
make %{?_smp_mflags} \
%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}
%files
%defattr(-, root, root)
%doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README SECURITY TODO THANKS
%doc %{_mandir}/man?/*
%{prefix}
%{_bindir}/*
%changelog