You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
690B

  1. #!/bin/sh
  2. # check for git short hash
  3. revision=$(cd "$1" && git describe --always 2> /dev/null)
  4. test "$revision" && revision=git-$revision
  5. # no revision number found
  6. test "$revision" || revision=UNKNOWN
  7. # releases extract the version number from the VERSION file
  8. version=$(cd "$1" && cat VERSION 2> /dev/null)
  9. test "$version" || version=$revision
  10. test -n "$3" && version=$version-$3
  11. if [ -z "$2" ]; then
  12. echo "$version"
  13. exit
  14. fi
  15. NEW_REVISION="#define LIBAV_VERSION \"$version\""
  16. OLD_REVISION=$(cat version.h 2> /dev/null)
  17. # Update version.h only on revision changes to avoid spurious rebuilds
  18. if test "$NEW_REVISION" != "$OLD_REVISION"; then
  19. echo "$NEW_REVISION" > "$2"
  20. fi