@ -23,11 +23,6 @@
## SUCH DAMAGE.
##
# package versions
%define V_major 3.2.2
%define V_short 3.2.2
%define V_long 3.2.2
# package information
Name: gcc
Summary: GNU Compiler Collection
@ -37,8 +32,8 @@ Packager: The OpenPKG Project
Distribution: OpenPKG [CORE]
Group: Language
License: GPL
Version: %{V_short}
Release: 20030205
Version: 3.2.2
Release: 20030208
# package options
%option with_cxx yes
@ -47,7 +42,7 @@ Release: 20030205
%option with_threads yes
# list of sources
Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_long}/gcc-%{V_long }.tar.bz2
Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version }.tar.bz2
Patch0: gcc.patch
# build information
@ -67,20 +62,44 @@ AutoReqProv: no
highly portable ISO C and ISO C++ compiler.
%prep
%setup -q -n gcc-%{V_long }
%setup -q -n gcc-%{version }
%patch -p0
%{l_shtool} subst -v -s \
-e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \
gcc/configure
%build
# configure the package
# create build sub-directory
mkdir obj
cd obj
options=""
# determine ld(1) and as(1) usage
l_with_gnu_ld_as=""
%if "%{with_binutils}" == "yes"
l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
%else
case "%{l_target}" in
*-linux* | *-freebsd* ) options="--with-gnu-as --with-gnu-ld" ;;
*-linux* | *-freebsd* )
l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
;;
esac
%endif
# determine threads usage
%if "%{with_threads}" == "yes"
l_enable_threads="posix"
%else
l_enable_threads="single"
%endif
# determine language usage
l_enable_languages="c"
%if "%{with_cxx}" == "yes"
l_enable_languages="${l_enable_languages},c++"
%endif
# configure the package
CC="%{l_cc}" \
CFLAGS="%{l_cflags}" \
../configure \
@ -89,93 +108,56 @@ AutoReqProv: no
--includedir=%{l_prefix}/include/gcc \
--with-gxx-include-dir=%{l_prefix}/include/g++ \
--with-local-prefix=%{l_prefix}/lib/gcc-lib \
%if "%{with_cxx}" == "yes"
--enable-languages="c,c++" \
%else
--enable-languages="c" \
%endif
%if "%{with_threads}" == "yes"
--enable-threads=posix \
%else
--enable-threads=single \
%endif
--enable-languages="${l_enable_languages}" \
--enable-threads="${l_enable_threads}" \
--disable-maintainer-mode \
--disable-shared \
--disable-nls \
%if "%{with_binutils}" == "yes"
--with-gnu-ld --with-ld=%{l_prefix}/bin/ld \
--with-gnu-as --with-as=%{l_prefix}/bin/as \
%endif
$options
${l_with_gnu_ld_as}
# build the package
# determine build parameters
%if "%{with_optimize}" == "yes"
l_boot_cflags="-O2"
l_cflags="-O"
l_libcflags="-g -O2"
l_libcxxflags="-g -O2 -fno-implicit-templates"
case "%{l_target}" in
*-osf* ) l_boot_cflags="-O" ;;
esac
%else
l_boot_cflags="-O0"
l_cflags=""
l_libcflags="-g -O0"
l_libcxxflags="-g -O0"
%endif
# build the package
%{l_make} %{l_mflags} \
MAKE="%{l_make} %{l_mflags}" \
BOOT_CFLAGS="$l_boot_cflags" \
CFLAGS="$l_cflags" \
LIBCFLAGS="$l_libcflags" \
LIBCXXFLAGS="$l_libcxxflags" \
BOOT_CFLAGS="${ l_boot_cflags} " \
CFLAGS="${ l_cflags} " \
LIBCFLAGS="${ l_libcflags} " \
LIBCXXFLAGS="${ l_libcxxflags} " \
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_shtool} subst -v -s \
-e "s;^\\(prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
-e "s;^\\(exec_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
-e "s;^\\(gcc_gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
-e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
-e "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++;" \
-e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib;" \
-e "s;^\\(includedir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/gcc;" \
`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_shtool} subst -v -s \
-e 's;^install-cpp:.*;install-cpp:;' \
-e 's;^install-common:.*;install-common: installdirs lang.install-common;' \
-e 's;^install-driver:.*;install-driver:;' \
-e 's;^install-libgcc:.*;install-libgcc: installdirs;' \
-e 's;^install-build:.*;install-build:;' \
-e 's;^install-collect2:.*;install-collect2: installdirs;' \
-e 's;^install-assert-h:.*;install-assert-h: installdirs;' \
-e 's;^install: stmp-dirs ./libgcc.a;install: stmp-dirs;' \
-e '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
# fetch GNU platform triple
triple=`./config.guess`
triple=`./config.sub ${triple}`
# perform the standard installation procedure
( cd obj
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT )
# cleanup installation tree
mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/
mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/include/ \
>/dev/null 2>&1 || true
# 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"
@ -184,11 +166,13 @@ AutoReqProv: no
%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-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/${triple}/%{version}/${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
# 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"
@ -196,8 +180,8 @@ AutoReqProv: no
$RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
%endif
# create file list
%{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/ files -r$RPM_BUILD_ROOT %{l_files_std}
# determine installation file list
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files