-rw-r--r-- | qmake/generators/mac/metrowerks_xml.cpp | 23 | ||||
-rw-r--r-- | qmake/generators/mac/metrowerks_xml.h | 19 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 981 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.h | 33 |
4 files changed, 736 insertions, 320 deletions
diff --git a/qmake/generators/mac/metrowerks_xml.cpp b/qmake/generators/mac/metrowerks_xml.cpp index 125749d..baaeeec 100644 --- a/qmake/generators/mac/metrowerks_xml.cpp +++ b/qmake/generators/mac/metrowerks_xml.cpp | |||
@@ -1,75 +1,72 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MetrowerksMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "metrowerks_xml.h" | 36 | #include "metrowerks_xml.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qdict.h> | 39 | #include <qdict.h> |
42 | #include <qregexp.h> | 40 | #include <qregexp.h> |
43 | #include <stdlib.h> | 41 | #include <stdlib.h> |
44 | #include <time.h> | 42 | #include <time.h> |
45 | #ifdef Q_OS_MAC | 43 | #if !defined(QWS) && defined(Q_OS_MAC) |
46 | #include <Carbon/Carbon.h> | 44 | #include <Carbon/Carbon.h> |
47 | #include <sys/types.h> | 45 | #include <sys/types.h> |
48 | #include <sys/stat.h> | 46 | #include <sys/stat.h> |
49 | #endif | 47 | #endif |
50 | 48 | ||
51 | |||
52 | MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) | 49 | MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) |
53 | { | 50 | { |
54 | 51 | ||
55 | } | 52 | } |
56 | 53 | ||
57 | bool | 54 | bool |
58 | MetrowerksMakefileGenerator::writeMakefile(QTextStream &t) | 55 | MetrowerksMakefileGenerator::writeMakefile(QTextStream &t) |
59 | { | 56 | { |
60 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 57 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
61 | /* for now just dump, I need to generated an empty xml or something.. */ | 58 | /* for now just dump, I need to generated an empty xml or something.. */ |
62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 59 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 60 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
64 | return TRUE; | 61 | return TRUE; |
65 | } | 62 | } |
66 | 63 | ||
67 | if(project->first("TEMPLATE") == "app" || | 64 | if(project->first("TEMPLATE") == "app" || |
68 | project->first("TEMPLATE") == "lib") { | 65 | project->first("TEMPLATE") == "lib") { |
69 | return writeMakeParts(t); | 66 | return writeMakeParts(t); |
70 | } | 67 | } |
71 | else if(project->first("TEMPLATE") == "subdirs") { | 68 | else if(project->first("TEMPLATE") == "subdirs") { |
72 | writeHeader(t); | 69 | writeHeader(t); |
73 | qDebug("Not supported!"); | 70 | qDebug("Not supported!"); |
74 | return TRUE; | 71 | return TRUE; |
75 | } | 72 | } |
@@ -586,106 +583,106 @@ MetrowerksMakefileGenerator::init() | |||
586 | 583 | ||
587 | //set the target up | 584 | //set the target up |
588 | project->variables()["TARGET_STEM"] = project->variables()["TARGET"]; | 585 | project->variables()["TARGET_STEM"] = project->variables()["TARGET"]; |
589 | if(project->first("TEMPLATE") == "lib") { | 586 | if(project->first("TEMPLATE") == "lib") { |
590 | if(project->isActiveConfig("staticlib")) | 587 | if(project->isActiveConfig("staticlib")) |
591 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + ".lib"; | 588 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + ".lib"; |
592 | else | 589 | else |
593 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + "." + | 590 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + "." + |
594 | project->first("QMAKE_EXTENSION_SHLIB"); | 591 | project->first("QMAKE_EXTENSION_SHLIB"); |
595 | 592 | ||
596 | project->variables()["CODEWARRIOR_VERSION"].append(project->first("VER_MAJ") + | 593 | project->variables()["CODEWARRIOR_VERSION"].append(project->first("VER_MAJ") + |
597 | project->first("VER_MIN") + | 594 | project->first("VER_MIN") + |
598 | project->first("VER_PAT")); | 595 | project->first("VER_PAT")); |
599 | } else { | 596 | } else { |
600 | project->variables()["CODEWARRIOR_VERSION"].append("0"); | 597 | project->variables()["CODEWARRIOR_VERSION"].append("0"); |
601 | if(project->isEmpty("QMAKE_ENTRYPOINT")) | 598 | if(project->isEmpty("QMAKE_ENTRYPOINT")) |
602 | project->variables()["QMAKE_ENTRYPOINT"].append("start"); | 599 | project->variables()["QMAKE_ENTRYPOINT"].append("start"); |
603 | project->variables()["CODEWARRIOR_ENTRYPOINT"].append( | 600 | project->variables()["CODEWARRIOR_ENTRYPOINT"].append( |
604 | project->first("QMAKE_ENTRYPOINT")); | 601 | project->first("QMAKE_ENTRYPOINT")); |
605 | } | 602 | } |
606 | } | 603 | } |
607 | 604 | ||
608 | 605 | ||
609 | QString | 606 | QString |
610 | MetrowerksMakefileGenerator::findTemplate(QString file) | 607 | MetrowerksMakefileGenerator::findTemplate(const QString &file) |
611 | { | 608 | { |
612 | QString ret; | 609 | QString ret; |
613 | if(!QFile::exists(ret = file) && | 610 | if(!QFile::exists(ret = file) && |
614 | !QFile::exists((ret = Option::mkfile::qmakespec + QDir::separator() + file)) && | 611 | !QFile::exists((ret = Option::mkfile::qmakespec + QDir::separator() + file)) && |
615 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/mac-mwerks/" + file)) && | 612 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/mac-mwerks/" + file)) && |
616 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 613 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
617 | return ""; | 614 | return ""; |
618 | return ret; | 615 | return ret; |
619 | } | 616 | } |
620 | 617 | ||
621 | bool | 618 | bool |
622 | MetrowerksMakefileGenerator::createFork(const QString &f) | 619 | MetrowerksMakefileGenerator::createFork(const QString &f) |
623 | { | 620 | { |
624 | #if defined(Q_OS_MACX) | 621 | #if !defined(QWS) && defined(Q_OS_MACX) |
625 | FSRef fref; | 622 | FSRef fref; |
626 | FSSpec fileSpec; | 623 | FSSpec fileSpec; |
627 | if(QFile::exists(f)) { | 624 | if(QFile::exists(f)) { |
628 | mode_t perms = 0; | 625 | mode_t perms = 0; |
629 | { | 626 | { |
630 | struct stat s; | 627 | struct stat s; |
631 | stat(f.latin1(), &s); | 628 | stat(f.latin1(), &s); |
632 | if(!(s.st_mode & S_IWUSR)) { | 629 | if(!(s.st_mode & S_IWUSR)) { |
633 | perms = s.st_mode; | 630 | perms = s.st_mode; |
634 | chmod(f.latin1(), perms | S_IWUSR); | 631 | chmod(f.latin1(), perms | S_IWUSR); |
635 | } | 632 | } |
636 | } | 633 | } |
637 | FILE *o = fopen(f.latin1(), "a"); | 634 | FILE *o = fopen(f.latin1(), "a"); |
638 | if(!o) | 635 | if(!o) |
639 | return FALSE; | 636 | return FALSE; |
640 | if(FSPathMakeRef((const UInt8 *)f.latin1(), &fref, NULL) == noErr) { | 637 | if(FSPathMakeRef((const UInt8 *)f.latin1(), &fref, NULL) == noErr) { |
641 | if(FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, NULL, &fileSpec, NULL) == noErr) | 638 | if(FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, NULL, &fileSpec, NULL) == noErr) |
642 | FSpCreateResFile(&fileSpec, 'CUTE', 'TEXT', smSystemScript); | 639 | FSpCreateResFile(&fileSpec, 'CUTE', 'TEXT', smSystemScript); |
643 | else | 640 | else |
644 | qDebug("bogus %d", __LINE__); | 641 | qDebug("bogus %d", __LINE__); |
645 | } else | 642 | } else |
646 | qDebug("bogus %d", __LINE__); | 643 | qDebug("bogus %d", __LINE__); |
647 | fclose(o); | 644 | fclose(o); |
648 | if(perms) | 645 | if(perms) |
649 | chmod(f.latin1(), perms); | 646 | chmod(f.latin1(), perms); |
650 | } | 647 | } |
651 | #else | 648 | #else |
652 | Q_UNUSED(f) | 649 | Q_UNUSED(f) |
653 | #endif | 650 | #endif |
654 | return TRUE; | 651 | return TRUE; |
655 | } | 652 | } |
656 | 653 | ||
657 | bool | 654 | bool |
658 | MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool ) | 655 | MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool ) |
659 | { | 656 | { |
660 | v = "Absolute"; | 657 | v = "Absolute"; |
661 | if(p.find(':') != -1) //guess its macish already | 658 | if(p.find(':') != -1) //guess its macish already |
662 | return TRUE; | 659 | return TRUE; |
663 | 660 | ||
664 | static QString st_volume; | 661 | static QString st_volume; |
665 | if(st_volume.isEmpty()) { | 662 | if(st_volume.isEmpty()) { |
666 | st_volume = var("QMAKE_VOLUMENAME"); | 663 | st_volume = var("QMAKE_VOLUMENAME"); |
667 | #ifdef Q_OS_MAC | 664 | #if !defined(QWS) && defined(Q_OS_MACX) |
668 | if(st_volume.isEmpty()) { | 665 | if(st_volume.isEmpty()) { |
669 | uchar foo[512]; | 666 | uchar foo[512]; |
670 | HVolumeParam pb; | 667 | HVolumeParam pb; |
671 | memset(&pb, '\0', sizeof(pb)); | 668 | memset(&pb, '\0', sizeof(pb)); |
672 | pb.ioVRefNum = 0; | 669 | pb.ioVRefNum = 0; |
673 | pb.ioNamePtr = foo; | 670 | pb.ioNamePtr = foo; |
674 | if(PBHGetVInfoSync((HParmBlkPtr)&pb) == noErr) { | 671 | if(PBHGetVInfoSync((HParmBlkPtr)&pb) == noErr) { |
675 | int len = foo[0]; | 672 | int len = foo[0]; |
676 | memcpy(foo,foo+1, len); | 673 | memcpy(foo,foo+1, len); |
677 | foo[len] = '\0'; | 674 | foo[len] = '\0'; |
678 | st_volume = (char *)foo; | 675 | st_volume = (char *)foo; |
679 | } | 676 | } |
680 | } | 677 | } |
681 | #endif | 678 | #endif |
682 | } | 679 | } |
683 | QString volume = st_volume; | 680 | QString volume = st_volume; |
684 | 681 | ||
685 | fixEnvVariables(p); | 682 | fixEnvVariables(p); |
686 | if(p.startsWith("\"") && p.endsWith("\"")) | 683 | if(p.startsWith("\"") && p.endsWith("\"")) |
687 | p = p.mid(1, p.length() - 2); | 684 | p = p.mid(1, p.length() - 2); |
688 | if(p.isEmpty()) | 685 | if(p.isEmpty()) |
689 | return FALSE; | 686 | return FALSE; |
690 | if(!p.endsWith("/")) | 687 | if(!p.endsWith("/")) |
691 | p += "/"; | 688 | p += "/"; |
@@ -712,67 +709,67 @@ MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool ) | |||
712 | return TRUE; | 709 | return TRUE; |
713 | } | 710 | } |
714 | 711 | ||
715 | void | 712 | void |
716 | MetrowerksMakefileGenerator::processPrlFiles() | 713 | MetrowerksMakefileGenerator::processPrlFiles() |
717 | { | 714 | { |
718 | QPtrList<MakefileDependDir> libdirs; | 715 | QPtrList<MakefileDependDir> libdirs; |
719 | libdirs.setAutoDelete(TRUE); | 716 | libdirs.setAutoDelete(TRUE); |
720 | const QString lflags[] = { "QMAKE_LIBS", QString::null }; | 717 | const QString lflags[] = { "QMAKE_LIBS", QString::null }; |
721 | for(int i = 0; !lflags[i].isNull(); i++) { | 718 | for(int i = 0; !lflags[i].isNull(); i++) { |
722 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 719 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
723 | QStringList l_out; | 720 | QStringList l_out; |
724 | QStringList &l = project->variables()[lflags[i]]; | 721 | QStringList &l = project->variables()[lflags[i]]; |
725 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 722 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
726 | QString opt = (*it); | 723 | QString opt = (*it); |
727 | if(opt.startsWith("-")) { | 724 | if(opt.startsWith("-")) { |
728 | if(opt.startsWith("-L")) { | 725 | if(opt.startsWith("-L")) { |
729 | QString r = opt.right(opt.length() - 2), l = r; | 726 | QString r = opt.right(opt.length() - 2), l = r; |
730 | fixEnvVariables(l); | 727 | fixEnvVariables(l); |
731 | libdirs.append(new MakefileDependDir(r.replace( "\"", ""), | 728 | libdirs.append(new MakefileDependDir(r.replace( "\"", ""), |
732 | l.replace( "\"", ""))); | 729 | l.replace( "\"", ""))); |
733 | } else if(opt.left(2) == "-l") { | 730 | } else if(opt.left(2) == "-l") { |
734 | QString lib = opt.right(opt.length() - 2), prl; | 731 | QString lib = opt.right(opt.length() - 2), prl; |
735 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 732 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
736 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 733 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib; |
737 | if(processPrlFile(prl)) { | 734 | if(processPrlFile(prl)) { |
738 | if(prl.startsWith(mdd->local_dir)) | 735 | if(prl.startsWith(mdd->local_dir)) |
739 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 736 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
740 | QRegExp reg("^.*lib(" + lib + "[^.]*)\\." + | 737 | QRegExp reg("^.*lib(" + lib + "[^.]*)\\." + |
741 | project->first("QMAKE_EXTENSION_SHLIB") + "$"); | 738 | project->first("QMAKE_EXTENSION_SHLIB") + "$"); |
742 | if(reg.exactMatch(prl)) | 739 | if(reg.exactMatch(prl)) |
743 | prl = "-l" + reg.cap(1); | 740 | prl = "-l" + reg.cap(1); |
744 | opt = prl; | 741 | opt = prl; |
745 | ret = TRUE; | 742 | ret = TRUE; |
746 | break; | 743 | break; |
747 | } | 744 | } |
748 | } | 745 | } |
749 | } else if(opt == "-framework") { | 746 | } else if(opt == "-framework") { |
750 | l_out.append(opt); | 747 | l_out.append(opt); |
751 | ++it; | 748 | ++it; |
752 | opt = (*it); | 749 | opt = (*it); |
753 | QString prl = "/System/Library/Frameworks/" + opt + | 750 | QString prl = "/System/Library/Frameworks/" + opt + |
754 | ".framework/" + opt + Option::prl_ext; | 751 | ".framework/" + opt; |
755 | if(processPrlFile(prl)) | 752 | if(processPrlFile(prl)) |
756 | ret = TRUE; | 753 | ret = TRUE; |
757 | } | 754 | } |
758 | if(!opt.isEmpty()) | 755 | if(!opt.isEmpty()) |
759 | l_out.append(opt); | 756 | l_out.append(opt); |
760 | } else { | 757 | } else { |
761 | if(processPrlFile(opt)) | 758 | if(processPrlFile(opt)) |
762 | ret = TRUE; | 759 | ret = TRUE; |
763 | if(!opt.isEmpty()) | 760 | if(!opt.isEmpty()) |
764 | l_out.append(opt); | 761 | l_out.append(opt); |
765 | } | 762 | } |
766 | } | 763 | } |
767 | if(ret) | 764 | if(ret) |
768 | l = l_out; | 765 | l = l_out; |
769 | else | 766 | else |
770 | break; | 767 | break; |
771 | } | 768 | } |
772 | } | 769 | } |
773 | } | 770 | } |
774 | 771 | ||
775 | void | 772 | void |
776 | MetrowerksMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 773 | MetrowerksMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
777 | { | 774 | { |
778 | if(var == "QMAKE_PRL_LIBS") { | 775 | if(var == "QMAKE_PRL_LIBS") { |
diff --git a/qmake/generators/mac/metrowerks_xml.h b/qmake/generators/mac/metrowerks_xml.h index ae3cfae..0aa3615 100644 --- a/qmake/generators/mac/metrowerks_xml.h +++ b/qmake/generators/mac/metrowerks_xml.h | |||
@@ -1,69 +1,68 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of MetrowerksMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __METROWERKSMAKE_H__ | 35 | |
38 | #define __METROWERKSMAKE_H__ | 36 | #ifndef __METROWERKS_XML_H__ |
37 | #define __METROWERKS_XML_H__ | ||
39 | 38 | ||
40 | #include "makefile.h" | 39 | #include "makefile.h" |
41 | 40 | ||
42 | class MetrowerksMakefileGenerator : public MakefileGenerator | 41 | class MetrowerksMakefileGenerator : public MakefileGenerator |
43 | { | 42 | { |
44 | bool createFork(const QString &f); | 43 | bool createFork(const QString &f); |
45 | bool fixifyToMacPath(QString &c, QString &v, bool exists=TRUE); | 44 | bool fixifyToMacPath(QString &c, QString &v, bool exists=TRUE); |
46 | 45 | ||
47 | bool init_flag; | 46 | bool init_flag; |
48 | 47 | ||
49 | bool writeMakeParts(QTextStream &); | 48 | bool writeMakeParts(QTextStream &); |
50 | bool writeSubDirs(QTextStream &); | 49 | bool writeSubDirs(QTextStream &); |
51 | 50 | ||
52 | bool writeMakefile(QTextStream &); | 51 | bool writeMakefile(QTextStream &); |
53 | QString findTemplate(QString file); | 52 | QString findTemplate(const QString &file); |
54 | void init(); | 53 | void init(); |
55 | public: | 54 | public: |
56 | MetrowerksMakefileGenerator(QMakeProject *p); | 55 | MetrowerksMakefileGenerator(QMakeProject *p); |
57 | ~MetrowerksMakefileGenerator(); | 56 | ~MetrowerksMakefileGenerator(); |
58 | 57 | ||
59 | bool openOutput(QFile &file) const; | 58 | bool openOutput(QFile &file) const; |
60 | protected: | 59 | protected: |
61 | virtual void processPrlFiles(); | 60 | virtual void processPrlFiles(); |
62 | virtual void processPrlVariable(const QString &var, const QStringList &l); | 61 | virtual void processPrlVariable(const QString &var, const QStringList &l); |
63 | virtual bool doDepends() const { return FALSE; } //never necesary | 62 | virtual bool doDepends() const { return FALSE; } //never necesary |
64 | }; | 63 | }; |
65 | 64 | ||
66 | inline MetrowerksMakefileGenerator::~MetrowerksMakefileGenerator() | 65 | inline MetrowerksMakefileGenerator::~MetrowerksMakefileGenerator() |
67 | { } | 66 | { } |
68 | 67 | ||
69 | #endif /* __METROWERKSMAKE_H__ */ | 68 | #endif /* __METROWERKS_XML_H__ */ |
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index b46005b..9d1286e 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp | |||
@@ -1,418 +1,662 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of ProjectBuilderMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "pbuilder_pbx.h" | 36 | #include "pbuilder_pbx.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "meta.h" | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qdict.h> | 40 | #include <qdict.h> |
42 | #include <qregexp.h> | 41 | #include <qregexp.h> |
43 | #include <stdlib.h> | 42 | #include <stdlib.h> |
44 | #include <time.h> | 43 | #include <time.h> |
44 | #include "qtmd5.h" | ||
45 | #ifdef Q_OS_UNIX | 45 | #ifdef Q_OS_UNIX |
46 | # include <sys/types.h> | 46 | # include <sys/types.h> |
47 | # include <sys/stat.h> | 47 | # include <sys/stat.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | // Note: this is fairly hacky, but it does the job... | 50 | // Note: this is fairly hacky, but it does the job... |
51 | 51 | ||
52 | |||
53 | ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p) | 52 | ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p) |
54 | { | 53 | { |
55 | 54 | ||
56 | } | 55 | } |
57 | 56 | ||
58 | bool | 57 | bool |
59 | ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) | 58 | ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) |
60 | { | 59 | { |
61 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 60 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
62 | /* for now just dump, I need to generated an empty xml or something.. */ | 61 | /* for now just dump, I need to generated an empty xml or something.. */ |
63 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
64 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
65 | return TRUE; | 64 | return TRUE; |
66 | } | 65 | } |
67 | 66 | ||
68 | project->variables()["MAKEFILE"].clear(); | 67 | project->variables()["MAKEFILE"].clear(); |
69 | project->variables()["MAKEFILE"].append("Makefile"); | 68 | project->variables()["MAKEFILE"].append("Makefile"); |
70 | if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") { | 69 | if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") |
71 | return writeMakeParts(t); | 70 | return writeMakeParts(t); |
72 | } else if(project->first("TEMPLATE") == "subdirs") { | 71 | else if(project->first("TEMPLATE") == "subdirs") |
73 | writeSubdirs(t, FALSE); | 72 | return writeSubdirs(t, FALSE); |
74 | return TRUE; | ||
75 | } | ||
76 | return FALSE; | 73 | return FALSE; |
77 | } | 74 | } |
78 | 75 | ||
79 | bool | 76 | bool |
77 | ProjectBuilderMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | ||
78 | { | ||
79 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), | ||
80 | QDir::currentDirPath()); | ||
81 | QFile mkwrapf(mkwrap); | ||
82 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { | ||
83 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); | ||
84 | QTextStream mkwrapt(&mkwrapf); | ||
85 | UnixMakefileGenerator::writeSubdirs(mkwrapt, direct); | ||
86 | } | ||
87 | |||
88 | //HEADER | ||
89 | t << "// !$*UTF8*$!" << "\n" | ||
90 | << "{" << "\n" | ||
91 | << "\t" << "archiveVersion = 1;" << "\n" | ||
92 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" | ||
93 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" | ||
94 | << "\t" << "objects = {" << endl; | ||
95 | |||
96 | //SUBDIRS | ||
97 | QStringList subdirs = project->variables()["SUBDIRS"]; | ||
98 | QString oldpwd = QDir::currentDirPath(); | ||
99 | QMap<QString, QStringList> groups; | ||
100 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | ||
101 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | ||
102 | if(fi.exists()) { | ||
103 | if(fi.isDir()) { | ||
104 | QString profile = (*it); | ||
105 | if(!profile.endsWith(Option::dir_sep)) | ||
106 | profile += Option::dir_sep; | ||
107 | profile += fi.baseName() + ".pro"; | ||
108 | subdirs.append(profile); | ||
109 | } else { | ||
110 | QMakeProject tmp_proj; | ||
111 | QString dir = fi.dirPath(), fn = fi.fileName(); | ||
112 | if(!dir.isEmpty()) { | ||
113 | if(!QDir::setCurrent(dir)) | ||
114 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | ||
115 | } | ||
116 | if(tmp_proj.read(fn, oldpwd)) { | ||
117 | if(Option::debug_level) { | ||
118 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | ||
119 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | ||
120 | it != vars.end(); ++it) { | ||
121 | if(it.key().left(1) != "." && !it.data().isEmpty()) | ||
122 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | ||
123 | it.data().join(" :: ").latin1()); | ||
124 | } | ||
125 | } | ||
126 | if(tmp_proj.first("TEMPLATE") == "subdirs") { | ||
127 | subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]); | ||
128 | } else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") { | ||
129 | QString pbxproj = QDir::currentDirPath() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix(); | ||
130 | if(!QFile::exists(pbxproj)) { | ||
131 | warn_msg(WarnLogic, "Ignored (not found) '%s'", pbxproj.latin1()); | ||
132 | goto nextfile; // # Dirty! | ||
133 | } | ||
134 | project->variables()["QMAKE_PBX_SUBDIRS"] += pbxproj; | ||
135 | //PROJECTREF | ||
136 | { | ||
137 | bool in_root = TRUE; | ||
138 | QString name = QDir::currentDirPath(); | ||
139 | QString project_key = keyFor(pbxproj + "_PROJECTREF"); | ||
140 | if(project->isActiveConfig("flat")) { | ||
141 | QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE); | ||
142 | if(flat_file.find(Option::dir_sep) != -1) { | ||
143 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
144 | name = dirs.back(); | ||
145 | } | ||
146 | } else { | ||
147 | QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE); | ||
148 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | ||
149 | QString last_grp("QMAKE_PBX_HEIR_GROUP"); | ||
150 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
151 | name = dirs.back(); | ||
152 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
153 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp)); | ||
154 | if(dir_it == dirs.begin()) { | ||
155 | if(!groups.contains(new_grp)) | ||
156 | project->variables()["QMAKE_PBX_GROUPS"].append(new_grp_key); | ||
157 | } else { | ||
158 | if(!groups[last_grp].contains(new_grp_key)) | ||
159 | groups[last_grp] += new_grp_key; | ||
160 | } | ||
161 | last_grp = new_grp; | ||
162 | } | ||
163 | groups[last_grp] += project_key; | ||
164 | in_root = FALSE; | ||
165 | } | ||
166 | } | ||
167 | if(in_root) | ||
168 | project->variables()["QMAKE_PBX_GROUPS"] += project_key; | ||
169 | t << "\t\t" << project_key << " = {" << "\n" | ||
170 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
171 | << "\t\t\t" << "name = " << tmp_proj.first("TARGET") << ";" << "\n" | ||
172 | << "\t\t\t" << "path = " << pbxproj << ";" << "\n" | ||
173 | << "\t\t\t" << "refType = 0;" << "\n" | ||
174 | << "\t\t\t" << "sourceTree = \"<absolute>\";" << "\n" | ||
175 | << "\t\t" << "};" << "\n"; | ||
176 | //PRODUCTGROUP | ||
177 | t << "\t\t" << keyFor(pbxproj + "_PRODUCTGROUP") << " = {" << "\n" | ||
178 | << "\t\t\t" << "children = (" << "\n" | ||
179 | << "\t\t\t" << ");" << "\n" | ||
180 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
181 | << "\t\t\t" << "name = Products;" << "\n" | ||
182 | << "\t\t\t" << "refType = 4;" << "\n" | ||
183 | << "\t\t\t" << "sourceTree = \"<group>\";" << "\n" | ||
184 | << "\t\t" << "};" << "\n"; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | nextfile: | ||
189 | QDir::setCurrent(oldpwd); | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) { | ||
194 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" | ||
195 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
196 | << "\t\t\t" << "children = (" << "\n" | ||
197 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
198 | << "\t\t\t" << ");" << "\n" | ||
199 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" | ||
200 | << "\t\t\t" << "refType = 4;" << "\n" | ||
201 | << "\t\t" << "};" << "\n"; | ||
202 | } | ||
203 | |||
204 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
205 | //BUILDSTYLE | ||
206 | QString active_buildstyle; | ||
207 | #if 0 | ||
208 | for(int as_release = 0; as_release < 2; as_release++) | ||
209 | #else | ||
210 | bool as_release = !project->isActiveConfig("debug"); | ||
211 | #endif | ||
212 | { | ||
213 | QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG")); | ||
214 | if(project->isActiveConfig("debug") != as_release) | ||
215 | active_buildstyle = key; | ||
216 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); | ||
217 | t << "\t\t" << key << " = {" << "\n" | ||
218 | << "\t\t\t" << "buildRules = (" << "\n" | ||
219 | << "\t\t\t" << ");" << "\n" | ||
220 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
221 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; | ||
222 | if(as_release) | ||
223 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; | ||
224 | t << "\t\t\t" << "};" << "\n" | ||
225 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" | ||
226 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" | ||
227 | << "\t\t" << "};" << "\n"; | ||
228 | } | ||
229 | |||
230 | //ROOT_GROUP | ||
231 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" | ||
232 | << "\t\t\t" << "children = (" << "\n" | ||
233 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
234 | << "\t\t\t" << ");" << "\n" | ||
235 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
236 | << "\t\t\t" << "refType = 4;" << "\n" | ||
237 | << "\t\t\t" << "sourceTree = \"<group>\";" << "\n" | ||
238 | << "\t\t" << "};" << "\n"; | ||
239 | |||
240 | //ROOT | ||
241 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" | ||
242 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
243 | << "\t\t\t" << "};" << "\n" | ||
244 | << "\t\t\t" << "buildStyles = (" << "\n" | ||
245 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
246 | << "\t\t\t" << ");" << "\n" | ||
247 | << "\t\t\t" << "isa = PBXProject;" << "\n" | ||
248 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" | ||
249 | << "\t\t\t" << "projectDirPath = \"\";" << "\n" | ||
250 | << "\t\t\t" << "projectReferences = (" << "\n"; | ||
251 | { | ||
252 | QStringList &libdirs = project->variables()["QMAKE_PBX_SUBDIRS"]; | ||
253 | for(QStringList::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) | ||
254 | t << "\t\t\t\t" << "{" << "\n" | ||
255 | << "\t\t\t\t\t" << "ProductGroup = " << keyFor((*it) + "_PRODUCTGROUP") << ";" << "\n" | ||
256 | << "\t\t\t\t\t" << "ProjectRef = " << keyFor((*it) + "_PROJECTREF") << ";" << "\n" | ||
257 | << "\t\t\t\t" << "}," << "\n"; | ||
258 | } | ||
259 | t << "\t\t\t" << ");" << "\n" | ||
260 | << "\t\t\t" << "targets = (" << "\n" | ||
261 | << "\t\t\t" << ");" << "\n" | ||
262 | << "\t\t" << "};" << "\n"; | ||
263 | |||
264 | //FOOTER | ||
265 | t << "\t" << "};" << "\n" | ||
266 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" | ||
267 | << "}" << endl; | ||
268 | |||
269 | return TRUE; | ||
270 | } | ||
271 | |||
272 | bool | ||
80 | ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) | 273 | ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) |
81 | { | 274 | { |
82 | int i; | 275 | int i; |
83 | QStringList tmp; | 276 | QStringList tmp; |
84 | bool did_preprocess = FALSE; | 277 | bool did_preprocess = FALSE; |
85 | 278 | ||
86 | //HEADER | 279 | //HEADER |
87 | t << "// !$*UTF8*$!" << "\n" | 280 | t << "// !$*UTF8*$!" << "\n" |
88 | << "{" << "\n" | 281 | << "{" << "\n" |
89 | << "\t" << "archiveVersion = 1;" << "\n" | 282 | << "\t" << "archiveVersion = 1;" << "\n" |
90 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" | 283 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" |
91 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" | 284 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" |
92 | << "\t" << "objects = {" << endl; | 285 | << "\t" << "objects = {" << endl; |
93 | 286 | ||
94 | //MAKE QMAKE equivlant | 287 | //MAKE QMAKE equivlant |
95 | if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") { | 288 | if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") { |
96 | QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak"; | 289 | QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak"; |
97 | QFile mkf(mkfile); | 290 | QFile mkf(mkfile); |
98 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 291 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
99 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 292 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
100 | QTextStream mkt(&mkf); | 293 | QTextStream mkt(&mkf); |
101 | writeHeader(mkt); | 294 | writeHeader(mkt); |
102 | mkt << "QMAKE = "<< | 295 | mkt << "QMAKE = "<< |
103 | (project->isEmpty("QMAKE_QMAKE") ? QString("$(QTDIR)/bin/qmake") : | 296 | (project->isEmpty("QMAKE_QMAKE") ? QString("$(QTDIR)/bin/qmake") : |
104 | var("QMAKE_QMAKE")) << endl; | 297 | var("QMAKE_QMAKE")) << endl; |
105 | writeMakeQmake(mkt); | 298 | writeMakeQmake(mkt); |
106 | mkf.close(); | 299 | mkf.close(); |
107 | } | 300 | } |
108 | QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); | 301 | QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); |
109 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 302 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
110 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 303 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
111 | t << "\t\t" << phase_key << " = {" << "\n" | 304 | t << "\t\t" << phase_key << " = {" << "\n" |
112 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 305 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
113 | << "\t\t\t" << "files = (" << "\n" | 306 | << "\t\t\t" << "files = (" << "\n" |
114 | << "\t\t\t" << ");" << "\n" | 307 | << "\t\t\t" << ");" << "\n" |
115 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 308 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
116 | << "\t\t\t" << ");" << "\n" | 309 | << "\t\t\t" << ");" << "\n" |
117 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 310 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
118 | << "\t\t\t" << "name = \"Qt Qmake\";" << "\n" | 311 | << "\t\t\t" << "name = \"Qt Qmake\";" << "\n" |
119 | << "\t\t\t" << "neededFileNames = (" << "\n" | 312 | << "\t\t\t" << "neededFileNames = (" << "\n" |
120 | << "\t\t\t" << ");" << "\n" | 313 | << "\t\t\t" << ");" << "\n" |
121 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 314 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
122 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << | 315 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
123 | " -f " << mkfile << "\";" << "\n" | 316 | " -f " << mkfile << "\";" << "\n" |
124 | << "\t\t" << "};" << "\n"; | 317 | << "\t\t" << "};" << "\n"; |
125 | } | 318 | } |
126 | 319 | ||
127 | //DUMP SOURCES | 320 | //DUMP SOURCES |
128 | QMap<QString, QStringList> groups; | 321 | QMap<QString, QStringList> groups; |
129 | QString srcs[] = { "SOURCES", "SRCMOC", "UICIMPLS", QString::null }; | 322 | QString srcs[] = { "HEADERS", "SOURCES", "SRCMOC", "UICIMPLS", "QMAKE_IMAGE_COLLECTION", |
323 | "FORMS", "QMAKE_INTERNAL_INCLUDED_FILES", QString::null }; | ||
130 | for(i = 0; !srcs[i].isNull(); i++) { | 324 | for(i = 0; !srcs[i].isNull(); i++) { |
131 | tmp = project->variables()[srcs[i]]; | 325 | tmp = project->variables()[srcs[i]]; |
326 | if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") { | ||
327 | QString pfile = project->projectFile(); | ||
328 | if(pfile != "(stdin)") | ||
329 | tmp.prepend(pfile); | ||
330 | } | ||
132 | QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]]; | 331 | QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]]; |
332 | QStringList &root_group_list = project->variables()["QMAKE_PBX_GROUPS"]; | ||
333 | |||
334 | //hard coded groups.. | ||
335 | QString src_group; | ||
336 | if(srcs[i] == "SOURCES") | ||
337 | src_group = "Sources"; | ||
338 | else if(srcs[i] == "HEADERS") | ||
339 | src_group = "Headers"; | ||
340 | else if(srcs[i] == "SRCMOC") | ||
341 | src_group = "Sources [moc]"; | ||
342 | else if(srcs[i] == "UICIMPLS" || srcs[i] == "FORMS") | ||
343 | src_group = "Sources [uic]"; | ||
344 | else if(srcs[i] == "QMAKE_IMAGE_COLLECTION") | ||
345 | src_group = "Sources [images]"; | ||
346 | else if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") | ||
347 | src_group = "Sources [qmake]"; | ||
348 | |||
133 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { | 349 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { |
134 | QString file = fileFixify((*it)); | 350 | QStringList files = (*it); |
135 | if(file.endsWith(Option::moc_ext)) | 351 | bool buildable = TRUE; |
136 | continue; | 352 | if(srcs[i] == "FORMS") { |
137 | bool in_root = TRUE; | 353 | QString form_dot_h = (*it) + Option::h_ext.first(); |
138 | QString src_key = keyFor(file); | 354 | if(QFile::exists(form_dot_h)) |
139 | if(!project->isActiveConfig("flat")) { | 355 | files += form_dot_h; |
140 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | 356 | buildable = FALSE; |
141 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | 357 | } else if(srcs[i] == "HEADERS" || srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") { |
142 | QString last_grp("QMAKE_PBX_" + srcs[i] + "_HEIR_GROUP"); | 358 | buildable = FALSE; |
143 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | 359 | } |
144 | dirs.pop_back(); //remove the file portion as it will be added via src_key | 360 | |
145 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | 361 | files = fileFixify(files); |
146 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), | 362 | for(QStringList::Iterator file_it = files.begin(); file_it != files.end(); ++file_it) { |
147 | new_grp_key(keyFor(new_grp)), last_grp_key(keyFor(last_grp)); | 363 | QString file = (*file_it); |
148 | if(dir_it == dirs.begin()) { | 364 | if(file.length() >= 2 && (file[0] == '"' || file[0] == '\'') && file[(int) file.length()-1] == file[0]) |
149 | if(!groups.contains(new_grp)) | 365 | file = file.mid(1, file.length()-2); |
150 | project->variables()["QMAKE_PBX_" + srcs[i]].append(new_grp_key); | 366 | if(file.endsWith(Option::cpp_moc_ext) || file.endsWith(Option::prl_ext)) |
151 | } else { | 367 | continue; |
152 | groups[last_grp] += new_grp_key; | 368 | bool in_root = TRUE; |
369 | QString src_key = keyFor(file), name = file; | ||
370 | if(project->isActiveConfig("flat")) { | ||
371 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | ||
372 | if(flat_file.find(Option::dir_sep) != -1) { | ||
373 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
374 | name = dirs.back(); | ||
375 | } | ||
376 | } else { | ||
377 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | ||
378 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | ||
379 | QString last_grp("QMAKE_PBX_" + src_group + "_HEIR_GROUP"); | ||
380 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
381 | name = dirs.back(); | ||
382 | dirs.pop_back(); //remove the file portion as it will be added via src_key | ||
383 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
384 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp)); | ||
385 | if(dir_it == dirs.begin()) { | ||
386 | if(!src_list.contains(new_grp_key)) | ||
387 | src_list.append(new_grp_key); | ||
388 | } else { | ||
389 | if(!groups[last_grp].contains(new_grp_key)) | ||
390 | groups[last_grp] += new_grp_key; | ||
391 | } | ||
392 | last_grp = new_grp; | ||
393 | } | ||
394 | groups[last_grp] += src_key; | ||
395 | in_root = FALSE; | ||
396 | } | ||
397 | } | ||
398 | if(in_root) | ||
399 | src_list.append(src_key); | ||
400 | //source reference | ||
401 | t << "\t\t" << src_key << " = {" << "\n" | ||
402 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
403 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" | ||
404 | << "\t\t\t" << "path = \"" << file << "\";" << "\n" | ||
405 | << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n"; | ||
406 | if (ideType() == MAC_XCODE) { | ||
407 | QString filetype; | ||
408 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | ||
409 | if(file.endsWith((*cppit))) { | ||
410 | filetype = "sourcecode.cpp.cpp"; | ||
411 | break; | ||
153 | } | 412 | } |
154 | last_grp = new_grp; | ||
155 | } | 413 | } |
156 | groups[last_grp] += src_key; | 414 | if(!filetype.isNull()) |
157 | in_root = FALSE; | 415 | t << "\t\t\t" << "lastKnownFileType = " << filetype << ";" << "\n"; |
416 | } | ||
417 | t << "\t\t" << "};" << "\n"; | ||
418 | if(buildable) { //build reference | ||
419 | QString obj_key = file + ".o"; | ||
420 | obj_key = keyFor(obj_key); | ||
421 | t << "\t\t" << obj_key << " = {" << "\n" | ||
422 | << "\t\t\t" << "fileRef = " << src_key << ";" << "\n" | ||
423 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | ||
424 | << "\t\t\t" << "settings = {" << "\n" | ||
425 | << "\t\t\t\t" << "ATTRIBUTES = (" << "\n" | ||
426 | << "\t\t\t\t" << ");" << "\n" | ||
427 | << "\t\t\t" << "};" << "\n" | ||
428 | << "\t\t" << "};" << "\n"; | ||
429 | project->variables()["QMAKE_PBX_OBJ"].append(obj_key); | ||
158 | } | 430 | } |
159 | } | 431 | } |
160 | if(in_root) | ||
161 | src_list.append(src_key); | ||
162 | //source reference | ||
163 | t << "\t\t" << src_key << " = {" << "\n" | ||
164 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
165 | << "\t\t\t" << "path = \"" << file << "\";" << "\n" | ||
166 | << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n" | ||
167 | << "\t\t" << "};" << "\n"; | ||
168 | //build reference | ||
169 | QString obj_key = file + ".o"; | ||
170 | obj_key = keyFor(obj_key); | ||
171 | t << "\t\t" << obj_key << " = {" << "\n" | ||
172 | << "\t\t\t" << "fileRef = " << src_key << ";" << "\n" | ||
173 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | ||
174 | << "\t\t\t" << "settings = {" << "\n" | ||
175 | << "\t\t\t\t" << "ATTRIBUTES = (" << "\n" | ||
176 | << "\t\t\t\t" << ");" << "\n" | ||
177 | << "\t\t\t" << "};" << "\n" | ||
178 | << "\t\t" << "};" << "\n"; | ||
179 | project->variables()["QMAKE_PBX_OBJ"].append(obj_key); | ||
180 | } | 432 | } |
181 | if(!src_list.isEmpty()) { | 433 | if(!src_list.isEmpty()) { |
182 | QString grp; | ||
183 | if(srcs[i] == "SOURCES") { | 434 | if(srcs[i] == "SOURCES") { |
184 | if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon | 435 | if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon |
185 | QString icns_file = keyFor("ICNS_FILE"); | 436 | QString icns_file = keyFor("ICNS_FILE"); |
186 | src_list.append(icns_file); | 437 | src_list.append(icns_file); |
187 | t << "\t\t" << icns_file << " = {" << "\n" | 438 | t << "\t\t" << icns_file << " = {" << "\n" |
188 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | 439 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" |
189 | << "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n" | 440 | << "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n" |
190 | << "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n" | 441 | << "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n" |
191 | << "\t\t" << "};" << "\n"; | 442 | << "\t\t" << "};" << "\n"; |
192 | t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n" | 443 | t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n" |
193 | << "\t\t\t" << "fileRef = " << icns_file << ";" << "\n" | 444 | << "\t\t\t" << "fileRef = " << icns_file << ";" << "\n" |
194 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | 445 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" |
195 | << "\t\t\t" << "settings = {" << "\n" | 446 | << "\t\t\t" << "settings = {" << "\n" |
196 | << "\t\t\t" << "};" << "\n" | 447 | << "\t\t\t" << "};" << "\n" |
197 | << "\t\t" << "};" << "\n"; | 448 | << "\t\t" << "};" << "\n"; |
198 | } | 449 | } |
199 | grp = "Sources"; | ||
200 | } else if(srcs[i] == "SRCMOC") { | ||
201 | grp = "Mocables"; | ||
202 | } else if(srcs[i] == "UICIMPLS") { | ||
203 | grp = "UICables"; | ||
204 | } | 450 | } |
205 | QString grp_key = keyFor(grp); | 451 | |
206 | project->variables()["QMAKE_PBX_GROUPS"].append(grp_key); | 452 | QString src_group_key = keyFor(src_group); |
207 | t << "\t\t" << grp_key << " = {" << "\n" | 453 | if(root_group_list.findIndex(src_group_key) == -1) |
208 | << "\t\t\t" << "children = (" << "\n" | 454 | root_group_list += src_group_key; |
209 | << varGlue("QMAKE_PBX_" + srcs[i], "\t\t\t\t", ",\n\t\t\t\t", "\n") | 455 | groups[src_group] += src_list; |
210 | << "\t\t\t" << ");" << "\n" | ||
211 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
212 | << "\t\t\t" << "name = " << grp << ";" << "\n" | ||
213 | << "\t\t\t" << "refType = 4;" << "\n" | ||
214 | << "\t\t" << "};" << "\n"; | ||
215 | } | 456 | } |
216 | } | 457 | } |
217 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); | 458 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) { |
218 | grp_it != groups.end(); ++grp_it) { | ||
219 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" | 459 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" |
220 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 460 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
221 | << "\t\t\t" << "children = (" << "\n" | 461 | << "\t\t\t" << "children = (" << "\n" |
222 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") | 462 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") |
223 | << "\t\t\t" << ");" << "\n" | 463 | << "\t\t\t" << ");" << "\n" |
224 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" | 464 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" |
225 | << "\t\t\t" << "refType = 4;" << "\n" | 465 | << "\t\t\t" << "refType = 4;" << "\n" |
226 | << "\t\t" << "};" << "\n"; | 466 | << "\t\t" << "};" << "\n"; |
227 | } | 467 | } |
228 | 468 | ||
229 | //PREPROCESS BUILDPHASE (just a makefile) | 469 | //PREPROCESS BUILDPHASE (just a makefile) |
230 | if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") || | 470 | if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") || |
231 | !project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) { | 471 | !project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) { |
232 | QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak"; | 472 | QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak"; |
233 | QFile mkf(mkfile); | 473 | QFile mkf(mkfile); |
234 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 474 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
235 | did_preprocess = TRUE; | 475 | did_preprocess = TRUE; |
236 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 476 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
237 | QTextStream mkt(&mkf); | 477 | QTextStream mkt(&mkf); |
238 | writeHeader(mkt); | 478 | writeHeader(mkt); |
239 | mkt << "MOC = " << var("QMAKE_MOC") << endl; | 479 | mkt << "MOC = " << Option::fixPathToTargetOS(var("QMAKE_MOC")) << endl; |
240 | mkt << "UIC = " << var("QMAKE_UIC") << endl; | 480 | mkt << "UIC = " << Option::fixPathToTargetOS(var("QMAKE_UIC")) << endl; |
241 | mkt << "LEX = " << var("QMAKE_LEX") << endl; | 481 | mkt << "LEX = " << var("QMAKE_LEX") << endl; |
242 | mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 482 | mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
243 | mkt << "YACC = " << var("QMAKE_YACC") << endl; | 483 | mkt << "YACC = " << var("QMAKE_YACC") << endl; |
244 | mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; | 484 | mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; |
245 | mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 485 | mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
246 | mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; | 486 | mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; |
247 | mkt << "FORMS = " << varList("UICIMPLS") << endl; | 487 | mkt << "FORMS = " << varList("UICIMPLS") << endl; |
488 | mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl; | ||
248 | mkt << "MOCS = " << varList("SRCMOC") << endl; | 489 | mkt << "MOCS = " << varList("SRCMOC") << endl; |
249 | mkt << "PARSERS ="; | 490 | mkt << "PARSERS ="; |
250 | if(!project->isEmpty("YACCSOURCES")) { | 491 | if(!project->isEmpty("YACCSOURCES")) { |
251 | QStringList &yaccs = project->variables()["YACCSOURCES"]; | 492 | QStringList &yaccs = project->variables()["YACCSOURCES"]; |
252 | for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { | 493 | for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { |
253 | QFileInfo fi((*yit)); | 494 | QFileInfo fi((*yit)); |
254 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) | 495 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) |
255 | << Option::yacc_mod << Option::cpp_ext.first(); | 496 | << Option::yacc_mod << Option::cpp_ext.first(); |
256 | } | 497 | } |
257 | } | 498 | } |
258 | if(!project->isEmpty("LEXSOURCES")) { | 499 | if(!project->isEmpty("LEXSOURCES")) { |
259 | QStringList &lexs = project->variables()["LEXSOURCES"]; | 500 | QStringList &lexs = project->variables()["LEXSOURCES"]; |
260 | for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { | 501 | for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { |
261 | QFileInfo fi((*lit)); | 502 | QFileInfo fi((*lit)); |
262 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) | 503 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) |
263 | << Option::lex_mod << Option::cpp_ext.first(); | 504 | << Option::lex_mod << Option::cpp_ext.first(); |
264 | } | 505 | } |
265 | } | 506 | } |
266 | mkt << "\n"; | 507 | mkt << "\n"; |
267 | mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl; | 508 | mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS) $(IMAGES)" << endl; |
268 | mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl; | 509 | mkt << "clean preprocess_clean: mocclean uiclean parser_clean" << endl << endl; |
269 | mkt << "mocclean:" << "\n"; | 510 | mkt << "mocclean:" << "\n"; |
270 | if(!project->isEmpty("SRCMOC")) | 511 | if(!project->isEmpty("SRCMOC")) |
271 | mkt << "\t-rm -f $(MOCS)" << "\n"; | 512 | mkt << "\t-rm -f $(MOCS)" << "\n"; |
272 | mkt << "uiclean:" << "\n"; | 513 | mkt << "uiclean:" << "\n"; |
273 | if(!project->isEmpty("UICIMPLS")) | 514 | if(!project->isEmpty("UICIMPLS")) |
274 | mkt << "\t-rm -f $(FORMS)" << "\n"; | 515 | mkt << "\t-rm -f $(FORMS)" << "\n"; |
516 | if(!project->isEmpty("QMAKE_IMAGE_COLLECTION")) | ||
517 | mkt << "\t-rm -f $(IMAGES)" << "\n"; | ||
275 | mkt << "parser_clean:" << "\n"; | 518 | mkt << "parser_clean:" << "\n"; |
276 | if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) | 519 | if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) |
277 | mkt << "\t-rm -f $(PARSERS)" << "\n"; | 520 | mkt << "\t-rm -f $(PARSERS)" << "\n"; |
278 | writeUicSrc(mkt, "FORMS"); | 521 | writeUicSrc(mkt, "FORMS"); |
279 | writeMocSrc(mkt, "HEADERS"); | 522 | writeMocSrc(mkt, "HEADERS"); |
280 | writeMocSrc(mkt, "SOURCES"); | 523 | writeMocSrc(mkt, "SOURCES"); |
281 | writeMocSrc(mkt, "UICDECLS"); | 524 | writeMocSrc(mkt, "UICDECLS"); |
282 | writeYaccSrc(mkt, "YACCSOURCES"); | 525 | writeYaccSrc(mkt, "YACCSOURCES"); |
283 | writeLexSrc(mkt, "LEXSOURCES"); | 526 | writeLexSrc(mkt, "LEXSOURCES"); |
527 | writeImageSrc(mkt, "QMAKE_IMAGE_COLLECTION"); | ||
284 | mkf.close(); | 528 | mkf.close(); |
285 | } | 529 | } |
286 | QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); | ||
287 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 530 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
288 | t << "\t\t" << target_key << " = {" << "\n" | 531 | QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); |
289 | << "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n" | 532 | //project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); |
290 | << "\t\t\t" << "buildPhases = (" << "\n" | 533 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
534 | t << "\t\t" << phase_key << " = {" << "\n" | ||
535 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | ||
536 | << "\t\t\t" << "files = (" << "\n" | ||
291 | << "\t\t\t" << ");" << "\n" | 537 | << "\t\t\t" << ");" << "\n" |
292 | << "\t\t\t" << "buildSettings = {" << "\n" | 538 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
293 | << "\t\t\t" << "};" << "\n" | 539 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
294 | << "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n" | ||
295 | << "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n" | ||
296 | << "\t\t\t" << "dependencies = (" << "\n" | ||
297 | << "\t\t\t" << ");" << "\n" | 540 | << "\t\t\t" << ");" << "\n" |
298 | << "\t\t\t" << "isa = PBXLegacyTarget;" << "\n" | 541 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
299 | << "\t\t\t" << "name = QtPreprocessors;" << "\n" | 542 | << "\t\t\t" << "name = \"Qt Preprocessors\";" << "\n" |
300 | << "\t\t\t" << "productName = QtPreprocessors;" << "\n" | 543 | << "\t\t\t" << "neededFileNames = (" << "\n" |
301 | << "\t\t\t" << "settingsToExpand = 6;" << "\n" | 544 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
302 | << "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n" | 545 | << "\t\t\t" << ");" << "\n" |
303 | << "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n" | 546 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
304 | << "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n" | 547 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
548 | " -f " << mkfile << "\";" << "\n" | ||
305 | << "\t\t" << "};" << "\n"; | 549 | << "\t\t" << "};" << "\n"; |
550 | } | ||
306 | 551 | ||
307 | QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND"); | ||
308 | project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key); | ||
309 | t << "\t\t" << target_depend_key << " = {" << "\n" | ||
310 | << "\t\t\t" << "isa = PBXTargetDependency;" << "\n" | ||
311 | << "\t\t\t" << "target = " << target_key << ";" << "\n" | ||
312 | << "\t\t" << "};" << "\n"; | ||
313 | } | ||
314 | //SOURCE BUILDPHASE | 552 | //SOURCE BUILDPHASE |
315 | if(!project->isEmpty("QMAKE_PBX_OBJ")) { | 553 | if(!project->isEmpty("QMAKE_PBX_OBJ")) { |
316 | QString grp = "Build Sources", key = keyFor(grp); | 554 | QString grp = "Build Sources", key = keyFor(grp); |
317 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 555 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
318 | t << "\t\t" << key << " = {" << "\n" | 556 | t << "\t\t" << key << " = {" << "\n" |
319 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 557 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
320 | << "\t\t\t" << "files = (" << "\n" | 558 | << "\t\t\t" << "files = (" << "\n" |
321 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 559 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
322 | << "\t\t\t" << ");" << "\n" | 560 | << "\t\t\t" << ");" << "\n" |
323 | << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n" | 561 | << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n" |
324 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 562 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
325 | << "\t\t" << "};" << "\n"; | 563 | << "\t\t" << "};" << "\n"; |
326 | } | 564 | } |
327 | 565 | ||
328 | if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES | 566 | if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES |
329 | QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; | 567 | QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; |
330 | QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 568 | QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
331 | for(i = 0; !libs[i].isNull(); i++) { | 569 | for(i = 0; !libs[i].isNull(); i++) { |
332 | tmp = project->variables()[libs[i]]; | 570 | tmp = project->variables()[libs[i]]; |
333 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) { | 571 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) { |
334 | bool remove = FALSE; | 572 | bool remove = FALSE; |
335 | QString library, name, opt = (*it).stripWhiteSpace(); | 573 | QString library, name, opt = (*it).stripWhiteSpace(); |
574 | if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && opt[(int) opt.length()-1] == opt[0]) | ||
575 | opt = opt.mid(1, opt.length()-2); | ||
336 | if(opt.startsWith("-L")) { | 576 | if(opt.startsWith("-L")) { |
337 | QString r = opt.right(opt.length() - 2); | 577 | QString r = opt.right(opt.length() - 2); |
338 | fixEnvVariables(r); | 578 | fixEnvVariables(r); |
339 | libdirs.append(r); | 579 | libdirs.append(r); |
580 | } else if(opt == "-prebind") { | ||
581 | project->variables()["QMAKE_DO_PREBINDING"].append("TRUE"); | ||
582 | remove = TRUE; | ||
340 | } else if(opt.startsWith("-l")) { | 583 | } else if(opt.startsWith("-l")) { |
341 | name = opt.right(opt.length() - 2); | 584 | name = opt.right(opt.length() - 2); |
342 | QString lib("lib" + name); | 585 | QString lib("lib" + name); |
343 | for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { | 586 | for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { |
344 | if(project->isActiveConfig("link_prl")) { | 587 | if(project->isActiveConfig("link_prl")) { |
345 | /* This isn't real nice, but it is real useful. This looks in a prl | 588 | /* This isn't real nice, but it is real usefull. This looks in a prl |
346 | for what the library will ultimately be called so we can stick it | 589 | for what the library will ultimately be called so we can stick it |
347 | in the ProjectFile. If the prl format ever changes (not likely) then | 590 | in the ProjectFile. If the prl format ever changes (not likely) then |
348 | this will not really work. However, more concerning is that it will | 591 | this will not really work. However, more concerning is that it will |
349 | encode the version number in the Project file which might be a bad | 592 | encode the version number in the Project file which might be a bad |
350 | things in days to come? --Sam | 593 | things in days to come? --Sam |
351 | */ | 594 | */ |
352 | QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext; | 595 | QString lib_file = (*lit) + Option::dir_sep + lib; |
353 | if(QFile::exists(prl_file)) { | 596 | if(QMakeMetaInfo::libExists(lib_file)) { |
354 | QMakeProject proj; | 597 | QMakeMetaInfo libinfo; |
355 | if(proj.read(prl_file, QDir::currentDirPath())) { | 598 | if(libinfo.readLib(lib_file)) { |
356 | if(!proj.isEmpty("QMAKE_PRL_TARGET")) { | 599 | if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { |
357 | library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET"); | 600 | library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); |
358 | debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", | 601 | debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", |
359 | opt.latin1(), prl_file.latin1(), library.latin1()); | 602 | opt.latin1(), lib_file.latin1(), library.latin1()); |
360 | remove = TRUE; | 603 | remove = TRUE; |
361 | } | 604 | } |
362 | } | 605 | } |
363 | |||
364 | } | 606 | } |
365 | } | 607 | } |
366 | if(!remove) { | 608 | if(!remove) { |
367 | QString extns[] = { ".dylib", ".so", ".a", QString::null }; | 609 | QString extns[] = { ".dylib", ".so", ".a", QString::null }; |
368 | for(int n = 0; !remove && !extns[n].isNull(); n++) { | 610 | for(int n = 0; !remove && !extns[n].isNull(); n++) { |
369 | QString tmp = (*lit) + Option::dir_sep + lib + extns[n]; | 611 | QString tmp = (*lit) + Option::dir_sep + lib + extns[n]; |
370 | if(QFile::exists(tmp)) { | 612 | if(QFile::exists(tmp)) { |
371 | library = tmp; | 613 | library = tmp; |
372 | debug_msg(1, "pbuilder: Found library (%s) via %s", | 614 | debug_msg(1, "pbuilder: Found library (%s) via %s", |
373 | opt.latin1(), library.latin1()); | 615 | opt.latin1(), library.latin1()); |
374 | remove = TRUE; | 616 | remove = TRUE; |
375 | } | 617 | } |
376 | } | 618 | } |
377 | } | 619 | } |
378 | } | 620 | } |
379 | } else if(opt == "-framework") { | 621 | } else if(opt == "-framework") { |
380 | ++it; | 622 | ++it; |
381 | if(it == tmp.end()) | 623 | if(it == tmp.end()) |
382 | break; | 624 | break; |
383 | QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"]; | 625 | QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"]; |
384 | if(fdirs.isEmpty()) | 626 | if(fdirs.isEmpty()) |
385 | fdirs.append("/System/Library/Frameworks/"); | 627 | fdirs.append("/System/Library/Frameworks/"); |
386 | for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) { | 628 | for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) { |
387 | if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) { | 629 | if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) { |
388 | --it; | 630 | --it; |
389 | it = tmp.remove(it); | 631 | it = tmp.remove(it); |
390 | remove = TRUE; | 632 | remove = TRUE; |
391 | library = (*fit) + Option::dir_sep + (*it) + ".framework"; | 633 | library = (*fit) + Option::dir_sep + (*it) + ".framework"; |
392 | break; | 634 | break; |
393 | } | 635 | } |
394 | } | 636 | } |
637 | } else if(opt == "-undefined") { | ||
638 | ++it; //the next option is not a library.. | ||
395 | } else if(opt.left(1) != "-") { | 639 | } else if(opt.left(1) != "-") { |
396 | remove = TRUE; | 640 | remove = TRUE; |
397 | library = opt; | 641 | library = opt; |
398 | } | 642 | } |
399 | if(!library.isEmpty()) { | 643 | if(!library.isEmpty()) { |
400 | if(name.isEmpty()) { | 644 | if(name.isEmpty()) { |
401 | int slsh = library.findRev(Option::dir_sep); | 645 | int slsh = library.findRev(Option::dir_sep); |
402 | if(slsh != -1) | 646 | if(slsh != -1) |
403 | name = library.right(library.length() - slsh - 1); | 647 | name = library.right(library.length() - slsh - 1); |
404 | } | 648 | } |
405 | library = fileFixify(library); | 649 | library = fileFixify(library); |
406 | QString key = keyFor(library); | 650 | QString key = keyFor(library); |
407 | bool is_frmwrk = (library.endsWith(".framework")); | 651 | bool is_frmwrk = (library.endsWith(".framework")); |
408 | t << "\t\t" << key << " = {" << "\n" | 652 | t << "\t\t" << key << " = {" << "\n" |
409 | << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n" | 653 | << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n" |
410 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" | 654 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" |
411 | << "\t\t\t" << "path = \"" << library << "\";" << "\n" | 655 | << "\t\t\t" << "path = \"" << library << "\";" << "\n" |
412 | << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n" | 656 | << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n" |
413 | << "\t\t" << "};" << "\n"; | 657 | << "\t\t" << "};" << "\n"; |
414 | project->variables()["QMAKE_PBX_LIBRARIES"].append(key); | 658 | project->variables()["QMAKE_PBX_LIBRARIES"].append(key); |
415 | QString obj_key = library + ".o"; | 659 | QString obj_key = library + ".o"; |
416 | obj_key = keyFor(obj_key); | 660 | obj_key = keyFor(obj_key); |
417 | t << "\t\t" << obj_key << " = {" << "\n" | 661 | t << "\t\t" << obj_key << " = {" << "\n" |
418 | << "\t\t\t" << "fileRef = " << key << ";" << "\n" | 662 | << "\t\t\t" << "fileRef = " << key << ";" << "\n" |
@@ -432,552 +676,721 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) | |||
432 | } | 676 | } |
433 | //SUBLIBS BUILDPHASE (just another makefile) | 677 | //SUBLIBS BUILDPHASE (just another makefile) |
434 | if(!project->isEmpty("SUBLIBS")) { | 678 | if(!project->isEmpty("SUBLIBS")) { |
435 | QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; | 679 | QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; |
436 | QFile mkf(mkfile); | 680 | QFile mkf(mkfile); |
437 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 681 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
438 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 682 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
439 | QTextStream mkt(&mkf); | 683 | QTextStream mkt(&mkf); |
440 | writeHeader(mkt); | 684 | writeHeader(mkt); |
441 | mkt << "SUBLIBS= "; | 685 | mkt << "SUBLIBS= "; |
442 | tmp = project->variables()["SUBLIBS"]; | 686 | tmp = project->variables()["SUBLIBS"]; |
443 | QStringList::Iterator it; | 687 | QStringList::Iterator it; |
444 | for(it = tmp.begin(); it != tmp.end(); ++it) | 688 | for(it = tmp.begin(); it != tmp.end(); ++it) |
445 | t << "tmp/lib" << (*it) << ".a "; | 689 | t << "tmp/lib" << (*it) << ".a "; |
446 | t << endl << endl; | 690 | t << endl << endl; |
447 | mkt << "sublibs: $(SUBLIBS)" << endl << endl; | 691 | mkt << "sublibs: $(SUBLIBS)" << endl << endl; |
448 | tmp = project->variables()["SUBLIBS"]; | 692 | tmp = project->variables()["SUBLIBS"]; |
449 | for(it = tmp.begin(); it != tmp.end(); ++it) | 693 | for(it = tmp.begin(); it != tmp.end(); ++it) |
450 | t << "tmp/lib" << (*it) << ".a" << ":\n\t" | 694 | t << "tmp/lib" << (*it) << ".a" << ":\n\t" |
451 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 695 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
452 | mkf.close(); | 696 | mkf.close(); |
453 | } | 697 | } |
454 | QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); | 698 | QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); |
455 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 699 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
456 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 700 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
457 | t << "\t\t" << phase_key << " = {" << "\n" | 701 | t << "\t\t" << phase_key << " = {" << "\n" |
458 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 702 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
459 | << "\t\t\t" << "files = (" << "\n" | 703 | << "\t\t\t" << "files = (" << "\n" |
460 | << "\t\t\t" << ");" << "\n" | 704 | << "\t\t\t" << ");" << "\n" |
461 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 705 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
462 | << "\t\t\t" << ");" << "\n" | 706 | << "\t\t\t" << ");" << "\n" |
463 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 707 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
464 | << "\t\t\t" << "name = \"Qt Sublibs\";" << "\n" | 708 | << "\t\t\t" << "name = \"Qt Sublibs\";" << "\n" |
465 | << "\t\t\t" << "neededFileNames = (" << "\n" | 709 | << "\t\t\t" << "neededFileNames = (" << "\n" |
466 | << "\t\t\t" << ");" << "\n" | 710 | << "\t\t\t" << ");" << "\n" |
467 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 711 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
468 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << | 712 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
469 | " -f " << mkfile << "\";" << "\n" | 713 | " -f " << mkfile << "\";" << "\n" |
470 | << "\t\t" << "};" << "\n"; | 714 | << "\t\t" << "};" << "\n"; |
471 | } | 715 | } |
472 | //LIBRARY BUILDPHASE | 716 | //LIBRARY BUILDPHASE |
473 | if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { | 717 | if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { |
474 | tmp = project->variables()["QMAKE_PBX_LIBRARIES"]; | 718 | tmp = project->variables()["QMAKE_PBX_LIBRARIES"]; |
475 | if(!tmp.isEmpty()) { | 719 | if(!tmp.isEmpty()) { |
476 | QString grp("External Frameworks and Libraries"), key = keyFor(grp); | 720 | QString grp("External Frameworks and Libraries"), key = keyFor(grp); |
477 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | 721 | project->variables()["QMAKE_PBX_GROUPS"].append(key); |
478 | t << "\t\t" << key << " = {" << "\n" | 722 | t << "\t\t" << key << " = {" << "\n" |
479 | << "\t\t\t" << "children = (" << "\n" | 723 | << "\t\t\t" << "children = (" << "\n" |
480 | << varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 724 | << varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
481 | << "\t\t\t" << ");" << "\n" | 725 | << "\t\t\t" << ");" << "\n" |
482 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 726 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
483 | << "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n" | 727 | << "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n" |
484 | << "\t\t\t" << "path = \"\";" << "\n" | 728 | << "\t\t\t" << "path = \"\";" << "\n" |
485 | << "\t\t\t" << "refType = 4;" << "\n" | 729 | << "\t\t\t" << "refType = 4;" << "\n" |
486 | << "\t\t" << "};" << "\n"; | 730 | << "\t\t" << "};" << "\n"; |
487 | } | 731 | } |
488 | } | 732 | } |
489 | { | 733 | { |
490 | QString grp("Frameworks & Libraries"), key = keyFor(grp); | 734 | QString grp("Frameworks & Libraries"), key = keyFor(grp); |
491 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 735 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
492 | t << "\t\t" << key << " = {" << "\n" | 736 | t << "\t\t" << key << " = {" << "\n" |
493 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 737 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
494 | << "\t\t\t" << "files = (" << "\n" | 738 | << "\t\t\t" << "files = (" << "\n" |
495 | << varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 739 | << varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
496 | << "\t\t\t" << ");" << "\n" | 740 | << "\t\t\t" << ");" << "\n" |
497 | << "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n" | 741 | << "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n" |
498 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 742 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
499 | << "\t\t" << "};" << "\n"; | 743 | << "\t\t" << "};" << "\n"; |
500 | } | 744 | } |
501 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console") && | 745 | if(!project->isActiveConfig("console") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES |
502 | project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES | ||
503 | QString grp("Bundle Resources"), key = keyFor(grp); | 746 | QString grp("Bundle Resources"), key = keyFor(grp); |
504 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 747 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
505 | t << "\t\t" << key << " = {" << "\n" | 748 | t << "\t\t" << key << " = {" << "\n" |
506 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 749 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
507 | << "\t\t\t" << "files = (" << "\n" | 750 | << "\t\t\t" << "files = (" << "\n" |
508 | << (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString("")) | 751 | << (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString("")) |
509 | << "\t\t\t" << ");" << "\n" | 752 | << "\t\t\t" << ");" << "\n" |
510 | << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n" | 753 | << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n" |
511 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 754 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
512 | << "\t\t" << "};" << "\n"; | 755 | << "\t\t" << "};" << "\n"; |
513 | } | 756 | } |
514 | |||
515 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
516 | //PRODUCTS | ||
517 | { | ||
518 | QString grp("Products"), key = keyFor(grp); | ||
519 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | ||
520 | t << "\t\t" << key << " = {" << "\n" | ||
521 | << "\t\t\t" << "children = (" << "\n" | ||
522 | << "\t\t\t\t" << keyFor("QMAKE_PBX_REFERENCE") << "\n" | ||
523 | << "\t\t\t" << ");" << "\n" | ||
524 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
525 | << "\t\t\t" << "name = Products;" << "\n" | ||
526 | << "\t\t\t" << "refType = 4;" << "\n" | ||
527 | << "\t\t" << "};" << "\n"; | ||
528 | } | ||
529 | { //INSTALL BUILDPHASE (sh script) | 757 | { //INSTALL BUILDPHASE (sh script) |
530 | QString targ = project->first("TARGET"); | 758 | QString targ = project->first("TARGET"); |
531 | if(project->first("TEMPLATE") == "app" || | 759 | if(project->first("TEMPLATE") == "app" || |
532 | (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && | 760 | (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && |
533 | project->isActiveConfig("frameworklib"))) | 761 | project->isActiveConfig("frameworklib"))) |
534 | targ = project->first("QMAKE_ORIG_TARGET"); | 762 | targ = project->first("QMAKE_ORIG_TARGET"); |
535 | int slsh = targ.findRev(Option::dir_sep); | 763 | int slsh = targ.findRev(Option::dir_sep); |
536 | if(slsh != -1) | 764 | if(slsh != -1) |
537 | targ = targ.right(targ.length() - slsh - 1); | 765 | targ = targ.right(targ.length() - slsh - 1); |
538 | fixEnvVariables(targ); | 766 | fixEnvVariables(targ); |
539 | QStringList links; | 767 | QStringList links; |
540 | if(project->first("TEMPLATE") == "app") { | 768 | if(project->first("TEMPLATE") == "app") { |
541 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 769 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) |
542 | targ += ".app"; | 770 | targ += ".app"; |
543 | } else if(!project->isActiveConfig("staticlib") && | 771 | } else if(!project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") && |
544 | !project->isActiveConfig("frameworklib")) { | 772 | !project->isActiveConfig("frameworklib")) { |
545 | QString li[] = { "TARGET_", "TARGET_x", "TARGET_x.y", QString::null }; | 773 | QString li[] = { "TARGET_", "TARGET_x", "TARGET_x.y", QString::null }; |
546 | for(int n = 0; !li[n].isNull(); n++) { | 774 | for(int n = 0; !li[n].isNull(); n++) { |
547 | QString t = project->first(li[n]); | 775 | QString t = project->first(li[n]); |
548 | slsh = t.findRev(Option::dir_sep); | 776 | slsh = t.findRev(Option::dir_sep); |
549 | if(slsh != -1) | 777 | if(slsh != -1) |
550 | t = t.right(t.length() - slsh); | 778 | t = t.right(t.length() - slsh); |
551 | fixEnvVariables(t); | 779 | fixEnvVariables(t); |
552 | links << t; | 780 | links << t; |
553 | } | 781 | } |
554 | } | 782 | } |
555 | QString script = pbx_dir + Option::dir_sep + "qt_install.sh"; | 783 | QString script = pbx_dir + Option::dir_sep + "qt_install.sh"; |
556 | QFile shf(script); | 784 | QFile shf(script); |
557 | if(shf.open(IO_WriteOnly | IO_Translate)) { | 785 | if(shf.open(IO_WriteOnly | IO_Translate)) { |
558 | debug_msg(1, "pbuilder: Creating file: %s", script.latin1()); | 786 | debug_msg(1, "pbuilder: Creating file: %s", script.latin1()); |
559 | QString targ = project->first("QMAKE_ORIG_TARGET"), cpflags; | 787 | QString targ = project->first("QMAKE_ORIG_TARGET"), cpflags; |
560 | if(project->first("TEMPLATE") == "app") { | 788 | if(project->first("TEMPLATE") == "app") { |
561 | targ = project->first("TARGET"); | 789 | targ = project->first("TARGET"); |
562 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 790 | if(!project->isActiveConfig("console")) { |
563 | targ += ".app"; | 791 | targ += ".app"; |
564 | cpflags += "-r "; | 792 | cpflags += "-r "; |
565 | } | 793 | } |
566 | } else if(!project->isActiveConfig("frameworklib")) { | 794 | } else if(!project->isActiveConfig("frameworklib")) { |
567 | if(project->isActiveConfig("staticlib")) | 795 | if(project->isActiveConfig("staticlib")) |
568 | targ = project->first("TARGET"); | 796 | targ = project->first("TARGET"); |
569 | else | 797 | else |
570 | targ = project->first("TARGET_"); | 798 | targ = project->first("TARGET_"); |
571 | int slsh = targ.findRev(Option::dir_sep); | ||
572 | if(slsh != -1) | ||
573 | targ = targ.right(targ.length() - slsh - 1); | ||
574 | } | 799 | } |
575 | QTextStream sht(&shf); | 800 | int slsh = targ.findRev(Option::dir_sep); |
801 | if(slsh != -1) | ||
802 | targ = targ.right(targ.length() - slsh - 1); | ||
803 | |||
576 | QString dstdir = project->first("DESTDIR"); | 804 | QString dstdir = project->first("DESTDIR"); |
577 | fixEnvVariables(dstdir); | 805 | fixEnvVariables(dstdir); |
578 | 806 | ||
807 | QTextStream sht(&shf); | ||
579 | sht << "#!/bin/sh" << endl; | 808 | sht << "#!/bin/sh" << endl; |
580 | //copy the actual target | 809 | //copy the actual target |
581 | sht << "OUT_TARG=\"" << targ << "\"\n" | 810 | sht << "OUT_TARG=\"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"\n" |
582 | << "[ -z \"$BUILD_ROOT\" ] || OUT_TARG=\"${BUILD_ROOT}/${OUT_TARG}\"" << endl; | 811 | << "if [ -e \"$OUT_TARG\" ]; then" << "\n" |
583 | sht << "[ \"$OUT_TARG\" = \"" | 812 | << " [ \"$OUT_TARG\" = \"" |
584 | << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || " | 813 | << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || " |
585 | << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || " | 814 | << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || " |
586 | << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << endl; | 815 | << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << "\n" |
816 | << "fi" << endl; | ||
587 | //rename as a framework | 817 | //rename as a framework |
588 | if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib")) | 818 | if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib") && !project->isActiveConfig("plugin")) |
589 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl; | 819 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl; |
590 | //create all the version symlinks (just to be like unixmake) | 820 | //create all the version symlinks (just to be like unixmake) |
591 | for(QStringList::Iterator it = links.begin(); it != links.end(); ++it) { | 821 | for(QStringList::Iterator it = links.begin(); it != links.end(); ++it) { |
592 | if(targ != (*it)) | 822 | if(targ != (*it)) |
593 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << (*it) << "\"" << endl; | 823 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << (*it) << "\"" << endl; |
594 | } | 824 | } |
595 | shf.close(); | 825 | shf.close(); |
596 | #ifdef Q_OS_UNIX | 826 | #ifdef Q_OS_UNIX |
597 | chmod(script.latin1(), S_IRWXU | S_IRWXG); | 827 | chmod(script.latin1(), S_IRWXU | S_IRWXG); |
598 | #endif | 828 | #endif |
599 | QString phase_key = keyFor("QMAKE_PBX_INSTALL_BUILDPHASE"); | 829 | QString phase_key = keyFor("QMAKE_PBX_INSTALL_BUILDPHASE"); |
600 | script = fileFixify(script, QDir::currentDirPath()); | 830 | script = fileFixify(script, QDir::currentDirPath()); |
601 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 831 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); |
602 | t << "\t\t" << phase_key << " = {" << "\n" | 832 | t << "\t\t" << phase_key << " = {" << "\n" |
603 | << "\t\t\t" << "buildActionMask = 8;" << "\n" //only on install! | 833 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
604 | << "\t\t\t" << "files = (" << "\n" | 834 | << "\t\t\t" << "files = (" << "\n" |
605 | << "\t\t\t" << ");" << "\n" | 835 | << "\t\t\t" << ");" << "\n" |
606 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 836 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
607 | << "\t\t\t" << ");" << "\n" | 837 | << "\t\t\t" << ");" << "\n" |
608 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 838 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
609 | << "\t\t\t" << "name = \"Qt Install\";" << "\n" | 839 | << "\t\t\t" << "name = \"Qt Install\";" << "\n" |
610 | << "\t\t\t" << "neededFileNames = (" << "\n" | 840 | << "\t\t\t" << "neededFileNames = (" << "\n" |
611 | << "\t\t\t" << ");" << "\n" | 841 | << "\t\t\t" << ");" << "\n" |
612 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 842 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
613 | << "\t\t\t" << "shellScript = \"" << script << "\";" << "\n" | 843 | << "\t\t\t" << "shellScript = \"" << script << "\";" << "\n" |
614 | << "\t\t" << "};" << "\n"; | 844 | << "\t\t" << "};" << "\n"; |
615 | } | 845 | } |
616 | } | 846 | } |
847 | if(/*ideType() == MAC_XCODE &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) { | ||
848 | // build reference | ||
849 | t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n" | ||
850 | << "\t\t\t" << "includeInIndex = 0;" << "\n" | ||
851 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
852 | << "\t\t\t" << "path = preprocessor.out;" << "\n" | ||
853 | << "\t\t\t" << "refType = 3;" << "\n" | ||
854 | << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR;" << "\n" | ||
855 | << "\t\t" << "};" << "\n"; | ||
856 | project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")); | ||
857 | //build phase | ||
858 | QString prescript_key = keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE"); | ||
859 | project->variables()["QMAKE_PBX_TARGETS"].append(prescript_key); | ||
860 | t << "\t\t" << prescript_key << " = {" << "\n" | ||
861 | << "\t\t\t" << "buildPhases = (" << "\n" | ||
862 | << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
863 | << "\t\t\t" << ");" << "\n" | ||
864 | << "\t\t\t" << "buildRules = (" << "\n" | ||
865 | << "\t\t\t" << ");" << "\n" | ||
866 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
867 | << "\t\t\t" << "};" << "\n" | ||
868 | << "\t\t\t" << "dependencies = (" << "\n" | ||
869 | << "\t\t\t" << ");" << "\n" | ||
870 | << "\t\t\t" << "isa = PBXNativeTarget;" << "\n" | ||
871 | << "\t\t\t" << "name = \"Qt Preprocessor Steps\";" << "\n" | ||
872 | << "\t\t\t" << "productName = \"Qt Preprocessor Steps\";" << "\n" | ||
873 | << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE") << ";" << "\n" | ||
874 | << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n" | ||
875 | << "\t\t" << "};" << "\n"; | ||
876 | //dependency | ||
877 | t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") << " = {" << "\n" | ||
878 | << "\t\t\t" << "isa = PBXTargetDependency;" << "\n" | ||
879 | << "\t\t\t" << "target = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE") << ";" << "\n" | ||
880 | << "\t\t" << "};" << "\n"; | ||
881 | project->variables()["QMAKE_PBX_TARGET_DEPENDS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY")); | ||
882 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].clear(); //these are already consumed above | ||
883 | } | ||
884 | |||
885 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
617 | //ROOT_GROUP | 886 | //ROOT_GROUP |
618 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" | 887 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" |
619 | << "\t\t\t" << "children = (" << "\n" | 888 | << "\t\t\t" << "children = (" << "\n" |
620 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 889 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
621 | << "\t\t\t" << ");" << "\n" | 890 | << "\t\t\t" << ");" << "\n" |
622 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 891 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
623 | << "\t\t\t" << "name = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n" | 892 | << "\t\t\t" << "name = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n" |
624 | << "\t\t\t" << "path = \"\";" << "\n" | 893 | << "\t\t\t" << "path = \"\";" << "\n" |
625 | << "\t\t\t" << "refType = 4;" << "\n" | 894 | << "\t\t\t" << "refType = 4;" << "\n" |
626 | << "\t\t" << "};" << "\n"; | 895 | << "\t\t" << "};" << "\n"; |
627 | //REFERENCE | 896 | //REFERENCE |
628 | t << "\t\t" << keyFor("QMAKE_PBX_REFERENCE") << " = {" << "\n"; | 897 | project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); |
898 | t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n" | ||
899 | << "\t\t\t" << "fallbackIsa = PBXFileReference;" << "\n"; | ||
629 | if(project->first("TEMPLATE") == "app") { | 900 | if(project->first("TEMPLATE") == "app") { |
630 | QString targ = project->first("QMAKE_ORIG_TARGET"); | 901 | QString targ = project->first("QMAKE_ORIG_TARGET"); |
631 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 902 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
632 | targ += ".app"; | 903 | targ += ".app"; |
633 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; | 904 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; |
634 | } else { | 905 | } else { |
635 | t << "\t\t\t" << "isa = PBXExecutableFileReference;" << "\n"; | 906 | t << "\t\t\t" << "isa = PBXExecutableFileReference;" << "\n"; |
636 | } | 907 | } |
637 | QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : | 908 | QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : |
638 | QDir::currentDirPath()) + Option::dir_sep + targ; | 909 | QDir::currentDirPath()) + Option::dir_sep + targ; |
639 | t << "\t\t\t" << "name = " << targ << ";" << "\n" | 910 | t << "\t\t\t" << "name = " << targ << ";" << "\n" |
640 | << "\t\t\t" << "path = \"" << targ << "\";" << "\n" | 911 | << "\t\t\t" << "path = \"" << targ << "\";" << "\n" |
641 | << "\t\t\t" << "refType = " << reftypeForFile(app) << ";" << "\n"; | 912 | << "\t\t\t" << "refType = " << reftypeForFile(app) << ";" << "\n"; |
642 | } else { | 913 | } else { |
643 | QString lib = project->first("QMAKE_ORIG_TARGET"); | 914 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
644 | if(project->isActiveConfig("staticlib")) { | 915 | if(project->isActiveConfig("staticlib")) { |
645 | lib = project->first("TARGET"); | 916 | lib = project->first("TARGET"); |
646 | } else if(!project->isActiveConfig("frameworklib")) { | 917 | } else if(!project->isActiveConfig("frameworklib")) { |
647 | if(project->isActiveConfig("plugin")) | 918 | if(project->isActiveConfig("plugin")) |
648 | lib = project->first("TARGET"); | 919 | lib = project->first("TARGET"); |
649 | else | 920 | else |
650 | lib = project->first("TARGET_"); | 921 | lib = project->first("TARGET_"); |
651 | } | 922 | } |
652 | int slsh = lib.findRev(Option::dir_sep); | 923 | int slsh = lib.findRev(Option::dir_sep); |
653 | if(slsh != -1) | 924 | if(slsh != -1) |
654 | lib = lib.right(lib.length() - slsh - 1); | 925 | lib = lib.right(lib.length() - slsh - 1); |
655 | t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n" | 926 | t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n" |
927 | << "\t\t\t" << "expectedFileType = \"compiled.mach-o.dylib\";" << "\n" | ||
656 | << "\t\t\t" << "path = " << lib << ";\n" | 928 | << "\t\t\t" << "path = " << lib << ";\n" |
657 | << "\t\t\t" << "refType = " << reftypeForFile(lib) << ";" << "\n"; | 929 | << "\t\t\t" << "refType = " << 3/*reftypeForFile(lib)*/ << ";" << "\n" |
930 | << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR" << ";" << "\n"; | ||
658 | } | 931 | } |
659 | t << "\t\t" << "};" << "\n"; | 932 | t << "\t\t" << "};" << "\n"; |
933 | { //Products group | ||
934 | QString grp("Products"), key = keyFor(grp); | ||
935 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | ||
936 | t << "\t\t" << key << " = {" << "\n" | ||
937 | << "\t\t\t" << "children = (" << "\n" | ||
938 | << varGlue("QMAKE_PBX_PRODUCTS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
939 | << "\t\t\t" << ");" << "\n" | ||
940 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
941 | << "\t\t\t" << "name = Products;" << "\n" | ||
942 | << "\t\t\t" << "refType = 4;" << "\n" | ||
943 | << "\t\t" << "};" << "\n"; | ||
944 | } | ||
660 | //TARGET | 945 | //TARGET |
661 | t << "\t\t" << keyFor("QMAKE_PBX_TARGET") << " = {" << "\n" | 946 | QString target_key = keyFor("QMAKE_PBX_TARGET"); |
947 | project->variables()["QMAKE_PBX_TARGETS"].append(target_key); | ||
948 | t << "\t\t" << target_key << " = {" << "\n" | ||
662 | << "\t\t\t" << "buildPhases = (" << "\n" | 949 | << "\t\t\t" << "buildPhases = (" << "\n" |
950 | << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", ",\n") | ||
663 | << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 951 | << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
664 | << "\t\t\t" << ");" << "\n" | 952 | << "\t\t\t" << ");" << "\n" |
665 | << "\t\t\t" << "buildSettings = {" << "\n" | 953 | << "\t\t\t" << "buildSettings = {" << "\n" |
954 | << "\t\t\t\t" << "CC = \"" << fixEnvsList("QMAKE_CC") << "\";" << "\n" | ||
955 | << "\t\t\t\t" << "CPLUSPLUS = \"" << fixEnvsList("QMAKE_CXX") << "\";" << "\n" | ||
666 | << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n" | 956 | << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n" |
667 | << "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n" | 957 | << "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n" |
668 | << "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n" | 958 | << "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n" |
669 | << "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n" | 959 | << "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n" |
670 | << "\t\t\t\t" << "OTHER_CFLAGS = \"" << | 960 | << "\t\t\t\t" << "OTHER_CFLAGS = \"" << |
671 | fixEnvsList("QMAKE_CFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << | 961 | fixEnvsList("QMAKE_CFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) << |
672 | varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" | 962 | fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n" |
673 | << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n" | 963 | << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n" |
674 | << "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n" | 964 | << "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n" |
675 | << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" << | 965 | << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" << |
676 | fixEnvsList("QMAKE_CXXFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << | 966 | fixEnvsList("QMAKE_CXXFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) << |
677 | varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" | 967 | fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n" |
678 | << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n" | 968 | << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n" |
679 | << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n" | 969 | << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n" |
680 | << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n"; | 970 | << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n" |
971 | << "\t\t\t\t" << "PREBINDING = " << (project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES") << ";" << "\n"; | ||
972 | if(!project->isEmpty("PRECOMPILED_HEADER")) { | ||
973 | if (ideType() == MAC_XCODE) { | ||
974 | t << "\t\t\t\t" << "GCC_PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n" | ||
975 | << "\t\t\t\t" << "GCC_PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n"; | ||
976 | } else { | ||
977 | t << "\t\t\t\t" << "PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n" | ||
978 | << "\t\t\t\t" << "PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n"; | ||
979 | } | ||
980 | } | ||
981 | if(project->first("TEMPLATE") == "app") { | ||
982 | QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); | ||
983 | if(plist.isEmpty()) | ||
984 | plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); | ||
985 | if(QFile::exists(plist)) { | ||
986 | QFile plist_in_file(plist); | ||
987 | if(plist_in_file.open(IO_ReadOnly)) { | ||
988 | QTextStream plist_in(&plist_in_file); | ||
989 | QString plist_in_text = plist_in.read(); | ||
990 | plist_in_text = plist_in_text.replace("@ICON@", (project->isEmpty("RC_FILE") ? QString("") : project->first("RC_FILE").section(Option::dir_sep, -1))); | ||
991 | plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET")); | ||
992 | QFile plist_out_file("Info.plist"); | ||
993 | if(plist_out_file.open(IO_WriteOnly | IO_Translate)) { | ||
994 | QTextStream plist_out(&plist_out_file); | ||
995 | plist_out << plist_in_text; | ||
996 | t << "\t\t\t\t" << "INFOPLIST_FILE = \"Info.plist\";" << "\n"; | ||
997 | } | ||
998 | } | ||
999 | } | ||
1000 | } | ||
681 | #if 1 | 1001 | #if 1 |
682 | t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; | 1002 | t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; |
683 | #endif | 1003 | #endif |
684 | if(!project->isActiveConfig("staticlib")) | 1004 | if(!project->isActiveConfig("staticlib")) |
685 | t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " << | 1005 | t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " << |
686 | fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") << | 1006 | fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") << |
687 | " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n"; | 1007 | " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n"; |
1008 | if(!project->isEmpty("DESTDIR")) { | ||
1009 | QString dir = project->first("DESTDIR"); | ||
1010 | if (QDir::isRelativePath(dir)) | ||
1011 | dir.prepend(QDir::currentDirPath() + Option::dir_sep); | ||
1012 | t << "\t\t\t\t" << "INSTALL_DIR = \"" << dir << "\";" << "\n"; | ||
1013 | } | ||
1014 | if ( project->first("TEMPLATE") == "lib") { | ||
1015 | t << "\t\t\t\t" << "INSTALL_PATH = \"" << "\";" << "\n"; | ||
1016 | } | ||
1017 | if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { | ||
1018 | t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VER_MAJ") << "." | ||
1019 | << project->first("VER_MIN") << "." << project->first("VER_PAT") << "\";" << "\n"; | ||
1020 | if(project->isEmpty("COMPAT_VERSION")) | ||
1021 | t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("VER_MAJ") << "." | ||
1022 | << project->first("VER_MIN") << "\";" << "\n"; | ||
1023 | } | ||
1024 | if(!project->isEmpty("COMPAT_VERSION")) | ||
1025 | t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("COMPAT_VERSION") << "\";" << "\n"; | ||
1026 | |||
1027 | if(ideType() == MAC_XCODE) { | ||
1028 | if(!project->isEmpty("OBJECTS_DIR")) | ||
1029 | t << "\t\t\t\t" << "OBJROOT = \"" << project->first("OBJECTS_DIR") << "\";" << "\n"; | ||
1030 | } | ||
1031 | #if 0 | ||
688 | if(!project->isEmpty("DESTDIR")) | 1032 | if(!project->isEmpty("DESTDIR")) |
689 | t << "\t\t\t\t" << "INSTALL_PATH = \"" << project->first("DESTDIR") << "\";" << "\n"; | 1033 | t << "\t\t\t\t" << "SYMROOT = \"" << project->first("DESTDIR") << "\";" << "\n"; |
690 | if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") | 1034 | else |
691 | t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VERSION") << "\";" << "\n"; | 1035 | t << "\t\t\t\t" << "SYMROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; |
692 | if(!project->isEmpty("OBJECTS_DIR")) | 1036 | #endif |
693 | t << "\t\t\t\t" << "OBJECT_FILE_DIR = \"" << project->first("OBJECTS_DIR") << "\";" << "\n"; | ||
694 | if(project->first("TEMPLATE") == "app") { | 1037 | if(project->first("TEMPLATE") == "app") { |
695 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 1038 | if(ideType() == MAC_PBUILDER && !project->isActiveConfig("console")) |
696 | t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n"; | 1039 | t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n"; |
697 | t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; | 1040 | t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; |
698 | } else { | 1041 | } else { |
699 | QString lib = project->first("QMAKE_ORIG_TARGET"); | ||
700 | if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { | 1042 | if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { |
701 | t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n"; | 1043 | t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n"; |
702 | lib = project->first("TARGET"); | ||
703 | } else { | 1044 | } else { |
704 | t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n"; | 1045 | t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n"; |
705 | if(!project->isActiveConfig("frameworklib")) { | ||
706 | if(project->isActiveConfig("plugin")) | ||
707 | lib = project->first("TARGET"); | ||
708 | else | ||
709 | lib = project->first("TARGET_"); | ||
710 | } | ||
711 | } | 1046 | } |
712 | int slsh = lib.findRev(Option::dir_sep); | 1047 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
713 | if(slsh != -1) | 1048 | if (!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib")) |
714 | lib = lib.right(lib.length() - slsh - 1); | 1049 | lib.prepend("lib"); |
715 | t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n"; | 1050 | t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n"; |
716 | } | 1051 | } |
717 | tmp = project->variables()["QMAKE_PBX_VARS"]; | 1052 | tmp = project->variables()["QMAKE_PBX_VARS"]; |
718 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) | 1053 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { |
719 | t << "\t\t\t\t" << (*it) << " = \"" << getenv((*it)) << "\";" << "\n"; | 1054 | QString var = (*it), val = getenv(var); |
1055 | if(!val && var == "TB") | ||
1056 | val = "/usr/bin/"; | ||
1057 | t << "\t\t\t\t" << var << " = \"" << val << "\";" << "\n"; | ||
1058 | } | ||
720 | t << "\t\t\t" << "};" << "\n" | 1059 | t << "\t\t\t" << "};" << "\n" |
721 | << "\t\t\t" << "conditionalBuildSettings = {" << "\n" | 1060 | << "\t\t\t" << "conditionalBuildSettings = {" << "\n" |
722 | << "\t\t\t" << "};" << "\n" | 1061 | << "\t\t\t" << "};" << "\n" |
723 | << "\t\t\t" << "dependencies = (" << "\n" | 1062 | << "\t\t\t" << "dependencies = (" << "\n" |
724 | << varGlue("QMAKE_PBX_TARGETDEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 1063 | << varGlue("QMAKE_PBX_TARGET_DEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
725 | << "\t\t\t" << ");" << "\n" | 1064 | << "\t\t\t" << ");" << "\n" |
726 | << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_REFERENCE") << ";" << "\n" | 1065 | << "\t\t\t" << "productReference = " << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << ";" << "\n" |
727 | << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n"; | 1066 | << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n"; |
1067 | if(ideType() == MAC_XCODE) | ||
1068 | t << "\t\t\t" << "isa = PBXNativeTarget;" << "\n"; | ||
728 | if(project->first("TEMPLATE") == "app") { | 1069 | if(project->first("TEMPLATE") == "app") { |
729 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 1070 | if(project->isActiveConfig("console")) { |
730 | t << "\t\t\t" << "isa = PBXApplicationTarget;" << "\n" | 1071 | if(ideType() == MAC_XCODE) |
731 | << "\t\t\t" << "productSettingsXML = " << "\"" << "<?xml version=" | 1072 | t << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n"; |
732 | << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" | 1073 | else |
733 | << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" | 1074 | t << "\t\t\t" << "isa = PBXToolTarget;" << "\n"; |
734 | << "Library/DTDs/PropertyList.dtd\\\">" << "\n" | ||
735 | << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n" | ||
736 | << "\t\t\t\t" << "<dict>" << "\n" | ||
737 | << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n" | ||
738 | << "\t\t\t\t\t" << "<string>English</string>" << "\n" | ||
739 | << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n" | ||
740 | << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n" | ||
741 | << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n" | ||
742 | << "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n" | ||
743 | << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n" | ||
744 | << "\t\t\t\t\t" << "<string>6.0</string>" << "\n" | ||
745 | << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n" | ||
746 | << "\t\t\t\t\t" << "<string>APPL</string>" << "\n" | ||
747 | << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" | ||
748 | << "\t\t\t\t\t" << "<string>????</string>" << "\n" | ||
749 | << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" | ||
750 | << "\t\t\t\t\t" << "<string>0.1</string>" << "\n" | ||
751 | << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n" | ||
752 | << "\t\t\t\t\t" << "<true/>" << "\n" | ||
753 | << "\t\t\t\t" << "</dict>" << "\n" | ||
754 | << "\t\t\t\t" << "</plist>" << "\";" << "\n"; | ||
755 | } else { | 1075 | } else { |
756 | t << "\t\t\t" << "isa = PBXToolTarget;" << "\n"; | 1076 | if(ideType() == MAC_XCODE) |
1077 | t << "\t\t\t" << "productType = \"com.apple.product-type.application\";" << "\n"; | ||
1078 | else | ||
1079 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; | ||
1080 | t << "\t\t\t" << "productSettingsXML = \""; | ||
1081 | bool read_plist = false; | ||
1082 | if(QFile::exists("Info.plist")) { | ||
1083 | QFile plist("Info.plist"); | ||
1084 | if(plist.open(IO_ReadOnly)) { | ||
1085 | read_plist = true; | ||
1086 | QTextStream stream(&plist); | ||
1087 | while(!stream.eof()) | ||
1088 | t << stream.readLine().replace('"', "\\\"") << endl; | ||
1089 | } | ||
1090 | } | ||
1091 | if(!read_plist) { | ||
1092 | t << "<?xml version=" | ||
1093 | << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" | ||
1094 | << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" | ||
1095 | << "Library/DTDs/PropertyList.dtd\\\">" << "\n" | ||
1096 | << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n" | ||
1097 | << "\t\t\t\t" << "<dict>" << "\n" | ||
1098 | << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n" | ||
1099 | << "\t\t\t\t\t" << "<string>English</string>" << "\n" | ||
1100 | << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n" | ||
1101 | << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n" | ||
1102 | << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n" | ||
1103 | << "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n" | ||
1104 | << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n" | ||
1105 | << "\t\t\t\t\t" << "<string>6.0</string>" << "\n" | ||
1106 | << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n" | ||
1107 | << "\t\t\t\t\t" << "<string>APPL</string>" << "\n" | ||
1108 | << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" | ||
1109 | //Although the output below looks strange it is to avoid the trigraph ??< | ||
1110 | << "\t\t\t\t\t" << "<string>????" << "</string>" << "\n" | ||
1111 | << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" | ||
1112 | << "\t\t\t\t\t" << "<string>0.1</string>" << "\n" | ||
1113 | << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n" | ||
1114 | << "\t\t\t\t\t" << "<true/>" << "\n" | ||
1115 | << "\t\t\t\t" << "</dict>" << "\n" | ||
1116 | << "\t\t\t\t" << "</plist>"; | ||
1117 | } | ||
757 | } | 1118 | } |
1119 | t << "\";" << "\n"; | ||
758 | t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n" | 1120 | t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n" |
759 | << "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; | 1121 | << "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; |
760 | } else { | 1122 | } else { |
761 | QString lib = project->first("QMAKE_ORIG_TARGET"); | 1123 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
762 | if(!project->isActiveConfig("frameworklib")) | 1124 | if(!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib")) |
763 | lib.prepend("lib"); | 1125 | lib.prepend("lib"); |
764 | t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n" | 1126 | t << "\t\t\t" << "name = \"" << lib << "\";" << "\n" |
765 | << "\t\t\t" << "name = \"" << lib << "\";" << "\n" | ||
766 | << "\t\t\t" << "productName = " << lib << ";" << "\n"; | 1127 | << "\t\t\t" << "productName = " << lib << ";" << "\n"; |
1128 | if(ideType() == MAC_XCODE) { | ||
1129 | if(project->isActiveConfig("staticlib")) | ||
1130 | t << "\t\t\t" << "productType = \"com.apple.product-type.library.static\";" << "\n"; | ||
1131 | else | ||
1132 | t << "\t\t\t" << "productType = \"com.apple.product-type.library.dynamic\";" << "\n"; | ||
1133 | } else { | ||
1134 | t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n"; | ||
1135 | } | ||
767 | } | 1136 | } |
1137 | t << "\t\t\t" << "startupPath = \"<<ProjectDirectory>>\";" << "\n"; | ||
768 | if(!project->isEmpty("DESTDIR")) | 1138 | if(!project->isEmpty("DESTDIR")) |
769 | t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n"; | 1139 | t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n"; |
770 | t << "\t\t" << "};" << "\n"; | 1140 | t << "\t\t" << "};" << "\n"; |
771 | //DEBUG/RELEASE | 1141 | //DEBUG/RELEASE |
772 | for(i = 0; i < 2; i++) { | 1142 | QString active_buildstyle; |
773 | bool as_release = !i; | 1143 | #if 0 |
774 | if(project->isActiveConfig("debug")) | 1144 | for(int as_release = 0; as_release < 2; as_release++) |
775 | as_release = i; | 1145 | #else |
776 | QString key = "QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"); | 1146 | bool as_release = !project->isActiveConfig("debug"); |
777 | key = keyFor(key); | 1147 | #endif |
1148 | { | ||
1149 | QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG")); | ||
1150 | if(project->isActiveConfig("debug") != as_release) | ||
1151 | active_buildstyle = key; | ||
778 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); | 1152 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); |
779 | t << "\t\t" << key << " = {" << "\n" | 1153 | t << "\t\t" << key << " = {" << "\n" |
780 | << "\t\t\t" << "buildRules = (" << "\n" | 1154 | << "\t\t\t" << "buildRules = (" << "\n" |
781 | << "\t\t\t" << ");" << "\n" | 1155 | << "\t\t\t" << ");" << "\n" |
782 | << "\t\t\t" << "buildSettings = {" << "\n" | 1156 | << "\t\t\t" << "buildSettings = {" << "\n" |
783 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; | 1157 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; |
784 | if(as_release) | 1158 | if(as_release) { |
785 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; | 1159 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; |
1160 | } else { | ||
1161 | t << "\t\t\t\t" << "GCC_ENABLE_FIX_AND_CONTINUE = " | ||
1162 | << (project->isActiveConfig("no_fix_and_continue") ? "NO" : "YES") << ";" << "\n" | ||
1163 | << "\t\t\t\t" << "GCC_GENERATE_DEBUGGING_SYMBOLS = YES;" << "\n" | ||
1164 | << "\t\t\t\t" << "GCC_OPTIMIZATION_LEVEL = 0;" << "\n" | ||
1165 | << "\t\t\t\t" << "ZERO_LINK =" | ||
1166 | << (project->isActiveConfig("no_zero_link") ? "NO" : "YES") << ";" << "\n"; | ||
1167 | } | ||
786 | t << "\t\t\t" << "};" << "\n" | 1168 | t << "\t\t\t" << "};" << "\n" |
787 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" | 1169 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" |
788 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" | 1170 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" |
789 | << "\t\t" << "};" << "\n"; | 1171 | << "\t\t" << "};" << "\n"; |
790 | } | 1172 | } |
791 | //ROOT | 1173 | //ROOT |
792 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" | 1174 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" |
793 | << "\t\t\t" << "buildStyles = (" << "\n" | 1175 | << "\t\t\t" << "buildStyles = (" << "\n" |
794 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 1176 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
795 | << "\t\t\t" << ");" << "\n" | 1177 | << "\t\t\t" << ");" << "\n" |
1178 | << "\t\t\t" << "hasScannedForEncodings = 1;" << "\n" | ||
796 | << "\t\t\t" << "isa = PBXProject;" << "\n" | 1179 | << "\t\t\t" << "isa = PBXProject;" << "\n" |
797 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" | 1180 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" |
1181 | << "\t\t\t" << "projectDirPath = \"\";" << "\n" | ||
798 | << "\t\t\t" << "targets = (" << "\n" | 1182 | << "\t\t\t" << "targets = (" << "\n" |
799 | << "\t\t\t\t" << keyFor("QMAKE_PBX_TARGET") << "\n" | 1183 | << varGlue("QMAKE_PBX_TARGETS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
800 | << "\t\t\t" << ");" << "\n" | 1184 | << "\t\t\t" << ");" << "\n" |
801 | << "\t\t" << "};" << "\n"; | 1185 | << "\t\t" << "};" << "\n"; |
802 | 1186 | ||
803 | //FOOTER | 1187 | //FOOTER |
804 | t << "\t" << "};" << "\n" | 1188 | t << "\t" << "};" << "\n" |
805 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" | 1189 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" |
806 | << "}" << endl; | 1190 | << "}" << endl; |
807 | 1191 | ||
808 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), | 1192 | if(project->isActiveConfig("generate_pbxbuild_makefile")) { |
809 | QDir::currentDirPath()); | 1193 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), |
810 | QFile mkwrapf(mkwrap); | 1194 | QDir::currentDirPath()); |
811 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { | 1195 | QFile mkwrapf(mkwrap); |
812 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); | 1196 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { |
813 | QTextStream mkwrapt(&mkwrapf); | 1197 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); |
814 | writeHeader(mkwrapt); | 1198 | QTextStream mkwrapt(&mkwrapf); |
815 | const char *cleans = "uiclean mocclean preprocess_clean "; | 1199 | writeHeader(mkwrapt); |
816 | mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" | 1200 | const char *cleans = "uiclean mocclean preprocess_clean "; |
817 | << "all:" << "\n\t" | 1201 | mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" |
818 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild") << "\n" | 1202 | << "all:" << "\n\t" |
819 | << "install: all" << "\n\t" | 1203 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << "\n" |
820 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild install") << "\n" | 1204 | << "install: all" << "\n\t" |
821 | << "distclean clean: preprocess_clean" << "\n\t" | 1205 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " install\n" |
822 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild clean") << "\n" | 1206 | << "distclean clean: preprocess_clean" << "\n\t" |
823 | << (!did_preprocess ? cleans : "") << ":" << "\n"; | 1207 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " clean" << "\n" |
824 | if(did_preprocess) | 1208 | << (!did_preprocess ? cleans : "") << ":" << "\n"; |
825 | mkwrapt << cleans << ":" << "\n\t" | 1209 | if(did_preprocess) |
826 | << "make -f " | 1210 | mkwrapt << cleans << ":" << "\n\t" |
827 | << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; | 1211 | << "make -f " |
1212 | << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; | ||
1213 | } | ||
828 | } | 1214 | } |
829 | return TRUE; | 1215 | return TRUE; |
830 | } | 1216 | } |
831 | 1217 | ||
832 | QString | 1218 | QString |
833 | ProjectBuilderMakefileGenerator::fixEnvs(QString file) | 1219 | ProjectBuilderMakefileGenerator::fixQuotes(const QString &val) |
1220 | { | ||
1221 | QString ret(val); | ||
1222 | ret = ret.replace(QRegExp("('|\")"), "\\\\1"); | ||
1223 | return ret; | ||
1224 | } | ||
1225 | |||
1226 | QString | ||
1227 | ProjectBuilderMakefileGenerator::fixEnvs(const QString &file) | ||
834 | { | 1228 | { |
835 | QRegExp reg_var("\\$\\((.*)\\)"); | 1229 | QRegExp reg_var("\\$\\((.*)\\)"); |
836 | for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) { | 1230 | for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) { |
837 | if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1) | 1231 | if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1) |
838 | project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1)); | 1232 | project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1)); |
839 | rep += reg_var.matchedLength(); | 1233 | rep += reg_var.matchedLength(); |
840 | } | 1234 | } |
841 | return file; | 1235 | return file; |
842 | } | 1236 | } |
843 | 1237 | ||
844 | QString | 1238 | QString |
845 | ProjectBuilderMakefileGenerator::fixEnvsList(QString where) | 1239 | ProjectBuilderMakefileGenerator::fixEnvsList(const QString &where) |
846 | { | 1240 | { |
847 | QString ret; | 1241 | QString ret; |
848 | const QStringList &l = project->variables()[where]; | 1242 | const QStringList &l = project->variables()[where]; |
849 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1243 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
850 | fixEnvs((*it)); | 1244 | fixEnvs((*it)); |
851 | if(!ret.isEmpty()) | 1245 | if(!ret.isEmpty()) |
852 | ret += " "; | 1246 | ret += " "; |
853 | ret += (*it); | 1247 | ret += (*it); |
854 | } | 1248 | } |
855 | return ret; | 1249 | return ret; |
856 | } | 1250 | } |
857 | 1251 | ||
858 | QString | 1252 | QString |
859 | ProjectBuilderMakefileGenerator::keyFor(QString block) | 1253 | ProjectBuilderMakefileGenerator::keyFor(const QString &block) |
860 | { | 1254 | { |
861 | #if 0 //This make this code much easier to debug.. | 1255 | #if 1 //This make this code much easier to debug.. |
862 | return block; | 1256 | if(project->isActiveConfig("no_pb_munge_key")) |
1257 | return block; | ||
863 | #endif | 1258 | #endif |
864 | |||
865 | QString ret; | 1259 | QString ret; |
866 | if(!keys.contains(block)) { | 1260 | if(!keys.contains(block)) { |
867 | #if 0 | 1261 | ret = qtMD5(block.utf8()).left(24).upper(); |
868 | static unsigned int r = 0; | ||
869 | ret.sprintf("%024x", ++r); | ||
870 | #else //not really necesary, but makes it look more interesting.. | ||
871 | static struct { unsigned int a1, a2, a3; } r = { 0, 0, 0 }; | ||
872 | if(!r.a1 && !r.a2 && !r.a3) { | ||
873 | r.a1 = rand(); | ||
874 | r.a2 = rand(); | ||
875 | r.a3 = rand(); | ||
876 | } | ||
877 | switch(rand() % 3) { | ||
878 | case 0: ++r.a1; break; | ||
879 | case 1: ++r.a2; break; | ||
880 | case 2: ++r.a3; break; | ||
881 | } | ||
882 | ret.sprintf("%08x%08x%08x", r.a1, r.a2, r.a3); | ||
883 | #endif | ||
884 | ret = ret.upper(); | ||
885 | keys.insert(block, ret); | 1262 | keys.insert(block, ret); |
886 | } else { | 1263 | } else { |
887 | ret = keys[block]; | 1264 | ret = keys[block]; |
888 | } | 1265 | } |
889 | return ret; | 1266 | return ret; |
890 | } | 1267 | } |
891 | 1268 | ||
892 | bool | 1269 | bool |
893 | ProjectBuilderMakefileGenerator::openOutput(QFile &file) const | 1270 | ProjectBuilderMakefileGenerator::openOutput(QFile &file) const |
894 | { | 1271 | { |
895 | if(project->first("TEMPLATE") != "subdirs") { | 1272 | if(QDir::isRelativePath(file.name())) |
896 | QFileInfo fi(file); | 1273 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run |
897 | if(fi.extension() != "pbxproj" || file.name().isEmpty()) { | 1274 | QFileInfo fi(file); |
898 | QString output = file.name(); | 1275 | if(fi.extension() != "pbxproj" || file.name().isEmpty()) { |
899 | if(fi.isDir()) | 1276 | QString output = file.name(); |
900 | output += QDir::separator(); | 1277 | if(fi.isDir()) |
901 | if(fi.extension() != "pbproj") { | 1278 | output += QDir::separator(); |
902 | if(file.name().isEmpty() || fi.isDir()) | 1279 | if(!output.endsWith(projectSuffix())) { |
903 | output += project->first("TARGET"); | 1280 | if(file.name().isEmpty() || fi.isDir()) |
904 | output += QString(".pbproj") + QDir::separator(); | 1281 | output += project->first("TARGET"); |
905 | } else if(output[(int)output.length() - 1] != QDir::separator()) { | 1282 | output += projectSuffix() + QDir::separator(); |
906 | output += QDir::separator(); | 1283 | } else if(output[(int)output.length() - 1] != QDir::separator()) { |
907 | } | 1284 | output += QDir::separator(); |
908 | output += QString("project.pbxproj"); | ||
909 | file.setName(output); | ||
910 | } | 1285 | } |
911 | bool ret = UnixMakefileGenerator::openOutput(file); | 1286 | output += QString("project.pbxproj"); |
912 | ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); | 1287 | file.setName(output); |
913 | Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); | ||
914 | return ret; | ||
915 | } | 1288 | } |
916 | return UnixMakefileGenerator::openOutput(file); | 1289 | bool ret = UnixMakefileGenerator::openOutput(file); |
1290 | ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); | ||
1291 | Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); | ||
1292 | return ret; | ||
917 | } | 1293 | } |
918 | 1294 | ||
919 | /* This function is such a hack it is almost pointless, but it | 1295 | /* This function is such a hack it is almost pointless, but it |
920 | eliminates the warning message from ProjectBuilder that the project | 1296 | eliminates the warning message from ProjectBuilder that the project |
921 | file is for an older version. I guess this could be used someday if | 1297 | file is for an older version. I guess this could be used someday if |
922 | the format of the output is dependant upon the version of | 1298 | the format of the output is dependant upon the version of |
923 | ProjectBuilder as well. | 1299 | ProjectBuilder as well. |
924 | */ | 1300 | */ |
925 | int | 1301 | int |
926 | ProjectBuilderMakefileGenerator::pbuilderVersion() const | 1302 | ProjectBuilderMakefileGenerator::pbuilderVersion() const |
927 | { | 1303 | { |
928 | QString ret; | 1304 | QString ret; |
929 | if(project->isEmpty("QMAKE_PBUILDER_VERSION")) { | 1305 | if(project->isEmpty("QMAKE_PBUILDER_VERSION")) { |
930 | QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST"); | 1306 | QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST"); |
931 | if(version_plist.isEmpty()) | 1307 | if(version_plist.isEmpty()) { |
932 | version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist"; | 1308 | if(ideType() == MAC_XCODE && QFile::exists("/Developer/Applications/Xcode.app/Contents/version.plist")) |
933 | else | 1309 | version_plist = "/Developer/Applications/Xcode.app/Contents/version.plist"; |
1310 | else | ||
1311 | version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist"; | ||
1312 | } else { | ||
934 | version_plist = version_plist.replace(QRegExp("\""), ""); | 1313 | version_plist = version_plist.replace(QRegExp("\""), ""); |
1314 | } | ||
935 | QFile version_file(version_plist); | 1315 | QFile version_file(version_plist); |
936 | if(version_file.open(IO_ReadOnly)) { | 1316 | if(version_file.open(IO_ReadOnly)) { |
937 | debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1()); | 1317 | debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1()); |
938 | QTextStream plist(&version_file); | 1318 | QTextStream plist(&version_file); |
939 | 1319 | ||
940 | bool in_dict = FALSE; | 1320 | bool in_dict = FALSE; |
941 | QString current_key; | 1321 | QString current_key; |
942 | QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$"); | 1322 | QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$"); |
943 | while(!plist.eof()) { | 1323 | while(!plist.eof()) { |
944 | QString line = plist.readLine().stripWhiteSpace(); | 1324 | QString line = plist.readLine().stripWhiteSpace(); |
945 | if(line == "<dict>") | 1325 | if(line == "<dict>") |
946 | in_dict = TRUE; | 1326 | in_dict = TRUE; |
947 | else if(line == "</dict>") | 1327 | else if(line == "</dict>") |
948 | in_dict = FALSE; | 1328 | in_dict = FALSE; |
949 | else if(in_dict) { | 1329 | else if(in_dict) { |
950 | if(keyreg.exactMatch(line)) | 1330 | if(keyreg.exactMatch(line)) |
951 | current_key = keyreg.cap(1); | 1331 | current_key = keyreg.cap(1); |
952 | else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line)) | 1332 | else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line)) |
953 | version = stringreg.cap(1); | 1333 | version = stringreg.cap(1); |
954 | } | 1334 | } |
955 | } | 1335 | } |
956 | version_file.close(); | 1336 | version_file.close(); |
957 | } else debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); | 1337 | } else { debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); } |
958 | if(version.startsWith("2.0")) | 1338 | if(version_plist.contains("Xcode")) { |
959 | ret = "38"; | 1339 | ret = "39"; |
960 | else if(version == "1.1") | 1340 | } else { |
961 | ret = "34"; | 1341 | if(version.startsWith("2.")) |
1342 | ret = "38"; | ||
1343 | else if(version == "1.1") | ||
1344 | ret = "34"; | ||
1345 | } | ||
962 | } else { | 1346 | } else { |
963 | ret = project->first("QMAKE_PBUILDER_VERSION"); | 1347 | ret = project->first("QMAKE_PBUILDER_VERSION"); |
964 | } | 1348 | } |
965 | if(!ret.isEmpty()) { | 1349 | if(!ret.isEmpty()) { |
966 | bool ok; | 1350 | bool ok; |
967 | int int_ret = ret.toInt(&ok); | 1351 | int int_ret = ret.toInt(&ok); |
968 | if(ok) { | 1352 | if(ok) { |
969 | debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret); | 1353 | debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret); |
970 | return int_ret; | 1354 | return int_ret; |
971 | } | 1355 | } |
972 | } | 1356 | } |
973 | debug_msg(1, "pbuilder: version.plist: Fallback to default version"); | 1357 | debug_msg(1, "pbuilder: version.plist: Fallback to default version"); |
974 | return 34; //my fallback | 1358 | return 34; //my fallback |
975 | } | 1359 | } |
976 | 1360 | ||
977 | QString | 1361 | int |
978 | ProjectBuilderMakefileGenerator::reftypeForFile(QString where) | 1362 | ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where) |
979 | { | 1363 | { |
1364 | int ret = 0; //absolute is the default.. | ||
980 | if(QDir::isRelativePath(where)) | 1365 | if(QDir::isRelativePath(where)) |
981 | return "4"; //relative | 1366 | ret = 4; //relative |
982 | return "0"; //absolute | 1367 | return ret; |
1368 | } | ||
1369 | |||
1370 | ProjectBuilderMakefileGenerator::IDE_TYPE | ||
1371 | ProjectBuilderMakefileGenerator::ideType() const | ||
1372 | { | ||
1373 | if(!project->isActiveConfig("no_pbx_xcode") && | ||
1374 | (QFile::exists("/Developer/Applications/Xcode.app") || project->isActiveConfig("pbx_xcode"))) | ||
1375 | return ProjectBuilderMakefileGenerator::MAC_XCODE; | ||
1376 | return ProjectBuilderMakefileGenerator::MAC_PBUILDER; | ||
1377 | } | ||
1378 | |||
1379 | QString | ||
1380 | ProjectBuilderMakefileGenerator::projectSuffix() const | ||
1381 | { | ||
1382 | if(ideType() == MAC_XCODE) | ||
1383 | return ".xcode"; | ||
1384 | return ".pbproj"; | ||
1385 | } | ||
1386 | |||
1387 | QString | ||
1388 | ProjectBuilderMakefileGenerator::pbxbuild() | ||
1389 | { | ||
1390 | if(QFile::exists("/usr/bin/pbbuild")) | ||
1391 | return "pbbuild"; | ||
1392 | if(QFile::exists("/usr/bin/xcodebuild")) | ||
1393 | return "xcodebuild"; | ||
1394 | return (ideType() == MAC_XCODE ? "xcodebuild" : "pbxbuild"); | ||
983 | } | 1395 | } |
1396 | |||
diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index ec2e1be..4ffb9a8 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h | |||
@@ -1,68 +1,75 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ProjectBuilderMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __PBUILDERMAKE_H__ | 35 | |
38 | #define __PBUILDERMAKE_H__ | 36 | #ifndef __PBUILDER_PBX_H__ |
37 | #define __PBUILDER_PBX_H__ | ||
39 | 38 | ||
40 | #include "unixmake.h" | 39 | #include "unixmake.h" |
41 | 40 | ||
42 | class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator | 41 | class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator |
43 | { | 42 | { |
44 | QString pbx_dir; | 43 | QString pbx_dir; |
45 | int pbuilderVersion() const; | 44 | int pbuilderVersion() const; |
45 | bool writeSubdirs(QTextStream &, bool); | ||
46 | bool writeMakeParts(QTextStream &); | 46 | bool writeMakeParts(QTextStream &); |
47 | bool writeMakefile(QTextStream &); | 47 | bool writeMakefile(QTextStream &); |
48 | 48 | ||
49 | QString pbxbuild(); | ||
49 | QMap<QString, QString> keys; | 50 | QMap<QString, QString> keys; |
50 | QString keyFor(QString file); | 51 | QString keyFor(const QString &file); |
51 | QString fixEnvs(QString file); | 52 | QString fixQuotes(const QString &val); |
52 | QString fixEnvsList(QString where); | 53 | QString fixEnvs(const QString &file); |
53 | QString reftypeForFile(QString file); | 54 | QString fixEnvsList(const QString &where); |
55 | int reftypeForFile(const QString &where); | ||
56 | QString projectSuffix() const; | ||
57 | |||
58 | enum IDE_TYPE { MAC_XCODE, MAC_PBUILDER }; | ||
59 | IDE_TYPE ideType() const; | ||
54 | 60 | ||
55 | public: | 61 | public: |
56 | ProjectBuilderMakefileGenerator(QMakeProject *p); | 62 | ProjectBuilderMakefileGenerator(QMakeProject *p); |
57 | ~ProjectBuilderMakefileGenerator(); | 63 | ~ProjectBuilderMakefileGenerator(); |
58 | 64 | ||
59 | virtual bool openOutput(QFile &) const; | 65 | virtual bool openOutput(QFile &) const; |
60 | protected: | 66 | protected: |
67 | bool doPrecompiledHeaders() const { return FALSE; } | ||
61 | virtual bool doDepends() const { return FALSE; } //never necesary | 68 | virtual bool doDepends() const { return FALSE; } //never necesary |
62 | }; | 69 | }; |
63 | 70 | ||
64 | inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() | 71 | inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() |
65 | { } | 72 | { } |
66 | 73 | ||
67 | 74 | ||
68 | #endif /* __PBUILDERMAKE_H__ */ | 75 | #endif /* __PBUILDER_PBX_H__ */ |