diff --git a/fftw3.sh b/fftw3.sh index 2efe3b7297..3fda9bc195 100644 --- a/fftw3.sh +++ b/fftw3.sh @@ -9,44 +9,25 @@ build_requires: - "GCC-Toolchain:(?!osx)" --- #!/bin/bash -e -export FFTW3_WITH_AVX # use AVX with float or double. Unset automatically for long double and quad +# ROOT and O2 need different variants of fftw3, but we cannot configure fftw3 +# to build both at the same time. As a workaround, configure and build one, +# then wipe out the build directory and configure and build the second one. -if [[ $FFTW3_DOUBLE == "ON" ]]; then # ensure only one option is set and AVX is disabled if necessary - FFTW3_FLOAT="OFF" - FFTW3_LONG_DOUBLE="OFF" -elif [[ $FFTW3_LONG_DOUBLE == "ON" ]]; then - unset FFTW3_WITH_AVX - FFTW3_FLOAT="OFF" - FFTW3_DOUBLE="OFF" -else # keep FLOAT default option as it was - FFTW3_FLOAT="ON" - FFTW3_DOUBLE="OFF" - FFTW3_LONG_DOUBLE="OFF" -fi +# First, build fftw3 (double precision), required by ROOT. +cmake -S "$SOURCEDIR" -B "$BUILDDIR/fftw3" \ + -DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \ + -DCMAKE_INSTALL_LIBDIR:PATH=lib +make -C "$BUILDDIR/fftw3" ${JOBS+-j "$JOBS"} +make -C "$BUILDDIR/fftw3" install -case $ARCHITECTURE in - osx_arm64) - cmake $SOURCEDIR \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALLROOT}" \ - -DCMAKE_INSTALL_LIBDIR:PATH="lib" \ - -DENABLE_LONG_DOUBLE=${FFTW3_LONG_DOUBLE-OFF} \ - -DENABLE_FLOAT=${FFTW3_FLOAT-OFF} - ;; - *) - cmake $SOURCEDIR \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALLROOT}" \ - -DCMAKE_INSTALL_LIBDIR:PATH="lib" \ - -DENABLE_LONG_DOUBLE=${FFTW3_LONG_DOUBLE-OFF} \ - -DENABLE_FLOAT=${FFTW3_FLOAT-OFF} \ - ${FFTW3_WITH_AVX:+-DENABLE_AVX=ON} - ;; -esac - -make ${JOBS+-j $JOBS} -make install +# Now reconfigure for fftw3f (single precision float), required by O2. +cmake -S "$SOURCEDIR" -B "$BUILDDIR/fftw3f" \ + -DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \ + -DCMAKE_INSTALL_LIBDIR:PATH=lib \ + -DENABLE_FLOAT=ON +make -C "$BUILDDIR/fftw3f" ${JOBS+-j "$JOBS"} +make -C "$BUILDDIR/fftw3f" install #Modulefile -MODULEDIR="$INSTALLROOT/etc/modulefiles" -MODULEFILE="$MODULEDIR/$PKGNAME" -mkdir -p "$MODULEDIR" -alibuild-generate-module --bin --lib > $MODULEFILE +mkdir -p "$INSTALLROOT/etc/modulefiles" +alibuild-generate-module --bin --lib > "$INSTALLROOT/etc/modulefiles/$PKGNAME" diff --git a/root.sh b/root.sh index 7a7c7b44c5..3d8e9f5376 100644 --- a/root.sh +++ b/root.sh @@ -184,6 +184,10 @@ cmake $SOURCEDIR cmake --build . --target install ${JOBS+-j $JOBS} +# Make sure ROOT actually found its build dependencies and didn't disable +# features we requested. "-Dfail-on-missing=ON" would probably be better. +[ "$("$INSTALLROOT/bin/root-config" --has-fftw3)" = yes ] + # Add support for ROOT_PLUGIN_PATH envvar for specifying additional plugin search paths grep -v '^Unix.*.Root.PluginPath' $INSTALLROOT/etc/system.rootrc > system.rootrc.0 cat >> system.rootrc.0 <<\EOF