6 # Generate a version from available information
9 my $prefix = shift @ARGV;
10 my $root = shift @ARGV;
13 if ( not defined $root ) {
14 die "usage: $0 prefix root-dir\n";
18 die "root directory $root not found\n";
21 my $version = "unknown";
24 if ( -d "$root/.git" ) {
25 # attempt to work out git version. only do so
26 # on a linux build host, as cygwin builds are
29 if ( -f "/usr/bin/git" || -f "/usr/local/bin/git" ) {
30 if (not open(F, "git --git-dir $root/.git rev-parse --verify HEAD|")) {
31 $version = "no git version";
35 $version =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin).
36 $version =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin).
39 if (open(G, "git --git-dir $root/.git status --porcelain|")) {
41 $tainted =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin).
42 $tainted =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin).
43 if (length $tainted) {
44 $version = join ' ', $version, "(tainted)";
47 $version = join ' ', $version, "(clean)";
53 my $hostname = `hostname`;
54 $hostname =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin).
55 $hostname =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin).
58 print STDERR "Version $version\n";
60 #include "${prefix}_build_info.h"
61 #include <linux/broadcom/vc_debug_sym.h>
63 VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_hostname, "$hostname" );
64 VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_version, "$version" );
65 VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_time, __TIME__ );
66 VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_date, __DATE__ );
68 const char *vchiq_get_build_hostname( void )
70 return vchiq_build_hostname;
73 const char *vchiq_get_build_version( void )
75 return vchiq_build_version;
78 const char *vchiq_get_build_date( void )
80 return vchiq_build_date;
83 const char *vchiq_get_build_time( void )
85 return vchiq_build_time;