nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 58 lines 1.6 kB view raw
1#!/bin/sh 2 3buildcpath() { 4 local path after 5 while (( $# )); do 6 case $1 in 7 -isystem) 8 shift 9 path=$path${path:+':'}$1 10 ;; 11 -idirafter) 12 shift 13 after=$after${after:+':'}$1 14 ;; 15 esac 16 shift 17 done 18 echo $path${after:+':'}$after 19} 20 21buildcpluspath() { 22 local path after 23 while (( $# )); do 24 case $1 in 25 -isystem|-cxx-isystem) 26 shift 27 path=$path${path:+':'}$1 28 ;; 29 -idirafter) 30 shift 31 after=$after${after:+':'}$1 32 ;; 33 esac 34 shift 35 done 36 echo $path${after:+':'}$after 37} 38 39# When user passes `--query-driver`, avoid extending `CPATH` et al, since we 40# don't want to infect user-specified toolchain and headers with our stuff. 41extendcpath=true 42 43for arg in "$@"; do 44 if [[ "${arg}" == \-\-query\-driver* ]]; then 45 extendcpath=false 46 fi 47done 48 49if [ "$extendcpath" = true ]; then 50 export C_INCLUDE_PATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \ 51 $(<@clang@/nix-support/libc-cflags)) 52 53 export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpluspath ${NIX_CFLAGS_COMPILE} \ 54 $(<@clang@/nix-support/libcxx-cxxflags) \ 55 $(<@clang@/nix-support/libc-cflags)) 56fi 57 58@out@/bin/$(basename $0)-unwrapped "$@"