1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 15:36:34 +00:00
Nick Briggs 96046c01f0 Adds MaikoGitVersion string to vdate.o
The variable MaikoGitVersion will contain a git revision from the head of the source tree
along with an indication if the status was "dirty".  If git is not present on the system
or the directory that the build happened in was not under git control the version will be
"none".
2024-11-20 11:18:41 -08:00

23 lines
540 B
Bash
Executable File

#!/bin/sh
if command -v "git" >/dev/null 2>&1; then
MAIKO_REV="$(git status --porcelain)"
if [ $? == 0 ]; then
if [ ! -z "$(git status --porcelain)" ]; then
MAIKO_REV="$(git rev-parse --short HEAD)-dirty"
else
MAIKO_REV="$(git rev-parse --short HEAD)"
fi
else
MAIKO_REV="none"
fi
else
MAIKO_REV = "none"
fi
cat <<EOF
#include <time.h>
extern const time_t MDate;
const time_t MDate = $(date +%s);
extern const char *MaikoGitVersion;
const char *MaikoGitVersion = "maiko git version: $MAIKO_REV";
EOF