aboutsummaryrefslogtreecommitdiff
path: root/iraf.axe/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'iraf.axe/build.sh')
-rw-r--r--iraf.axe/build.sh38
1 files changed, 27 insertions, 11 deletions
diff --git a/iraf.axe/build.sh b/iraf.axe/build.sh
index 5222b17..58b8259 100644
--- a/iraf.axe/build.sh
+++ b/iraf.axe/build.sh
@@ -1,6 +1,31 @@
# Install aXe binaries into STSDAS in the same way as the Ureka pkg-install.
# This must be built on CentOS >=6, for compatibility with the cfitsio build.
+set -e
+
+# Get the target stsdas/bin.$IRAFARCH installation path from IRAF.
+# The aXe build does not actually rely on IRAF apart from this.
+. setup_iraf.sh
+rm -rf irafdir
+mkdir irafdir
+cd irafdir
+echo xterm | mkiraf > tmp
+touch .hushiraf
+cl > tmp << ARF
+cd stsdas
+cd bin
+pwd -P
+logout
+ARF
+stbindir=$(sed -Ee 's|e?cl>[ \t]*||g' tmp)
+stdir=$(dirname "$stbindir")
+cd ..
+
+if ! echo "$stbindir" | grep -q 'stsdas/bin'; then
+ echo "Failed to determine stsdas/bin path from IRAF" >&2
+ exit 1
+fi
+
# I'd have thought conda-build would take care of this but it appears not to:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PREFIX/lib"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PREFIX/lib"
@@ -9,15 +34,6 @@ export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PREFIX/lib"
# deprecated C usage, as when building IRAF:
export CFLAGS="$CFLAGS -Wno-return-type"
-set -e
-
-# Creating a dummy STSDAS directory as the install target avoids having IRAF
-# as a heavyweight build dependency when it's not needed (at the cost of this
-# script having to know the IRAF directory structure in the env, but that's
-# not likely to change):
-stdir=$PREFIX/iraf_extern/stsdas
-mkdir -p "$stdir/bin"
-
echo "Build static GSL (old version needed by aXe)"
# Put static GSL in a temporary location, because we don't need to distribute
@@ -38,8 +54,8 @@ cd ../aXe/ccc
--with-gsl-prefix="${SRC_DIR}/gsl_build"
make
-echo "Install aXe into STSDAS path"
-cp -p bin/* "$stdir/bin/"
+echo "Install aXe into $stbindir/"
+cp -p bin/* "$stbindir/"
# Install obligatory licensing information (best kept in pkg with binaries):
cp -p "$RECIPE_DIR/copyright.aXe" "$stdir/"