]>
Lady’s Gitweb - CGirls/blob - sh/gen-version.sh
a9d626ef64032eec062f968d22adac11e958cf7d
2 # SPDX-FileCopyrightText: 2007 Lars Hjemli <hjemli@gmail.com>
3 # SPDX-FileCopyrightText: 2014 Fabien C <t74jgwb88tli9ch@jetable.org>
4 # SPDX-FileCopyrightText: 2025 Lady <https://www.ladys.computer/about/#lady>
5 # SPDX-License-Identifier: GPL-2.0-only
7 # This script is based on the one used by `cgit´ (<https://git.zx2c4.com/cgit/tree/gen-version.sh>) as of commit e8cacb5981039e7e74921659ea50e287395ed411.
8 # It writes a line like `CGIRLS_VERSION := {VERSION}´ to a file, which can be included in a make·file to set the `CGIRLS_VERSION´ variable.
9 # The argument gives the file to write.
10 V
= " $(cat GNUmakefile | sed '/^CGIRLS_VERSION[ :=]/!d;s/^[^=]*= *//') "
13 # Use `git describe´ to get current version if we¦re inside a git repo.
14 if test " $(git rev-parse --git-dir 2>/dev/null) " = '.git'
16 V
= $(git describe HEAD 2>>/dev/null || git rev-parse --short=7 HEAD 2>>/dev/null || :)
19 # Make the build directory if it does not exist.
20 if test '!' -d " $(dirname $F) "
22 mkdir -p " $(dirname $F) "
26 new
= "CGIRLS_VERSION := $V "
27 old
= " $(cat $F 2>/dev/null) "
29 # Exit if version is up·to·date.
30 if test " $old " = " $new "
36 # Update version with new version info.
37 printf '%s \n ' " $new " | tee $F
This page took 0.459429 seconds and 3 git commands to generate.