##
## gcc.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2003 The OpenPKG Project
## Copyright (c) 2000-2003 Ralf S. Engelschall
## Copyright (c) 2000-2003 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_full 3.3.1
%define V_comp %nil
%define V_bounds 3.3.1-1.01
%define V_spp 3.3-4
# package information
Name: gcc
Summary: GNU Compiler Collection
URL: http://gcc.gnu.org/
Vendor: Free Software Foundation
Packager: The OpenPKG Project
Distribution: OpenPKG [CORE]
Group: Compiler
License: GPL
Version: %{V_full}
Release: 20031002
# package options
%option with_cxx yes
%option with_objc no
%option with_java no
%option with_f77 no
%option with_optimize yes
%option with_binutils yes
%option with_threads yes
%option with_bounds no
%option with_spp no
%option with_gcc no
# options sanity check
%if "%{with_bounds}" == "yes" && "%{with_spp}" == "yes"
%{error:build-time options 'with_bounds' and 'with_spp' conflict}
%endif
# list of sources
Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version}.tar.bz2
Patch0: gcc.patch
Patch1: http://web.inter.nl.net/hcc/Haj.Ten.Brugge/bounds-checking-gcc-%{V_bounds}.patch.bz2
Patch2: http://www.trl.ibm.com/projects/security/ssp/gcc3_3/protector-%{V_spp}.tar.gz
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030927, make
PreReq: OpenPKG, openpkg >= 20030927
%if "%{with_binutils}" == "yes"
BuildPreReq: binutils >= 2.13
PreReq: binutils >= 2.13
%endif
AutoReq: no
AutoReqProv: no
%if "%{with_gcc}" == "yes"
Provides: gcc = %{version}-%{release}
%endif
%description
The GNU Compiler Collection (GCC) provides a standard conforming and
highly portable ISO C and ISO C++ compiler.
%prep
%setup -q -n gcc-%{version}
%patch0 -p0
%if "%{with_bounds}" == "yes"
%patch1 -p1
%endif
%if "%{with_spp}" == "yes"
( cd gcc
%{l_gzip} -d -c %{PATCH protector-%{V_spp}.tar.gz} | %{l_tar} xf -
%{l_patch} -p1 /dev/null 2>&1 || true
%if "%{with_java}" == "yes"
mv $RPM_BUILD_ROOT%{l_prefix}/share/java \
$RPM_BUILD_ROOT%{l_prefix}/share/gcc
%endif
# strip installation tree
rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
%if "%{with_cxx}" == "yes"
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
%endif
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
for prog in cc1 cc1plus collect2 cpp; do
strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}-lib/${triple}/%{V_full}/${prog} \
>/dev/null 2>&1 || true
done
# bump up installation tree
ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
$RPM_BUILD_ROOT%{l_prefix}/bin/cc
ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
$RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
%if "%{with_cxx}" == "yes"
ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
$RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
%endif
# resolve filename conflicts
%if "%{with_gcc}" != "yes" && "%{V_comp}" != ""
( cd $RPM_BUILD_ROOT%{l_prefix}/bin
for file in *; do
mv ${file} ${file}%{V_comp}
done
) || exit $?
( cd $RPM_BUILD_ROOT%{l_prefix}/info
for file in *; do
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
done
) || exit $?
( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
for file in *; do
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
done
) || exit $?
%endif
# determine installation file list
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT