Skip to content

Commit

Permalink
Add RPATH comment | Update shell pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
abejgonzalez committed Sep 9, 2022
1 parent c0be131 commit 917b56e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@

set -ex

TOOLCHAIN_NAME=riscv-tools

# strip debugging info
export LDFLAGS="$LDFLAGS -s"

# de-init unneeded qemu submodule
git -C ./riscv-gnu-toolchain submodule deinit --force qemu

NPROC=$CPU_COUNT ./build-toolchains.sh --prefix $PREFIX/riscv-tools --clean-after-install
NPROC=$CPU_COUNT ./build-toolchains.sh --prefix $PREFIX/$TOOLCHAIN_NAME --clean-after-install

# create activate & deactivate scripts that manage the toolchain
mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d

perl -pe 's/\@NATURE\@/activate/' "${RECIPE_DIR}"/activate.sh > "${PREFIX}"/etc/conda/activate.d/activate-${PKG_NAME}.sh
perl -pe 's/\@NATURE\@/deactivate/' "${RECIPE_DIR}"/activate.sh > "${PREFIX}"/etc/conda/deactivate.d/deactivate-${PKG_NAME}.sh

pushd $PREFIX/riscv-tools/sysroot
pushd $PREFIX/$TOOLCHAIN_NAME/sysroot

for file in $(find . -exec file {} \; | grep -I ELF | awk {'print $1}' | sed 's/.$//')
# Strip $ORIGIN/.*/lib (if it exists) from the RPATH of all sysroot binaries.
# Fixes linux boot (since the RPATH shouldn't be set for the sysroot ld*.so)
shopt -s globstar
for file in ** ;
do
file -b "${file}" | grep -q 'ELF' || continue
if output=$(patchelf --print-rpath $file); then
echo "Current RPATH=$output for FILE=$file"
if [[ $output == *":"* ]]; then
Expand Down

0 comments on commit 917b56e

Please sign in to comment.