|
13 | 13 | # called during the Maven build process.
|
14 | 14 | #
|
15 | 15 | # Command-line parameters:
|
16 |
| -# $1 - Absolute path to the file containing Open CV version |
17 |
| -# $2 - The build directory and where the output file will be written |
18 |
| -# $3 - The name of the output file to write to. |
| 16 | +# $1 - The build directory and where the output file will be written |
| 17 | +# $2 - The name of the output file to write to. |
19 | 18 | #
|
20 | 19 | # Returns:
|
21 | 20 | # 0 - Successfully written the properties file.
|
|
28 | 27 | #
|
29 | 28 | #####################################################################
|
30 | 29 |
|
31 |
| -majorHashDefine="#define CV_VERSION_MAJOR" |
32 |
| -minorHashDefine="#define CV_VERSION_MINOR" |
33 |
| -revisionHashDefine="#define CV_VERSION_REVISION" |
34 |
| -statusHashDefine="#define CV_VERSION_STATUS" |
| 30 | +# Include some external functions and variables |
| 31 | +. ./functions |
35 | 32 |
|
36 | 33 | #Test build directory exists
|
37 |
| -if [ ! -n "$2" ] || [ ! -d $2 ];then |
| 34 | +if [ ! -n "$1" ] || [ ! -d $1 ];then |
38 | 35 | echo "Build directory not specified or does not exist!"
|
39 | 36 | exit 1
|
40 | 37 | fi
|
41 | 38 |
|
42 |
| -if [ -n "$1" ] && [ -e $1 ];then |
43 |
| - minorVersion=$(grep "${minorHashDefine}" $1 | grep -o ".$") |
44 |
| - majorVersion=$(grep "${majorHashDefine}" $1 | grep -o ".$") |
45 |
| - revision=$(grep "${revisionHashDefine}" $1 | grep -o ".$") |
| 39 | +if [ -n "${versionHeader}" ] && [ -e ${versionHeader} ];then |
| 40 | + |
| 41 | + extract_version |
46 | 42 |
|
47 | 43 | bits=$(getconf LONG_BIT)
|
48 | 44 | architecture=$(arch)
|
@@ -78,13 +74,13 @@ if [ -n "$1" ] && [ -e $1 ];then
|
78 | 74 | esac
|
79 | 75 |
|
80 | 76 | echo "The version number will be ${majorVersion}.${minorVersion}.${revision}"
|
81 |
| - echo "opencv.version=${majorVersion}.${minorVersion}.${revision}" > ${2}/${3} |
82 |
| - echo "lib.version.string=${majorVersion}${minorVersion}${revision}" >> ${2}/${3} |
83 |
| - echo "bits=${bits}" >> ${2}/${3} |
84 |
| - echo "architecture=$(arch)" >> ${2}/${3} |
85 |
| - echo "osgi.processor=${osgiProcessor}" >> ${2}/${3} |
| 77 | + echo "opencv.version=${majorVersion}.${minorVersion}.${revision}" > ${1}/${2} |
| 78 | + echo "lib.version.string=${majorVersion}${minorVersion}${revision}" >> ${1}/${2} |
| 79 | + echo "bits=${bits}" >> ${1}/${2} |
| 80 | + echo "architecture=$(arch)" >> ${1}/${2} |
| 81 | + echo "osgi.processor=${osgiProcessor}" >> ${1}/${2} |
86 | 82 | exit 0
|
87 | 83 | else
|
88 |
| - echo "Could not locate file $1 to determine versioning." |
| 84 | + echo "Could not locate file ${versionHeader} to determine versioning." |
89 | 85 | exit 1
|
90 | 86 | fi
|
0 commit comments