mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Fix demo scripts for out-of-tree builds
Allow demo scripts to be run from the build directory for out-of-tree builds. If the executable is not found in the source tree then search in the current directory in case the script is being run from a build directory. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
@@ -20,8 +20,29 @@
|
||||
|
||||
set -e -u
|
||||
|
||||
program_name="dlopen"
|
||||
program_dir="${0%/*}"
|
||||
program="$program_dir/dlopen"
|
||||
program="$program_dir/$program_name"
|
||||
|
||||
if [ ! -e "$program" ]; then
|
||||
# Look for programs in the current directory and the directories above it
|
||||
for dir in "." ".." "../.."; do
|
||||
program_dir="$dir/programs/test"
|
||||
program="$program_dir/$program_name"
|
||||
if [ -e "$program" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -e "$program" ]; then
|
||||
echo "Could not find $program_name program"
|
||||
|
||||
echo "Make sure that Mbed TLS is built as a shared library." \
|
||||
"If building out-of-tree, this script must be run" \
|
||||
"from the project build directory."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
top_dir="$program_dir/../.."
|
||||
library_dir="$top_dir/library"
|
||||
|
||||
|
Reference in New Issue
Block a user