##
## gcc.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 The OpenPKG Project
## Copyright (c) 2000-2001 Ralf S. Engelschall
##
## 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.
##
%define V_major 3.0.2
%define V_short 3.0.2
%define V_long 3.0.2
# package information
Name: gcc
Summary: GNU C/C++ Compiler
URL: http://gcc.gnu.org/
Vendor: Free Software Foundation
Packager: The OpenPKG Project
Distribution: OpenPKG [REL]
Group: Language
License: GPL
Version: %{V_short}
Release: 20011201.0
# list of sources
Source0: ftp://gcc.gnu.org/pub/gcc/releases/%{V_long}/gcc-%{V_long}.tar.bz2
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20011126.0, make
PreReq: OpenPKG, openpkg >= 20011126.0
AutoReq: no
AutoReqProv: no
%description
The GNU Compiler Collection (GCC) provides C and C++ compilers.
%prep
%setup -q -n gcc-%{V_long}
%build
# configure the package
mkdir obj
cd obj
options=""
case "%{l_target}" in
*-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
esac
CC="%{l_cc}" \
CFLAGS="%{l_cflags}" \
../configure \
--prefix=%{l_prefix} \
--exec-prefix=%{l_prefix} \
--with-gxx-include-dir=%{l_prefix}/include/g++ \
--with-local-prefix=%{l_prefix}/lib/gcc-lib \
--enable-languages="c,c++" \
--enable-threads \
--disable-maintainer-mode \
--disable-shared \
--disable-nls \
$options
# build the package
%{l_make} %{l_mflags} \
MAKE="%{l_make} %{l_mflags}" \
CFLAGS='-O' \
LIBCFLAGS='-g -O2' \
LIBCXXFLAGS='-g -O2 -fno-implicit-templates' \
bootstrap-lean
%install
rm -rf $RPM_BUILD_ROOT
triple=`./config.guess`
triple=`./config.sub $triple | sed -e 's;-unknown-;--;'`
cd obj
# redirect to temporary build root
%{l_rpmtool} subst -v -s \
"s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
"s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
"s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
"s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
"s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
"s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib;" \
-- `find . -name Makefile -type f -print`
# make sure the install procedure doesn't compile anything
# (or else we would have wrong paths hard-coded in the programs)
%{l_rpmtool} subst -v -s \
's;^install-cpp:.*;install-cpp:;' \
's;^install-common:.*;install-common: installdirs lang.install-common;' \
's;^install-driver:.*;install-driver:;' \
's;^install-libgcc:.*;install-libgcc: installdirs;' \
's;^install-build:.*;install-build:;' \
's;^install-collect2:.*;install-collect2: installdirs;' \
's;^install-assert-h:.*;install-assert-h: installdirs;' \
's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
's;^\(install-.*:.*\) all *\(.*\)$;\1\2;' \
-- gcc/Makefile gcc/libgcc.mk gcc/*/Makefile
# make sure the Makefiles are not re-generated
for file in `find . -name config.status -print`; do
( echo "#!/bin/sh"
echo ":"
) >$file
done
# run the standard installation procedure
%{l_make} %{l_mflags} install
# strip the installation
mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
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-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
done
# make additional links
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
ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
# create file list
%{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT