Skip to content

Commit

Permalink
test-release.sh: tweak RPATH for the binary packages.
Browse files Browse the repository at this point in the history
libtool sets RPATH to "$ORIGIN/../lib:/the/directory/where/it/was/built/lib" so that a developper can use the built or the installed version seamlessly. Our binary packages should not have this developer friendly tweak, as the users of the binaries will not have the build tree.

Beside, in case the development tree is a possibly on an automounted share, this can create very bad user experience : they will incur an automount timeout penalty and will get a very bad feeling of llvm/clang's speed.

llvm-svn: 194999
  • Loading branch information
Arnaud-de-Grandmaison committed Nov 18, 2013
1 parent 88134e9 commit 69690e4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions llvm/utils/release/test-release.sh
Expand Up @@ -180,6 +180,18 @@ if [ "$do_dragonegg" = "yes" ]; then
fi
fi

# Make sure that a required program is available
function check_program_exists() {
local program="$1"
if ! type -P $program > /dev/null 2>&1 ; then
echo "program '$1' not found !"
exit 1
fi
}

check_program_exists 'chrpath'
check_program_exists 'file'
check_program_exists 'objdump'

# Make sure that the URLs are valid.
function check_valid_urls() {
Expand Down Expand Up @@ -328,6 +340,21 @@ function test_llvmCore() {
cd $BuildDir
}

# Clean RPATH. Libtool adds the build directory to the search path, which is
# not necessary --- and even harmful --- for the binary packages we release.
function clean_RPATH() {
local InstallPath="$1"
for Candidate in `find $InstallPath/{bin,lib} -type f`; do
if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
rpath=`objdump -x $Candidate | grep 'RPATH' | sed -e's/^ *RPATH *//'`
if [ -n "$rpath" ]; then
newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
fi
fi
done
}

set -e # Exit if any command fails

if [ "$do_checkout" = "yes" ]; then
Expand Down Expand Up @@ -415,6 +442,7 @@ for Flavor in $Flavors ; do
$llvmCore_phase1_objdir $llvmCore_phase1_installdir
build_llvmCore 1 $Flavor \
$llvmCore_phase1_objdir
clean_RPATH $llvmCore_phase1_installdir

# Test clang
if [ "$do_clang" = "yes" ]; then
Expand All @@ -427,6 +455,7 @@ for Flavor in $Flavors ; do
$llvmCore_phase2_objdir $llvmCore_phase2_installdir
build_llvmCore 2 $Flavor \
$llvmCore_phase2_objdir
clean_RPATH $llvmCore_phase2_installdir

########################################################################
# Phase 3: Build llvmCore with newly built clang from phase 2.
Expand All @@ -437,6 +466,7 @@ for Flavor in $Flavors ; do
$llvmCore_phase3_objdir $llvmCore_phase3_installdir
build_llvmCore 3 $Flavor \
$llvmCore_phase3_objdir
clean_RPATH $llvmCore_phase3_installdir

########################################################################
# Testing: Test phase 3
Expand Down Expand Up @@ -478,6 +508,7 @@ for Flavor in $Flavors ; do
build_llvmCore 2 $Flavor \
$llvmCore_de_phase2_objdir
build_dragonegg 2 $Flavor $llvmCore_de_phase2_installdir $dragonegg_phase2_objdir
clean_RPATH $llvmCore_de_phase2_installdir

########################################################################
# Phase 3: Build llvmCore with newly built dragonegg from phase 2.
Expand All @@ -489,6 +520,7 @@ for Flavor in $Flavors ; do
build_llvmCore 3 $Flavor \
$llvmCore_de_phase3_objdir
build_dragonegg 3 $Flavor $llvmCore_de_phase3_installdir $dragonegg_phase3_objdir
clean_RPATH $llvmCore_de_phase3_installdir

########################################################################
# Testing: Test phase 3
Expand Down

0 comments on commit 69690e4

Please sign in to comment.