summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-11-01 16:20:04 (UTC)
committer kergoth <kergoth>2002-11-01 16:20:04 (UTC)
commit4c9df59925da5a67d884f8ffb37a263d85948951 (patch) (unidiff)
tree278796d7d27a06243e584a05f443dbb23eaf028c
parentebd6adcd2f72935f0ee7af7485c75c34ac3389a3 (diff)
downloadopie-4c9df59925da5a67d884f8ffb37a263d85948951.zip
opie-4c9df59925da5a67d884f8ffb37a263d85948951.tar.gz
opie-4c9df59925da5a67d884f8ffb37a263d85948951.tar.bz2
Make qmake obey QMAKESPECSDIR if set.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/project.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp
index ae24193..96cdad8 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -396,117 +396,124 @@ QMakeProject::read(QString file, QMap<QString, QStringList> &place)
396 if(!s.isEmpty()) { 396 if(!s.isEmpty()) {
397 if(!(ret = parse(s, place))) 397 if(!(ret = parse(s, place)))
398 break; 398 break;
399 s = ""; 399 s = "";
400 } 400 }
401 } 401 }
402 } 402 }
403 if(!using_stdin) 403 if(!using_stdin)
404 qfile.close(); 404 qfile.close();
405 } 405 }
406 parser = pi; 406 parser = pi;
407 return ret; 407 return ret;
408} 408}
409 409
410bool 410bool
411QMakeProject::read(QString project, QString) 411QMakeProject::read(QString project, QString)
412{ 412{
413 if(cfile.isEmpty()) { 413 if(cfile.isEmpty()) {
414 // hack to get the Option stuff in there 414 // hack to get the Option stuff in there
415 base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; 415 base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext;
416 base_vars["QMAKE_EXT_H"] = Option::h_ext; 416 base_vars["QMAKE_EXT_H"] = Option::h_ext;
417 417
418 /* parse the cache */ 418 /* parse the cache */
419 if(Option::mkfile::do_cache) { 419 if(Option::mkfile::do_cache) {
420 if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified 420 if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified
421 QString dir = QDir::convertSeparators(Option::output_dir); 421 QString dir = QDir::convertSeparators(Option::output_dir);
422 while(!QFile::exists((Option::mkfile::cachefile = dir + 422 while(!QFile::exists((Option::mkfile::cachefile = dir +
423 QDir::separator() + ".qmake.cache"))) { 423 QDir::separator() + ".qmake.cache"))) {
424 dir = dir.left(dir.findRev(QDir::separator())); 424 dir = dir.left(dir.findRev(QDir::separator()));
425 if(dir.isEmpty() || dir.find(QDir::separator()) == -1) { 425 if(dir.isEmpty() || dir.find(QDir::separator()) == -1) {
426 Option::mkfile::cachefile = ""; 426 Option::mkfile::cachefile = "";
427 break; 427 break;
428 } 428 }
429 if(Option::mkfile::cachefile_depth == -1) 429 if(Option::mkfile::cachefile_depth == -1)
430 Option::mkfile::cachefile_depth = 1; 430 Option::mkfile::cachefile_depth = 1;
431 else 431 else
432 Option::mkfile::cachefile_depth++; 432 Option::mkfile::cachefile_depth++;
433 } 433 }
434 } 434 }
435 if(!Option::mkfile::cachefile.isEmpty()) { 435 if(!Option::mkfile::cachefile.isEmpty()) {
436 read(Option::mkfile::cachefile, cache); 436 read(Option::mkfile::cachefile, cache);
437 if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) 437 if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty())
438 Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); 438 Option::mkfile::qmakespec = cache["QMAKESPEC"].first();
439 } 439 }
440 } 440 }
441 /* parse mkspec */ 441 /* parse mkspec */
442 QStringList mkspec_roots; 442 QStringList mkspec_roots;
443 /* prefer $QTDIR if it is set */ 443 /* prefer $QTDIR if it is set */
444 /* minor hack here, prefer QMAKESPECDIR -cl */ 444 /* prefer QMAKESPECSDIR -cl */
445 445
446 if (getenv("QMAKESPECDIR")){ 446 if (getenv("QTDIR")) {
447 mkspec_roots << getenv("QMAKESPECDIR");
448 } else if (getenv("QTDIR")) {
449 mkspec_roots << getenv("QTDIR"); 447 mkspec_roots << getenv("QTDIR");
450 } 448 }
451 mkspec_roots << qInstallPathData(); 449 mkspec_roots << qInstallPathData();
450
451 if (getenv("QMAKESPECSDIR")){
452 QString mkspec = QString(getenv("QMAKESPECSDIR")) + QDir::separator() +
453 QDir::separator() + "default";
454 if(QFile::exists(mkspec))
455 Option::mkfile::qmakespec = mkspec;
456 }
457
452 if(Option::mkfile::qmakespec.isEmpty()) { 458 if(Option::mkfile::qmakespec.isEmpty()) {
453 for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { 459 for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
454 QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + 460 QString mkspec = (*it) + QDir::separator() + QString("mkspecs") +
455 QDir::separator() + "default"; 461 QDir::separator() + "default";
456 if(QFile::exists(mkspec)) { 462 if(QFile::exists(mkspec)) {
457 Option::mkfile::qmakespec = mkspec; 463 Option::mkfile::qmakespec = mkspec;
458 break; 464 break;
459 } 465 }
460 } 466 }
461 if(Option::mkfile::qmakespec.isEmpty()) { 467 }
462 fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n"); 468
463 return FALSE; 469 if(Option::mkfile::qmakespec.isEmpty()) {
464 } 470 fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n");
471 return FALSE;
465 } 472 }
466 473
467 if(QDir::isRelativePath(Option::mkfile::qmakespec)) { 474 if(QDir::isRelativePath(Option::mkfile::qmakespec)) {
468 bool found_mkspec = FALSE; 475 bool found_mkspec = FALSE;
469 for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { 476 for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
470 QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + 477 QString mkspec = (*it) + QDir::separator() + QString("mkspecs") +
471 QDir::separator() + Option::mkfile::qmakespec; 478 QDir::separator() + Option::mkfile::qmakespec;
472 if(QFile::exists(mkspec)) { 479 if(QFile::exists(mkspec)) {
473 found_mkspec = TRUE; 480 found_mkspec = TRUE;
474 Option::mkfile::qmakespec = mkspec; 481 Option::mkfile::qmakespec = mkspec;
475 break; 482 break;
476 } 483 }
477 } 484 }
478 if(!found_mkspec) { 485 if(!found_mkspec) {
479 fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n", 486 fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n",
480 mkspec_roots.join("\n\t").latin1()); 487 mkspec_roots.join("\n\t").latin1());
481 return FALSE; 488 return FALSE;
482 } 489 }
483 } 490 }
484 491
485 /* parse qmake configuration */ 492 /* parse qmake configuration */
486 QString spec = Option::mkfile::qmakespec + QDir::separator() + "qmake.conf"; 493 QString spec = Option::mkfile::qmakespec + QDir::separator() + "qmake.conf";
487 debug_msg(1, "QMAKESPEC conf: reading %s", spec.latin1()); 494 debug_msg(1, "QMAKESPEC conf: reading %s", spec.latin1());
488 if(!read(spec, base_vars)) { 495 if(!read(spec, base_vars)) {
489 fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.latin1()); 496 fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.latin1());
490 return FALSE; 497 return FALSE;
491 } 498 }
492 if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) { 499 if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) {
493 debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.latin1()); 500 debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.latin1());
494 read(Option::mkfile::cachefile, base_vars); 501 read(Option::mkfile::cachefile, base_vars);
495 } 502 }
496 503
497 /* commandline */ 504 /* commandline */
498 cfile = project; 505 cfile = project;
499 parser.line_no = 1; //really arg count now.. duh 506 parser.line_no = 1; //really arg count now.. duh
500 parser.file = "(internal)"; 507 parser.file = "(internal)";
501 for(QStringList::Iterator it = Option::before_user_vars.begin(); 508 for(QStringList::Iterator it = Option::before_user_vars.begin();
502 it != Option::before_user_vars.end(); ++it) { 509 it != Option::before_user_vars.end(); ++it) {
503 if(!parse((*it), base_vars)) { 510 if(!parse((*it), base_vars)) {
504 fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); 511 fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1());
505 return FALSE; 512 return FALSE;
506 } 513 }
507 parser.line_no++; 514 parser.line_no++;
508 } 515 }
509 } 516 }
510 517
511 /* parse project file */ 518 /* parse project file */
512 debug_msg(1, "Project file: reading %s", project.latin1()); 519 debug_msg(1, "Project file: reading %s", project.latin1());