From 39df5831cae0dce4628e80cf7f6f5520a9dae18e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 3 May 2018 17:52:11 -0400 Subject: [PATCH] lib{std,}c++: Fix setup hooks for cross --- pkgs/development/compilers/gcc/libstdc++-hook.sh | 15 +++++++++++++-- .../compilers/llvm/3.5/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/3.7/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/3.8/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/3.9/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/4/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/5/libc++/setup-hook.sh | 15 +++++++++++++-- .../compilers/llvm/6/libc++/setup-hook.sh | 15 +++++++++++++-- 8 files changed, 104 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/gcc/libstdc++-hook.sh b/pkgs/development/compilers/gcc/libstdc++-hook.sh index 893bbbc0c2d..2325eeb9e2c 100644 --- a/pkgs/development/compilers/gcc/libstdc++-hook.sh +++ b/pkgs/development/compilers/gcc/libstdc++-hook.sh @@ -1,2 +1,13 @@ -export NIX_CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)" -export NIX_CXXSTDLIB_LINK=" -stdlib=libstdc++" +# The `hostOffset` describes how the host platform of the dependencies are slid +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libstdc++" diff --git a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh index 9022fced6ec..e18733b5ea3 100644 --- a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies are slid +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh index 9022fced6ec..e18733b5ea3 100644 --- a/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies are slid +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh index 9022fced6ec..bcd93cf486f 100644 --- a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh index 9022fced6ec..bcd93cf486f 100644 --- a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh index 9022fced6ec..bcd93cf486f 100644 --- a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh index 9022fced6ec..bcd93cf486f 100644 --- a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh index 9022fced6ec..bcd93cf486f 100644 --- a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh @@ -1,3 +1,14 @@ +# The `hostOffset` describes how the host platform of the dependencies +# relative to the depending package. It is brought into scope of the setup hook +# defined as the role of the dependency whose hooks is being run. +case $hostOffset in + -1) local role='BUILD_' ;; + 0) local role='' ;; + 1) local role='TARGET_' ;; + *) echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2; + return 1 ;; +esac + linkCxxAbi="@linkCxxAbi@" -export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" +export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"