use --with dynamic + --with ssp constructs

This commit is contained in:
ensc 2008-06-21 13:23:09 +00:00
commit b1c14b3c8d

View file

@ -1,20 +1,21 @@
## $Id: dietlibc.spec,v 1.3 2005/02/01 12:03:17 ensc Exp $
## This package understands the following switches:
## --with[out] ssp ... enable/disable SSP; default depends
## on target architecture
## --with dynamic ... enable dynamic lib support
## Fedora Extras specific customization below...
##
%global snapshot 20080212
%ifarch %ix86 x86_64 arm
%global do_dyn 0
%ifarch %ix86 x86_64
%bcond_without ssp
%else
%global do_dyn 0
%bcond_with ssp
%endif
%if %do_dyn
%global with_dyn 1
%ifarch %ix86 x86_64 arm
%bcond_with dynamic
%endif
%ifarch %ix86
@ -23,7 +24,6 @@
%global target_cpu %_target_cpu
%endif
%{!?release_func:%global release_func() %1%{?dist}}
Summary: Small libc implementation
@ -52,8 +52,8 @@ Patch34: dietlibc-0.31.20080212-printffmt.patch
Patch40: dietlibc-0.31-printftest.patch
Patch41: dietlibc-0.31.20080212-teststdout.patch
BuildRoot: %_tmppath/%name-%version-%release-buildroot
%{?with_dyn:Requires: dietlibc-lib = %version-%release}
%{!?with_dyn:Obsoletes: dietlibc-lib < %version-%release}
%{?with_dynamic:Requires: dietlibc-lib = %version-%release}
%{!?with_dynamic:Obsoletes: dietlibc-lib < %version-%release}
%package lib
@ -89,7 +89,7 @@ This package contains the dynamic libraries for dietlibc.
%patch40 -p1 -b .printftest
%patch41 -p1 -b .teststdout
%ifnarch i386 x86_64
%if %{without ssp}
%patch20 -p1 -b .nostackprotector
sed -i -e 's!^#define WANT_SSP$!// \0!g;
s!.*\(#define WANT_STACKGAP\).*!\1!g' dietfeatures.h
@ -100,7 +100,7 @@ sed -i -e 's!^#define WANT_SSP$!// \0!g;
sed -i -e 's!strip !: !g' Makefile
%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os -O0 -g3
%global fixcflags -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %xtra_fixcflags -Os
%global basemakeflags prefix=%_libdir/dietlibc BINDIR=%_bindir MAN1DIR=%_mandir/man1 COMMENT=: CFLAGS="$RPM_OPT_FLAGS %fixcflags" PDIET=%_libdir/dietlibc
%global makeflags %basemakeflags
@ -113,7 +113,7 @@ done
make %makeflags all %{?_smp_mflags}
# 'dyn' target is not SMP safe
%{?with_dyn:make %makeflags dyn}
%{?with_dynamic:make %makeflags dyn}
%install
@ -129,8 +129,8 @@ rm -f $RPM_BUILD_ROOT%_bindir/dnsd
%check
make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet)
make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet)
make %makeflags -C test all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) -k || :
make %makeflags -C test/inet all %{?_smp_mflags} DIET=$(echo `pwd`/bin-*/diet) || :
cd test
ulimit -m $[ 50*1024 ] -v $[ 100*1024 ] -d $[ 50*1024 ]
@ -142,14 +142,14 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{?with_dyn:%exclude %_libdir/dietlibc/*/*.so}
%{?with_dynamic:%exclude %_libdir/dietlibc/*/*.so}
%doc AUTHOR BUGS CAVEAT CHANGES COPYING FAQ PORTING README*
%doc SECURITY THANKS TODO
%doc %_mandir/*/*
%_bindir/*
%_libdir/dietlibc
%if %do_dyn
%if %{with dynamic}
%files lib
%defattr(-,root,root,-)
%config(noreplace) %_sysconfdir/*