~mordred/pandora-build/devel

253 by Monty Taylor
Updated copyright headers.
1
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
2
dnl This file is free software; Sun Microsystems, Inc.
8 by Monty Taylor
Added copyright headers.
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
5
131 by Monty Taylor
Fixed the warning detection.
6
AC_DEFUN([PANDORA_TEST_VC_DIR],[
119 by Monty Taylor
Fixed some issues in the VC version setting.
7
  pandora_building_from_vc=no
8
9
  if test -d ".bzr" ; then
10
    pandora_building_from_bzr=yes
11
    pandora_building_from_vc=yes
12
  else
13
    pandora_building_from_bzr=no
14
  fi
15
16
  if test -d ".svn" ; then
17
    pandora_building_from_svn=yes
18
    pandora_building_from_vc=yes
19
  else
20
    pandora_building_from_svn=no
21
  fi
22
23
  if test -d ".hg" ; then
24
    pandora_building_from_hg=yes
25
    pandora_building_from_vc=yes
26
  else
27
    pandora_building_from_hg=no
28
  fi
29
30
  if test -d ".git" ; then
31
    pandora_building_from_git=yes
32
    pandora_building_from_vc=yes
33
  else
34
    pandora_building_from_git=no
35
  fi
36
])
37
1 by Monty Taylor
First version of the pandora build macros.
38
AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
259 by Monty Taylor
All the latest from innodb c++ work in drizzle on sun studio.
39
  m4_syscmd(PANDORA_TEST_VC_DIR
40
    m4_if(PCT_NO_VC_CHANGELOG,yes,[
41
      vc_changelog=no
42
      ],[
43
      vc_changelog=yes
44
      ])
45
  
46
    [
47
119 by Monty Taylor
Fixed some issues in the VC version setting.
48
    PANDORA_RELEASE_DATE=`date +%Y.%m`
49
    PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
50
51
    # Set some defaults
52
    PANDORA_VC_REVNO="0"
53
    PANDORA_VC_REVID="unknown"
54
    PANDORA_VC_BRANCH="bzr-export"
55
56
    if test "${pandora_building_from_bzr}" = "yes"; then
57
      echo "# Grabbing changelog and version information from bzr"
58
      PANDORA_BZR_REVNO=`bzr revno`
59
      if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then
60
        PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
61
        PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1`
62
        PANDORA_VC_BRANCH=`bzr nick`
261 by Monty Taylor
Updated from latest drizzle.
63
        PANDORA_VC_TAG=`bzr tags -r-1 | cut -f1 -d' ' | head -1`
264 by Monty Taylor
Added git and latest tag support
64
        PANDORA_VC_LATEST_TAG=`bzr tags --sort=time | grep -v '\?'| cut -f1 -d' '  | tail -1`
259 by Monty Taylor
All the latest from innodb c++ work in drizzle on sun studio.
65
        if test "x${vc_changelog}" = "xyes"; then
252 by Monty Taylor
Made visibility work a little better in the skip-visibility mode.
66
          bzr log --gnu > ChangeLog
67
        fi
119 by Monty Taylor
Fixed some issues in the VC version setting.
68
      fi
264 by Monty Taylor
Added git and latest tag support
69
    elif test "${pandora_building_from_git}" = "yes"; then
70
      echo "# Grabbing changelog and version information from git"
71
      PANDORA_GIT_REVID=`git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1`
72
      if test "x$PANDORA_GIT_REVID" != "x${PANDORA_VC_REVNO}" ; then
73
         PANDORA_VC_REVID="${PANDORA_GIT_REVID}"
74
         PANDORA_VC_BRANCH=`git branch | grep -Ei "\* (.*)" | cut -f2 -d' '`
268 by Monty Taylor
Added some git support.
75
         PANDORA_VC_TAG=`git tag --contains HEAD`
76
         PANDORA_VC_LATEST_TAG=`git tag | xargs -I@ git log --format=format:"%ci %h @%n" -1 @ | sort | tail -1 | cut -f5 -d' '`
264 by Monty Taylor
Added git and latest tag support
77
      fi
119 by Monty Taylor
Fixed some issues in the VC version setting.
78
    fi
79
80
    if ! test -d config ; then
81
      mkdir -p config
82
    fi
83
151 by Monty Taylor
Fixed the vc build to not overwrite version info.
84
    if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then 
85
      cat > config/pandora_vc_revinfo.tmp <<EOF
119 by Monty Taylor
Fixed some issues in the VC version setting.
86
PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
87
PANDORA_VC_REVID=${PANDORA_VC_REVID}
88
PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
261 by Monty Taylor
Updated from latest drizzle.
89
PANDORA_VC_TAG=${PANDORA_VC_TAG}
264 by Monty Taylor
Added git and latest tag support
90
PANDORA_VC_LATEST_TAG=${PANDORA_VC_LATEST_TAG}
119 by Monty Taylor
Fixed some issues in the VC version setting.
91
PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
92
PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
93
EOF
151 by Monty Taylor
Fixed the vc build to not overwrite version info.
94
      if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then
95
        mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo
96
      fi
97
      rm -f config/pandora_vc_revinfo.tmp
119 by Monty Taylor
Fixed some issues in the VC version setting.
98
    fi
99
  ])
1 by Monty Taylor
First version of the pandora build macros.
100
])
8 by Monty Taylor
Added copyright headers.
101
  
82 by Monty Taylor
updates to how we build plugins.
102
AC_DEFUN([_PANDORA_READ_FROM_FILE],[
103
  $1=`grep $1 $2 | cut -f2 -d=`
104
])
105
106
AC_DEFUN([PANDORA_VC_VERSION],[
107
  AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
108
131 by Monty Taylor
Fixed the warning detection.
109
  PANDORA_TEST_VC_DIR
119 by Monty Taylor
Fixed some issues in the VC version setting.
110
111
  AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[
112
    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo)
113
    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo)
82 by Monty Taylor
updates to how we build plugins.
114
    _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH],
119 by Monty Taylor
Fixed some issues in the VC version setting.
115
                            ${srcdir}/config/pandora_vc_revinfo)
261 by Monty Taylor
Updated from latest drizzle.
116
    _PANDORA_READ_FROM_FILE([PANDORA_VC_TAG],
117
                            ${srcdir}/config/pandora_vc_revinfo)
264 by Monty Taylor
Added git and latest tag support
118
    _PANDORA_READ_FROM_FILE([PANDORA_VC_LATEST_TAG],
119
                            ${srcdir}/config/pandora_vc_revinfo)
82 by Monty Taylor
updates to how we build plugins.
120
    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE],
119 by Monty Taylor
Fixed some issues in the VC version setting.
121
                            ${srcdir}/config/pandora_vc_revinfo)
82 by Monty Taylor
updates to how we build plugins.
122
    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE],
119 by Monty Taylor
Fixed some issues in the VC version setting.
123
                            ${srcdir}/config/pandora_vc_revinfo)
124
  ])
125
  AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[
126
    PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
127
  ],[
128
    PANDORA_RELEASE_COMMENT="trunk"
129
  ])
82 by Monty Taylor
updates to how we build plugins.
130
    
264 by Monty Taylor
Added git and latest tag support
131
  AS_IF([test "x${PANDORA_VC_TAG}" != "x"],[
261 by Monty Taylor
Updated from latest drizzle.
132
    PANDORA_RELEASE_VERSION="${PANDORA_VC_TAG}"
265 by Monty Taylor
Add PANDORA_MSG_ERROR for configurable erroring conditions.
133
    changequote(<<, >>)dnl
134
    PANDORA_RELEASE_ID=`echo ${PANDORA_RELEASE_VERSION} | sed 's/[^0-9]//g'`
135
    changequote([, ])dnl
264 by Monty Taylor
Added git and latest tag support
136
  ],[
137
    AS_IF([test "x${PANDORA_VC_LATEST_TAG}" != "x"],[
138
      PANDORA_RELEASE_VERSION="${PANDORA_VC_LATEST_TAG}.${PANDORA_VC_REVNO}"
265 by Monty Taylor
Add PANDORA_MSG_ERROR for configurable erroring conditions.
139
      changequote(<<, >>)dnl
140
      PANDORA_RELEASE_ID=`echo ${PANDORA_VC_LATEST_TAG} | sed 's/[^0-9]//g'`
141
      changequote([, ])dnl
264 by Monty Taylor
Added git and latest tag support
142
    ],[
143
      PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}"
265 by Monty Taylor
Add PANDORA_MSG_ERROR for configurable erroring conditions.
144
      changequote(<<, >>)dnl
145
      PANDORA_RELEASE_ID=`echo ${PANDORA_RELEASE_DATE} | sed 's/[^0-9]//g'`
146
      changequote([, ])dnl
264 by Monty Taylor
Added git and latest tag support
147
    ])
261 by Monty Taylor
Updated from latest drizzle.
148
  ])
264 by Monty Taylor
Added git and latest tag support
149
82 by Monty Taylor
updates to how we build plugins.
150
151
  VERSION="${PANDORA_RELEASE_VERSION}"
152
  AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"],
153
                     [The real version of the software])
154
  AC_SUBST(PANDORA_VC_REVNO)
155
  AC_SUBST(PANDORA_VC_REVID)
156
  AC_SUBST(PANDORA_VC_BRANCH)
157
  AC_SUBST(PANDORA_RELEASE_DATE)
158
  AC_SUBST(PANDORA_RELEASE_NODOTS_DATE)
159
  AC_SUBST(PANDORA_RELEASE_COMMENT)
160
  AC_SUBST(PANDORA_RELEASE_VERSION)
161
  AC_SUBST(PANDORA_RELEASE_ID)
119 by Monty Taylor
Fixed some issues in the VC version setting.
162
])
118 by Monty Taylor
Added patch from Chris Barber.
163
119 by Monty Taylor
Fixed some issues in the VC version setting.
164
AC_DEFUN([PANDORA_VC_INFO_HEADER],[
165
  AC_REQUIRE([PANDORA_VC_VERSION])
118 by Monty Taylor
Added patch from Chris Barber.
166
  m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_])
167
168
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVNO], [$PANDORA_VC_REVNO], [Version control revision number])
169
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVID], ["$PANDORA_VC_REVID"], [Version control revision ID])
170
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_BRANCH], ["$PANDORA_VC_BRANCH"], [Version control branch name])
171
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_DATE], ["$PANDORA_RELEASE_DATE"], [Release date of version control checkout])
172
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_NODOTS_DATE], [$PANDORA_RELEASE_NODOTS_DATE], [Numeric formatted release date of checkout])
173
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_COMMENT], ["$PANDORA_RELEASE_COMMENT"], [Set to trunk if the branch is the main $PACKAGE branch])
174
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_VERSION], ["$PANDORA_RELEASE_VERSION"], [Release date and revision number of checkout])
175
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_ID], [$PANDORA_RELEASE_ID], [Numeric formatted release date and revision number of checkout])
82 by Monty Taylor
updates to how we build plugins.
176
])