6 if test -z "$VERSION_FILE";then
7 VERSION_FILE
="../VERSION"
10 if test -z "$OUTPUT_FILE";then
11 OUTPUT_FILE
="include/autoconf/version.h"
16 SAMBA_VERSION_MAJOR
=`sed -n 's/^SAMBA_VERSION_MAJOR=//p' $SOURCE_DIR$VERSION_FILE`
17 SAMBA_VERSION_MINOR
=`sed -n 's/^SAMBA_VERSION_MINOR=//p' $SOURCE_DIR$VERSION_FILE`
18 SAMBA_VERSION_RELEASE
=`sed -n 's/^SAMBA_VERSION_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
20 SAMBA_VERSION_REVISION
=`sed -n 's/^SAMBA_VERSION_REVISION=//p' $SOURCE_DIR$VERSION_FILE`
22 SAMBA_VERSION_TP_RELEASE
=`sed -n 's/^SAMBA_VERSION_TP_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
23 SAMBA_VERSION_BETA_RELEASE
=`sed -n 's/^SAMBA_VERSION_BETA_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
24 SAMBA_VERSION_PRE_RELEASE
=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
25 SAMBA_VERSION_RC_RELEASE
=`sed -n 's/^SAMBA_VERSION_RC_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
27 SAMBA_VERSION_IS_GIT_SNAPSHOT
=`sed -n 's/^SAMBA_VERSION_IS_GIT_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
29 SAMBA_VERSION_RELEASE_NICKNAME
=`sed -n 's/^SAMBA_VERSION_RELEASE_NICKNAME=//p' $SOURCE_DIR$VERSION_FILE`
31 SAMBA_VERSION_VENDOR_SUFFIX
=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
32 SAMBA_VERSION_VENDOR_PATCH
=`sed -n 's/^SAMBA_VERSION_VENDOR_PATCH=//p' $SOURCE_DIR$VERSION_FILE`
34 SAMBA_VERSION_VENDOR_FUNCTION
=`sed -n 's/^SAMBA_VERSION_VENDOR_FUNCTION=//p' $SOURCE_DIR$VERSION_FILE`
36 echo "/* Autogenerated by script/mkversion.sh */" > $OUTPUT_FILE
38 echo "#define SAMBA_VERSION_MAJOR ${SAMBA_VERSION_MAJOR}" >> $OUTPUT_FILE
39 echo "#define SAMBA_VERSION_MINOR ${SAMBA_VERSION_MINOR}" >> $OUTPUT_FILE
40 echo "#define SAMBA_VERSION_RELEASE ${SAMBA_VERSION_RELEASE}" >> $OUTPUT_FILE
44 ## start with "3.0.22"
46 SAMBA_VERSION_STRING
="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}"
50 ## maybe add "3.0.22a" or "4.0.0tp11" or "3.0.22pre1" or "3.0.22rc1"
51 ## We do not do pre or rc version on patch/letter releases
53 if test -n "${SAMBA_VERSION_REVISION}";then
54 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}${SAMBA_VERSION_REVISION}"
55 echo "#define SAMBA_VERSION_REVISION \"${SAMBA_VERSION_REVISION}\"" >> $OUTPUT_FILE
56 elif test -n "${SAMBA_VERSION_TP_RELEASE}";then
57 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}tp${SAMBA_VERSION_TP_RELEASE}"
58 echo "#define SAMBA_VERSION_TP_RELEASE ${SAMBA_VERSION_TP_RELEASE}" >> $OUTPUT_FILE
59 elif test -n "${SAMBA_VERSION_BETA_RELEASE}";then
60 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}beta${SAMBA_VERSION_BETA_RELEASE}"
61 echo "#define SAMBA_VERSION_BETA_RELEASE ${SAMBA_VERSION_BETA_RELEASE}" >> $OUTPUT_FILE
62 elif test -n "${SAMBA_VERSION_PRE_RELEASE}";then
63 ## maybe add "3.0.22pre2"
64 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}pre${SAMBA_VERSION_PRE_RELEASE}"
65 echo "#define SAMBA_VERSION_PRE_RELEASE ${SAMBA_VERSION_PRE_RELEASE}" >> $OUTPUT_FILE
66 elif test -n "${SAMBA_VERSION_RC_RELEASE}";then
67 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}rc${SAMBA_VERSION_RC_RELEASE}"
68 echo "#define SAMBA_VERSION_RC_RELEASE ${SAMBA_VERSION_RC_RELEASE}" >> $OUTPUT_FILE
74 if test x
"${SAMBA_VERSION_IS_GIT_SNAPSHOT}" = x
"yes";then
79 if test x
"${HAVEVER}" != x
"yes" -a -d "${SOURCE_DIR}../.git";then
81 GIT_INFO
=`git show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD 2>/dev/null`
82 GIT_COMMIT_ABBREV
=`printf "%s" "${GIT_INFO}" | sed -n 1p`
83 COMMIT_TIME
=`printf "%s" "${GIT_INFO}" | sed -n 2p`
84 GIT_COMMIT_FULLREV
=`printf "%s" "${GIT_INFO}" | sed -n 3p`
85 COMMIT_DATE
=`printf "%s" "${GIT_INFO}" | sed -n 4p`
86 if test -n "${GIT_COMMIT_ABBREV}";then
92 if test x
"${HAVEGIT}" = x
"yes";then
93 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-GIT-${GIT_COMMIT_ABBREV}"
95 echo "#define SAMBA_VERSION_GIT_COMMIT_ABBREV \"${GIT_COMMIT_ABBREV}\"" >> $OUTPUT_FILE
96 echo "#define SAMBA_VERSION_COMMIT_TIME ${COMMIT_TIME}" >> $OUTPUT_FILE
97 echo "#define SAMBA_VERSION_GIT_COMMIT_FULLREV \"${GIT_COMMIT_FULLREV}\"" >> $OUTPUT_FILE
98 echo "#define SAMBA_VERSION_COMMIT_DATE \"${COMMIT_DATE}\"" >> $OUTPUT_FILE
100 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-GIT-UNKNOWN"
105 echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
108 ## Add the vendor string if present
110 if test -n "${SAMBA_VERSION_VENDOR_FUNCTION}"; then
111 echo "#define SAMBA_VERSION_VENDOR_FUNCTION ${SAMBA_VERSION_VENDOR_FUNCTION}" >> $OUTPUT_FILE
114 if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
115 echo "#define SAMBA_VERSION_VENDOR_SUFFIX \"${SAMBA_VERSION_VENDOR_SUFFIX}\"" >> $OUTPUT_FILE
116 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}"
117 if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then
118 echo "#define SAMBA_VERSION_VENDOR_PATCH ${SAMBA_VERSION_VENDOR_PATCH}" >> $OUTPUT_FILE
119 echo "#define SAMBA_VERSION_VENDOR_PATCH_STRING \"${SAMBA_VERSION_VENDOR_PATCH}\"" >> $OUTPUT_FILE
120 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_PATCH}"
125 ## Add a release nickname
127 if test -n "${SAMBA_VERSION_RELEASE_NICKNAME}";then
128 echo "#define SAMBA_VERSION_RELEASE_NICKNAME \"${SAMBA_VERSION_RELEASE_NICKNAME}\"" >> $OUTPUT_FILE
129 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING} (${SAMBA_VERSION_RELEASE_NICKNAME})"
132 cat >>$OUTPUT_FILE<<CEOF
133 #ifdef SAMBA_VERSION_VENDOR_FUNCTION
134 # define SAMBA_VERSION_STRING SAMBA_VERSION_VENDOR_FUNCTION
135 #else /* SAMBA_VERSION_VENDOR_FUNCTION */
136 # ifdef SAMBA_VERSION_VENDOR_SUFFIX
137 # ifdef SAMBA_VERSION_VENDOR_PATCH
138 # define SAMBA_VERSION_STRING SAMBA_VERSION_OFFICIAL_STRING "-" SAMBA_VERSION_VENDOR_SUFFIX "-" SAMBA_VERSION_VENDOR_PATCH_STRING
139 # else /* SAMBA_VERSION_VENDOR_PATCH */
140 # define SAMBA_VERSION_STRING SAMBA_VERSION_OFFICIAL_STRING "-" SAMBA_VERSION_VENDOR_SUFFIX
141 # endif /* SAMBA_VERSION_VENDOR_SUFFIX */
142 # else /* SAMBA_VERSION_VENDOR_FUNCTION */
143 # define SAMBA_VERSION_STRING SAMBA_VERSION_OFFICIAL_STRING
148 echo "$0: '$OUTPUT_FILE' created for Samba(\"${SAMBA_VERSION_STRING}\")"