3 time the charm
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo " "
|
||||
echo "======================="
|
||||
echo " "
|
||||
@ -8,60 +9,67 @@ chmod +x ./compile_checksum.sh
|
||||
./compile_checksum.sh
|
||||
outfile="src/include/asuro.pas"
|
||||
file="version"
|
||||
while IFS=: read -r line;do
|
||||
major=$(echo $line | awk '{print $1}')
|
||||
minor=$(echo $line | awk '{print $2}')
|
||||
sub=$(echo $line | awk '{print $3}')
|
||||
release=$(echo $line | awk '{print $4}')
|
||||
done <"$file"
|
||||
{
|
||||
# this script requires semver tool
|
||||
wget -q https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver -O bin/semver && chmod +x bin/semver
|
||||
export PATH="$(pwd)/bin:$PATH"
|
||||
}
|
||||
tagref=$(git describe --tags)
|
||||
revision=$(git rev-parse --short=8 HEAD)
|
||||
major=$(semver get major $tagref)
|
||||
minor=$(semver get minor $tagref)
|
||||
sub=$(semver get patch $tagref)
|
||||
version=$(semver get release $tagref)
|
||||
release=$(semver get prerel $tagref)
|
||||
build=$(semver get build $tagref)
|
||||
linecount=$(./loc.sh | awk '{print $1}')
|
||||
sourcecount=$(find src -type f | wc -l)
|
||||
drivercount=$(find src/driver -type f | wc -l)
|
||||
revision=$(git rev-list --all --count)
|
||||
fpcversion=$(fpc -h | grep -m 1 version | awk '{print $5}')
|
||||
makeversion=$(make -v | grep GNU | awk '{print $3}' | grep -v GNU)
|
||||
nasmversion=$(nasm -v | awk '{print $3'})
|
||||
compiledate=$(date +"%d/%m/%y")
|
||||
compiletime=$(date +"%T")
|
||||
checksum=$(md5sum checksums.md5 | awk '{print $1}')
|
||||
echo "{" > $outfile
|
||||
echo " Include->Asuro - Constants generated during pipeline/compilation for use at runtime." >> $outfile
|
||||
echo " @author(Autogenerated)" >> $outfile
|
||||
echo "}" >> $outfile
|
||||
echo "unit asuro;" >> $outfile
|
||||
echo " " >> $outfile
|
||||
echo "interface" >> $outfile
|
||||
echo " " >> $outfile
|
||||
echo "const" >> $outfile
|
||||
echo " VERSION = '$major.$minor.$sub-$revision$release'; //The current full version as a string." >> $outfile
|
||||
echo " VERSION_MAJOR = '$major'; // Current major version as a string." >> $outfile
|
||||
echo " VERSION_MINOR = '$minor'; // Current minor version as a string." >> $outfile
|
||||
echo " VERSION_SUB = '$sub'; // Current sub version as a string." >> $outfile
|
||||
echo " REVISION = '$revision'; // Current revision as a string." >> $outfile
|
||||
echo " RELEASE = '$release'; // Current release as a string." >> $outfile
|
||||
echo " LINE_COUNT = $linecount; // Project line count as compiled as a string." >> $outfile
|
||||
echo " FILE_COUNT = $sourcecount; // Project line count as compiled as a string." >> $outfile
|
||||
echo " DRIVER_COUNT = $drivercount; // Number of baked drivers in the current binary." >> $outfile
|
||||
echo " FPC_VERSION = '$fpcversion'; // Version of the FreePascal Compiler used to compile the current binary." >> $outfile
|
||||
echo " NASM_VERSION = '$nasmversion'; // Version of the Netwide Assembler used to compile the multiboot stub." >> $outfile
|
||||
echo " MAKE_VERSION = '$makeversion'; // Version of MAKE used to link the current binary." >> $outfile
|
||||
echo " COMPILE_DATE = '$compiledate'; // Date in which the current binary was compiled." >> $outfile
|
||||
echo " COMPILE_TIME = '$compiletime'; // Time in which the current binary was compiled." >> $outfile
|
||||
echo " CHECKSUM = '$checksum'; // MD5 pseduo-checksum of all of the sourcefiles together." >> $outfile
|
||||
echo " " >> $outfile
|
||||
echo "implementation" >> $outfile
|
||||
echo " " >> $outfile
|
||||
echo "end." >> $outfile
|
||||
|
||||
[[ -n "$release" ]] && version="$version-$release"
|
||||
cat > $outfile <<EOF
|
||||
unit asuro;
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
VERSION = '$version';
|
||||
VERSION_MAJOR = '$major';
|
||||
VERSION_MINOR = '$minor';
|
||||
VERSION_SUB = '$sub';
|
||||
REVISION = '$revision';
|
||||
RELEASE = '$release';
|
||||
LINE_COUNT = $linecount;
|
||||
FILE_COUNT = $sourcecount;
|
||||
DRIVER_COUNT = $drivercount;
|
||||
FPC_VERSION = '$fpcversion';
|
||||
NASM_VERSION = '$nasmversion';
|
||||
MAKE_VERSION = '$makeversion';
|
||||
COMPILE_DATE = '$compiledate';
|
||||
COMPILE_TIME = '$compiletime';
|
||||
CHECKSUM = '$checksum';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
EOF
|
||||
echo "Generating release info..."
|
||||
wget -q https://img.shields.io/badge/version-$major.$minor.$sub--$revision$release-blue.svg -O release/version.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/revision-$revision-blue.svg -O release/revision.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/release-$release-blue.svg -O release/release.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/lines-$linecount-blueviolet.svg -O release/lines.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/files-$sourcecount-blueviolet.svg -O release/files.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/drivers-$drivercount-blueviolet.svg -O release/drivers.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/FPC_version-$fpcversion-lightgrey.svg -O release/fpcversion.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/NASM_version-$nasmversion-lightgrey.svg -O release/nasmversion.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/MAKE_version-$makeversion-lightgrey.svg -O release/makeversion.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/release_date-$compiledate-lightgrey.svg -O release/date.svg 2>/dev/null
|
||||
wget -q https://img.shields.io/badge/fingerprint-$checksum-important.svg -O release/fingerprint.svg 2>/dev/null
|
||||
set +e # These can fail on branches and such, for now
|
||||
wget -q https://img.shields.io/badge/version-$major.$minor.$sub--$revision$release-blue.svg -O release/version.svg
|
||||
wget -q https://img.shields.io/badge/revision-$revision-blue.svg -O release/revision.svg
|
||||
wget -q https://img.shields.io/badge/release-$release-blue.svg -O release/release.svg
|
||||
wget -q https://img.shields.io/badge/lines-$linecount-blueviolet.svg -O release/lines.svg
|
||||
wget -q https://img.shields.io/badge/files-$sourcecount-blueviolet.svg -O release/files.svg
|
||||
wget -q https://img.shields.io/badge/drivers-$drivercount-blueviolet.svg -O release/drivers.svg
|
||||
wget -q https://img.shields.io/badge/FPC_version-$fpcversion-lightgrey.svg -O release/fpcversion.svg
|
||||
wget -q https://img.shields.io/badge/NASM_version-$nasmversion-lightgrey.svg -O release/nasmversion.svg
|
||||
wget -q https://img.shields.io/badge/MAKE_version-$makeversion-lightgrey.svg -O release/makeversion.svg
|
||||
wget -q https://img.shields.io/badge/release_date-$compiledate-lightgrey.svg -O release/date.svg
|
||||
wget -q https://img.shields.io/badge/fingerprint-$checksum-important.svg -O release/fingerprint.svg
|
||||
echo "Done versioning."
|
||||
|
Reference in New Issue
Block a user