You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
238 lines
8.4 KiB
238 lines
8.4 KiB
## |
|
## gcc33.spec -- OpenPKG RPM Specification |
|
## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH |
|
## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/> |
|
## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com> |
|
## |
|
## 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 versions |
|
%define V_major 3.3 |
|
%define V_short 33 |
|
%define V_snap 20021014 |
|
|
|
# package options |
|
%ifndef with_cxx |
|
%define with_cxx yes |
|
%endif |
|
%ifndef with_optimize |
|
%define with_optimize yes |
|
%endif |
|
%ifndef with_binutils |
|
%define with_binutils %(if [ -f %{SOURCE gcc.sh} ]; then sh %{SOURCE gcc.sh} require-binutils %{l_target}; else echo "no"; fi) |
|
%endif |
|
|
|
# package information |
|
Name: gcc33 |
|
Summary: GNU Compiler Collection (VERSION 3.3 SNAPSHOT) |
|
URL: http://gcc.gnu.org/ |
|
Vendor: Free Software Foundation |
|
Packager: The OpenPKG Project |
|
Distribution: OpenPKG [CORE] |
|
Group: Language |
|
License: GPL |
|
Version: %{V_major}s%{V_snap} |
|
Release: 20021018 |
|
|
|
# list of sources |
|
Source0: gcc-%{V_major}-snapshot-%{V_snap}.tar.bz2 |
|
Source1: gcc.sh |
|
Patch0: gcc.patch |
|
|
|
# build information |
|
Prefix: %{l_prefix} |
|
BuildRoot: %{l_buildroot} |
|
BuildPreReq: OpenPKG, openpkg >= 20020206, make |
|
PreReq: OpenPKG, openpkg >= 20020206 |
|
%if "%{with_binutils}" == "yes" |
|
BuildPreReq: binutils >= 2.13 |
|
PreReq: binutils >= 2.13 |
|
%endif |
|
AutoReq: no |
|
AutoReqProv: no |
|
|
|
%description |
|
The GNU Compiler Collection (GCC) provides a standard conforming and |
|
highly portable ISO C and ISO C++ compiler. |
|
|
|
Options: |
|
--define 'with_cxx %{with_cxx}' |
|
--define 'with_optimize %{with_optimize}' |
|
--define 'with_binutils %{with_binutils}' |
|
|
|
%prep |
|
%setup -q -n gcc-%{V_major}-snapshot |
|
%patch -p0 |
|
%{l_shtool} subst -v -s \ |
|
-e "s;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g" \ |
|
gcc/configure |
|
|
|
%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} \ |
|
--includedir=%{l_prefix}/include/gcc \ |
|
--with-gxx-include-dir=%{l_prefix}/include/g++%{V_short} \ |
|
--with-local-prefix=%{l_prefix}/lib/gcc%{V_short}-lib \ |
|
%if "%{with_cxx}" == "yes" |
|
--enable-languages="c,c++" \ |
|
%else |
|
--enable-languages="c" \ |
|
%endif |
|
--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 |
|
|
|
# redirect lib directory |
|
%{l_shtool} subst -v -s \ |
|
-e "s;/gcc-lib/;/gcc%{V_short}-lib/;" \ |
|
`find . -name Makefile -type f -print` |
|
|
|
# build the package |
|
%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="" |
|
l_cflags="" |
|
l_libcflags="-g" |
|
l_libcxxflags="-g" |
|
%endif |
|
%{l_make} %{l_mflags} \ |
|
MAKE="%{l_make} %{l_mflags}" \ |
|
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` |
|
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++%{V_short};" \ |
|
-e "s;^\\(gxx_include_dir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++%{V_short};" \ |
|
-e "s;^\\(glibcppinstalldir[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/include/g++%{V_short};" \ |
|
-e "s;^\\(local_prefix[ ]*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib;" \ |
|
-e "s;/gcc-lib/;/gcc%{V_short}-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_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%{V_short}-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/gccbug >/dev/null 2>&1 || true |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc-%{V_major} >/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_short}-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true |
|
done |
|
|
|
# cleanup tree |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libiberty.a |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{version}/libstdc++.a |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib/libstdc++.a* \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{version}/libstdc++.a |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{version}/libsupc++.a |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib/libsupc++.a* \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_short}-lib/$triple/%{version}/libsupc++.a |
|
|
|
# rename files |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/bin |
|
for file in *; do |
|
mv ${file} ${file}%{V_short} |
|
done |
|
) |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/info |
|
for file in *; do |
|
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_short}\2;'` |
|
done |
|
) |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1 |
|
for file in *; do |
|
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_short}\2;'` |
|
done |
|
) |
|
|
|
# create file list |
|
%{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_major}-snapshot/files -r$RPM_BUILD_ROOT %{l_files_std} |
|
|
|
%files -f files |
|
|
|
%clean |
|
rm -rf $RPM_BUILD_ROOT |
|
|
|
|