Add release and build info to version-alist

env_release.h shall be updated on each release.
This commit is contained in:
Lassi Kortela 2019-10-14 19:15:45 +03:00
parent f9f4b54d1e
commit 975ad5de51
5 changed files with 44 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/build-*/
/c/env_build.c

4
c/env_release.c Normal file
View File

@ -0,0 +1,4 @@
// Latest release on which this build is based.
char env_release[] = "0.0.0";
char env_release_date[] = "1970-01-01";

View File

@ -185,11 +185,24 @@ static value_t get_version_alist(void)
fl_cons(symbol("scheme"), fl_cons(symbol("r7rs"), FL_NIL)));
accum_name_value(&acc, "features", get_features_list());
accum_name_value(&acc, "platform", get_platform());
accum_name_value(&acc, "c-type-bits", get_c_type_bits_list());
accum_name_value(
&acc, "c-compiler",
&acc, "c-compiler-version",
fl_list2(string_from_cstr(SCHEME_C_COMPILER_NAME),
string_from_cstr(SCHEME_C_COMPILER_VERSION)));
accum_name_value(&acc, "c-type-bits", get_c_type_bits_list());
accum_name_value1(&acc, "c-compiler-command",
string_from_cstr(env_build_cc));
accum_name_value1(&acc, "c-compiler-flags",
string_from_cstr(env_build_cflags));
accum_name_value1(&acc, "c-linker-flags",
string_from_cstr(env_build_lflags));
accum_name_value1(&acc, "revision",
string_from_cstr(env_build_revision));
accum_name_value1(&acc, "build-date",
string_from_cstr(env_build_date));
accum_name_value1(&acc, "release", string_from_cstr(env_release));
accum_name_value1(&acc, "release-date",
string_from_cstr(env_release_date));
}
return acc.list;
}

View File

@ -1005,6 +1005,15 @@ const char *env_get_os_name(void);
value_t builtin_environment_stack(value_t *args, uint32_t nargs);
extern char env_build_cc[];
extern char env_build_cflags[];
extern char env_build_lflags[];
extern char env_build_revision[];
extern char env_build_date[];
extern char env_release[];
extern char env_release_date[];
//// #include "libraries.h"
value_t builtin_import(value_t *args, uint32_t nargs);

View File

@ -16,6 +16,8 @@ o_files="$o_files buf.o"
o_files="$o_files builtins.o"
o_files="$o_files char.o"
o_files="$o_files dump.o"
o_files="$o_files env_build.o"
o_files="$o_files env_release.o"
o_files="$o_files env_unix.o"
o_files="$o_files equalhash.o"
o_files="$o_files flisp.o"
@ -81,11 +83,22 @@ esac
CC="${CC:-$default_cc}"
CFLAGS="${CFLAGS:-$default_cflags}"
LFLAGS="${LFLAGS:-$default_lflags}"
revision="$(git describe --dirty --always 2>/dev/null || echo unknown)"
builddate="$(date -u '+%Y-%m-%d')"
builddir="build-$os-$(uname -m | tr A-Z- a-z_)-$(basename "$CC")"
cd "$(dirname "$0")"/..
echo "Entering directory '$PWD'"
set -x
cat >c/env_build.c <<EOF
// Generated from scratch at each build.
char env_build_cc[] = "$CC";
char env_build_cflags[] = "$CFLAGS";
char env_build_lflags[] = "$LFLAGS";
char env_build_revision[] = "$revision";
char env_build_date[] = "$builddate";
EOF
mkdir -p "$builddir"
find "$builddir" -mindepth 1 -delete
@ -102,6 +115,8 @@ $CC $CFLAGS -c ../c/buf.c
$CC $CFLAGS -c ../c/builtins.c
$CC $CFLAGS -c ../c/char.c
$CC $CFLAGS -c ../c/dump.c
$CC $CFLAGS -c ../c/env_build.c
$CC $CFLAGS -c ../c/env_release.c
$CC $CFLAGS -c ../c/env_unix.c
$CC $CFLAGS -c ../c/equalhash.c
$CC $CFLAGS -c ../c/flisp.c