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