fixing libcCross related flags
(excluding darwin and mingw for now)
This commit is contained in:
parent
e8ca9dca53
commit
7399d0949c
@ -44,7 +44,8 @@ stdenv.mkDerivation {
|
||||
ldWrapper = ./ld-wrapper.sh;
|
||||
utils = ./utils.sh;
|
||||
addFlags = ./add-flags;
|
||||
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
|
||||
inherit nativeTools nativeLibc nativePrefix gcc binutils;
|
||||
libc = if libc ? out then libc.out else libc;
|
||||
crossConfig = if cross != null then cross.config else null;
|
||||
osxMinVersion = cross.osxMinVersion or null;
|
||||
gccLibs = if gcc != null then gccLibs else null;
|
||||
|
@ -256,9 +256,9 @@ stdenv.mkDerivation ({
|
||||
sed -i "${gnu_h}" \
|
||||
-es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g'
|
||||
|
||||
echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc}/include'..."
|
||||
echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc.dev}/include'..."
|
||||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc}/include"|g'
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
@ -272,7 +272,7 @@ stdenv.mkDerivation ({
|
||||
grep -q LIBC_DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc}\3"|g'
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
|
||||
done
|
||||
''
|
||||
else null;
|
||||
@ -482,15 +482,28 @@ stdenv.mkDerivation ({
|
||||
++ optional (libpthread != null) libpthread)));
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null
|
||||
then "-idirafter ${libcCross}/include"
|
||||
if cross != null && libcCross != null then [
|
||||
"-idirafter ${libcCross.dev}/include"
|
||||
]
|
||||
++ optionals (! crossStageStatic) [
|
||||
"-B${libcCross.out}/lib"
|
||||
]
|
||||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null
|
||||
then "-B${libcCross}/lib -Wl,-L${libcCross}/lib" +
|
||||
(optionalString (libpthreadCross != null)
|
||||
" -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}")
|
||||
if cross != null && libcCross != null then [
|
||||
"-Wl,-L${libcCross.out}/lib"
|
||||
]
|
||||
++ (if crossStageStatic then [
|
||||
"-B${libcCross.out}/lib"
|
||||
] else [
|
||||
"-Wl,-rpath,${libcCross.out}/lib"
|
||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||
])
|
||||
++ optionals (libpthreadCross != null) [
|
||||
"-L${libpthreadCross}/lib"
|
||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||
]
|
||||
else null;
|
||||
|
||||
passthru =
|
||||
|
@ -70,10 +70,6 @@ if test "$noSysDirs" = "1"; then
|
||||
# gcj in.
|
||||
unset LIBRARY_PATH
|
||||
unset CPATH
|
||||
if test -z "$crossStageStatic"; then
|
||||
EXTRA_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
|
||||
fi
|
||||
else
|
||||
if test -z "$NIX_CC_CROSS"; then
|
||||
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
|
||||
|
Loading…
Reference in New Issue
Block a user