1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

Store Git hash

This commit is contained in:
Anthony Scemama 2021-11-08 19:41:17 +01:00
parent b40c960cef
commit 42bf7ce94c
2 changed files with 24 additions and 13 deletions

View File

@ -35,8 +35,9 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
CLEANFILES = trexio.mod CLEANFILES = trexio.mod
BUILT_SOURCES = trexio.mod BUILT_SOURCES = trexio.mod
EXTRA_DIST = .git_hash
SUBDIRS = SUBDIRS =
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = pkgconfig/trexio.pc pkgconfig_DATA = pkgconfig/trexio.pc
@ -61,9 +62,9 @@ SOURCES = \
src/trexio_text.c \ src/trexio_text.c \
src/trexio_text.h src/trexio_text.h
if HAVE_HDF5 if HAVE_HDF5
SOURCES += src/trexio_hdf5.c \ SOURCES += src/trexio_hdf5.c \
src/trexio_hdf5.h src/trexio_hdf5.h
endif endif
ORG_FILES = \ ORG_FILES = \
@ -88,7 +89,7 @@ TESTS_C = \
tests/overwrite_all_text \ tests/overwrite_all_text \
tests/io_all tests/io_all
if HAVE_HDF5 if HAVE_HDF5
TESTS_C += \ TESTS_C += \
tests/open_hdf5 \ tests/open_hdf5 \
tests/io_num_hdf5 \ tests/io_num_hdf5 \
@ -97,7 +98,7 @@ TESTS_C += \
tests/io_safe_dset_float_hdf5 \ tests/io_safe_dset_float_hdf5 \
tests/io_str_hdf5 \ tests/io_str_hdf5 \
tests/io_dset_str_hdf5 \ tests/io_dset_str_hdf5 \
tests/overwrite_all_hdf5 tests/overwrite_all_hdf5
endif endif
TESTS_F = \ TESTS_F = \
@ -110,7 +111,7 @@ check_PROGRAMS = $(TESTS)
LDADD = src/libtrexio.la LDADD = src/libtrexio.la
# in principal, specifying -no-install (see below) is not mandatory # in principal, specifying -no-install (see below) is not mandatory
# for the tests to compile and pass, but the produced test binaries differ # for the tests to compile and pass, but the produced test binaries differ
tests_open_text_LDFLAGS = -no-install tests_open_text_LDFLAGS = -no-install
tests_io_num_text_LDFLAGS = -no-install tests_io_num_text_LDFLAGS = -no-install
tests_io_dset_float_text_LDFLAGS = -no-install tests_io_dset_float_text_LDFLAGS = -no-install
@ -175,10 +176,10 @@ $(HTML_TANGLED): $(htmlizer)
# =============== DEVELOPER MODE =============== # # =============== DEVELOPER MODE =============== #
SWIG = @SWIG@ SWIG = @SWIG@
HDF5_LDFLAGS = @HDF5_LDFLAGS@ HDF5_LDFLAGS = @HDF5_LDFLAGS@
HDF5_CFLAGS = @HDF5_CFLAGS@ HDF5_CFLAGS = @HDF5_CFLAGS@
HDF5_CPPFLAGS = @HDF5_CPPFLAGS@ HDF5_CPPFLAGS = @HDF5_CPPFLAGS@
if TREXIO_DEVEL if TREXIO_DEVEL
@ -186,6 +187,9 @@ CLEANFILES += $(SOURCES) $(trexio_f) $(trexio_h)
BUILT_SOURCES += $(SOURCES) $(trexio_f) $(test_trexio_f) BUILT_SOURCES += $(SOURCES) $(trexio_f) $(test_trexio_f)
.git_hash:
git log | head -1 | cut -d ' ' -f 2 > .git_hash
$(SOURCES): $(trexio_f) $(SOURCES): $(trexio_f)
src/trexio.c: $(trexio_h) src/trexio.c: $(trexio_h)
@ -229,7 +233,7 @@ python-sdist: $(pytrexio_py) $(setup_py) $(setup_cfg)
cd python && \ cd python && \
python setup.py sdist python setup.py sdist
$(pytrexio_py): $(pytrexio_c) $(pytrexio_py): $(pytrexio_c)
cd tools && ./prepare_python.sh cd tools && ./prepare_python.sh
# Build Python module and C wrapper code for TREXIO using SWIG # Build Python module and C wrapper code for TREXIO using SWIG
@ -241,7 +245,7 @@ $(pytrexio_c): $(ORG_FILES) $(trexio_h) $(pytrexio_i) $(numpy_i)
$(RM) -- src/trexio.h $(RM) -- src/trexio.h
$(numpy_i): $(numpy_i):
wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O $(numpy_i) wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O $(numpy_i)
check-numpy: check-numpy:
cd tools && ./check_numpy_i.sh cd tools && ./check_numpy_i.sh

View File

@ -169,7 +169,14 @@ if test "x${TREXIO_DEVEL}" != "x"; then
HAS_CPPCHECK=1 HAS_CPPCHECK=1
fi fi
GIT_HASH=`git log | head -1 | cut -d ' ' -f 2 | tee ${srcdir}/.git_hash`
else
GIT_HASH=`cat ${srcdir}/.git_hash`
fi fi
AC_DEFINE_UNQUOTED(GIT_HASH, ["${GIT_HASH}"], [Git SHA1 Hash])
## Libm ## Libm
## ---- ## ----
@ -191,7 +198,7 @@ AC_OUTPUT
echo \ echo \
"------------------------------------------------- "-------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${TREXIO_DEVEL} ${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${GIT_HASH} ${TREXIO_DEVEL}
Prefix ........: ${prefix} Prefix ........: ${prefix}
CC ............: ${CC} CC ............: ${CC}