freebsd-ports/devel/llvm-cheriot/files/gen-Makefile.snapshot.sh
Brooks Davis 72ae5276b7 devel/llvm-{cheri,cheriot,morello}: new snapshots
Major changes:
    llvm-cheri: merge LLVM 15
    llvm-cheriot: switch the fork at github.com/CHERIoT-Platform
    llvm-morello: merge LLVM 14

Rework patching and filtering of commands and man pages to better
accomdate version skew between the different ports now that all three
have different bases.

Centralize the addition of ${.CURDIR}/files to EXTRA_PATCHS.
2024-01-23 22:33:31 +00:00

46 lines
1 KiB
Bash

#!/bin/sh
#
# Simple script to fetch the latest commits via the github API. Requires
# curl and jq. Uses unauthenticated access which is ratelimited to 60
# queries per hour.
REPOS_URL=https://api.github.com/repos/CHERIoT-Platform
MAX_DATE=1970101
tmpfile=`mktemp -t gen-Makefile.snapshot`
query_repo()
{
curl ${REPOS_URL}/$1/branches/cheriot > $tmpfile
# Accumulate the dates of the last commits to find the snapshot date
committime=`jq -r '.commit.commit.committer.date' $tmpfile`
committime=${committime%%T*}
year=${committime%%-*}
month=${committime%-*}
month=${month#*-}
day=${committime##*-}
dateint=${year}${month}${day}
if [ $dateint -gt $MAX_DATE ]; then
export MAX_DATE=$dateint
fi
SHA=`jq -r '.commit.sha' $tmpfile`
}
query_repo llvm-project
LLVM_COMMIT=$SHA
cat <<EOF > Makefile.snapshot
# Generated file! Do not edit!
#
# Generated by: files/gen-Makefile.snapshot.sh.
#
LLVM_MAJOR= 13
LLVM_RELEASE= \${LLVM_MAJOR}.0.0
SNAPDATE= ${MAX_DATE}
LLVM_COMMIT= ${LLVM_COMMIT}
EOF
rm -f $tmpfile