|
30 | 30 | # Given a package name and an output name, return the path of that output in our
|
31 | 31 | # current guix environment
|
32 | 32 | store_path() {
|
33 |
| - grep --extended-regexp "/[^-]{32}-${1}-cross-${HOST}-[^-]+${2:+-${2}}" "${GUIX_ENVIRONMENT}/manifest" \ |
| 33 | + grep --extended-regexp "/[^-]{32}-${1}-[^-]+${2:+-${2}}" "${GUIX_ENVIRONMENT}/manifest" \ |
34 | 34 | | head --lines=1 \
|
35 | 35 | | sed --expression='s|^[[:space:]]*"||' \
|
36 | 36 | --expression='s|"[[:space:]]*$||'
|
37 | 37 | }
|
38 | 38 |
|
39 | 39 | # Determine output paths to use in CROSS_* environment variables
|
40 |
| -CROSS_GLIBC="$(store_path glibc)" |
41 |
| -CROSS_GLIBC_STATIC="$(store_path glibc static)" |
42 |
| -CROSS_KERNEL="$(store_path linux-libre-headers)" |
43 |
| -CROSS_GCC="$(store_path gcc)" |
| 40 | +CROSS_GLIBC="$(store_path glibc-cross-${HOST})" |
| 41 | +CROSS_GLIBC_STATIC="$(store_path glibc-cross-${HOST} static)" |
| 42 | +CROSS_KERNEL="$(store_path linux-libre-headers-cross-${HOST})" |
| 43 | +CROSS_GCC="$(store_path gcc-cross-${HOST})" |
| 44 | +CROSS_GCC_LIBS=( "${CROSS_GCC}/lib/gcc/${HOST}"/* ) # This expands to an array of directories... |
| 45 | +CROSS_GCC_LIB="${CROSS_GCC_LIBS[0]}" # ...we just want the first one (there should only be one) |
44 | 46 |
|
45 | 47 | # Set environment variables to point Guix's cross-toolchain to the right
|
46 | 48 | # includes/libs for $HOST
|
47 |
| -export CROSS_C_INCLUDE_PATH="${CROSS_GCC}/include:${CROSS_GLIBC}/include:${CROSS_KERNEL}/include" |
48 |
| -export CROSS_CPLUS_INCLUDE_PATH="${CROSS_GCC}/include/c++:${CROSS_GLIBC}/include:${CROSS_KERNEL}/include" |
49 |
| -export CROSS_LIBRARY_PATH="${CROSS_GLIBC}/lib:${CROSS_GLIBC_STATIC}/lib:${CROSS_GCC}/lib:${CROSS_GCC}/${HOST}/lib:${CROSS_KERNEL}/lib" |
| 49 | +# |
| 50 | +# NOTE: CROSS_C_INCLUDE_PATH is missing ${CROSS_GCC_LIB}/include-fixed, because |
| 51 | +# the limits.h in it is missing a '#include_next <limits.h>' |
| 52 | +# |
| 53 | +export CROSS_C_INCLUDE_PATH="${CROSS_GCC_LIB}/include:${CROSS_GLIBC}/include:${CROSS_KERNEL}/include" |
| 54 | +export CROSS_CPLUS_INCLUDE_PATH="${CROSS_GCC}/include/c++:${CROSS_GCC}/include/c++/${HOST}:${CROSS_GCC}/include/c++/backward:${CROSS_C_INCLUDE_PATH}" |
| 55 | +export CROSS_LIBRARY_PATH="${CROSS_GCC}/lib:${CROSS_GCC}/${HOST}/lib:${CROSS_GCC_LIB}:${CROSS_GLIBC}/lib:${CROSS_GLIBC_STATIC}/lib" |
| 56 | + |
| 57 | +# Sanity check CROSS_*_PATH directories |
| 58 | +IFS=':' read -ra PATHS <<< "${CROSS_C_INCLUDE_PATH}:${CROSS_CPLUS_INCLUDE_PATH}:${CROSS_LIBRARY_PATH}" |
| 59 | +for p in "${PATHS[@]}"; do |
| 60 | + if [ ! -d "$p" ]; then |
| 61 | + echo "'$p' doesn't exist or isn't a directory... Aborting..." |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | +done |
50 | 65 |
|
51 | 66 | # Disable Guix ld auto-rpath behavior
|
52 | 67 | export GUIX_LD_WRAPPER_DISABLE_RPATH=yes
|
|
0 commit comments