summaryrefslogtreecommitdiffstats
path: root/src/qt-1-cherrypicks.patch
blob: 993e9fe50d0e006b43af80d85299201068f998f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
This file is part of mingw-cross-env.
See doc/index.html for further information.

Commits backported (cherry-picked) from Qt 4.7 branch.
http://qt.gitorious.org/qt

From bb75d02785da59c967dee09006700488af9f482e Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Fri, 15 Oct 2010 14:56:03 +0200
Subject: [PATCH 01/17] removed obsolete -qt-gif configure option

Since "-system-gif" is not offered, offering "-qt-gif" is unnecessary
and perhaps misleading. By default the GIF handler is built from code
included with Qt, unless suppressed by "-no-gif".

Merge-request: 859
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit dfe9084344d73d59f4569c8be6104ce83ae0df95)
---
 configure                        |    7 ++-----
 tools/configure/configureapp.cpp |    5 +----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 7abe0eb..c159cd4 100755
--- a/configure
+++ b/configure
@@ -1570,8 +1570,7 @@ while [ "$#" -gt 0 ]; do
         fi
         ;;
     gif)
-        [ "$VAL" = "qt" ] && VAL=auto
-        if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
+        if [ "$VAL" = "no" ]; then
             CFG_GIF="$VAL"
         else
             UNKNOWN_OPT=yes
@@ -3544,7 +3543,7 @@ Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
         [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
-        [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
+        [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
@@ -3773,8 +3772,6 @@ Third Party Libraries:
                          See http://www.gzip.org/zlib
 
     -no-gif ............ Do not compile GIF reading support.
- *  -qt-gif ............ Compile GIF reading support.
-                         See also src/gui/image/qgifhandler_p.h
 
     -no-libtiff ........ Do not compile TIFF support.
     -qt-libtiff ........ Use the libtiff bundled with Qt.
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 15c0ddb..dd5647b 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -590,8 +590,6 @@ void Configure::parseCmdLine()
         // Image formats --------------------------------------------
         else if (configCmdLine.at(i) == "-no-gif")
             dictionary[ "GIF" ] = "no";
-        else if (configCmdLine.at(i) == "-qt-gif")
-            dictionary[ "GIF" ] = "plugin";
 
         else if (configCmdLine.at(i) == "-no-libtiff") {
             dictionary[ "TIFF"] = "no";
@@ -1661,7 +1659,7 @@ bool Configure::displayHelp()
                     "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
                     "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
                     "[-saveconfig <config>] [-loadconfig <config>]\n"
-                    "[-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libpng]\n"
+                    "[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng]\n"
                     "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
                     "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
                     "[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
@@ -1794,7 +1792,6 @@ bool Configure::displayHelp()
         desc("ZLIB", "system",  "-system-zlib",         "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
 
         desc("GIF", "no",       "-no-gif",              "Do not compile GIF reading support.");
-        desc("GIF", "auto",     "-qt-gif",              "Compile GIF reading support.\nSee also src/gui/image/qgifhandler_p.h\n");
 
         desc("LIBPNG", "no",    "-no-libpng",           "Do not compile PNG support.");
         desc("LIBPNG", "qt",    "-qt-libpng",           "Use the libpng bundled with Qt.");
-- 
1.7.6


From b5e382d8335628edf5d5c5a1671682de7c50c6d2 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:54 +0100
Subject: [PATCH 02/17] qmake: fix double directory separator

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 89886a34d7c4fdacc472f6e1498bc0769f2302ad)
---
 qmake/generators/unix/unixmake2.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index df580fd..81a379f 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1345,8 +1345,13 @@ UnixMakefileGenerator::pkgConfigFileName(bool fixify)
     if(dot != -1)
         ret = ret.left(dot);
     ret += Option::pkgcfg_ext;
-    if(!project->isEmpty("QMAKE_PKGCONFIG_DESTDIR"))
-        ret.prepend(project->first("QMAKE_PKGCONFIG_DESTDIR") + Option::dir_sep);
+    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
+    if(!subdir.isEmpty()) {
+        // initOutPaths() appends dir_sep, but just to be safe..
+        if (!subdir.endsWith(Option::dir_sep))
+            ret.prepend(Option::dir_sep);
+        ret.prepend(subdir);
+    }
     if(fixify) {
         if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
             ret.prepend(project->first("DESTDIR"));
-- 
1.7.6


From f35c452aaf665489060d317ce180d192433abd24 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:55 +0100
Subject: [PATCH 03/17] qmake: don't limit pkg-config writing to unix
 generator

Move pkg-config related methods from unix generator to base class
so they can be used by other generators too.

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 95646b07968604aa69f7e367dab7c9966dc44772)
---
 qmake/generators/makefile.cpp       |  178 +++++++++++++++++++++++++++++++++++
 qmake/generators/makefile.h         |    5 +
 qmake/generators/unix/unixmake.h    |    4 -
 qmake/generators/unix/unixmake2.cpp |  178 -----------------------------------
 4 files changed, 183 insertions(+), 182 deletions(-)

diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 77b9979..d77f002 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3123,4 +3123,182 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
     return false;
 }
 
+QString
+MakefileGenerator::pkgConfigFileName(bool fixify)
+{
+    QString ret = var("TARGET");
+    int slsh = ret.lastIndexOf(Option::dir_sep);
+    if(slsh != -1)
+        ret = ret.right(ret.length() - slsh - 1);
+    if(ret.startsWith("lib"))
+        ret = ret.mid(3);
+    int dot = ret.indexOf('.');
+    if(dot != -1)
+        ret = ret.left(dot);
+    ret += Option::pkgcfg_ext;
+    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
+    if(!subdir.isEmpty()) {
+        // initOutPaths() appends dir_sep, but just to be safe..
+        if (!subdir.endsWith(Option::dir_sep))
+            ret.prepend(Option::dir_sep);
+        ret.prepend(subdir);
+    }
+    if(fixify) {
+        if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
+            ret.prepend(project->first("DESTDIR"));
+        ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
+    }
+    return ret;
+}
+
+QString
+MakefileGenerator::pkgConfigPrefix() const
+{
+    if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
+        return project->first("QMAKE_PKGCONFIG_PREFIX");
+    return QLibraryInfo::location(QLibraryInfo::PrefixPath);
+}
+
+QString
+MakefileGenerator::pkgConfigFixPath(QString path) const
+{
+    QString prefix = pkgConfigPrefix();
+    if(path.startsWith(prefix))
+        path = path.replace(prefix, "${prefix}");
+    return path;
+}
+
+void
+MakefileGenerator::writePkgConfigFile()
+{
+    QString fname = pkgConfigFileName(), lname = fname;
+    mkdir(fileInfo(fname).path());
+    int slsh = lname.lastIndexOf(Option::dir_sep);
+    if(slsh != -1)
+        lname = lname.right(lname.length() - slsh - 1);
+    QFile ft(fname);
+    if(!ft.open(QIODevice::WriteOnly))
+        return;
+    project->values("ALL_DEPS").append(fileFixify(fname));
+    QTextStream t(&ft);
+
+    QString prefix = pkgConfigPrefix();
+    QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
+    if(libDir.isEmpty())
+        libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
+    QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
+    if(includeDir.isEmpty())
+        includeDir = prefix + "/include";
+
+    t << "prefix=" << prefix << endl;
+    t << "exec_prefix=${prefix}\n"
+      << "libdir=" << pkgConfigFixPath(libDir) << "\n"
+      << "includedir=" << pkgConfigFixPath(includeDir) << endl;
+    // non-standard entry. Provides useful info normally only
+    // contained in the internal .qmake.cache file
+    t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
+
+    //extra PKGCONFIG variables
+    const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
+    for(int i = 0; i < pkgconfig_vars.size(); ++i) {
+        QString var = project->first(pkgconfig_vars.at(i) + ".name"),
+                val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
+        if(var.isEmpty())
+            continue;
+        if(val.isEmpty()) {
+            const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
+            for(int v = 0; v < var_vars.size(); ++v) {
+                const QStringList &vars = project->values(var_vars.at(v));
+                for(int var = 0; var < vars.size(); ++var) {
+                    if(!val.isEmpty())
+                        val += " ";
+                    val += pkgConfigFixPath(vars.at(var));
+                }
+            }
+        }
+        t << var << "=" << val << endl;
+    }
+
+    t << endl;
+
+    QString name = project->first("QMAKE_PKGCONFIG_NAME");
+    if(name.isEmpty()) {
+        name = project->first("QMAKE_ORIG_TARGET").toLower();
+        name.replace(0, 1, name[0].toUpper());
+    }
+    t << "Name: " << name << endl;
+    QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
+    if(desc.isEmpty()) {
+        if(name.isEmpty()) {
+            desc = project->first("QMAKE_ORIG_TARGET").toLower();
+            desc.replace(0, 1, desc[0].toUpper());
+        } else {
+            desc = name;
+        }
+        if(project->first("TEMPLATE") == "lib") {
+            if(project->isActiveConfig("plugin"))
+               desc += " Plugin";
+            else
+               desc += " Library";
+        } else if(project->first("TEMPLATE") == "app") {
+            desc += " Application";
+        }
+    }
+    t << "Description: " << desc << endl;
+    t << "Version: " << project->first("VERSION") << endl;
+
+    // libs
+    t << "Libs: ";
+    QString pkgConfiglibDir;
+    QString pkgConfiglibName;
+    if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
+        pkgConfiglibDir = "-F${libdir}";
+        QString bundle;
+        if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+            bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
+        else
+            bundle = unescapeFilePath(project->first("TARGET"));
+        int suffix = bundle.lastIndexOf(".framework");
+        if (suffix != -1)
+            bundle = bundle.left(suffix);
+        pkgConfiglibName = "-framework " + bundle + " ";
+    } else {
+        pkgConfiglibDir = "-L${libdir}";
+        pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
+    }
+    t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
+
+    QStringList libs;
+    if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
+        libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
+    } else {
+        libs << "QMAKE_LIBS"; //obvious one
+    }
+    libs << "QMAKE_LIBS_PRIVATE";
+    libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+    t << "Libs.private: ";
+    for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
+        t << project->values((*it)).join(" ") << " ";
+    }
+    t << endl;
+
+    // flags
+    // ### too many
+    t << "Cflags: "
+        // << var("QMAKE_CXXFLAGS") << " "
+      << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+      << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
+      << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
+        //      << varGlue("DEFINES","-D"," -D"," ")
+      << " -I${includedir}" << endl;
+
+    // requires
+    const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
+    if (!requires.isEmpty()) {
+        t << "Requires: " << requires << endl;
+    }
+
+    t << endl;
+}
+
 QT_END_NAMESPACE
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index b674a44..9b5b4a3 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -105,6 +105,11 @@ protected:
     virtual bool writeStubMakefile(QTextStream &t);
     virtual bool writeMakefile(QTextStream &t);
 
+    QString pkgConfigPrefix() const;
+    QString pkgConfigFileName(bool fixify=true);
+    QString pkgConfigFixPath(QString) const;
+    void writePkgConfigFile();   // for pkg-config
+
     //generating subtarget makefiles
     struct SubTarget
     {
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index ad54833..b28da82 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -51,10 +51,6 @@ class UnixMakefileGenerator : public MakefileGenerator
     bool init_flag, include_deps;
     QString libtoolFileName(bool fixify=true);
     void writeLibtoolFile();     // for libtool
-    QString pkgConfigPrefix() const;
-    QString pkgConfigFileName(bool fixify=true);
-    QString pkgConfigFixPath(QString) const;
-    void writePkgConfigFile();   // for pkg-config
     void writePrlFile(QTextStream &);
 
 public:
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 81a379f..1846d56 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1332,182 +1332,4 @@ UnixMakefileGenerator::writeLibtoolFile()
         "libdir='" << Option::fixPathToTargetOS(install_dir, false) << "'\n";
 }
 
-QString
-UnixMakefileGenerator::pkgConfigFileName(bool fixify)
-{
-    QString ret = var("TARGET");
-    int slsh = ret.lastIndexOf(Option::dir_sep);
-    if(slsh != -1)
-        ret = ret.right(ret.length() - slsh - 1);
-    if(ret.startsWith("lib"))
-        ret = ret.mid(3);
-    int dot = ret.indexOf('.');
-    if(dot != -1)
-        ret = ret.left(dot);
-    ret += Option::pkgcfg_ext;
-    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
-    if(!subdir.isEmpty()) {
-        // initOutPaths() appends dir_sep, but just to be safe..
-        if (!subdir.endsWith(Option::dir_sep))
-            ret.prepend(Option::dir_sep);
-        ret.prepend(subdir);
-    }
-    if(fixify) {
-        if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
-            ret.prepend(project->first("DESTDIR"));
-        ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
-    }
-    return ret;
-}
-
-QString
-UnixMakefileGenerator::pkgConfigPrefix() const
-{
-    if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
-        return project->first("QMAKE_PKGCONFIG_PREFIX");
-    return QLibraryInfo::location(QLibraryInfo::PrefixPath);
-}
-
-QString
-UnixMakefileGenerator::pkgConfigFixPath(QString path) const
-{
-    QString prefix = pkgConfigPrefix();
-    if(path.startsWith(prefix))
-        path = path.replace(prefix, "${prefix}");
-    return path;
-}
-
-void
-UnixMakefileGenerator::writePkgConfigFile()
-{
-    QString fname = pkgConfigFileName(), lname = fname;
-    mkdir(fileInfo(fname).path());
-    int slsh = lname.lastIndexOf(Option::dir_sep);
-    if(slsh != -1)
-        lname = lname.right(lname.length() - slsh - 1);
-    QFile ft(fname);
-    if(!ft.open(QIODevice::WriteOnly))
-        return;
-    project->values("ALL_DEPS").append(fileFixify(fname));
-    QTextStream t(&ft);
-
-    QString prefix = pkgConfigPrefix();
-    QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
-    if(libDir.isEmpty())
-        libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
-    QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
-    if(includeDir.isEmpty())
-        includeDir = prefix + "/include";
-
-    t << "prefix=" << prefix << endl;
-    t << "exec_prefix=${prefix}\n"
-      << "libdir=" << pkgConfigFixPath(libDir) << "\n"
-      << "includedir=" << pkgConfigFixPath(includeDir) << endl;
-    // non-standard entry. Provides useful info normally only
-    // contained in the internal .qmake.cache file
-    t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
-
-    //extra PKGCONFIG variables
-    const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
-    for(int i = 0; i < pkgconfig_vars.size(); ++i) {
-        QString var = project->first(pkgconfig_vars.at(i) + ".name"),
-                val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
-        if(var.isEmpty())
-            continue;
-        if(val.isEmpty()) {
-            const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
-            for(int v = 0; v < var_vars.size(); ++v) {
-                const QStringList &vars = project->values(var_vars.at(v));
-                for(int var = 0; var < vars.size(); ++var) {
-                    if(!val.isEmpty())
-                        val += " ";
-                    val += pkgConfigFixPath(vars.at(var));
-                }
-            }
-        }
-        t << var << "=" << val << endl;
-    }
-
-    t << endl;
-
-    QString name = project->first("QMAKE_PKGCONFIG_NAME");
-    if(name.isEmpty()) {
-        name = project->first("QMAKE_ORIG_TARGET").toLower();
-        name.replace(0, 1, name[0].toUpper());
-    }
-    t << "Name: " << name << endl;
-    QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
-    if(desc.isEmpty()) {
-        if(name.isEmpty()) {
-            desc = project->first("QMAKE_ORIG_TARGET").toLower();
-            desc.replace(0, 1, desc[0].toUpper());
-        } else {
-            desc = name;
-        }
-        if(project->first("TEMPLATE") == "lib") {
-            if(project->isActiveConfig("plugin"))
-               desc += " Plugin";
-            else
-               desc += " Library";
-        } else if(project->first("TEMPLATE") == "app") {
-            desc += " Application";
-        }
-    }
-    t << "Description: " << desc << endl;
-    t << "Version: " << project->first("VERSION") << endl;
-
-    // libs
-    t << "Libs: ";
-    QString pkgConfiglibDir;
-    QString pkgConfiglibName;
-    if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
-        pkgConfiglibDir = "-F${libdir}";
-        QString bundle;
-        if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
-            bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
-        else
-            bundle = unescapeFilePath(project->first("TARGET"));
-        int suffix = bundle.lastIndexOf(".framework");
-        if (suffix != -1)
-            bundle = bundle.left(suffix);
-        pkgConfiglibName = "-framework " + bundle + " ";
-    } else {
-        pkgConfiglibDir = "-L${libdir}";
-        pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
-    }
-    t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
-
-    QStringList libs;
-    if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
-        libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
-    } else {
-        libs << "QMAKE_LIBS"; //obvious one
-    }
-    libs << "QMAKE_LIBS_PRIVATE";
-    libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
-    t << "Libs.private: ";
-    for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
-        t << project->values((*it)).join(" ") << " ";
-    }
-    t << endl;
-
-    // flags
-    // ### too many
-    t << "Cflags: "
-        // << var("QMAKE_CXXFLAGS") << " "
-      << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
-      << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
-      << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
-        //      << varGlue("DEFINES","-D"," -D"," ")
-      << " -I${includedir}" << endl;
-
-    // requires
-    const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
-    if (!requires.isEmpty()) {
-        t << "Requires: " << requires << endl;
-    }
-
-    t << endl;
-}
-
 QT_END_NAMESPACE
-- 
1.7.6


From e8afbb5a998931c154aa83ed87be6521cb8d50d3 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:56 +0100
Subject: [PATCH 04/17] qmake: write and install pkg-config files for mingw

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit f18aca79a233c71f7a4bc72c9e31de948ba43c31)
---
 qmake/generators/win32/mingw_make.cpp  |    3 +++
 qmake/generators/win32/winmakefile.cpp |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 3202cb8..492b584 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -142,6 +142,9 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
 
     if(project->first("TEMPLATE") == "app" ||
        project->first("TEMPLATE") == "lib") {
+        if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
+            writePkgConfigFile();
+
         if(Option::mkfile::do_stub_makefile) {
             t << "QMAKE    = " << var("QMAKE_QMAKE") << endl;
             QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 8af7ddd..6d0a5c4 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -803,6 +803,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
                 uninst.append("\n\t");
             uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
         }
+        if(project->isActiveConfig("create_pc")) {
+            QString dst_pc = pkgConfigFileName(false);
+            if (!dst_pc.isEmpty()) {
+                dst_pc = filePrefixRoot(root, targetdir + dst_pc);
+                if(!ret.isEmpty())
+                    ret += "\n\t";
+                ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\"";
+                if(!uninst.isEmpty())
+                    uninst.append("\n\t");
+                uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
+            }
+        }
         if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
             QString lib_target = getLibTarget();
             lib_target.remove('"');
-- 
1.7.6


From 175b395655d3f24aea0e4232069853dca1c33efd Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:57 +0100
Subject: [PATCH 05/17] qt project files: create pkg-config files for mingw

This is mostly the same as for unix.

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 45fe2dddc3a0677b9ec9fce09f07cd4129e37afa)
---
 src/3rdparty/webkit/WebCore/WebCore.pro            |    4 +---
 src/dbus/dbus.pro                                  |    2 +-
 src/declarative/declarative.pro                    |    2 +-
 src/gui/gui.pro                                    |    2 +-
 src/multimedia/multimedia.pro                      |    2 +-
 src/network/network.pro                            |    2 +-
 src/opengl/opengl.pro                              |    2 +-
 src/openvg/openvg.pro                              |    2 +-
 src/phonon/phonon.pro                              |    2 +-
 src/qbase.pri                                      |    8 ++++++++
 src/qt3support/qt3support.pro                      |    2 +-
 src/script/script.pro                              |    2 +-
 src/scripttools/scripttools.pro                    |    2 +-
 src/sql/sql.pro                                    |    2 +-
 src/svg/svg.pro                                    |    2 +-
 src/xml/xml.pro                                    |    2 +-
 src/xmlpatterns/xmlpatterns.pro                    |    2 +-
 .../lib/fulltextsearch/fulltextsearch.pro          |    2 +-
 tools/assistant/lib/lib.pro                        |    2 +-
 tools/designer/src/components/lib/lib.pro          |    2 +-
 tools/designer/src/lib/lib.pro                     |    2 +-
 tools/designer/src/uitools/uitools.pro             |    2 +-
 22 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index 37d216d..008bef7 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -85,9 +85,7 @@ moduleFile=$$PWD/../WebKit/qt/qt_webkit_version.pri
 isEmpty(QT_BUILD_TREE):include($$moduleFile)
 VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION}
 
-unix {
-    QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
-}
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
 
 unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections 
 unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 46a723a..52ed217 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -12,7 +12,7 @@ contains(QT_CONFIG, dbus-linked) {
 }
 
 # INCLUDEPATH += .
-unix { 
+unix|win32-g++* {
     QMAKE_PKGCONFIG_DESCRIPTION = Qt \
         DBus \
         module
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 1ad888b..4ed4f9f 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -6,7 +6,7 @@ DEFINES   += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 exists("qdeclarative_enable_gcov") {
     QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 4d51fa8..05d961c 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -7,7 +7,7 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
 
 !win32:!embedded:!mac:!symbian:CONFIG      += x11
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 852322d..e827cdd 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -4,7 +4,7 @@ QT = core gui
 
 DEFINES += QT_BUILD_MULTIMEDIA_LIB QT_NO_USING_NAMESPACE
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/network/network.pro b/src/network/network.pro
index 7ed7d3a..948922b 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -13,7 +13,7 @@ DEFINES += QT_BUILD_NETWORK_LIB QT_NO_USING_NAMESPACE
 QT = core
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 include(access/access.pri)
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 0e82467..d467148 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -7,7 +7,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index c05af90..e7ed890 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -42,7 +42,7 @@ symbian {
 
 include(../qbase.pri)
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 symbian:TARGET.UID3 = 0x2001E62F
 
 !isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
diff --git a/src/phonon/phonon.pro b/src/phonon/phonon.pro
index 7f79d0b..b16c5a1 100644
--- a/src/phonon/phonon.pro
+++ b/src/phonon/phonon.pro
@@ -11,7 +11,7 @@ DEFINES += MAKE_PHONON_LIB
 
 PHONON_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/phonon
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
 
 # Input
 HEADERS += $$PHONON_DIR/abstractaudiooutput.h \
diff --git a/src/qbase.pri b/src/qbase.pri
index babea56..a72bc76 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -152,6 +152,14 @@ unix:!symbian {
    QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
 }
 
+win32-g++* {
+   CONFIG += create_pc
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+}
+
 contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
 DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
 contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT
diff --git a/src/qt3support/qt3support.pro b/src/qt3support/qt3support.pro
index a30117c..1e0717d 100644
--- a/src/qt3support/qt3support.pro
+++ b/src/qt3support/qt3support.pro
@@ -21,7 +21,7 @@ include(canvas/canvas.pri)
 include(network/network.pri)
 include(painting/painting.pri)
 
-unix {
+unix|win32-g++* {
    QMAKE_PKGCONFIG_CFLAGS += -DQT3_SUPPORT
    QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork QtSql
 }
diff --git a/src/script/script.pro b/src/script/script.pro
index 63917b1..b5a2e70 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -7,7 +7,7 @@ DEFINES   += QT_NO_USING_NAMESPACE
 DEFINES   += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
 #win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000       ### FIXME
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro
index b1df7aa..061dea5 100644
--- a/src/scripttools/scripttools.pro
+++ b/src/scripttools/scripttools.pro
@@ -5,7 +5,7 @@ DEFINES   += QT_BUILD_SCRIPTTOOLS_LIB
 DEFINES   += QT_NO_USING_NAMESPACE
 #win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript
 
 include(../qbase.pri)
 
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index a02b0f4..81aa3c0 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -5,7 +5,7 @@ DEFINES += QT_BUILD_SQL_LIB
 DEFINES += QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/svg/svg.pro b/src/svg/svg.pro
index 7b5251a..79f284a 100644
--- a/src/svg/svg.pro
+++ b/src/svg/svg.pro
@@ -6,7 +6,7 @@ DEFINES   += QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/xml/xml.pro b/src/xml/xml.pro
index 8d1bf68..019153c 100644
--- a/src/xml/xml.pro
+++ b/src/xml/xml.pro
@@ -4,7 +4,7 @@ QT         = core
 DEFINES   += QT_BUILD_XML_LIB QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro
index e50d184..d22f417 100644
--- a/src/xmlpatterns/xmlpatterns.pro
+++ b/src/xmlpatterns/xmlpatterns.pro
@@ -5,7 +5,7 @@ QT = core \
 DEFINES += QT_BUILD_XMLPATTERNS_LIB \
     QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore \
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore \
     QtNetwork
 include(../qbase.pri)
 PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
index 4d2fddb..d0e7a87 100644
--- a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
+++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
@@ -23,7 +23,7 @@ contains(QT_CONFIG, reduce_exports) {
     linux*-g++*:DEFINES += _GLIBCXX_EXTERN_TEMPLATE=0
 }
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 # impossible to disable exceptions in clucene atm
 CONFIG(exceptions_off) {
diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro
index 26d3456..03821b2 100644
--- a/tools/assistant/lib/lib.pro
+++ b/tools/assistant/lib/lib.pro
@@ -19,7 +19,7 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
     win32:qclucene = $${qclucene}d
 }
 linux-lsb-g++:LIBS_PRIVATE += --lsb-shared-libs=$$qclucene
-unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
     QtSql \
     QtXml
 LIBS_PRIVATE += -l$$qclucene
diff --git a/tools/designer/src/components/lib/lib.pro b/tools/designer/src/components/lib/lib.pro
index 0ada845..50a8b00 100644
--- a/tools/designer/src/components/lib/lib.pro
+++ b/tools/designer/src/components/lib/lib.pro
@@ -64,7 +64,7 @@ PRECOMPILED_HEADER= lib_pch.h
 include(../../sharedcomponents.pri)
 include(../component.pri)
 
-unix {
+unix|win32-g++* {
     QMAKE_PKGCONFIG_REQUIRES = QtCore QtDesigner QtGui QtXml
     contains(QT_CONFIG, script): QMAKE_PKGCONFIG_REQUIRES += QtScript
 }
diff --git a/tools/designer/src/lib/lib.pro b/tools/designer/src/lib/lib.pro
index 495976d..3ba6f52 100644
--- a/tools/designer/src/lib/lib.pro
+++ b/tools/designer/src/lib/lib.pro
@@ -13,7 +13,7 @@ isEmpty(QT_MAJOR_VERSION) {
    VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
 }
 
-unix:QMAKE_PKGCONFIG_REQUIRES += QtXml
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtXml
 
 include(../../../../src/qt_targets.pri)
 QMAKE_TARGET_PRODUCT = Designer
diff --git a/tools/designer/src/uitools/uitools.pro b/tools/designer/src/uitools/uitools.pro
index 7b94587..6e0a247 100644
--- a/tools/designer/src/uitools/uitools.pro
+++ b/tools/designer/src/uitools/uitools.pro
@@ -35,7 +35,7 @@ INSTALLS        += quitools_headers
 target.path=$$[QT_INSTALL_LIBS]
 INSTALLS        += target
 
-unix {
+unix|win32-g++* {
    CONFIG     += create_pc
    QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
    QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
-- 
1.7.6


From 5ef7985e6015c09735094545a07ed93832075507 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 20:21:05 +0100
Subject: [PATCH 06/17] Fix static build on Windows with MinGW.

Q_DECL_IMPORT is still __declspec(dllimport), which is unsuitable for
static code.

Commit edbc656b changed Q_DECL_IMPORT_IMPORT to Q_CORE_EXPORT when
declaring QtCore functions in svg.

Now we change Q_DECL_IMPORT to Q_GUI_EXPORT when declaring QtGui
functions into opengl and openvg.

Also removed the redundant keyword "extern" from the function declarations.

Merge-request: 2540
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: mariusSO
(cherry picked from commit 7ec1c27e662dfd4393491f90bfcb9c868cc0a23f)
---
 .../gl2paintengineex/qpaintengineex_opengl2.cpp    |    4 ++--
 src/opengl/qglframebufferobject.cpp                |    4 ++--
 src/opengl/qglpixelbuffer.cpp                      |    4 ++--
 src/opengl/qglpixmapfilter.cpp                     |    6 +++---
 src/opengl/qpaintengine_opengl.cpp                 |    2 +-
 src/opengl/qpixmapdata_gl.cpp                      |    4 ++--
 src/openvg/qpaintengine_vg.cpp                     |    8 ++++----
 src/openvg/qpixmapdata_vg.cpp                      |    4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 251fcb9..34f4e75 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -102,7 +102,7 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
 extern bool qt_applefontsmoothing_enabled;
 #endif
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
+Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert);
 
 ////////////////////////////////// Private Methods //////////////////////////////////////////
 
@@ -1154,7 +1154,7 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
     d->fill(path);
 }
 
-extern Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
 
 
 void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 6faa645..d57ffc5 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1171,8 +1171,8 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint te
 }
 #endif
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 /*! \reimp */
 int QGLFramebufferObject::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 931f701..815afee 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -416,8 +416,8 @@ QPaintEngine *QGLPixelBuffer::paintEngine() const
 #endif
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 /*! \reimp */
 int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 5305e10..eeb791f 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -63,8 +63,8 @@
 QT_BEGIN_NAMESPACE
 
 // qpixmapfilter.cpp
-Q_DECL_IMPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
-Q_DECL_IMPORT QImage qt_halfScaled(const QImage &source);
+Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source);
 
 void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
 {
@@ -436,7 +436,7 @@ static inline uint nextMultiple(uint x, uint multiplier)
     return x + multiplier - mod;
 }
 
-Q_DECL_IMPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+Q_GUI_EXPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
                        quint32 *dest, int dstStride);
 
 bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 0b0f910..c04311d 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -79,7 +79,7 @@
 
 QT_BEGIN_NAMESPACE
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
+Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
 #ifdef QT_MAC_USE_COCOA
 extern void *qt_current_nsopengl_context(); // qgl_mac.mm
 #endif
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 0ac647c..d901ab8 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -739,8 +739,8 @@ QGLTexture* QGLPixmapData::texture() const
     return &m_texture;
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
 {
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index ec2936e..af077e4 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -77,8 +77,8 @@ static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
 
 #if !defined(QVG_NO_DRAW_GLYPHS)
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 class QVGPaintEnginePrivate;
 
@@ -526,7 +526,7 @@ void QVGPaintEnginePrivate::setTransform
     vgLoadMatrix(mat);
 }
 
-Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
 
 void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
 {
@@ -994,7 +994,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius,
     return vgpath;
 }
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int style, bool invert);
+Q_GUI_EXPORT QImage qt_imageForBrush(int style, bool invert);
 
 static QImage colorizeBitmap(const QImage &image, const QColor &color)
 {
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index ee5c7d9..cdff46c 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -412,8 +412,8 @@ void QVGPixmapData::reclaimImages()
     destroyImages();
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
 {
-- 
1.7.6


From 3411ae8c3d83b3eb9407c8c338336e95fe74edf3 Mon Sep 17 00:00:00 2001
From: Bernhard Rosenkraenzer <br@blankpage.ch>
Date: Thu, 27 Jan 2011 13:48:13 +0100
Subject: [PATCH 07/17] Allow the user to select imageformats to be built as
 plugin vs internal

This adds what is already there for different plugin types to
imageformats plugins -- allowing the user to configure which
image formats will be built into Qt and which will be built as
plugins.

Merge-request: 1028
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit a6167267d302b97b94fd350df4b27dc7c9a20ef4)
---
 configure                        |   24 +++++++++++++++++++++++-
 tools/configure/configureapp.cpp |   12 ++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index c159cd4..207dcc1 100755
--- a/configure
+++ b/configure
@@ -908,6 +908,16 @@ if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
   CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
 fi
 
+CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
+if [ -d "$relpath/src/plugins/imageformats" ]; then
+    for a in "$relpath/src/plugins/imageformats/"*; do
+        if [ -d "$a" ]; then
+            base_a=`basename "$a"`
+            CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
+        fi
+    done
+fi
+
 #-------------------------------------------------------------------------------
 # parse command line arguments
 #-------------------------------------------------------------------------------
@@ -2060,7 +2070,7 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
-    sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
+    sql-*|gfx-*|decoration-*|kbd-*|mouse-*|imageformat-*)
         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
         # if autoconf style options were used, $VAL can be "yes" or "no"
         [ "$VAL" = "yes" ] && VAL=qt
@@ -2102,6 +2112,13 @@ while [ "$#" -gt 0 ]; do
 		avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
 	    fi
             ;;
+        imageformat)
+            avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
+            if [ "$OPT" != "plugin" ]; then
+                # png is always built in
+                avail="$avail png"
+            fi
+            ;;
         *)
             avail=""
             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
@@ -2122,6 +2139,11 @@ while [ "$#" -gt 0 ]; do
             # set the CFG_SQL_driver
             eval "CFG_SQL_$VAL=\$OPT"
             continue
+        elif [ "$VAR" = "imageformat" ]; then
+            [ "$OPT" = "qt" ] && OPT=yes
+            VAL="`echo $VAL |tr a-z A-Z`"
+            eval "CFG_$VAL=$OPT"
+            continue
         fi
 
         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index dd5647b..b6e80ea 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -437,6 +437,7 @@ void Configure::parseCmdLine()
 {
     int argCount = configCmdLine.size();
     int i = 0;
+    const QStringList imageFormats = QStringList() << "gif" << "png" << "mng" << "jpeg" << "tiff";
 
 #if !defined(EVAL)
     if (argCount < 1) // skip rest if no arguments
@@ -829,6 +830,17 @@ void Configure::parseCmdLine()
             dictionary[ "SQL_IBASE" ] = "plugin";
         else if (configCmdLine.at(i) == "-no-sql-ibase")
             dictionary[ "SQL_IBASE" ] = "no";
+
+        // Image formats --------------------------------------------
+        else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
+        else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
+        else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
 #endif
         // IDE project generation -----------------------------------
         else if (configCmdLine.at(i) == "-no-dsp")
-- 
1.7.6


From 8d719e67c51987fb6439ea1d05a2b10684b974e1 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 16 Nov 2010 20:06:28 +0100
Subject: [PATCH 08/17] explicitly include -llcms for -lmng (mingw-cross-env
 specific)

---
 src/gui/image/qmnghandler.pri |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri
index ffb98de..c213e09 100644
--- a/src/gui/image/qmnghandler.pri
+++ b/src/gui/image/qmnghandler.pri
@@ -3,7 +3,7 @@ INCLUDEPATH *= $$PWD
 HEADERS += $$PWD/qmnghandler_p.h
 SOURCES += $$PWD/qmnghandler.cpp
 contains(QT_CONFIG, system-mng) {
-        if(unix|win32-g++*):LIBS += -lmng
+        if(unix|win32-g++*):LIBS += -lmng -llcms
         else:win32:         LIBS += libmng.lib
 } else {
     include($$PWD/../../3rdparty/libmng.pri)
-- 
1.7.6


From c34bd635af9263d1a719cd270db123b1a787640c Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 5 Jun 2010 23:41:04 +0200
Subject: [PATCH 09/17] added missing INSTALLS to JavaScriptCore.pro for
 static libjscore (mingw-cross-env specific)

For static build of Qt on win32-g++*, applications using webkit
link to libjscore.a.
---
 .../webkit/JavaScriptCore/JavaScriptCore.pro       |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
index a805170..027eb0f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
@@ -14,6 +14,12 @@ QT -= gui
 
 CONFIG += depend_includepath
 
+static:win32-g++* {
+    # applications must link to static libjscore
+    target.path = $$[QT_INSTALL_LIBS]
+    INSTALLS += target
+}
+
 contains(QT_CONFIG, embedded):CONFIG += embedded
 
 CONFIG(QTDIR_build) {
-- 
1.7.6


From c56ec08a3e3af1a9beae552872b443c6a7cf401c Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 9 Nov 2010 20:09:45 +0100
Subject: [PATCH 10/17] Partially restored support for static linking of
 QtWebKit (mingw-cross-env specific)

Support was removed by 4221d629e2cf37ee8c5ba7cb595b05ab8c82f113.
Static QtWebkit might be supported by mingw-cross-env.
---
 configure |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 207dcc1..b10b0a2 100755
--- a/configure
+++ b/configure
@@ -7179,12 +7179,6 @@ if [ "$CFG_GUI" = "no" ]; then
     canBuildWebKit="no"
 fi
 
-if [ "$CFG_SHARED" = "no" ]; then
-    echo
-    echo "WARNING: Using static linking will disable the WebKit module."
-    echo
-    canBuildWebKit="no"
-fi
 
 CFG_CONCURRENT="yes"
 if [ "$canBuildQtConcurrent" = "no" ]; then
-- 
1.7.6


From 074e13614d6071247600eea3c3d6a1f4c4f4a0d5 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 6 Jan 2011 14:21:32 +0100
Subject: [PATCH 11/17] pkg-config file for jscore (mingw-cross-env specific)

---
 .../webkit/JavaScriptCore/JavaScriptCore.pro       |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
index 027eb0f..44bbc3f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
@@ -236,3 +236,11 @@ SOURCES += \
 
 # Disable C++0x mode in JSC for those who enabled it in their Qt's mkspec
 *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
+
+win32-g++-* {
+   CONFIG += create_pc
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+}
-- 
1.7.6


From c907c7c1f0922416fd5f19cb477b71c6f97fee45 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Mon, 21 Feb 2011 22:22:04 +0100
Subject: [PATCH 12/17] workaround for native build on OSX (mingw-cross-env
 specific)

The native build complains about:
"You are building a 64-bit application, but using a 32-bit version of
Qt. Check your build configuration."
---
 mkspecs/macx-g++/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf
index 4464686..ba0c45b 100644
--- a/mkspecs/macx-g++/qmake.conf
+++ b/mkspecs/macx-g++/qmake.conf
@@ -13,8 +13,8 @@ CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib
 QT			+= core gui
 QMAKE_INCREMENTAL_STYLE = sublib
 
-QMAKE_CC		 = gcc
-QMAKE_CXX		 = g++
+QMAKE_CC		 = gcc -arch i386
+QMAKE_CXX		 = g++ -arch i386
 
 include(../common/mac-g++.conf)
 
-- 
1.7.6


From ac552171a0729e1fae026741e4ec89a415298667 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Mon, 10 Jan 2011 20:09:24 +0100
Subject: [PATCH 13/17] fix -enable-stdcall-fixup usage

the leading "-Wl," was apparently accidentally split off to the wrong
line.

Task-number: QTBUG-15391
Reviewed-by: mariusSO
(cherry picked from commit 0953ee31dba532603fb7dfbde78c99aafb048bef)
---
 mkspecs/win32-g++/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index ec216aa..2d9833b 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -52,8 +52,8 @@ QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
 QMAKE_LINK		= g++
 QMAKE_LINK_C		= gcc
-QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
-QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+QMAKE_LFLAGS		= -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
 QMAKE_LFLAGS_RELEASE	= -Wl,-s
 QMAKE_LFLAGS_DEBUG	=
-- 
1.7.6


From 0e32298cb08ef1168dc6c06dd48bab8ee62c6e5d Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 28 Mar 2011 13:33:58 +0200
Subject: [PATCH 14/17] fix -enable-stdcall-fixup usage

the leading "-Wl," was apparently accidentally split off to the wrong
line.

Originally done in 0953ee3 for mkspecs/win32-g++.

Merge-request: 1154
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 1dac22d30849f0dfb38f281c59afc886b1046bb3)
---
 mkspecs/unsupported/win32-g++-cross/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/unsupported/win32-g++-cross/qmake.conf b/mkspecs/unsupported/win32-g++-cross/qmake.conf
index 7e077a1..efc3de2 100644
--- a/mkspecs/unsupported/win32-g++-cross/qmake.conf
+++ b/mkspecs/unsupported/win32-g++-cross/qmake.conf
@@ -52,8 +52,8 @@ QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
 QMAKE_LINK		= i686-pc-mingw32-g++
 QMAKE_LINK_C		= i686-pc-mingw32-gcc
-QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
-QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+QMAKE_LFLAGS		= -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
 QMAKE_LFLAGS_RELEASE	= -Wl,-s
 QMAKE_LFLAGS_DEBUG	=
-- 
1.7.6


From 0a9731cad65337c7084791b54db8bfeb0939dc7d Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Mon, 4 Apr 2011 13:01:48 +0200
Subject: [PATCH 15/17] win32-g++: Correct the order of linked Windows
 libraries

On Windows 7, kernel32.dll exports many of the same functions as
advapi32.dll. If executables link to these functions in kernel32.dll
instead of advapi32.dll, running these executables on older versions
of Windows will cause an entry point error. This would occur due to
kernel32 being specified before advapi32.

To resolve this issue, advapi32 is specified before kernel32 when
linking.

Task-number: QTBUG-18537
Merge-request: 1169
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit a6d48ca57403539ab8e00d16f80bd4cd334e1b5c)
---
 mkspecs/win32-g++/qmake.conf |    2 +-
 qmake/Makefile.win32-g++     |    2 +-
 qmake/Makefile.win32-g++-sh  |    2 +-
 qmake/qmake.pri              |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index 2d9833b..bf69999 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -65,7 +65,7 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
 
 
 QMAKE_LIBS		=
-QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
+QMAKE_LIBS_CORE         = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
 QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
 QMAKE_LIBS_NETWORK      = -lws2_32
 QMAKE_LIBS_OPENGL       = -lglu32 -lopengl32 -lgdi32 -luser32
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index 29fbd0a..5a46e41 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -28,7 +28,7 @@ CFLAGS	    =	-c -o$@ -O \
 		-DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT
 CXXFLAGS    =   $(CFLAGS)
 LFLAGS	    = -static-libgcc -static-libstdc++ -s
-LIBS	    = -lole32 -luuid
+LIBS	    = -lole32 -luuid -ladvapi32 -lkernel32
 LINKQMAKE   =	g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS)
 ADDCLEAN    =
 
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index 9c7942c..6ca7514 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -28,7 +28,7 @@ CFLAGS	    =	-c -o$@ -O \
 		-DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT
 CXXFLAGS    =   $(CFLAGS)
 LFLAGS	    = -static-libgcc -static-libstdc++ -s
-LIBS	    = -lole32 -luuid
+LIBS	    = -lole32 -luuid -ladvapi32 -lkernel32
 LINKQMAKE   =	g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS)
 ADDCLEAN    =
 
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 8f46a2e..3a0ab12 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -135,7 +135,7 @@ bootstrap { #Qt code
 	SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp \
             qsystemlibrary.cpp
         win32-msvc*:LIBS += ole32.lib advapi32.lib
-        win32-g++*:LIBS += -lole32 -luuid
+        win32-g++*:LIBS += -lole32 -luuid -ladvapi32 -lkernel32
     }
 
     qnx {
-- 
1.7.6


From c4a1848f4178fe99daa2c12ad1f14e8de14cc389 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 5 Apr 2011 10:35:58 +0200
Subject: [PATCH 16/17] win32-g++: Correct the order of linked Windows
 libraries

Commit a6d48ca corrected the problem for win32-g++. Here we do the same
for win32-g++-cross.

Merge-request: 1173
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 63ea4ba0ceb8f625da48ddbe31f96b2148f62146)
---
 mkspecs/unsupported/win32-g++-cross/qmake.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mkspecs/unsupported/win32-g++-cross/qmake.conf b/mkspecs/unsupported/win32-g++-cross/qmake.conf
index efc3de2..6eed244 100644
--- a/mkspecs/unsupported/win32-g++-cross/qmake.conf
+++ b/mkspecs/unsupported/win32-g++-cross/qmake.conf
@@ -65,7 +65,7 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
 
 
 QMAKE_LIBS		=
-QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
+QMAKE_LIBS_CORE         = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
 QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
 QMAKE_LIBS_NETWORK      = -lws2_32
 QMAKE_LIBS_OPENGL       = -lglu32 -lopengl32 -lgdi32 -luser32
-- 
1.7.6


From 31cbd33f7f47bbfe52de9b27a6020e87f309d2be Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 28 Jun 2011 23:02:29 +0200
Subject: [PATCH 17/17] link static text codec plugins (mingw-cross-env
 specific)

Static QtCore for Windows introduces dependencies on the text codec plugins.
Without this patch, users would have to handle these dependencies explicitly
when building any Qt application.
---
 src/corelib/corelib.pro                   |    1 +
 src/plugins/codecs/staticcodecplugins.cpp |    5 +++++
 src/plugins/codecs/staticcodecplugins.pri |    2 ++
 3 files changed, 8 insertions(+), 0 deletions(-)
 create mode 100644 src/plugins/codecs/staticcodecplugins.cpp
 create mode 100644 src/plugins/codecs/staticcodecplugins.pri

diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 06aa191..21a8316 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -40,3 +40,4 @@ symbian: {
                   "$${LITERAL_HASH}endif"
     MMP_RULES += pagingBlock
 }
+win32:static:include(../plugins/codecs/staticcodecplugins.pri)
diff --git a/src/plugins/codecs/staticcodecplugins.cpp b/src/plugins/codecs/staticcodecplugins.cpp
new file mode 100644
index 0000000..47f5bf3
--- /dev/null
+++ b/src/plugins/codecs/staticcodecplugins.cpp
@@ -0,0 +1,5 @@
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(qcncodecs)
+Q_IMPORT_PLUGIN(qjpcodecs)
+Q_IMPORT_PLUGIN(qtwcodecs)
+Q_IMPORT_PLUGIN(qkrcodecs)
diff --git a/src/plugins/codecs/staticcodecplugins.pri b/src/plugins/codecs/staticcodecplugins.pri
new file mode 100644
index 0000000..a579487
--- /dev/null
+++ b/src/plugins/codecs/staticcodecplugins.pri
@@ -0,0 +1,2 @@
+QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs
+SOURCES += $$PWD/staticcodecplugins.cpp
-- 
1.7.6