2 * Return a string describing everything we know about how this
3 * particular binary was built: from what source, for what target
4 * platform, using what tools, with what settings, etc.
9 char *buildinfo(const char *newline
)
11 strbuf
*buf
= strbuf_new();
13 put_fmt(buf
, "Build platform: %d-bit %s",
14 (int)(CHAR_BIT
* sizeof(void *)), BUILDINFO_PLATFORM
);
16 #ifdef __clang_version__
17 #define FOUND_COMPILER
18 put_fmt(buf
, "%sCompiler: clang %s", newline
, __clang_version__
);
19 #elif defined __GNUC__ && defined __VERSION__
20 #define FOUND_COMPILER
21 put_fmt(buf
, "%sCompiler: gcc %s", newline
, __VERSION__
);
25 #ifndef FOUND_COMPILER
26 #define FOUND_COMPILER
27 put_fmt(buf
, "%sCompiler: ", newline
);
29 put_fmt(buf
, ", emulating ");
31 put_fmt(buf
, "Visual Studio");
35 * List of _MSC_VER values and their translations taken from
36 * https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
38 * The pointless #if 0 branch containing this comment is there so
39 * that every real clause can start with #elif and there's no
40 * anomalous first clause. That way the patch looks nicer when you
43 * Mostly you can tell the version just from _MSC_VER, but in some
44 * cases, two different compiler versions have the same _MSC_VER
45 * value, and have to be distinguished by _MSC_FULL_VER.
47 #elif _MSC_VER == 1933
48 put_fmt(buf
, " 2022 (17.3)");
49 #elif _MSC_VER == 1932
50 put_fmt(buf
, " 2022 (17.2)");
51 #elif _MSC_VER == 1931
52 put_fmt(buf
, " 2022 (17.1)");
53 #elif _MSC_VER == 1930
54 put_fmt(buf
, " 2022 (17.0)");
55 #elif _MSC_VER == 1929 && _MSC_FULL_VER >= 192930100
56 put_fmt(buf
, " 2019 (16.11)");
57 #elif _MSC_VER == 1929
58 put_fmt(buf
, " 2019 (16.10)");
59 #elif _MSC_VER == 1928 && _MSC_FULL_VER >= 192829500
60 put_fmt(buf
, " 2019 (16.9)");
61 #elif _MSC_VER == 1928
62 put_fmt(buf
, " 2019 (16.8)");
63 #elif _MSC_VER == 1927
64 put_fmt(buf
, " 2019 (16.7)");
65 #elif _MSC_VER == 1926
66 put_fmt(buf
, " 2019 (16.6)");
67 #elif _MSC_VER == 1925
68 put_fmt(buf
, " 2019 (16.5)");
69 #elif _MSC_VER == 1924
70 put_fmt(buf
, " 2019 (16.4)");
71 #elif _MSC_VER == 1923
72 put_fmt(buf
, " 2019 (16.3)");
73 #elif _MSC_VER == 1922
74 put_fmt(buf
, " 2019 (16.2)");
75 #elif _MSC_VER == 1921
76 put_fmt(buf
, " 2019 (16.1)");
77 #elif _MSC_VER == 1920
78 put_fmt(buf
, " 2019 (16.0)");
79 #elif _MSC_VER == 1916
80 put_fmt(buf
, " 2017 version 15.9");
81 #elif _MSC_VER == 1915
82 put_fmt(buf
, " 2017 version 15.8");
83 #elif _MSC_VER == 1914
84 put_fmt(buf
, " 2017 version 15.7");
85 #elif _MSC_VER == 1913
86 put_fmt(buf
, " 2017 version 15.6");
87 #elif _MSC_VER == 1912
88 put_fmt(buf
, " 2017 version 15.5");
89 #elif _MSC_VER == 1911
90 put_fmt(buf
, " 2017 version 15.3");
91 #elif _MSC_VER == 1910
92 put_fmt(buf
, " 2017 RTW (15.0)");
93 #elif _MSC_VER == 1900
94 put_fmt(buf
, " 2015 (14.0)");
95 #elif _MSC_VER == 1800
96 put_fmt(buf
, " 2013 (12.0)");
97 #elif _MSC_VER == 1700
98 put_fmt(buf
, " 2012 (11.0)");
99 #elif _MSC_VER == 1600
100 put_fmt(buf
, " 2010 (10.0)");
101 #elif _MSC_VER == 1500
102 put_fmt(buf
, " 2008 (9.0)");
103 #elif _MSC_VER == 1400
104 put_fmt(buf
, " 2005 (8.0)");
105 #elif _MSC_VER == 1310
106 put_fmt(buf
, " .NET 2003 (7.1)");
107 #elif _MSC_VER == 1300
108 put_fmt(buf
, " .NET 2002 (7.0)");
109 #elif _MSC_VER == 1200
110 put_fmt(buf
, " 6.0");
112 put_fmt(buf
, ", unrecognised version");
114 put_fmt(buf
, ", _MSC_VER=%d", (int)_MSC_VER
);
116 put_fmt(buf
, ", _MSC_FULL_VER=%d", (int)_MSC_FULL_VER
);
122 char *gtk_buildinfo
= buildinfo_gtk_version();
124 put_fmt(buf
, "%sCompiled against GTK version %s",
125 newline
, gtk_buildinfo
);
126 sfree(gtk_buildinfo
);
132 int echm
= has_embedded_chm();
134 put_fmt(buf
, "%sEmbedded HTML Help file: %s", newline
,
135 echm
? "yes" : "no");
139 #if defined _WINDOWS && defined MINEFIELD
140 put_fmt(buf
, "%sBuild option: MINEFIELD", newline
);
143 put_fmt(buf
, "%sBuild option: NO_IPV6", newline
);
146 put_fmt(buf
, "%sBuild option: NO_GSSAPI", newline
);
149 put_fmt(buf
, "%sBuild option: STATIC_GSSAPI", newline
);
152 put_fmt(buf
, "%sBuild option: UNPROTECT", newline
);
155 put_fmt(buf
, "%sBuild option: FUZZING", newline
);
158 put_fmt(buf
, "%sBuild option: DEBUG", newline
);
161 put_fmt(buf
, "%sSource commit: %s", newline
, commitid
);
163 return strbuf_to_str(buf
);