1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-03 10:06:01 +01:00

Fix portability issue with sed on MacOS

This commit is contained in:
q-posev 2022-01-26 14:00:05 +01:00
parent 213e51f606
commit 550cc73603

View File

@ -32,9 +32,14 @@ cp ${INCLUDIR}/trexio.h ${PYDIR}/src
# fix needed to define HAVE_HDF5 symbol so that Python extension is always compiled with HDF5 (without including config.h) # fix needed to define HAVE_HDF5 symbol so that Python extension is always compiled with HDF5 (without including config.h)
# add "#define HAVE_HDF5 1" line after "#include stdint.h" using awk and sed # add "#define HAVE_HDF5 1" line after "#include stdint.h" using awk and sed
export LINE_NO=$(($(awk '/stdint.h/{print NR}' ${PYDIR}/src/trexio.h) + 1)) export LINE_NO=$(($(awk '/stdint.h/{print NR}' ${PYDIR}/src/trexio.h) + 1))
sed -i'' -e "$LINE_NO"'i \ # sed on MacOS is different from GNU sed on Linux and requires special treatment
#define HAVE_HDF5 1 if [[ "$OSTYPE" == "darwin"* ]]; then
' -- ${PYDIR}/src/trexio.h sed -i '' -e "$LINE_NO"'i \
#define HAVE_HDF5 1' "${PYDIR}/src/trexio.h"
else
sed -i -e "$LINE_NO"'i \
#define HAVE_HDF5 1' "${PYDIR}/src/trexio.h"
fi
# Copy additional info # Copy additional info
cp ${TREXIO_ROOT}/AUTHORS ${TREXIO_ROOT}/LICENSE ${PYDIR} cp ${TREXIO_ROOT}/AUTHORS ${TREXIO_ROOT}/LICENSE ${PYDIR}