summaryrefslogtreecommitdiff
path: root/solenv/gcc-wrappers/wrapper.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-07-14 23:06:03 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-11 18:43:48 +0200
commit4108665b63ab432732b8b351568c255d872cc3ff (patch)
tree79c890b3d999e6e6bfd631b8df72ae18947719aa /solenv/gcc-wrappers/wrapper.cxx
parent63972e79bbb9ea9654e755381641052632b0402c (diff)
WIN cross: fix gpg-related library builds
Cross compiling these libraries requires to supply the cross- compiler via the CC_FOR_BUILD environment variable. Since we have to use the gcc-wrappers, we now need two different invocations with different inclues and libraries, but just have fixed environment variables. Also, the CC_FOR_BUILD clashes with LO's own variant, but that is easy to fix. So this change includes: - gcc-wrappers: new option --wrapper-env-prefix to add a prefix to the environment variable names - gcc-wrappers: new option --wrapper-print-cmdline to dump the real command called, when a verbose build is executed - gcc-wrappers: default to exe, if the output has no extension - unify build flags for gpg related libraries Change-Id: I4e6a6ba3c6e09237c8ffefa40ce61131290a3852 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102482 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'solenv/gcc-wrappers/wrapper.cxx')
-rw-r--r--solenv/gcc-wrappers/wrapper.cxx56
1 files changed, 51 insertions, 5 deletions
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index b156c89dc220..56936155fa47 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -82,7 +82,13 @@ void setupccenv() {
}
}
-string processccargs(vector<string> rawargs) {
+string processccargs(vector<string> rawargs, string &env_prefix, bool &verbose)
+{
+ // default env var prefix
+ env_prefix = "REAL_";
+ verbose = false;
+ bool env_prefix_next_arg = false;
+
// suppress the msvc banner
string args=" -nologo";
// TODO: should these options be enabled globally?
@@ -101,6 +107,13 @@ string processccargs(vector<string> rawargs) {
string linkargs(" -link -debug");
for(vector<string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
+ if (env_prefix_next_arg)
+ {
+ env_prefix = *i;
+ env_prefix_next_arg = false;
+ continue;
+ }
+
args.append(" ");
if(*i == "-o") {
// TODO: handle more than just exe output
@@ -121,10 +134,15 @@ string processccargs(vector<string> rawargs) {
linkargs.append(" -dll -out:");
linkargs.append(*i);
}
+ else if (dot == string::npos)
+ {
+ args.append("-Fe");
+ args.append(*i + ".exe");
+ }
else
{
cerr << "unknown -o argument - please adapt gcc-wrapper for \""
- << (*i) << "\"";
+ << (*i) << "\"" << endl;
exit(1);
}
}
@@ -159,14 +177,41 @@ string processccargs(vector<string> rawargs) {
}
else if(*i == "-Werror")
args.append("-WX");
+ else if (*i == "--wrapper-print-cmdline")
+ verbose = true;
else
- args.append(*i);
+ {
+ size_t pos = i->find("=");
+ if (0 == i->compare(0, pos, "--wrapper-env-prefix"))
+ {
+ if (pos == string::npos)
+ env_prefix_next_arg = true;
+ else if (pos + 1 == i->length())
+ {
+ // bailout - missing arg
+ env_prefix_next_arg = true;
+ break;
+ }
+ else
+ env_prefix = i->substr(pos + 1);
+ }
+ else
+ args.append(*i);
+ }
}
+
+ if (env_prefix_next_arg)
+ {
+ cerr << "wrapper-env-prefix needs an argument!" << endl;
+ exit(1);
+ }
+
args.append(linkargs);
return args;
}
-int startprocess(string command, string args) {
+int startprocess(string command, string args, bool verbose)
+{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
@@ -200,7 +245,8 @@ int startprocess(string command, string args) {
auto cmdline = "\"" + command + "\" " + args;
- //cerr << "CMD= " << command << " " << args << endl;
+ if (verbose)
+ cerr << "CMD= " << command << " " << args << endl;
// Commandline may be modified by CreateProcess
char* cmdlineBuf=_strdup(cmdline.c_str());