1dnl macros to set GST_PACKAGE_RELEASE_DATETIME
2
3dnl ===========================================================================
4dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME
5dnl
6dnl Usage:
7dnl
8dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME()
9dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([no]...)
10dnl sets the release datetime to the current date
11dnl (no = this is not a release, but git or prerelease)
12dnl
13dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([YYYY-MM-DD])
14dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([yes], [YYYY-MM-DD])
15dnl sets the release datetime to the specified date (and time, if given)
16dnl (yes = this is a release, not git or prerelease)
17dnl
18dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([yes], [DOAP-FILE], [RELEASE-VERSION])
19dnl sets the release date to the release date associated with version
20dnl RELEASE-VERSION in the .doap file DOAP-FILE
21dnl (yes = this is a release, not git or prerelease)
22dnl
23dnl We need to treat pre-releases like git because there won't be an entry
24dnl in the .doap file for pre-releases yet, and we don't want to use the
25dnl date of the last release either.
26dnl ===========================================================================
27AC_DEFUN([AG_GST_SET_PACKAGE_RELEASE_DATETIME],
28[
29  dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME()
30  dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([no]...)
31  if test "x$1" = "xno" -o "x$1" = "x"; then
32    GST_PACKAGE_RELEASE_DATETIME=`date -u "+%Y-%m-%dT%H:%MZ"`
33  elif test "x$1" = "xyes"; then
34    dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([yes], [YYYY-MM-DD])
35    dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([yes], [DOAP-FILE], [RELEASE-VERSION])
36changequote(<<, >>)dnl
37    if ( echo $2 | grep '^20[1-9][0-9]-[0-1][0-9]-[0-3][0-9]' >/dev/null ) ; then
38changequote([, ])dnl
39      GST_PACKAGE_RELEASE_DATETIME=$2
40    else
41      dnl we assume the .doap file contains the date as YYYY-MM-DD
42      YYYY_MM_DD=`sh "${srcdir}/common/extract-release-date-from-doap-file" $3 $2`;
43      if test "x$YYYY_MM_DD" != "x"; then
44        GST_PACKAGE_RELEASE_DATETIME=$YYYY_MM_DD
45      else
46        AC_MSG_ERROR([SET_PACKAGE_RELEASE_DATETIME: could not extract
47            release date for release version $3 from $2])
48        GST_PACKAGE_RELEASE_DATETIME=""
49      fi
50    fi
51  dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([YYYY-MM-DD])
52changequote(<<, >>)dnl
53  elif ( echo $1 | grep '^20[1-9][0-9]-[0-1][0-9]-[0-3][0-9]' >/dev/null ) ; then
54changequote([, ])dnl
55    GST_PACKAGE_RELEASE_DATETIME=$1
56  else
57    AC_MSG_WARN([SET_PACKAGE_RELEASE_DATETIME: invalid first argument])
58    GST_PACKAGE_RELEASE_DATETIME=""
59  fi
60
61  if test "x$GST_PACKAGE_RELEASE_DATETIME" = "x"; then
62    AC_MSG_WARN([Invalid package release date time: $GST_PACKAGE_RELEASE_DATETIME])
63  else
64    AC_MSG_NOTICE([Setting GST_PACKAGE_RELEASE_DATETIME to $GST_PACKAGE_RELEASE_DATETIME])
65
66    AC_DEFINE_UNQUOTED([GST_PACKAGE_RELEASE_DATETIME],
67        ["$GST_PACKAGE_RELEASE_DATETIME"],
68        [GStreamer package release date/time for plugins as YYYY-MM-DD])
69  fi
70])
71
72dnl ===========================================================================
73dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO
74dnl
75dnl Usage:
76dnl
77dnl AG_GST_SET_PACKAGE_RELEASE_DATETIME([NANO-VERSION], [DOAP-FILE], [RELEASE-VERSION])
78dnl if NANO-VERSION is 0, sets the release date to the release date associated
79dnl with version RELEASE-VERSION in the .doap file DOAP-FILE, otherwise sets
80dnl the release date and time to the current date/time.
81dnl
82dnl We need to treat pre-releases like git because there won't be an entry
83dnl in the .doap file for pre-releases yet, and we don't want to use the
84dnl date of the last release either.
85dnl ===========================================================================
86AC_DEFUN([AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO],
87[
88  if test "x$1" = "x0"; then
89    AG_GST_SET_PACKAGE_RELEASE_DATETIME([yes], [ $2 ], [ $3 ])
90  else
91    AG_GST_SET_PACKAGE_RELEASE_DATETIME([no])
92  fi
93])
94