Attempt to cope with ALT Linux' FHS idiocy
Apparently obeing FHS is more important than having a working (cross-) compiler.
This commit is contained in:
parent
708060b302
commit
e3b5169d89
@ -124,6 +124,12 @@ make -j$(nproc) install DESTDIR="$INSTALLDIR"
|
||||
# set /lib64/ld-linux-aarch64.so.1 as ELF interpreter
|
||||
$INSTALLDIR/bin/${TARGET}-gcc -dumpspecs > $BUILDDIR/specs
|
||||
sed -e 's;/lib/ld-linux-aarch64;/lib64/ld-linux-aarch64;g' -i $BUILDDIR/specs
|
||||
|
||||
# Use aarch64-linux-gnu-as instead of generic `as`
|
||||
sed -e "/^[*]invoke_as:/,/^[*]cpp:/ s; as ; ../../../../bin/${TARGET}-as ;" -i $BUILDDIR/specs
|
||||
# Same for objcopy
|
||||
sed -e "s; objcopy ; ../../../../bin/${TARGET}-objcopy /" -i $BUILDDIR/specs
|
||||
|
||||
mv $BUILDDIR/specs "$INSTALLDIR/lib/gcc/$TARGET/${GCC_MAJOR_VERSION}/"
|
||||
|
||||
# relocate libgcc_s
|
||||
|
@ -17,7 +17,7 @@ ExclusiveArch: x86_64
|
||||
%define glibc_evr 2.27-alt13
|
||||
%define kernel_version 5.4
|
||||
|
||||
%define sysroot %prefix/%target/sys-root
|
||||
%define sysroot %prefix/lib/%target/sys-root
|
||||
%define target_ld_linux /lib64/ld-linux-aarch64.so.1
|
||||
|
||||
Summary: aarch64-targeted GCC cross-toolchain
|
||||
@ -173,7 +173,7 @@ export PATH=`pwd`/stage%prefix/bin:$PATH
|
||||
headers_install
|
||||
|
||||
cd obj_binutils
|
||||
%make_install install DESTDIR=%buildroot
|
||||
%make_install install DESTDIR=%buildroot tooldir=%prefix/libexec/gcc/%target
|
||||
|
||||
cd ../obj_glibc
|
||||
%make_install install DESTDIR=%buildroot%sysroot
|
||||
@ -189,7 +189,15 @@ rmdir %buildroot%prefix/lib/gcc/%target/lib64
|
||||
# Make sure cross-toolchain we build does the same thing.
|
||||
%buildroot%prefix/bin/%target-gcc -dumpspecs > specs
|
||||
sed -e "s;/lib/ld-linux-aarch64;/lib64/ld-linux-aarch64;g" -i specs
|
||||
|
||||
# Assembler: %%target-as.
|
||||
# Path is relative to %%prefix/lib/gcc/%%target/%%gcc_branch
|
||||
sed -e '/^[*]invoke_as:/,/^[*]cpp:/ s; as ; ../../../../bin/%target-as ;' -i specs
|
||||
# objcopy: %%target-objcopy
|
||||
sed -e 's; objcopy ; ../../../../bin/%target-objcopy ;' -i specs
|
||||
install -m 644 specs %buildroot%prefix/lib/gcc/%target/%gcc_branch/specs
|
||||
# Note: collect2 (GCCs linker wrapper) searches for %%target-ld on its own.
|
||||
# Alas it does not use relative paths and is not adjustable via the specs file
|
||||
|
||||
# XXX: ABI: which is correct location of ELF interpreter for aarch64?
|
||||
# Native glibc provides ld-linux-aarch64.so.1 in both /lib64 and /lib.
|
||||
@ -251,7 +259,10 @@ EOF
|
||||
|
||||
gcc_runtime_libdir=`dirname $(%buildroot%prefix/bin/%target-gcc --print-libgcc-file-name)`
|
||||
|
||||
# XXX: PATH= is necessary for collect2 to find %%target-ld
|
||||
env PATH=%buildroot%prefix/bin:$PATH \
|
||||
%buildroot%prefix/bin/%target-gcc -o hello_c hello.c || exit 2
|
||||
env PATH=%buildroot%prefix/bin:$PATH \
|
||||
%buildroot%prefix/bin/%target-g++ -o hello_cpp hello.cpp || exit 3
|
||||
|
||||
# Note: LD_LIBRARY_PATH is for **target** ld.so.
|
||||
@ -266,8 +277,6 @@ env LD_LIBRARY_PATH=%buildroot%sysroot/lib64:${gcc_runtime_libdir} \
|
||||
%_bindir/*
|
||||
%prefix/lib/gcc/%target/%gcc_branch/*
|
||||
%prefix/libexec/gcc/%target/*
|
||||
%prefix/%target/bin/*
|
||||
%prefix/%target/lib/ldscripts/*
|
||||
%sysroot/usr/include/*
|
||||
# XXX: gcc needs %%sysroot/usr/lib to locate C runtime (crt1.o)
|
||||
%sysroot/usr/lib
|
||||
|
Loading…
Reference in New Issue
Block a user