summaryrefslogtreecommitdiff
path: root/solenv/gcc-wrappers
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-03-06 15:52:33 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-03-23 14:31:33 +0100
commita1a62a70411cb6041b5930ead08280d5e1e7b5f9 (patch)
treedd83ae0cd12fb6593f9a8f4dd9e425722b007f1e /solenv/gcc-wrappers
parent532ffb7a297d55b495141ce33692df5d9917b54f (diff)
build nss using gyp+ninja also on Windows
Change-Id: I3acb0f2a93cee85e382e03c2b2fdd68273e12516 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90117 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'solenv/gcc-wrappers')
-rw-r--r--solenv/gcc-wrappers/wrapper.cxx45
1 files changed, 27 insertions, 18 deletions
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index b156c89dc220..c320c722cc42 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -83,8 +83,7 @@ void setupccenv() {
}
string processccargs(vector<string> rawargs) {
- // suppress the msvc banner
- string args=" -nologo";
+ string args;
// TODO: should these options be enabled globally?
args.append(" -EHsc");
const char *const pDebugRuntime(getenv("MSVC_USE_DEBUG_RUNTIME"));
@@ -100,9 +99,15 @@ string processccargs(vector<string> rawargs) {
// note: always use -debug so a PDB file is created
string linkargs(" -link -debug");
+ bool hasv = false;
+
for(vector<string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
args.append(" ");
- if(*i == "-o") {
+ string a = *i;
+ // When building nss, there are strange trailing \'s (because of windows->cygwin?).
+ while( a.size() > 0 && a[a.size() - 1 ] == '\\')
+ a.resize(a.size() - 1 );
+ if(a == "-o") {
// TODO: handle more than just exe output
++i;
size_t dot=(*i).find_last_of(".");
@@ -128,40 +133,44 @@ string processccargs(vector<string> rawargs) {
exit(1);
}
}
- else if(*i == "-g" || !(*i).compare(0,5,"-ggdb")) {
+ else if(a == "-g" || !a.compare(0,5,"-ggdb")) {
args.append("-Zi");
args.append(" -FS");
}
- else if(!(*i).compare(0,2,"-D")) {
+ else if(!a.compare(0,2,"-D")) {
// need to re-escape strings for preprocessor
- for(size_t pos=(*i).find("\""); pos!=string::npos; pos=(*i).find("\"",pos)) {
- (*i).replace(pos,0,"\\");
+ for(size_t pos=a.find("\""); pos!=string::npos; pos=a.find("\"",pos)) {
+ a.replace(pos,0,"\\");
pos+=2;
}
- args.append(*i);
+ args.append(a);
}
- else if(!(*i).compare(0,2,"-L")) {
- linkargs.append(" -LIBPATH:"+(*i).substr(2));
+ else if(!a.compare(0,2,"-L")) {
+ linkargs.append(" -LIBPATH:"+a.substr(2));
}
- else if(!(*i).compare(0,2,"-l") && (*i).compare(0,5,"-link")) {
- linkargs.append(" "+(*i).substr(2)+".lib");
+ else if(!a.compare(0,2,"-l") && a.compare(0,5,"-link")) {
+ linkargs.append(" "+a.substr(2)+".lib");
}
- else if(!(*i).compare(0,5,"-def:") || !(*i).compare(0,5,"/def:")) {
+ else if(!a.compare(0,5,"-def:") || !a.compare(0,5,"/def:")) {
// why are we invoked with /def:? cl.exe should handle plain
// "foo.def" by itself
- linkargs.append(" " + *i);
+ linkargs.append(" " + a);
}
- else if(!(*i).compare(0,12,"-fvisibility") || *i == "-fPIC") {
+ else if(!a.compare(0,12,"-fvisibility") || a == "-fPIC") {
//TODO: drop other gcc-specific options
}
- else if(!(*i).compare(0,4,"-Wl,")) {
+ else if(!a.compare(0,4,"-Wl,")) {
//TODO: drop other gcc-specific options
}
- else if(*i == "-Werror")
+ else if(a == "-Werror")
args.append("-WX");
+ else if(a == "-v")
+ hasv = true;
else
- args.append(*i);
+ args.append(a);
}
+ if(!hasv) // suppress the msvc banner
+ args.append(" -nologo");
args.append(linkargs);
return args;
}