1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-22 04:14:40 +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)
# 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))
sed -i'' -e "$LINE_NO"'i \
#define HAVE_HDF5 1
' -- ${PYDIR}/src/trexio.h
# sed on MacOS is different from GNU sed on Linux and requires special treatment
if [[ "$OSTYPE" == "darwin"* ]]; then
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
cp ${TREXIO_ROOT}/AUTHORS ${TREXIO_ROOT}/LICENSE ${PYDIR}