2019-06-27 16:44:25 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-07-11 22:49:26 +02:00
|
|
|
USER_MODULES_H=app/include/user_modules.h
|
|
|
|
|
2019-06-27 16:44:25 +02:00
|
|
|
COMMIT_ID="$(git rev-parse HEAD)"
|
2019-07-27 13:09:11 +02:00
|
|
|
BRANCH="$(git rev-parse --abbrev-ref HEAD | sed -E 's/[\/\\]+/_/g')"
|
|
|
|
RELEASE="$(git describe --tags --long | sed -E 's/(.*)-(.*)-.*/\1 +\2/g' | sed 's/ +0$//')"
|
2019-07-22 23:43:53 +02:00
|
|
|
RELEASE_DTS=$(TZ=UTC git show --quiet --date=format-local:"%Y%m%d%H%M" --format="%cd" HEAD)
|
2019-06-27 16:44:25 +02:00
|
|
|
|
2019-07-11 22:49:26 +02:00
|
|
|
MODULES=$(awk '/^[ \t]*#define LUA_USE_MODULES/{modules=modules sep tolower(substr($2,17));sep=","}END{if(length(modules)==0)modules="-";print modules}' $USER_MODULES_H | tr -d '\r')
|
2019-06-27 16:44:25 +02:00
|
|
|
|
|
|
|
# create temp buildinfo
|
|
|
|
TEMPFILE=/tmp/buildinfo.h
|
|
|
|
cat > $TEMPFILE << EndOfMessage
|
|
|
|
#ifndef __BUILDINFO_H__
|
|
|
|
#define __BUILDINFO_H__
|
2019-07-19 21:24:22 +02:00
|
|
|
|
|
|
|
#include "user_config.h"
|
|
|
|
|
|
|
|
#define BUILDINFO_STR_HELPER(x) #x
|
|
|
|
#define BUILDINFO_TO_STR(x) BUILDINFO_STR_HELPER(x)
|
|
|
|
|
|
|
|
#ifdef LUA_FLASH_STORE
|
|
|
|
#define BUILDINFO_LFS LUA_FLASH_STORE
|
|
|
|
#else
|
|
|
|
#define BUILDINFO_LFS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CLIENT_SSL_ENABLE
|
|
|
|
#define BUILDINFO_SSL true
|
|
|
|
#define BUILDINFO_SSL_STR "true"
|
|
|
|
#else
|
|
|
|
#define BUILDINFO_SSL false
|
|
|
|
#define BUILDINFO_SSL_STR "false"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LUA_NUMBER_INTEGRAL
|
|
|
|
#define BUILDINFO_BUILD_TYPE "integer"
|
|
|
|
#else
|
|
|
|
#define BUILDINFO_BUILD_TYPE "float"
|
|
|
|
#endif
|
|
|
|
|
2019-07-27 08:27:19 +02:00
|
|
|
#define USER_PROLOG "$USER_PROLOG"
|
|
|
|
#define BUILDINFO_BRANCH "$BRANCH"
|
|
|
|
#define BUILDINFO_COMMIT_ID "$COMMIT_ID"
|
|
|
|
#define BUILDINFO_RELEASE "$RELEASE"
|
|
|
|
#define BUILDINFO_RELEASE_DTS "$RELEASE_DTS"
|
|
|
|
#define BUILDINFO_MODULES "$MODULES"
|
2019-06-27 16:44:25 +02:00
|
|
|
|
|
|
|
#define NODE_VERSION_LONG \\
|
2019-07-27 08:27:19 +02:00
|
|
|
USER_PROLOG "\n" \\
|
2019-07-12 21:36:44 +02:00
|
|
|
"\tbranch: " BUILDINFO_BRANCH "\n" \\
|
|
|
|
"\tcommit: " BUILDINFO_COMMIT_ID "\n" \\
|
|
|
|
"\trelease: " BUILDINFO_RELEASE "\n" \\
|
2019-07-12 22:39:04 +02:00
|
|
|
"\trelease DTS: " BUILDINFO_RELEASE_DTS "\n" \\
|
2019-07-12 21:36:44 +02:00
|
|
|
"\tSSL: " BUILDINFO_SSL_STR "\n" \\
|
2019-07-27 12:55:34 +02:00
|
|
|
"\tbuild type: " BUILDINFO_BUILD_TYPE "\n" \\
|
2019-07-19 21:24:22 +02:00
|
|
|
"\tLFS: " BUILDINFO_TO_STR(BUILDINFO_LFS) "\n" \\
|
2019-07-12 21:36:44 +02:00
|
|
|
"\tmodules: " BUILDINFO_MODULES "\n"
|
|
|
|
|
2019-07-27 08:27:19 +02:00
|
|
|
EndOfMessage
|
2019-06-27 16:44:25 +02:00
|
|
|
|
|
|
|
echo "#endif /* __BUILDINFO_H__ */" >> $TEMPFILE
|
2019-07-11 22:49:26 +02:00
|
|
|
|
|
|
|
diff -q $TEMPFILE app/include/buildinfo.h || cp $TEMPFILE app/include/buildinfo.h
|
2019-07-12 21:36:44 +02:00
|
|
|
rm $TEMPFILE
|