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.
284 lines
11 KiB
284 lines
11 KiB
## |
|
## gcc-bootstrap.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## 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 information |
|
Name: gcc-bootstrap |
|
Summary: GNU Compiler Collection (Bootstrap Version) |
|
URL: https://gcc.gnu.org/ |
|
Vendor: Free Software Foundation |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: CORE |
|
Group: Compiler |
|
License: GPL |
|
Version: 4.7.4 |
|
Release: 20171221 |
|
|
|
# list of sources |
|
Source0: https://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version}.tar.bz2 |
|
Patch0: gcc-bootstrap.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, make |
|
PreReq: OpenPKG, openpkg >= 20160101 |
|
BuildPreReq: binutils |
|
PreReq: binutils |
|
BuildPreReq: mpc, mpfr, gmp |
|
PreReq: mpc, mpfr, gmp |
|
BuildPreReq: libiconv |
|
PreReq: libiconv |
|
|
|
%description |
|
The GNU Compiler Collection (GCC) provides standard conforming and |
|
highly portable compilers for the ISO C and ISO C++ languages. This |
|
is the OpenPKG GCC Bootstrap package which is based on GCC 4.7, the |
|
last major version which can be built with just a system C compiler. |
|
It is required to be built and installed for building the latest GCC |
|
package in case the system compiler does not support C++. As it has |
|
just this single purpose, all package options were removed and the |
|
minimum GCC extend is compiled. |
|
|
|
%track |
|
prog gcc-bootstrap = { |
|
version = %{version} |
|
url = https://gcc.gnu.org/pub/gcc/releases/ |
|
regex = gcc-(4\.7\.\d+) |
|
} |
|
|
|
%prep |
|
%setup -q -n gcc-%{version} |
|
%patch -p0 |
|
%{l_shtool} subst -v -s \ |
|
-e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \ |
|
gcc/configure |
|
%{l_shtool} subst -v -s \ |
|
-e 's;(libdir)/gcc/;(libdir)/gcc-bootstrap/;' \ |
|
`find . -name Makefile.in -type f -print` |
|
case "%{l_platform -t}" in |
|
amd64*-linux* ) |
|
%{l_shtool} subst \ |
|
-e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \ |
|
-e 's/test x.gcc_no_link = xyes/false/g' \ |
|
libstdc++-v3/configure |
|
;; |
|
esac |
|
%{l_shtool} subst \ |
|
-e 's;<iconv\.h>;"%{l_prefix}/include/iconv.h";' \ |
|
libstdc++-v3/include/ext/codecvt_specializations.h |
|
|
|
%build |
|
# create build sub-directory |
|
%{l_shtool} mkdir -p obj |
|
cd obj |
|
|
|
# determine ld(1) and as(1) usage |
|
l_with_gnu_ld_as="" |
|
LD=%{l_tool_locate ld ld} |
|
AS=%{l_tool_locate as as} |
|
echo $LD | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-ld=$LD" |
|
echo $AS | grep '^/' >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=$AS" |
|
$LD --version </dev/null 2>/dev/null | grep "^GNU ld " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld" |
|
$AS --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as" |
|
unset LD |
|
unset AS |
|
|
|
# determine threads usage |
|
l_enable_threads="no" |
|
|
|
# determine language usage |
|
l_enable_languages="c,c++" |
|
|
|
# disable GNU iconv usage |
|
( echo "am_cv_func_iconv=no" |
|
echo "am_cv_lib_iconv=no" |
|
) >config.cache |
|
|
|
# configure the package |
|
CC="%{l_cc}" \ |
|
CFLAGS="%{l_cflags}" \ |
|
CPPFLAGS="%{l_cppflags}" \ |
|
LDFLAGS="%{l_ldflags}" \ |
|
CONFIG_SHELL="%{l_bash}" \ |
|
../configure \ |
|
--with-bugurl="http://openpkg.org/" \ |
|
--with-pkgversion="%{l_openpkg_release -F "OpenPKG-%%t"}" \ |
|
--cache-file=./config.cache \ |
|
--srcdir=`pwd`/.. \ |
|
--prefix=%{l_prefix} \ |
|
--exec-prefix=%{l_prefix} \ |
|
--mandir=%{l_prefix}/man \ |
|
--infodir=%{l_prefix}/info \ |
|
--includedir=%{l_prefix}/include/gcc-bootstrap \ |
|
--libexecdir=%{l_prefix}/libexec/gcc-bootstrap \ |
|
--with-gxx-include-dir=%{l_prefix}/include/g++-bootstrap \ |
|
--with-local-prefix=%{l_prefix}/lib/gcc-bootstrap \ |
|
--enable-languages="${l_enable_languages}" \ |
|
--enable-threads="${l_enable_threads}" \ |
|
--disable-maintainer-mode \ |
|
--disable-shared \ |
|
--disable-nls \ |
|
--with-pic \ |
|
--disable-multilib \ |
|
--with-libiconv-prefix=%{l_prefix} \ |
|
--with-gmp=%{l_prefix} \ |
|
--with-mpfr=%{l_prefix} \ |
|
--with-mpc=%{l_prefix} \ |
|
${l_with_gnu_ld_as} |
|
|
|
# determine build flags |
|
l_ccisgcc=no |
|
if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then |
|
l_ccisgcc=yes |
|
fi |
|
l_cflags="" |
|
l_cxxflags="" |
|
l_boot_cflags="" |
|
l_libcflags="-g" |
|
l_libcxxflags="-g" |
|
# at least GNU as from GNU binutils supports -pipe always |
|
AS="%{l_tool_locate as as}" |
|
"$AS" --version </dev/null 2>/dev/null | grep "^GNU assembler " >/dev/null && { |
|
l_boot_cflags="$l_boot_cflags -pipe" |
|
l_libcxxflags="$l_libcxxflags -pipe" |
|
} |
|
# else do no optimizations at all to reduce problems to minimum in advance |
|
l_boot_cflags="$l_boot_cflags -O0" |
|
l_libcxxflags="$l_libcxxflags -O0" |
|
maketarget="bootstrap2-lean" |
|
case "%{l_platform -t}" in |
|
amd64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC"; l_libcflags="$l_libcflags -fPIC"; l_libcxxflags="$l_libcxxflags -fPIC" ;; |
|
ia64-* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC"; l_libcflags="$l_libcflags -fPIC"; l_libcxxflags="$l_libcxxflags -fPIC" ;; |
|
sparc64-freebsd* ) l_cflags="$l_cflags -fPIC"; l_cxxflags="$l_cxxflags -fPIC"; l_libcflags="$l_libcflags -fPIC"; l_libcxxflags="$l_libcxxflags -fPIC" ;; |
|
esac |
|
l_cflags="$l_cflags %{l_cppflags}" |
|
l_cxxflags="$l_cxxflags %{l_cppflags}" |
|
l_libcflags="$l_libcflags %{l_cppflags}" |
|
l_libcxxflags="$l_libcxxflags %{l_cppflags}" |
|
|
|
# build the package |
|
MAKE="%{l_make} %{l_mflags}" \ |
|
%{l_make} %{l_mflags} \ |
|
MAKE="%{l_make} %{l_mflags}" \ |
|
BOOT_CFLAGS="${l_boot_cflags}" \ |
|
CFLAGS="${l_cflags}" \ |
|
CXXFLAGS="${l_cxxflags}" \ |
|
LIBCFLAGS="${l_libcflags}" \ |
|
LIBCXXFLAGS="${l_libcxxflags}" \ |
|
$maketarget |
|
|
|
%install |
|
# fetch GNU platform triple |
|
triple=`./config.guess` |
|
|
|
# perform the standard installation procedure |
|
( cd obj |
|
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
|
) || exit $? |
|
|
|
# cleanup installation tree |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib/{lib*.a,*.spec} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-bootstrap/${triple}/[0-9]*/ \ |
|
>/dev/null 2>&1 || true |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib64/{lib*.a,*.spec} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-bootstrap/${triple}/[0-9]*/ \ |
|
>/dev/null 2>&1 || true |
|
dirs="" |
|
for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do |
|
subdir=`echo "$multilib" | sed -e 's/;.*$//'` |
|
[ ".$subdir" = .. ] && continue |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-bootstrap/${triple}/[0-9]*/$subdir/ \ |
|
>/dev/null 2>&1 || true |
|
mv $RPM_BUILD_ROOT%{l_prefix}/lib64/$subdir/lib*.a \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-bootstrap/${triple}/[0-9]*/$subdir/ \ |
|
>/dev/null 2>&1 || true |
|
dirs="$dirs $subdir" |
|
done |
|
for subdir in $dirs; do |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir >/dev/null 2>&1 || true |
|
done |
|
mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \ |
|
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc-bootstrap/${triple}/[0-9]*/include/ \ |
|
>/dev/null 2>&1 || true |
|
|
|
# strip installation tree |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple} |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir |
|
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}/lib/libstdc++.a-gdb.py >/dev/null 2>&1 || true |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib64 >/dev/null 2>&1 || true |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gcc-* >/dev/null 2>&1 || true |
|
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 |
|
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-bootstrap/${triple}/[0-9]*/${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 |
|
ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1 |
|
|
|
# resolve filename conflicts |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/bin |
|
for file in *; do |
|
[ ".$file" = ".*" ] && continue |
|
mv ${file} ${file}-bootstrap |
|
done |
|
) || exit $? |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/info |
|
for file in *; do |
|
[ ".$file" = ".*" ] && continue |
|
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1-bootstrap\2;'` |
|
done |
|
) || exit $? |
|
( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1 |
|
for file in *; do |
|
[ ".$file" = ".*" ] && continue |
|
mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1-bootstrap\2;'` |
|
done |
|
) || exit $? |
|
|
|
# provide bootstrapping area |
|
# (optionally used by regular "gcc" package) |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/gcc-bootstrap/bin-bootstrap |
|
for prog in cpp c%{l_nil}c c++ gcc g++; do |
|
ln -s ../../../bin/$prog-bootstrap \ |
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/gcc-bootstrap/bin-bootstrap/$prog |
|
done |
|
|
|
# determine installation file list |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
|