Skip to content

Commit e4b9748

Browse files
committed
Merge #16810: guix: Remove ssp spec file hack
0065ead contrib: guix: Remove ssp spec file hack (Carl Dong) 0093a58 contrib: guix: More robust search paths, add checks (Carl Dong) Pull request description: See commit messages for more details ACKs for top commit: fanquake: ACK 0065ead Tree-SHA512: fde04005fb31cd4b75b80da4936a7c394f63f0b3bdcc33c20c99e05604a63efd9c850a8d097030ff0bf4b4e83f1a9997fc4621ce291ebcecd8397893447600a7
2 parents 0d20c42 + 0065ead commit e4b9748

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

contrib/guix/libexec/build.sh

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,38 @@ fi
3030
# Given a package name and an output name, return the path of that output in our
3131
# current guix environment
3232
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" \
3434
| head --lines=1 \
3535
| sed --expression='s|^[[:space:]]*"||' \
3636
--expression='s|"[[:space:]]*$||'
3737
}
3838

3939
# 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)
4446

4547
# Set environment variables to point Guix's cross-toolchain to the right
4648
# 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
5065

5166
# Disable Guix ld auto-rpath behavior
5267
export GUIX_LD_WRAPPER_DISABLE_RPATH=yes
@@ -121,17 +136,10 @@ DISTNAME="$(basename "$SOURCEDIST" '.tar.gz')"
121136
# Binary Tarball Building #
122137
###########################
123138

124-
# Create a spec file to normalize ssp linking behaviour
125-
spec_file="$(mktemp)"
126-
cat << EOF > "$spec_file"
127-
*link_ssp:
128-
%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:}
129-
EOF
130-
131139
# Similar flags to Gitian
132140
CONFIGFLAGS="--enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests"
133-
HOST_CFLAGS="-O2 -g -specs=${spec_file} -ffile-prefix-map=${PWD}=."
134-
HOST_CXXFLAGS="-O2 -g -specs=${spec_file} -ffile-prefix-map=${PWD}=."
141+
HOST_CFLAGS="-O2 -g -ffile-prefix-map=${PWD}=."
142+
HOST_CXXFLAGS="-O2 -g -ffile-prefix-map=${PWD}=."
135143
HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -static-libstdc++"
136144

137145
# Make $HOST-specific native binaries from depends available in $PATH

0 commit comments

Comments
 (0)