From db7d1c405fadfc8e06932fa11c650b227e57058f Mon Sep 17 00:00:00 2001 From: "Dr. Thomas Orgis" <thomas.orgis@uni-hamburg.de> Date: Wed, 1 Apr 2020 11:02:37 +0200 Subject: [PATCH] build_lofar.sh: add CASACORE_LDPATH with $dyscolib --- build_lofar.sh | 6 ++++++ test.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test.sh diff --git a/build_lofar.sh b/build_lofar.sh index 5b61cdc..198a27b 100644 --- a/build_lofar.sh +++ b/build_lofar.sh @@ -365,6 +365,7 @@ else fi >> "$prefix/build.log" 2>&1 || exit 1 begin_pkg dysco +dyscolib=$prefix/lib if [ ! -e $prefix/.done ]; then # # Install Dysco @@ -713,6 +714,11 @@ EOT pylib="$p/lib/python$pyver/site-packages" test -d "$lofar_prefix/$pylib" && echo "export PYTHONPATH=\"\$lofar_prefix/$pylib:\$PYTHONPATH\"" + case $p in + casacore) + echo "export CASACORE_LDPATH=\"$dyscolib:\$CASACORE_LDPATH\"" + ;; + esac done } diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..ad904e3 --- /dev/null +++ b/test.sh @@ -0,0 +1,49 @@ +print_init() +{ + cat <<EOT +# LOFAR Tools built by $USER@$(hostname) on $(date) +# +# Sourcing this script shall re-create the build environment and +# add things from the LOFAR prefix to appropriate path variables. +# It does _not_ set LD_LIBRARY_PATH (unless the build environment +# does), as a proper build should use RPATH in the binaries. +# But there is LD_RUN_PATH / LIBRARY_PATH set for link-time usage. +# You can set LD_LIBRARY_PATH=\$LD_RUN_PATH as a hack if some binary +# fails to find its libs. But this would be a bug in the build +# script that should be fixed properly. +# +# Step 1: The build config with all variables used. +# + +lofar_prefix='$lofar_prefix' + +EOT + cat $config +cat <<EOT +# +# Step 2: Paths to LOFAR tools in the prefix. +# +EOT + for p in lsmtool pyBDSF wsclean dysco DP3\ + idg aoflagger python-casacore casacore + do + echo "# $p" + pp="$lofar_prefix/$p" + test -d "$pp/bin" && + echo "export PATH=\"\$lofar_prefix/$p/bin:\$PATH\"" + test -d "$pp/lib" && + cat <<EOT +export LD_RUN_PATH=\"\$lofar_prefix/$p/lib:\$LD_RUN_PATH\" +export LIBRARY_PATH=\"\$lofar_prefix/$p/lib:\$LIBRARY_PATH\" +EOT + test -d "$pp/include" && + echo "export CPATH=\"\$lofar_prefix/$p/include:\$CPATH\"" + pylib="$p/lib/python$pyver/site-packages" + test -d "$lofar_prefix/$pylib" && + echo "export PYTHONPATH=\"\$lofar_prefix/$pylib:\$PYTHONPATH\"" + done +} + +print_init > "$lofar_prefix/init.sh" && +echo "Finished installation. You can source $lofar_prefix/init.sh and run." +true -- GitLab