2 #####################################################################
3 # This script extracts several properties and then writes them to a
4 # to a file, 'build.properties'. These properties include:
7 # 2. OpenVC version as a string for use by Maven.
8 # 3. The CPU binary word size.
9 # 4. Architecture string.
10 # 4. OSGi compatible CPU architecture string.
12 # There is no need to execute this script directly as it will be
13 # called during the Maven build process.
15 # Command-line parameters:
16 # $1 - The build directory and where the output file will be written
17 # $2 - The name of the output file to write to.
20 # 0 - Successfully written the properties file.
21 # 1 - Error occured such as build directory does not exist
22 # or OpenCV version could not be determined or an
25 # Kerry Billingham <contact (at) avionicengineers (d0t) com>
28 #####################################################################
30 # Include some external functions and variables
33 #Test build directory exists
34 if [ ! -n "$1" ] || [ ! -d $1 ];then
35 echo "Build directory not specified or does not exist!"
39 if [ -n "${versionHeader}" ] && [ -e ${versionHeader} ];then
43 bits=$(getconf LONG_BIT)
45 osgiProcessor="Not Set"
47 case ${architecture} in
49 echo "This is x86 (32 | 64) bit"
55 osgiProcessor="x86_64"
58 osgiProcessor="Unknown"
63 byteOrder=$(lscpu | grep -i "byte order")
65 if [[ "${byteOrder}" == *little* ]]; then
66 osgiProcessor="arm_le"
67 elif [[ "${byteOrder}}" == *big* ]]; then
68 osgiProcessor="arm_be"
73 echo "This is unknown architecture"
76 echo "The version number will be ${majorVersion}.${minorVersion}.${revision}"
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}
84 echo "Could not locate file ${versionHeader} to determine versioning."