6 if test -z "$VERSION_FILE";then
10 if test -z "$OUTPUT_FILE";then
11 OUTPUT_FILE
="include/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`
19 SAMBA_VERSION_REVISION
=`sed -n 's/^SAMBA_VERSION_REVISION=//p' $SOURCE_DIR$VERSION_FILE`
20 SAMBA_VERSION_PRE_RELEASE
=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
21 SAMBA_VERSION_RC_RELEASE
=`sed -n 's/^SAMBA_VERSION_RC_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
22 SAMBA_VERSION_IS_SVN_SNAPSHOT
=`sed -n 's/^SAMBA_VERSION_IS_SVN_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
23 SAMBA_VERSION_VENDOR_SUFFIX
=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
24 SAMBA_VENDOR_PATCH
=`sed -n 's/^SAMBA_VENDOR_PATCH=//p' $SOURCE_DIR$VERSION_FILE`
26 echo "/* Autogenerated by script/mkversion.sh */" > $OUTPUT_FILE
28 echo "#define SAMBA_VERSION_MAJOR ${SAMBA_VERSION_MAJOR}" >> $OUTPUT_FILE
29 echo "#define SAMBA_VERSION_MINOR ${SAMBA_VERSION_MINOR}" >> $OUTPUT_FILE
30 echo "#define SAMBA_VERSION_RELEASE ${SAMBA_VERSION_RELEASE}" >> $OUTPUT_FILE
34 ## start with "3.0.22"
36 SAMBA_VERSION_STRING
="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}"
40 ## maybe add "3.0.22a" or "3.0.22pre1" or "3.0.22rc1"
41 ## We do not do pre or rc version on patch/letter releases
43 if test -n "${SAMBA_VERSION_REVISION}";then
44 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}${SAMBA_VERSION_REVISION}"
45 echo "#define SAMBA_VERSION_REVISION \"${SAMBA_VERSION_REVISION}\"" >> $OUTPUT_FILE
46 elif test -n "${SAMBA_VERSION_PRE_RELEASE}";then
47 ## maybe add "3.0.22pre2"
48 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}pre${SAMBA_VERSION_PRE_RELEASE}"
49 echo "#define SAMBA_VERSION_PRE_RELEASE ${SAMBA_VERSION_PRE_RELEASE}" >> $OUTPUT_FILE
50 elif test -n "${SAMBA_VERSION_RC_RELEASE}";then
51 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}rc${SAMBA_VERSION_RC_RELEASE}"
52 echo "#define SAMBA_VERSION_RC_RELEASE ${SAMBA_VERSION_RC_RELEASE}" >> $OUTPUT_FILE
56 ## Add the vendor string if present
58 if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
59 echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
60 if test -n "${SAMBA_VENDOR_PATCH}";then
61 echo "#define SAMBA_VENDOR_PATCH ${SAMBA_VENDOR_PATCH}" >> $OUTPUT_FILE
68 ## SVN revision number?
70 if test x
"${SAMBA_VERSION_IS_SVN_SNAPSHOT}" = x
"yes";then
74 svn info
${SOURCE_DIR} >/dev
/null
2>&1 && HAVESVN
=yes
75 TMP_REVISION
=`(svn info ${SOURCE_DIR} 2>/dev/null || svk info ${SOURCE_DIR} 2>/dev/null) |grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
76 if test x
"${HAVESVN}" = x
"no";then
78 svk info
${SOURCE_DIR} >/dev
/null
2>&1 && HAVESVK
=yes
79 TMP_MIRRORED_REVISION
=`(svk info ${SOURCE_DIR} 2>/dev/null) |grep 'Mirrored From:.*samba\.org.*' |sed -e 's/Mirrored From: .* Rev\..* \([0-9]*\).*/\1/'`
80 if test -n "$TMP_MIRRORED_REVISION"; then
81 TMP_SVK_REVISION_STR
="${TMP_REVISION}-${USER}@${HOSTNAME}-[SVN-${TMP_MIRRORED_REVISION}]"
83 TMP_SVK_REVISION_STR
="${TMP_REVISION}-${USER}@${HOSTNAME}"
87 if test x
"${HAVESVN}" = x
"yes";then
88 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-SVN-build-${TMP_REVISION}"
89 echo "#define SAMBA_VERSION_SVN_REVISION ${TMP_REVISION}" >> $OUTPUT_FILE
90 elif test x
"${HAVESVK}" = x
"yes";then
91 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-SVK-build-${TMP_SVK_REVISION_STR}"
93 SAMBA_VERSION_STRING
="${SAMBA_VERSION_STRING}-SVN-build-UNKNOWN"
98 echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
100 echo "#define SAMBA_VERSION_STRING samba_version_string()" >> $OUTPUT_FILE
102 echo "$0: 'include/version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
104 if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
105 echo -n "$0: with VENDOR_SUFFIX = \""
106 echo -n ${SAMBA_VERSION_VENDOR_SUFFIX} |
sed 's/"//g'
107 if test -n ${SAMBA_VENDOR_PATCH}; then
108 echo -n "-${SAMBA_VENDOR_PATCH}"