cross-toolchain: use separate stagedir
This commit is contained in:
parent
9cdf784823
commit
cb8d13f7e7
@ -16,7 +16,6 @@ Release: alt1
|
||||
%define kernel_version 5.4
|
||||
|
||||
%define sysroot %prefix/%target/libc
|
||||
%define buildsysroot %buildroot%prefix/%target/libc
|
||||
|
||||
Summary: aarch64-targeted GCC cross-toolchain
|
||||
License: LGPL-2.1-or-later and LGPL-3.0-or-later and GPL-2.0-or-later and GPL-3.0-or-later and GPL-3.0-or-later with GCC-exception-3.1
|
||||
@ -41,23 +40,23 @@ tar -xf /usr/src/gcc-source/gcc-%version-%gcc_source_version_timestamp.tar
|
||||
tar -xf /usr/src/binutils-source/binutils-%binutils_version.tar
|
||||
tar -xf /usr/src/kernel/sources/kernel-source-%kernel_version.tar
|
||||
tar -xf /usr/src/glibc-source/glibc-%glibc_evr.tar
|
||||
rm -rf %buildroot
|
||||
rm -rf stage
|
||||
|
||||
%build
|
||||
mkdir -p %buildroot
|
||||
mkdir -p obj_binutils
|
||||
mkdir -p obj_gcc
|
||||
mkdir -p obj_kheaders
|
||||
mkdir -p obj_glibc
|
||||
mkdir -p -m755 %buildroot%prefix/bin
|
||||
export PATH=%buildroot%prefix/bin:$PATH
|
||||
mkdir -p -m755 stage%prefix/bin
|
||||
export PATH=`pwd`/stage%prefix/bin:$PATH
|
||||
stagedir=`pwd`/stage
|
||||
|
||||
# kernel headers
|
||||
%_make_bin -j%__nprocs \
|
||||
-C kernel-source-%kernel_version \
|
||||
O=`pwd`/obj_kheaders \
|
||||
ARCH=%target_kernel \
|
||||
INSTALL_HDR_PATH=%buildsysroot/usr \
|
||||
INSTALL_HDR_PATH=${stagedir}%sysroot/usr \
|
||||
headers_install
|
||||
|
||||
# XXX: avoid %%configure for it puts $target libraries into /usr/lib64
|
||||
@ -74,7 +73,7 @@ cd obj_binutils
|
||||
--disable-shared \
|
||||
--disable-nls \
|
||||
--with-sysroot=%sysroot \
|
||||
--with-build-sysroot=%buildsysroot \
|
||||
--with-build-sysroot=${stagedir}%sysroot \
|
||||
--with-system-zlib \
|
||||
--enable-plugins \
|
||||
--enable-gold=yes \
|
||||
@ -85,7 +84,7 @@ cd obj_binutils
|
||||
|
||||
%make_build
|
||||
# XXX: avoid makeinstall for it puts $target libraries into /usr/lib64
|
||||
%make_install install DESTDIR=%buildroot
|
||||
%make_install install DESTDIR=${stagedir}
|
||||
|
||||
# N.B.: this builds GCC in a single stage (but not all target at once)
|
||||
cd ../obj_gcc
|
||||
@ -100,7 +99,7 @@ cd ../obj_gcc
|
||||
--disable-multilib \
|
||||
--disable-werror \
|
||||
--with-sysroot=%sysroot \
|
||||
--with-build-sysroot=%buildsysroot \
|
||||
--with-build-sysroot=${stagedir}%sysroot \
|
||||
--with-gcc-major-version-only \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-nls \
|
||||
@ -108,7 +107,7 @@ cd ../obj_gcc
|
||||
|
||||
%make_build all-gcc
|
||||
# XXX: avoid makeinstall for it puts $target libraries into /usr/lib64
|
||||
%make_install install-gcc DESTDIR=%buildroot
|
||||
%make_install install-gcc DESTDIR=${stagedir}
|
||||
|
||||
cd ../obj_glibc
|
||||
# XXX: avoid %%configure since it puts target libraries/binaries into /usr/lib64
|
||||
@ -119,27 +118,27 @@ cd ../obj_glibc
|
||||
--build=%{_configure_platform} \
|
||||
--prefix=%prefix \
|
||||
--with-sysroot=%sysroot \
|
||||
--with-build-sysroot=%buildsysroot \
|
||||
--with-headers=%buildsysroot/usr/include \
|
||||
--with-lib=%buildsysroot/usr/lib \
|
||||
--with-build-sysroot=${stagedir}%sysroot \
|
||||
--with-headers=${stagedir}%sysroot/usr/include \
|
||||
--with-lib=${stagedir}%sysroot/usr/lib \
|
||||
--disable-multilib \
|
||||
--disable-crypt \
|
||||
libc_cv_forced_unwind=yes
|
||||
|
||||
# glibc: headers, C runtime
|
||||
%_make_bin -j%__nprocs install-bootstrap-headers=yes install-headers DESTDIR=%buildsysroot
|
||||
%_make_bin -j%__nprocs install-bootstrap-headers=yes install-headers DESTDIR=${stagedir}%sysroot
|
||||
%_make_bin -j%__nprocs csu/subdir_lib
|
||||
install -d -m755 %buildsysroot/usr/lib
|
||||
install csu/crt1.o csu/crti.o csu/crtn.o %buildsysroot/usr/lib
|
||||
%target-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o "%buildsysroot/usr/lib/libc.so"
|
||||
touch %buildsysroot/usr/include/gnu/stubs.h
|
||||
touch %buildsysroot/usr/include/bits/stdio_lim.h
|
||||
install -d -m755 ${stagedir}%sysroot/usr/lib
|
||||
install csu/crt1.o csu/crti.o csu/crtn.o ${stagedir}%sysroot/usr/lib
|
||||
%target-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o "${stagedir}%sysroot/usr/lib/libc.so"
|
||||
touch ${stagedir}/%sysroot/usr/include/gnu/stubs.h
|
||||
touch ${stagedir}/%sysroot/usr/include/bits/stdio_lim.h
|
||||
|
||||
# libgcc
|
||||
cd ../obj_gcc
|
||||
%make_build all-target-libgcc
|
||||
# XXX: avoid makeinstall since it puts target libs into /usr/lib64
|
||||
%make_install install-target-libgcc DESTDIR=%buildroot
|
||||
%make_install install-target-libgcc DESTDIR=${stagedir}
|
||||
|
||||
# finish off glibc
|
||||
cd ../obj_glibc
|
||||
@ -147,16 +146,35 @@ cd ../obj_glibc
|
||||
# XXX: avoid makeinstall since it puts target libs into /usr/lib64
|
||||
# Note: target glibc **must** be installed into sysroot to prevent
|
||||
# native compilers from using it by default
|
||||
%make_install install DESTDIR=%buildsysroot
|
||||
%make_install install DESTDIR=${stagedir}%sysroot
|
||||
|
||||
# finish off gcc (g++, libstdc++, libssp, whatever)
|
||||
cd ../obj_gcc
|
||||
%make_build
|
||||
# XXX: avoid makeinstall since it puts target libs into /usr/lib64
|
||||
%make_install install DESTDIR=%buildroot
|
||||
%make_install install DESTDIR=${stagedir}
|
||||
|
||||
%install
|
||||
true
|
||||
|
||||
export PATH=`pwd`/stage%prefix/bin:$PATH
|
||||
|
||||
%_make_bin -j%__nprocs \
|
||||
-C kernel-source-%kernel_version \
|
||||
O=`pwd`/obj_kheaders \
|
||||
ARCH=%target_kernel \
|
||||
INSTALL_HDR_PATH=%buildroot%sysroot/usr \
|
||||
headers_install
|
||||
|
||||
cd obj_binutils
|
||||
%make_install install DESTDIR=%buildroot
|
||||
|
||||
cd ../obj_glibc
|
||||
%make_install install DESTDIR=%buildroot%sysroot
|
||||
|
||||
cd ../obj_gcc
|
||||
%make_install install DESTDIR=%buildroot
|
||||
|
||||
find %buildroot
|
||||
|
||||
%files
|
||||
%_bindir/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user