File: git_revision.sh

package info (click to toggle)
texstudio 4.3.1%2Bds-2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 74,980 kB
  • sloc: cpp: 102,721; xml: 17,126; ansic: 8,143; sh: 194; javascript: 177; makefile: 28
file content (19 lines) | stat: -rwxr-xr-x 974 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# this script is executed as part of the build process. Call specified in texstudio.pro
QMAKE_CXX=$1
BUILD_DIR=$2
PRO_DIR=$3
export PATH=$PATH:/usr/local/bin  # standard path for hg installation on OSX. May not be on PATH when called from a GUI application (e.g. QtCreator)
version=$(git describe --tags --always)
# write new file if we have version information or if the file does not exist at all.
# ensures a file exists and that it is updated if new version information is available.
# We don't overwrite an existing file with missing version information. This is the
# case e.g. when compiling from the tar ball.
if [ -n "$version" ]; then
    echo "create git_revision.cpp"
    echo "const char * TEXSTUDIO_GIT_REVISION = \"$version\";" > src/git_revision.cpp
else
    echo "empty git revision"
    echo "const char * TEXSTUDIO_GIT_REVISION = \"N/A\";" > src/git_revision.cpp
fi
# $QMAKE_CXX -c "$PRO_DIR/src/git_revision.cpp" -o "$BUILD_DIR/git_revision.o"