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
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
|
#!/usr/bin/env bash
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
##### Args and Help Handling #####
# Parse command line!
ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,threads:,help,with-all,with-opencollada,all-static,force-all,\
force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
force-ffmpeg,skip-python,skip-numpy,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,\
skip-opencollada,required-numpy \
-- "$@" \
)
DISTRO=""
RPM=""
SRC="$HOME/src/blender-deps"
INST="/opt/lib"
TMP="/tmp"
CWD=$PWD
# Do not install some optional, potentially conflicting libs by default...
WITH_ALL=false
# Do not yet enable opencollada, use --with-opencollada (or --with-all) option to try it.
WITH_OPENCOLLADA=false
# Try to link everything statically. Use this to produce portable versions of blender.
ALL_STATIC=false
THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
if [ -z "$THREADS" ]; then
THREADS=1
fi
COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
Built libs of dependencies needed to be compiled will be installed into '\$INST'.
Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
or use --source/--install options, if you want to use other paths!
Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
Full install: \$WITH_ALL (use --with-all option to enable it).
Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
All static linking: \$ALL_STATIC (use --all-static option to enable it).
WARNING: Static build works fine with CMake, but with scons it may be tricky to get a valid Blender build!
Example:
Full install without OpenCOLLADA: --with-all --skip-opencollada
Use --help to show all available options!\""
ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
-h, --help
Show this message and exit.
-s <path>, --source=<path>
Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
-i <path>, --install=<path>
Use a specific path where to install built libraries (defaults to '\$INST').
--tmp=<path>
Use a specific temp path (defaults to '\$TMP').
-t n, --threads=n
Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
--with-all
By default, a number of optional and not-so-often needed libraries are not installed.
This option will try to install them, at the cost of potential conflicts (depending on
how your package system is set…).
Note this option also implies all other (more specific) --with-foo options below.
--with-opencollada
Build and install the OpenCOLLADA libraries.
--all-static
Build libraries as statically as possible, to create static builds of Blender.
--force-all
Force the rebuild of all built libraries.
--force-python
Force the rebuild of Python.
--force-numpy
Force the rebuild of NumPy.
--force-boost
Force the rebuild of Boost.
--force-ocio
Force the rebuild of OpenColorIO.
--force-openexr
Force the rebuild of OpenEXR.
--force-oiio
Force the rebuild of OpenImageIO.
--force-llvm
Force the rebuild of LLVM.
--force-osl
Force the rebuild of OpenShadingLanguage.
--force-opencollada
Force the rebuild of OpenCOLLADA.
--force-ffmpeg
Force the rebuild of FFMpeg.
Note about the --force-foo options:
* They obviously only have an effect if those libraries are built by this script
(i.e. if there is no available and satisfactory package)!
* If the “force-rebuilt” library is a dependency of others, it will force the rebuild
of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
* Do not forget --with-osl if you built it and still want it!
--skip-python
Unconditionally skip Python installation/building.
--skip-numpy
Unconditionally skip NumPy installation/building.
--skip-boost
Unconditionally skip Boost installation/building.
--skip-ocio
Unconditionally skip OpenColorIO installation/building.
--skip-openexr
Unconditionally skip OpenEXR installation/building.
--skip-oiio
Unconditionally skip OpenImageIO installation/building.
--skip-llvm
Unconditionally skip LLVM installation/building.
--skip-osl
Unconditionally skip OpenShadingLanguage installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
--skip-ffmpeg
Unconditionally skip FFMpeg installation/building.
--required-numpy
Use this in case your distro features a valid python package, but no matching Numpy one.
It will force compilation of both python 3.3 and numpy 1.7.\""
##### Main Vars #####
PYTHON_VERSION="3.3.2"
PYTHON_VERSION_MIN="3.3"
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false
NUMPY_VERSION="1.7.0"
NUMPY_VERSION_MIN="1.7"
NUMPY_SOURCE="http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz"
NUMPY_FORCE_REBUILD=false
NUMPY_SKIP=false
NUMPY_REQUIRED=false
BOOST_VERSION="1.51.0"
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
BOOST_VERSION_MIN="1.49"
BOOST_FORCE_REBUILD=false
BOOST_SKIP=false
OCIO_VERSION="1.0.7"
OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
OCIO_VERSION_MIN="1.0"
OCIO_FORCE_REBUILD=false
OCIO_SKIP=false
OPENEXR_VERSION="2.1.0"
OPENEXR_VERSION_MIN="2.0.1"
#OPENEXR_SOURCE="http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz"
OPENEXR_SOURCE="https://github.com/mont29/openexr.git"
OPENEXR_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
ILMBASE_VERSION="2.1.0"
ILMBASE_SOURCE="http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz"
OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="1.3.9"
OIIO_VERSION_MIN="1.3.9"
#OIIO_SOURCE="https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz"
OIIO_SOURCE="https://github.com/mont29/oiio.git"
OIIO_REPO_UID="99113d12619c90cf44721195a759674ea61f02b1"
OIIO_FORCE_REBUILD=false
OIIO_SKIP=false
LLVM_VERSION="3.1"
LLVM_VERSION_MIN="3.0"
LLVM_VERSION_FOUND=""
LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
OSL_VERSION="1.4.0"
OSL_VERSION_MIN=$OSL_VERSION
#OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz"
OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage.git"
OSL_REPO_UID="175989f2610a7d54e8edfb5ace0143e28e11ac70"
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_SOURCE="https://github.com/KhronosGroup/OpenCOLLADA.git"
OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8"
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
FFMPEG_VERSION="1.0"
FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
FFMPEG_VERSION_MIN="0.7.6"
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
# FFMPEG optional libs.
VORBIS_USE=false
VORBIS_DEV=""
OGG_USE=false
OGG_DEV=""
THEORA_USE=false
THEORA_DEV=""
XVID_USE=false
XVID_DEV=""
X264_USE=false
X264_DEV=""
X264_VERSION_MIN=0.118
VPX_USE=false
VPX_VERSION_MIN=0.9.7
VPX_DEV=""
MP3LAME_USE=false
MP3LAME_DEV=""
OPENJPEG_USE=false
OPENJPEG_DEV=""
# Switch to english language, else some things (like check_package_DEB()) won't work!
LANG_BACK=$LANG
LANG=""
export LANG
##### Generic Helpers #####
_echo() {
if [ "X$1" = "X-n" ]; then
shift; printf "%s" "$@"
else
printf "%s\n" "$@"
fi
}
ERROR() {
_echo "$@"
}
INFO() {
_echo "$@"
}
##### Args Handling #####
# Finish parsing the commandline args.
eval set -- "$ARGS"
while true; do
case $1 in
-s|--source)
SRC="$2"; shift; shift; continue
;;
-i|--install)
INST="$2"; shift; shift; continue
;;
--tmp)
TMP="$2"; shift; shift; continue
;;
-t|--threads)
THREADS="$2"; shift; shift; continue
;;
-h|--help)
INFO ""
INFO "USAGE:"
INFO ""
INFO "`eval _echo "$COMMON_INFO"`"
INFO ""
INFO "`eval _echo "$ARGUMENTS_INFO"`"
INFO ""
exit 0
;;
--with-all)
WITH_ALL=true; shift; continue
;;
--with-opencollada)
WITH_OPENCOLLADA=true; shift; continue
;;
--all-static)
ALL_STATIC=true; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
BOOST_FORCE_REBUILD=true
OCIO_FORCE_REBUILD=true
OIIO_FORCE_REBUILD=true
LLVM_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
shift; continue
;;
--force-python)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
shift; continue
;;
--force-numpy)
NUMPY_FORCE_REBUILD=true; shift; continue
;;
--force-boost)
BOOST_FORCE_REBUILD=true; shift; continue
;;
--force-ocio)
OCIO_FORCE_REBUILD=true; shift; continue
;;
--force-openexr)
OPENEXR_FORCE_REBUILD=true; shift; continue
;;
--force-oiio)
OIIO_FORCE_REBUILD=true
shift; continue
;;
--force-llvm)
LLVM_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
shift; continue
;;
--force-osl)
OSL_FORCE_REBUILD=true; shift; continue
;;
--force-opencollada)
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
;;
--force-ffmpeg)
FFMPEG_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
--skip-numpy)
NUMPY_SKIP=true; shift; continue
;;
--skip-boost)
BOOST_SKIP=true; shift; continue
;;
--skip-ocio)
OCIO_SKIP=true; shift; continue
;;
--skip-openexr)
OPENEXR_SKIP=true; shift; continue
;;
--skip-oiio)
OIIO_SKIP=true; shift; continue
;;
--skip-llvm)
LLVM_SKIP=true; shift; continue
;;
--skip-osl)
OSL_SKIP=true; shift; continue
;;
--skip-opencollada)
OPENCOLLADA_SKIP=true; shift; continue
;;
--skip-ffmpeg)
FFMPEG_SKIP=true; shift; continue
;;
--required-numpy)
NUMPY_REQUIRED=true; shift; continue
;;
--)
# no more arguments to parse
break
;;
*)
INFO ""
INFO "Wrong parameter! Usage:"
INFO ""
INFO "`eval _echo "$COMMON_INFO"`"
INFO ""
exit 1
;;
esac
done
if $WITH_ALL; then
WITH_OPENCOLLADA=true
fi
##### Generic Helpers #####
# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
# $1 and $2 should be version numbers made of numbers only.
version_eq() {
backIFS=$IFS
IFS='.'
# Split both version numbers into their numeric elements.
arr1=( $1 )
arr2=( $2 )
ret=1
count1=${#arr1[@]}
count2=${#arr2[@]}
if [ $count2 -ge $count1 ]; then
_t=$count1
count1=$count2
count2=$_t
arr1=( $2 )
arr2=( $1 )
fi
ret=0
for (( i=0; $i < $count2; i++ ))
do
if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
ret=1
break
fi
done
for (( i=$count2; $i < $count1; i++ ))
do
if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
ret=1
break
fi
done
IFS=$backIFS
return $ret
}
# Return 0 if $1 >= $2, else 1.
# $1 and $2 should be version numbers made of numbers only.
version_ge() {
version_eq $1 $2
if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
return 1
else
return 0
fi
}
# Return 0 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5), else 1.
# $1 and $2 should be version numbers made of numbers only.
# $1 should be at least as long as $2!
version_match() {
backIFS=$IFS
IFS='.'
# Split both version numbers into their numeric elements.
arr1=( $1 )
arr2=( $2 )
ret=1
count1=${#arr1[@]}
count2=${#arr2[@]}
if [ $count1 -ge $count2 ]; then
ret=0
for (( i=0; $i < $count2; i++ ))
do
if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
ret=1
break
fi
done
fi
IFS=$backIFS
return $ret
}
##### Generic compile helpers #####
prepare_opt() {
INFO "Ensuring $INST exists and is writable by us"
if [ ! -d $INST ]; then
sudo mkdir -p $INST
fi
if [ ! -w $INST ]; then
sudo chown $USER $INST
sudo chmod 775 $INST
fi
}
# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
magic_compile_check() {
if [ -f $INST/.$1-magiccheck-$2 ]; then
return 0
else
return 1
fi
}
magic_compile_set() {
rm -f $INST/.$1-magiccheck-*
touch $INST/.$1-magiccheck-$2
}
# Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
_clean() {
rm -rf `readlink -f $_inst_shortcut`
rm -rf $_src
rm -rf $_inst
rm -rf $_inst_shortcut
}
_create_inst_shortcut() {
rm -f $_inst_shortcut
ln -s $_inst $_inst_shortcut
}
# ldconfig
run_ldconfig() {
_lib_path="$INST/$1/lib"
_ldconf_path="/etc/ld.so.conf.d/$1.conf"
INFO ""
INFO "Running ldconfig for $1..."
sudo sh -c "echo \"$_lib_path\" > $_ldconf_path"
sudo /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!!
INFO ""
}
#### Build Python ####
_init_python() {
_src=$SRC/Python-$PYTHON_VERSION
_inst=$INST/python-$PYTHON_VERSION
_inst_shortcut=$INST/python-3.3
}
clean_Python() {
clean_Numpy
_init_python
_clean
}
compile_Python() {
# To be changed each time we make edits that would modify the compiled result!
py_magic=1
_init_python
# Clean install if needed!
magic_compile_check python-$PYTHON_VERSION $py_magic
if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
clean_Python
fi
if [ ! -d $_inst ]; then
INFO "Building Python-$PYTHON_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
wget -c $PYTHON_SOURCE -O $_src.tar.bz2
INFO "Unpacking Python-$PYTHON_VERSION"
tar -C $SRC -xf $_src.tar.bz2
fi
cd $_src
./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \
--enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
--with-computed-gotos --with-pymalloc
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set python-$PYTHON_VERSION $py_magic
cd $CWD
INFO "Done compiling Python-$PYTHON_VERSION!"
else
INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-python option."
fi
}
##### Build Numpy #####
_init_numpy() {
_src=$SRC/numpy-$NUMPY_VERSION
_inst=$INST/numpy-$NUMPY_VERSION
_python=$INST/python-$PYTHON_VERSION
_site=lib/python3.3/site-packages
_inst_shortcut=$_python/$_site/numpy
}
clean_Numpy() {
_init_numpy
_clean
}
compile_Numpy() {
# To be changed each time we make edits that would modify the compiled result!
numpy_magic=0
_init_numpy
# Clean install if needed!
magic_compile_check numpy-$NUMPY_VERSION $numpy_magic
if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
clean_Numpy
fi
if [ ! -d $_inst ]; then
INFO "Building Numpy-$NUMPY_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
wget -c $NUMPY_SOURCE -O $_src.tar.gz
INFO "Unpacking Numpy-$NUMPY_VERSION"
tar -C $SRC -xf $_src.tar.gz
fi
cd $_src
$_python/bin/python3 setup.py install --prefix=$_inst
if [ -d $_inst ]; then
# Can't use _create_inst_shortcut here...
rm -f $_inst_shortcut
ln -s $_inst/$_site/numpy $_inst_shortcut
else
ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set numpy-$NUMPY_VERSION $numpy_magic
cd $CWD
INFO "Done compiling Numpy-$NUMPY_VERSION!"
else
INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-numpy option."
fi
}
#### Build Boost ####
_init_boost() {
_src=$SRC/boost-$BOOST_VERSION
_inst=$INST/boost-$BOOST_VERSION
_inst_shortcut=$INST/boost
}
clean_Boost() {
_init_boost
_clean
}
compile_Boost() {
# To be changed each time we make edits that would modify the compiled result!
boost_magic=7
_init_boost
# Clean install if needed!
magic_compile_check boost-$BOOST_VERSION $boost_magic
if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
clean_Boost
fi
if [ ! -d $_inst ]; then
INFO "Building Boost-$BOOST_VERSION"
# Rebuild dependecies as well!
OIIO_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
prepare_opt
if [ ! -d $_src ]; then
INFO "Downloading Boost-$BOOST_VERSION"
mkdir -p $SRC
wget -c $BOOST_SOURCE -O $_src.tar.bz2
tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
fi
cd $_src
if [ ! -f $_src/b2 ]; then
./bootstrap.sh
fi
./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
--prefix=$_inst --disable-icu boost.locale.icu=off install
./b2 --clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set boost-$BOOST_VERSION $boost_magic
cd $CWD
INFO "Done compiling Boost-$BOOST_VERSION!"
else
INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi
# Just always run it, much simpler this way!
run_ldconfig "boost"
}
#### Build OCIO ####
_init_ocio() {
_src=$SRC/OpenColorIO-$OCIO_VERSION
_inst=$INST/ocio-$OCIO_VERSION
_inst_shortcut=$INST/ocio
}
clean_OCIO() {
_init_ocio
_clean
}
compile_OCIO() {
# To be changed each time we make edits that would modify the compiled result!
ocio_magic=1
_init_ocio
# Clean install if needed!
magic_compile_check ocio-$OCIO_VERSION $ocio_magic
if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
clean_OCIO
fi
if [ ! -d $_inst ]; then
INFO "Building OpenColorIO-$OCIO_VERSION"
prepare_opt
if [ ! -d $_src ]; then
INFO "Downloading OpenColorIO-$OCIO_VERSION"
mkdir -p $SRC
wget -c $OCIO_SOURCE -O $_src.tar.gz
INFO "Unpacking OpenColorIO-$OCIO_VERSION"
tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
-xf $_src.tar.gz
fi
cd $_src
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
cflags="-fPIC"
fi
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_PREFIX_PATH=$_inst \
-D CMAKE_INSTALL_PREFIX=$_inst \
-D CMAKE_CXX_FLAGS="$cflags" \
-D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
-D OCIO_BUILD_APPS=OFF \
-D OCIO_BUILD_PYGLUE=OFF \
..
make -j$THREADS && make install
# Force linking against static libs
rm -f $_inst/lib/*.so*
# Additional depencencies
cp ext/dist/lib/libtinyxml.a $_inst/lib
cp ext/dist/lib/libyaml-cpp.a $_inst/lib
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set ocio-$OCIO_VERSION $ocio_magic
cd $CWD
INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
else
INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi
}
#### Build ILMBase ####
_init_ilmbase() {
_src=$SRC/ILMBase-$ILMBASE_VERSION
_inst=$TMP/ilmbase-$ILMBASE_VERSION
_inst_shortcut=$TMP/ilmbase
}
clean_ILMBASE() {
_init_ilmbase
_clean
}
compile_ILMBASE() {
# To be changed each time we make edits that would modify the compiled result!
ilmbase_magic=8
_init_ilmbase
# Clean install if needed!
magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
clean_ILMBASE
rm -rf $_openexr_inst
fi
if [ ! -d $_openexr_inst ]; then
INFO "Building ILMBase-$ILMBASE_VERSION"
# Rebuild dependecies as well!
OPENEXR_FORCE_REBUILD=true
prepare_opt
if [ ! -d $_src ]; then
INFO "Downloading ILMBase-$ILMBASE_VERSION"
mkdir -p $SRC
wget -c $ILMBASE_SOURCE -O $_src.tar.gz
INFO "Unpacking ILMBase-$ILMBASE_VERSION"
tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" \
-xf $_src.tar.gz
fi
cd $_src
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
if [ $ALL_STATIC == true ]; then
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=OFF"
fi
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
cflags="-fPIC"
fi
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
exit 1
fi
cd $CWD
INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
else
INFO "Own ILMBase-$ILMBASE_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib (and openexr), use the --force-openexr option."
fi
magic_compile_set ilmbase-$ILMBASE_VERSION $ilmbase_magic
}
#### Build OpenEXR ####
_init_openexr() {
_src=$SRC/OpenEXR-$OPENEXR_VERSION
_inst=$_openexr_inst
_inst_shortcut=$INST/openexr
}
clean_OPENEXR() {
clean_ILMBASE
_init_openexr
_clean
}
compile_OPENEXR() {
# To be changed each time we make edits that would modify the compiled result!
openexr_magic=12
# Clean install if needed!
magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
clean_OPENEXR
fi
_openexr_inst=$INST/openexr-$OPENEXR_VERSION
compile_ILMBASE
_ilmbase_inst=$_inst_shortcut
_init_openexr
if [ ! -d $_inst ]; then
INFO "Building OpenEXR-$OPENEXR_VERSION"
# Rebuild dependecies as well!
OIIO_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
prepare_opt
if [ ! -d $_src ]; then
INFO "Downloading OpenEXR-$OPENEXR_VERSION"
mkdir -p $SRC
# wget -c $OPENEXR_SOURCE -O $_src.tar.gz
# INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
# tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" \
# -xf $_src.tar.gz
git clone $OPENEXR_SOURCE $_src
fi
cd $_src
# XXX For now, always update from latest repo...
git pull origin master
# Stick to same rev as windows' libs...
git checkout $OPENEXR_REPO_UID
git reset --hard
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
cflags="-fPIC"
fi
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../OpenEXR
make -j$THREADS && make install
# Force linking against static libs
# rm -f $_inst/lib/*.so*
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
# Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
cp -Lrn $_ilmbase_inst/* $_inst_shortcut
else
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set openexr-$OPENEXR_VERSION $openexr_magic
cd $CWD
INFO "Done compiling OpenEXR-$OPENEXR_VERSION!"
else
INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-openexr option."
fi
_with_built_openexr=true
# Just always run it, much simpler this way!
run_ldconfig "openexr"
}
#### Build OIIO ####
_init_oiio() {
_src=$SRC/OpenImageIO-$OIIO_VERSION
_inst=$INST/oiio-$OIIO_VERSION
_inst_shortcut=$INST/oiio
}
clean_OIIO() {
_init_oiio
_clean
}
compile_OIIO() {
# To be changed each time we make edits that would modify the compiled result!
oiio_magic=14
_init_oiio
# Clean install if needed!
magic_compile_check oiio-$OIIO_VERSION $oiio_magic
if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
clean_OIIO
fi
if [ ! -d $_inst ]; then
INFO "Building OpenImageIO-$OIIO_VERSION"
# Rebuild dependecies as well!
OSL_FORCE_REBUILD=true
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
# wget -c $OIIO_SOURCE -O "$_src.tar.gz"
# INFO "Unpacking OpenImageIO-$OIIO_VERSION"
# tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
# -xf $_src.tar.gz
git clone $OIIO_SOURCE $_src
fi
cd $_src
# XXX For now, always update from latest repo...
git pull origin master
# Stick to same rev as windows' libs...
git checkout $OIIO_REPO_UID
git reset --hard
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILDSTATIC=OFF"
if [ $_with_built_openexr == true ]; then
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
fi
# Optional tests and cmd tools
cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
#cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
# linking statically could give issues on Debian/Ubuntu (and probably other distros
# which doesn't like static linking) when linking shared oiio library due to missing
# text symbols (static libs should be compiled with -fPIC)
# cmake_d="$cmake_d -D LINKSTATIC=ON"
if [ -d $INST/boost ]; then
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
# XXX Does not work (looks like static boost are built without fPIC :/ ).
#if $ALL_STATIC; then
#cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
#fi
fi
# Looks like we do not need ocio in oiio for now...
# if [ -d $INST/ocio ]; then
# cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
# fi
cmake_d="$cmake_d -D USE_OCIO=OFF"
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
cflags="-fPIC"
fi
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set oiio-$OIIO_VERSION $oiio_magic
cd $CWD
INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
else
INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi
# Just always run it, much simpler this way!
run_ldconfig "oiio"
}
#### Build LLVM ####
_init_llvm() {
_src=$SRC/LLVM-$LLVM_VERSION
_src_clang=$SRC/CLANG-$LLVM_VERSION
_inst=$INST/llvm-$LLVM_VERSION
_inst_shortcut=$INST/llvm
}
clean_LLVM() {
_init_llvm
_clean
}
compile_LLVM() {
# To be changed each time we make edits that would modify the compiled result!
llvm_magic=2
_init_llvm
# Clean install if needed!
magic_compile_check llvm-$LLVM_VERSION $llvm_magic
if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
clean_LLVM
fi
if [ ! -d $_inst ]; then
INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
prepare_opt
if [ ! -d $_src -o true ]; then
mkdir -p $SRC
wget -c $LLVM_SOURCE -O "$_src.tar.gz"
wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
INFO "Unpacking LLVM-$LLVM_VERSION"
tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
-xf $_src.tar.gz
INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
tar -C $_src/tools \
--transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
-xf $_src_clang.tar.gz
cd $_src
# XXX Ugly patching hack!
cat << EOF | patch -p1
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@
set(LLVM_VERSION_MAJOR 3)
set(LLVM_VERSION_MINOR 1)
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
EOF
cd $CWD
fi
cd $_src
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
if [ -d $_FFI_INCLUDE_DIR ]; then
cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
fi
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set llvm-$LLVM_VERSION $llvm_magic
# Rebuild dependecies as well!
OSL_FORCE_REBUILD=true
cd $CWD
INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
else
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi
}
#### Build OSL ####
_init_osl() {
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
_inst=$INST/osl-$OSL_VERSION
_inst_shortcut=$INST/osl
}
clean_OSL() {
_init_osl
_clean
}
compile_OSL() {
# To be changed each time we make edits that would modify the compiled result!
osl_magic=13
_init_osl
# Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
clean_OSL
fi
if [ ! -d $_inst ]; then
INFO "Building OpenShadingLanguage-$OSL_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
# wget -c $OSL_SOURCE -O "$_src.tar.gz"
# INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
# tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
# -xf $_src.tar.gz
git clone $OSL_SOURCE $_src
fi
cd $_src
# XXX For now, always update from latest repo...
git pull origin master
# Stick to same rev as windows' libs...
git checkout $OSL_REPO_UID
git reset --hard
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILDSTATIC=ON"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
if [ $_with_built_openexr == true ]; then
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
fi
if [ -d $INST/boost ]; then
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
if $ALL_STATIC; then
cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
fi
fi
if [ -d $INST/oiio ]; then
cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
fi
INFO "$LLVM_VERSION_FOUND"
if [ ! -z $LLVM_VERSION_FOUND ]; then
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
if [ -d $INST/llvm ]; then
cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
cmake_d="$cmake_d -D LLVM_STATIC=ON"
fi
fi
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set osl-$OSL_VERSION $osl_magic
cd $CWD
INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
else
INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
_inst=$INST/opencollada-$OPENCOLLADA_VERSION
_inst_shortcut=$INST/opencollada
}
clean_OpenCOLLADA() {
_init_opencollada
_clean
}
compile_OpenCOLLADA() {
# To be changed each time we make edits that would modify the compiled results!
opencollada_magic=8
_init_opencollada
# Clean install if needed!
magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
clean_OpenCOLLADA
fi
if [ ! -d $_inst ]; then
INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
git clone $OPENCOLLADA_SOURCE $_src
fi
cd $_src
# XXX For now, always update from latest repo...
git pull origin master
# Stick to same rev as windows' libs...
git checkout $OPENCOLLADA_REPO_UID
git reset --hard
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_EXPAT=OFF"
cmake_d="$cmake_d -D USE_LIBXML=ON"
cmake_d="$cmake_d -D USE_STATIC=ON"
cmake $cmake_d ../
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
cd $CWD
INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
else
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
fi
}
#### Build FFMPEG ####
_init_ffmpeg() {
_src=$SRC/ffmpeg-$FFMPEG_VERSION
_inst=$INST/ffmpeg-$FFMPEG_VERSION
_inst_shortcut=$INST/ffmpeg
}
clean_FFmpeg() {
_init_ffmpeg
_clean
}
compile_FFmpeg() {
# To be changed each time we make edits that would modify the compiled result!
ffmpeg_magic=3
_init_ffmpeg
# Clean install if needed!
magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
clean_FFmpeg
fi
if [ ! -d $_inst ]; then
INFO "Building ffmpeg-$FFMPEG_VERSION"
prepare_opt
if [ ! -d $_src ]; then
INFO "Downloading ffmpeg-$FFMPEG_VERSION"
mkdir -p $SRC
wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
tar -C $SRC -xf $_src.tar.bz2
fi
cd $_src
extra=""
if $VORBIS_USE; then
extra="$extra --enable-libvorbis"
fi
if $THEORA_USE; then
extra="$extra --enable-libtheora"
fi
if $XVID_USE; then
extra="$extra --enable-libxvid"
fi
if $X264_USE; then
extra="$extra --enable-libx264"
fi
if $VPX_USE; then
extra="$extra --enable-libvpx"
fi
if $MP3LAME_USE; then
extra="$extra --enable-libmp3lame"
fi
if $OPENJPEG_USE; then
extra="$extra --enable-libopenjpeg"
fi
./configure --cc="gcc -Wl,--as-needed" \
--extra-ldflags="-pthread -static-libgcc" \
--prefix=$_inst --enable-static \
--disable-ffplay --disable-ffserver --disable-doc \
--enable-gray \
--enable-avfilter --disable-vdpau \
--disable-bzlib --disable-libgsm --disable-libspeex \
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
--disable-postproc --disable-x11grab --disable-librtmp --disable-libopencore-amrnb \
--disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
--disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
--disable-indev=lavfi $extra
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
cd $CWD
INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
else
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi
}
#### Install on DEB-like ####
get_package_version_DEB() {
dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
}
check_package_DEB() {
r=`apt-cache show $1 | grep -c 'Package:'`
if [ $r -ge 1 ]; then
return 0
else
return 1
fi
}
check_package_version_match_DEB() {
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
if [ -z "$v" ]; then
return 1
fi
version_match $v $2
return $?
}
check_package_version_ge_DEB() {
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
if [ -z "$v" ]; then
return 1
fi
version_ge $v $2
return $?
}
install_packages_DEB() {
sudo apt-get install -y --force-yes $@
if [ $? -ge 1 ]; then
ERROR "apt-get failed to install requested packages, exiting."
exit 1
fi
}
install_DEB() {
INFO ""
INFO "Installing dependencies for DEB-based distribution"
INFO ""
INFO "`eval _echo "$COMMON_INFO"`"
INFO ""
read -p "Do you want to continue (Y/n)?"
[ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`" ]; then
INFO "Looks like you're using Debian Squeeze which does have broken CMake"
INFO "It is highly recommended to install cmake from backports, otherwise"
INFO "compilation of some libraries could fail"
INFO ""
INFO "You could install newer CMake from debian-backports repository"
INFO "Add this this line to your /etc/apt/sources.lixt:"
INFO ""
INFO "deb http://backports.debian.org/debian-backports squeeze-backports main"
INFO ""
INFO "and then run:"
INFO ""
INFO "sudo apt-get update && sudo apt-get install cmake=2.8.7-4~bpo60+1 sudo apt-get install cmake=2.8.7-4~bpo60+1"
INFO ""
INFO "(you could also add this reporisotry using GUI like synaptic)"
INFO ""
INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
read
INFO ""
fi
fi
sudo apt-get update
# These libs should always be available in debian/ubuntu official repository...
OPENJPEG_DEV="libopenjpeg-dev"
VORBIS_DEV="libvorbis-dev"
OGG_DEV="libogg-dev"
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2"
OPENJPEG_USE=true
VORBIS_USE=true
OGG_USE=true
THEORA_USE=true
# Install newest libtiff-dev in debian/ubuntu.
TIFF="libtiff"
check_package_DEB $TIFF
if [ $? -eq 0 ]; then
_packages="$_packages $TIFF-dev"
else
TIFF="libtiff5"
check_package_DEB $TIFF
if [ $? -eq 0 ]; then
_packages="$_packages $TIFF-dev"
else
TIFF="libtiff4" # Some old distro, like e.g. ubuntu 10.04 :/
check_package_DEB $TIFF
if [ $? -eq 0 ]; then
_packages="$_packages $TIFF-dev"
fi
fi
fi
GIT="git"
check_package_DEB $GIT
if [ $? -eq 0 ]; then
INFO $GIT
_packages="$_packages $GIT"
else
GIT="git-core" # Some old distro, like e.g. ubuntu 10.04 :/
check_package_DEB $GIT
if [ $? -eq 0 ]; then
INFO $GIT
_packages="$_packages $GIT"
fi
fi
if $WITH_ALL; then
_packages="$_packages libspnav-dev libjack-dev"
fi
INFO ""
install_packages_DEB $_packages
INFO ""
X264_DEV="libx264-dev"
check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB $X264_DEV
X264_USE=true
fi
if $WITH_ALL; then
INFO ""
# Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
# Note: not since ubuntu 10.04
XVID_DEV="libxvidcore-dev"
check_package_DEB $XVID_DEV
if [ $? -eq 0 ]; then
install_packages_DEB $XVID_DEV
XVID_USE=true
else
XVID_DEV="libxvidcore4-dev"
check_package_DEB $XVID_DEV
if [ $? -eq 0 ]; then
install_packages_DEB $XVID_DEV
XVID_USE=true
fi
fi
INFO ""
MP3LAME_DEV="libmp3lame-dev"
check_package_DEB $MP3LAME_DEV
if [ $? -eq 0 ]; then
install_packages_DEB $MP3LAME_DEV
MP3LAME_USE=true
fi
INFO ""
VPX_DEV="libvpx-dev"
check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB $VPX_DEV
VPX_USE=true
fi
fi
INFO ""
if $PYTHON_SKIP; then
INFO "WARNING! Skipping Python installation, as requested..."
else
_do_compile=false
check_package_DEB python$PYTHON_VERSION_MIN-dev
if [ $? -eq 0 ]; then
install_packages_DEB python$PYTHON_VERSION_MIN-dev
INFO ""
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
check_package_DEB python$PYTHON_VERSION_MIN-numpy
if [ $? -eq 0 ]; then
install_packages_DEB python$PYTHON_VERSION_MIN-numpy
elif $NUMPY_REQUIRED; then
INFO "WARNING! Valid python package but no valid numpy package!"
INFO " Building both Python and Numpy from sources!"
_do_compile=true
else
INFO "WARNING! Sorry, using python package but no valid numpy package available!"
INFO " Use --required-numpy to force building of both Python and numpy."
fi
fi
else
_do_compile=true
fi
if $_do_compile; then
compile_Python
INFO ""
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
compile_Numpy
fi
else
clean_Python
fi
fi
INFO ""
if $BOOST_SKIP; then
INFO "WARNING! Skipping Boost installation, as requested..."
else
check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB libboost-dev
boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
check_package_DEB libboost-locale$boost_version-dev
if [ $? -eq 0 ]; then
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
libboost-thread$boost_version-dev
clean_Boost
else
compile_Boost
fi
else
compile_Boost
fi
fi
INFO ""
if $OCIO_SKIP; then
INFO "WARNING! Skipping OpenColorIO installation, as requested..."
else
check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB libopencolorio-dev
clean_OCIO
else
compile_OCIO
fi
fi
INFO ""
if $OPENEXR_SKIP; then
INFO "WARNING! Skipping OpenEXR installation, as requested..."
else
check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB libopenexr-dev
OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
ILMBASE_VERSION=$OPENEXR_VERSION
clean_OPENEXR
else
compile_OPENEXR
fi
fi
INFO ""
if $OIIO_SKIP; then
INFO "WARNING! Skipping OpenImageIO installation, as requested..."
else
check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_DEB libopenimageio-dev
clean_OIIO
else
compile_OIIO
fi
fi
have_llvm=false
if $LLVM_SKIP; then
INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
else
INFO ""
check_package_version_ge_DEB llvm-dev $LLVM_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB llvm-dev clang
have_llvm=true
LLVM_VERSION_FOUND="" # Using default one, no need to specify it!
clean_LLVM
else
install_packages_DEB libffi-dev
# LLVM can't find the debian ffi header dir
_FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
INFO ""
compile_LLVM
have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION
fi
fi
if $OSL_SKIP; then
INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
else
if $have_llvm; then
INFO ""
install_packages_DEB flex bison libtbb-dev
# No package currently!
INFO ""
compile_OSL
fi
fi
if $WITH_OPENCOLLADA; then
if $OPENCOLLADA_SKIP; then
INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
else
INFO ""
install_packages_DEB libpcre3-dev libxml2-dev
# Find path to libxml shared lib...
_XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
# No package
INFO ""
compile_OpenCOLLADA
fi
fi
INFO ""
if $FFMPEG_SKIP; then
INFO "WARNING! Skipping FFMpeg installation, as requested..."
else
# XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
# So for now, always build our own ffmpeg.
# check_package_DEB ffmpeg
# if [ $? -eq 0 ]; then
# install_packages_DEB ffmpeg
# ffmpeg_version=`get_package_version_DEB ffmpeg`
# INFO "ffmpeg version: $ffmpeg_version"
# if [ ! -z "$ffmpeg_version" ]; then
# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
# clean_FFmpeg
# else
# compile_FFmpeg
# fi
# fi
# fi
compile_FFmpeg
fi
}
#### Install on RPM-like ####
rpm_flavour() {
if [ -f /etc/redhat-release ]; then
if [ "`grep '6\.' /etc/redhat-release`" ]; then
RPM="RHEL"
else
RPM="FEDORA"
fi
elif [ -f /etc/SuSE-release ]; then
RPM="SUSE"
fi
}
get_package_version_RPM() {
rpm_flavour
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
elif [ $RPM = "SUSE" ]; then
zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
fi
}
check_package_RPM() {
rpm_flavour
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
r=`yum info $1 | grep -c 'Summary'`
elif [ $RPM = "SUSE" ]; then
r=`zypper info $1 | grep -c 'Summary'`
fi
if [ $r -ge 1 ]; then
return 0
else
return 1
fi
}
check_package_version_match_RPM() {
v=`get_package_version_RPM $1`
if [ -z "$v" ]; then
return 1
fi
version_match $v $2
return $?
}
check_package_version_ge_RPM() {
v=`get_package_version_RPM $1`
if [ -z "$v" ]; then
return 1
fi
version_ge $v $2
return $?
}
install_packages_RPM() {
rpm_flavour
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
sudo yum install -y $@
if [ $? -ge 1 ]; then
ERROR "yum failed to install requested packages, exiting."
exit 1
fi
elif [ $RPM = "SUSE" ]; then
sudo zypper --non-interactive install --auto-agree-with-licenses $@
if [ $? -ge 1 ]; then
ERROR "zypper failed to install requested packages, exiting."
exit 1
fi
fi
}
install_RPM() {
INFO ""
INFO "Installing dependencies for RPM-based distribution"
INFO ""
INFO "`eval _echo "$COMMON_INFO"`"
INFO ""
read -p "Do you want to continue (Y/n)?"
[ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
# Enable non-free repositories for all flavours
rpm_flavour
if [ $RPM = "FEDORA" ]; then
_fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
sudo yum -y localinstall --nogpgcheck \
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
sudo yum -y update
# Install cmake now because of difference with RHEL
sudo yum -y install cmake
elif [ $RPM = "RHEL" ]; then
sudo yum -y localinstall --nogpgcheck \
http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
sudo yum -y update
# Install cmake 2.8 from other repo
mkdir -p $SRC
if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
INFO ""
INFO "Special cmake already installed"
else
curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
sudo rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
fi
elif [ $RPM = "SUSE" ]; then
# Install this now to avoid using the version from packman repository...
if $WITH_ALL; then
install_packages_RPM libjack-devel
fi
_suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
INFO ""
INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/"
INFO "This is only needed if you do not already have a packman repository enabled..."
read -p "Do you want to add this repo (Y/n)?"
if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then
INFO " Installing packman..."
sudo zypper ar --refresh --name 'Packman Repository' http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_$_suse_rel/ ftp.gwdg.de-suse
INFO " Done."
else
INFO " Skipping packman installation."
fi
sudo zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
fi
# These libs should always be available in fedora/suse official repository...
OPENJPEG_DEV="openjpeg-devel"
VORBIS_DEV="libvorbis-devel"
OGG_DEV="libogg-devel"
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ make scons libtiff-devel freetype-devel libjpeg-devel\
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch"
OPENJPEG_USE=true
VORBIS_USE=true
OGG_USE=true
THEORA_USE=true
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
OPENEXR_DEV="openexr-devel"
_packages="$_packages libsqlite3x-devel fftw-devel SDL-devel"
if $WITH_ALL; then
_packages="$_packages jack-audio-connection-kit-devel"
fi
INFO ""
install_packages_RPM $_packages
INFO ""
X264_DEV="x264-devel"
check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM $X264_DEV
X264_USE=true
fi
if $WITH_ALL; then
INFO ""
XVID_DEV="xvidcore-devel"
check_package_RPM $XVID_DEV
if [ $? -eq 0 ]; then
install_packages_RPM $XVID_DEV
XVID_USE=true
fi
INFO ""
MP3LAME_DEV="lame-devel"
check_package_RPM $MP3LAME_DEV
if [ $? -eq 0 ]; then
install_packages_RPM $MP3LAME_DEV
MP3LAME_USE=true
fi
fi
elif [ $RPM = "SUSE" ]; then
OPENEXR_DEV="libopenexr-devel"
_packages="$_packages cmake sqlite3-devel fftw3-devel libSDL-devel"
INFO ""
install_packages_RPM $_packages
INFO ""
X264_DEV="libx264-devel"
check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM $X264_DEV
X264_USE=true
fi
if $WITH_ALL; then
INFO ""
XVID_DEV="libxvidcore-devel"
check_package_RPM $XVID_DEV
if [ $? -eq 0 ]; then
install_packages_RPM $XVID_DEV
XVID_USE=true
fi
INFO ""
MP3LAME_DEV="libmp3lame-devel"
check_package_RPM $MP3LAME_DEV
if [ $? -eq 0 ]; then
install_packages_RPM $MP3LAME_DEV
MP3LAME_USE=true
fi
fi
fi
if $WITH_ALL; then
INFO ""
VPX_DEV="libvpx-devel"
check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM $VPX_DEV
VPX_USE=true
fi
INFO ""
install_packages_RPM libspnav-devel
fi
INFO ""
if $PYTHON_SKIP; then
INFO "WARNING! Skipping Python installation, as requested..."
else
_do_compile=false
check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM python3-devel
INFO ""
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM python3-numpy
elif $NUMPY_REQUIRED; then
INFO "WARNING! Valid python package but no valid numpy package!"
INFO " Building both Python and Numpy from sources!"
_do_compile=true
else
INFO "WARNING! Sorry, using python package but no valid numpy package available!"
INFO " Use --required-numpy to force building of both Python and numpy."
fi
fi
else
_do_compile=true
fi
if $_do_compile; then
compile_Python
INFO ""
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
compile_Numpy
fi
else
clean_Python
fi
fi
INFO ""
if $BOOST_SKIP; then
INFO "WARNING! Skipping Boost installation, as requested..."
else
check_package_version_ge_RPM boost-devel $BOOST_VERSION
if [ $? -eq 0 ]; then
install_packages_RPM boost-devel
clean_Boost
else
compile_Boost
fi
fi
INFO ""
if $OCIO_SKIP; then
INFO "WARNING! Skipping OpenColorIO installation, as requested..."
else
check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM OpenColorIO-devel
clean_OCIO
else
compile_OCIO
fi
fi
INFO ""
if $OPENEXR_SKIP; then
INFO "WARNING! Skipping OpenEXR installation, as requested..."
else
check_package_version_ge_RPM $OPENEXR_DEV $OPENEXR_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM $OPENEXR_DEV
OPENEXR_VERSION=`get_package_version_RPM $OPENEXR_DEV`
ILMBASE_VERSION=$OPENEXR_VERSION
clean_OPENEXR
else
compile_OPENEXR
fi
fi
INFO ""
if $OIIO_SKIP; then
INFO "WARNING! Skipping OpenImageIO installation, as requested..."
else
check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel
clean_OIIO
else
compile_OIIO
fi
fi
have_llvm=false
INFO ""
if $LLVM_SKIP; then
INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
else
# Problem compiling with LLVM 3.2 so match version 3.1 ...
check_package_version_match_RPM llvm $LLVM_VERSION
if [ $? -eq 0 ]; then
if [ $RPM = "SUSE" ]; then
install_packages_RPM llvm-devel llvm-clang-devel
else
install_packages_RPM llvm-devel clang-devel
fi
have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM
else
#
# Better to compile it than use minimum version from repo...
#
install_packages_RPM libffi-devel
# LLVM can't find the fedora ffi header dir...
_FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
INFO ""
compile_LLVM
have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION
fi
fi
if $OSL_SKIP; then
INFO ""
INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
else
if $have_llvm; then
# No package currently!
INFO ""
install_packages_RPM flex bison git
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
install_packages_RPM tbb-devel
fi
INFO ""
compile_OSL
fi
fi
if $WITH_OPENCOLLADA; then
if $OPENCOLLADA_SKIP; then
INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
else
INFO ""
install_packages_RPM pcre-devel libxml2-devel git
# Find path to libxml shared lib...
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
# No package...
INFO ""
compile_OpenCOLLADA
fi
fi
if $FFMPEG_SKIP; then
INFO "WARNING! Skipping FFMpeg installation, as requested..."
else
check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM ffmpeg ffmpeg-devel
clean_FFmpeg
else
INFO ""
compile_FFmpeg
fi
fi
}
#### Install on ARCH-like ####
get_package_version_ARCH() {
pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
}
check_package_ARCH() {
r=`pacman -Si $1 | grep -c 'Description'`
if [ $r -ge 1 ]; then
return 0
else
return 1
fi
}
check_package_version_match_ARCH() {
v=`get_package_version_ARCH $1`
if [ -z "$v" ]; then
return 1
fi
version_match $v $2
return $?
}
check_package_version_ge_ARCH() {
v=`get_package_version_ARCH $1`
if [ -z "$v" ]; then
return 1
fi
version_ge $v $2
return $?
}
install_packages_ARCH() {
sudo pacman -S --needed --noconfirm $@
if [ $? -ge 1 ]; then
ERROR "pacman failed to install requested packages, exiting."
exit 1
fi
}
install_ARCH() {
INFO ""
INFO "Installing dependencies for ARCH-based distribution"
INFO ""
INFO "`eval _echo "$COMMON_INFO"`"
INFO ""
read -p "Do you want to continue (Y/n)?"
[ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
# Check for sudo...
if [ ! -x "/usr/bin/sudo" ]; then
INFO ""
INFO "This script requires sudo but it is not installed."
INFO "Please setup sudo according to:"
INFO "https://wiki.archlinux.org/index.php/Sudo"
INFO "and try again."
INFO ""
exit
fi
sudo pacman -Sy
# These libs should always be available in arch official repository...
OPENJPEG_DEV="openjpeg"
VORBIS_DEV="libvorbis"
OGG_DEV="libogg"
THEORA_DEV="libtheora"
_packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw"
OPENJPEG_USE=true
VORBIS_USE=true
OGG_USE=true
THEORA_USE=true
if $WITH_ALL; then
# No libspacenav in official arch repos...
_packages="$_packages jack"
fi
INFO ""
install_packages_ARCH $_packages
INFO ""
X264_DEV="x264"
check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH $X264_DEV
X264_USE=true
fi
if $WITH_ALL; then
INFO ""
XVID_DEV="xvidcore"
check_package_ARCH $XVID_DEV
if [ $? -eq 0 ]; then
install_packages_ARCH $XVID_DEV
XVID_USE=true
fi
INFO ""
MP3LAME_DEV="lame"
check_package_ARCH $MP3LAME_DEV
if [ $? -eq 0 ]; then
install_packages_ARCH $MP3LAME_DEV
MP3LAME_USE=true
fi
INFO ""
VPX_DEV="libvpx"
check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH $VPX_DEV
VPX_USE=true
fi
fi
INFO ""
if $PYTHON_SKIP; then
INFO "WARNING! Skipping Python installation, as requested..."
else
_do_compile=false
check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH python
INFO ""
if $WITH_NUMPY; then
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH python-numpy
elif $NUMPY_REQUIRED; then
INFO "WARNING! Valid python package but no valid numpy package!"
INFO " Building both Python and Numpy from sources!"
_do_compile=true
else
INFO "WARNING! Sorry, using python package but no valid numpy package available!"
INFO " Use --required-numpy to force building of both Python and numpy."
fi
fi
fi
else
_do_compile=true
fi
if $_do_compile; then
compile_Python
INFO ""
if $NUMPY_SKIP; then
INFO "WARNING! Skipping NumPy installation, as requested..."
else
compile_Numpy
fi
else
clean_Python
fi
fi
INFO ""
if $BOOST_SKIP; then
INFO "WARNING! Skipping Boost installation, as requested..."
else
check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH boost
clean_Boost
else
compile_Boost
fi
fi
INFO ""
if $OCIO_SKIP; then
INFO "WARNING! Skipping OpenColorIO installation, as requested..."
else
check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH opencolorio yaml-cpp tinyxml
clean_OCIO
else
install_packages_ARCH yaml-cpp tinyxml
compile_OCIO
fi
fi
INFO ""
if $OPENEXR_SKIP; then
INFO "WARNING! Skipping OpenEXR installation, as requested..."
else
check_package_version_ge_ARCH openexr $OPENEXR_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH openexr
OPENEXR_VERSION=`get_package_version_ARCH openexr`
ILMBASE_VERSION=$OPENEXR_VERSION
clean_OPENEXR
else
compile_OPENEXR
fi
fi
INFO ""
if $OIIO_SKIP; then
INFO "WARNING! Skipping OpenImageIO installation, as requested..."
else
check_package_version_ge_ARCH openimageio $OIIO_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH openimageio
clean_OIIO
else
compile_OIIO
fi
fi
have_llvm=false
INFO ""
if $LLVM_SKIP; then
INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
else
check_package_version_ge_ARCH llvm $LLVM_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH llvm clang
have_llvm=true
LLVM_VERSION=`check_package_version_ge_ARCH llvm $LLVM_VERSION_MIN`
LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM
else
install_packages_ARCH libffi
# LLVM can't find the arch ffi header dir...
_FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'`
# LLVM 3.1 needs python2 to build and arch defaults to python3
_PYTHON2_BIN="/usr/bin/python2"
INFO ""
compile_LLVM
have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION
fi
fi
if $OSL_SKIP; then
INFO ""
INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
else
if $have_llvm; then
check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH openshadinglanguage
clean_OSL
else
#XXX Note: will fail to build with LLVM 3.2!
INFO ""
install_packages_ARCH git intel-tbb
INFO ""
compile_OSL
fi
fi
fi
INFO ""
if $WITH_OPENCOLLADA; then
if $OPENCOLLADA_SKIP; then
INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
else
INFO ""
check_package_ARCH opencollada
if [ $? -eq 0 ]; then
install_packages_ARCH opencollada
clean_OpenCOLLADA
else
install_packages_ARCH pcre git
INFO ""
compile_OpenCOLLADA
fi
# Find path to libxml shared lib...
_XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'`
fi
fi
INFO ""
if $FFMPEG_SKIP; then
INFO "WARNING! Skipping FFMpeg installation, as requested..."
else
check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH ffmpeg
clean_FFmpeg
else
compile_FFmpeg
fi
fi
}
#### Printing User Info ####
print_info_ffmpeglink_DEB() {
if $ALL_STATIC; then
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
else
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
fi
}
print_info_ffmpeglink_RPM() {
# # XXX No static libs...
# if $ALL_STATIC; then
# rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
# else
rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
# fi
}
print_info_ffmpeglink_ARCH() {
# No static libs...
pacman -Ql $_packages | grep -e ".*\/lib[^\/]\+\.so$" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", $0)); nlines++ }'
}
print_info_ffmpeglink() {
# This func must only print a ';'-separated list of libs...
if [ -z "$DISTRO" ]; then
ERROR "Failed to detect distribution type"
exit 1
fi
# Create list of packages from which to get libs names...
_packages=""
if $THEORA_USE; then
_packages="$_packages $THEORA_DEV"
fi
if $VORBIS_USE; then
_packages="$_packages $VORBIS_DEV"
fi
if $OGG_USE; then
_packages="$_packages $OGG_DEV"
fi
if $XVID_USE; then
_packages="$_packages $XVID_DEV"
fi
if $VPX_USE; then
_packages="$_packages $VPX_DEV"
fi
if $MP3LAME_USE; then
_packages="$_packages $MP3LAME_DEV"
fi
if $X264_USE; then
_packages="$_packages $X264_DEV"
fi
if $OPENJPEG_USE; then
_packages="$_packages $OPENJPEG_DEV"
fi
if [ "$DISTRO" = "DEB" ]; then
print_info_ffmpeglink_DEB
elif [ "$DISTRO" = "RPM" ]; then
print_info_ffmpeglink_RPM
elif [ "$DISTRO" = "ARCH" ]; then
print_info_ffmpeglink_ARCH
# XXX TODO!
else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
fi
}
print_info() {
INFO ""
INFO ""
INFO "****WARNING****"
INFO "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
INFO "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
INFO "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
INFO "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
INFO ""
INFO ""
INFO "If you're using CMake add this to your configuration flags:"
_buildargs=""
if $ALL_STATIC; then
_1="-D WITH_STATIC_LIBS=ON"
# XXX Force linking with shared SDL lib!
_2="-D SDL_LIBRARY='libSDL.so;-lpthread'"
INFO " $_1"
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
# XXX Arch linux needs to link freetype dynamically...
if [ "$DISTRO" = "ARCH" ]; then
_1="-D FREETYPE_LIBRARY=/usr/lib/libfreetype.so"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
fi
if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
_1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_MIN"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
if [ -d $INST/boost ]; then
_1="-D BOOST_ROOT=$INST/boost"
_2="-D Boost_NO_SYSTEM_PATHS=ON"
INFO " $_1"
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
elif $ALL_STATIC; then
_1="-D WITH_BOOST_ICU=ON"
INFO " $_1"
_buildargs="$_buildargs $_1"
# XXX Arch linux fails static linking without these...
if [ "$DISTRO" = "ARCH" ]; then
_1="-D ICU_LIBRARY_DATA=/usr/lib/libicudata.so"
_2="-D ICU_LIBRARY_I18N=/usr/lib/libicui18n.so"
_3="-D ICU_LIBRARY_IO=/usr/lib/libicuio.so"
_4="-D ICU_LIBRARY_LE=/usr/lib/libicule.so"
_5="-D ICU_LIBRARY_LX=/usr/lib/libiculx.so"
_6="-D ICU_LIBRARY_TU=/usr/lib/libicutu.so"
_7="-D ICU_LIBRARY_UC=/usr/lib/libicuuc.so"
INFO " $_1"
INFO " $_2"
INFO " $_3"
INFO " $_4"
INFO " $_5"
INFO " $_6"
INFO " $_7"
_buildargs="$_buildargs $_1 $_2 $_3 $_4 $_5 $_6 $_7"
fi
fi
if [ -d $INST/openexr ]; then
_1="-D OPENEXR_ROOT_DIR=$INST/openexr"
_2="-D OPENEXR_VERSION=$OPENEXR_VERSION"
INFO " $_1"
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
_1="-D WITH_CYCLES_OSL=ON"
_2="-D WITH_LLVM=ON"
_3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
INFO " $_1"
INFO " $_2"
INFO " $_3"
_buildargs="$_buildargs $_1 $_2 $_3"
if [ -d $INST/osl ]; then
_1="-D CYCLES_OSL=$INST/osl"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
if [ -d $INST/llvm ]; then
_1="-D LLVM_DIRECTORY=$INST/llvm"
_2="-D LLVM_STATIC=ON"
INFO " $_1"
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
if $WITH_OPENCOLLADA; then
_1="-D WITH_OPENCOLLADA=ON"
INFO " $_1"
_buildargs="$_buildargs $_1"
if $ALL_STATIC; then
_1="-D XML2_LIBRARY=$_XML2_LIB"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
fi
_1="-D WITH_CODEC_FFMPEG=ON"
_2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
INFO " $_1"
INFO " $_2"
_buildargs="$_buildargs $_1 $_2"
if [ -d $INST/ffmpeg ]; then
_1="-D FFMPEG=$INST/ffmpeg"
INFO " $_1"
_buildargs="$_buildargs $_1"
fi
INFO ""
INFO "Or even simpler, just run (in your blender-source dir):"
INFO " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
INFO ""
INFO "If you're using SCons add this to your user-config:"
if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
INFO "BF_PYTHON = '$INST/python-$PYTHON_VERSION_MIN'"
INFO "BF_PYTHON_ABI_FLAGS = 'm'"
fi
if $ALL_STATIC; then
INFO "WITH_BF_STATICPYTHON = True"
fi
INFO "WITH_BF_OCIO = True"
if [ -d $INST/ocio ]; then
INFO "BF_OCIO = '$INST/ocio'"
fi
# XXX Always static for now :/
INFO "WITH_BF_STATICOCIO = True"
if [ -d $INST/openexr ]; then
INFO "BF_OPENEXR = '$INST/openexr'"
_ilm_libs_ext=""
version_ge $OPENEXR_VERSION "2.1.0"
if [ $? -eq 0 ]; then
_ilm_libs_ext=`echo $OPENEXR_VERSION | sed -r 's/([0-9]+)\.([0-9]+).*/-\1_\2/'`
fi
INFO "BF_OPENEXR_LIB = 'Half IlmImf$_ilm_libs_ext Iex$_ilm_libs_ext Imath$_ilm_libs_ext '"
INFO "BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf$_ilm_libs_ext.a ${BF_OPENEXR}/lib/libIex$_ilm_libs_ext.a ${BF_OPENEXR}/lib/libImath$_ilm_libs_ext.a ${BF_OPENEXR}/lib/libIlmThread$_ilm_libs_ext.a'"
fi
# XXX Always static for now :/
INFO "WITH_BF_STATICOPENEXR = True"
INFO "WITH_BF_OIIO = True"
if [ -d $INST/oiio ]; then
INFO "BF_OIIO = '$INST/oiio'"
fi
# XXX No more static oiio for now :/
#if $ALL_STATIC; then
#INFO "WITH_BF_STATICOIIO = True"
#fi
INFO "WITH_BF_CYCLES = True"
if [ -d $INST/osl ]; then
INFO "BF_OSL = '$INST/osl'"
fi
INFO "WITH_BF_BOOST = True"
if [ -d $INST/boost ]; then
INFO "BF_BOOST = '$INST/boost'"
fi
# XXX Broken in scons...
#if $ALL_STATIC; then
#INFO "WITH_BF_STATICBOOST = True"
#fi
if $WITH_OPENCOLLADA; then
INFO "WITH_BF_COLLADA = True"
if [ -d $INST/opencollada ]; then
INFO "BF_OPENCOLLADA = '$INST/opencollada'"
fi
fi
_ffmpeg_list_sep=" "
if [ -d $INST/ffmpeg ]; then
INFO "BF_FFMPEG = '$INST/ffmpeg'"
fi
if $ALL_STATIC; then
INFO "WITH_BF_STATICFFMPEG = True"
INFO "BF_FFMPEG_LIB_STATIC = '\${BF_FFMPEG_LIBPATH}/libavformat.a \${BF_FFMPEG_LIBPATH}/libavcodec.a \${BF_FFMPEG_LIBPATH}/libswscale.a \${BF_FFMPEG_LIBPATH}/libavutil.a \${BF_FFMPEG_LIBPATH}/libavdevice.a `print_info_ffmpeglink`'"
else
INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
fi
if ! $WITH_ALL; then
INFO "WITH_BF_3DMOUSE = False"
# No libspacenav in official arch repos...
elif [ "$DISTRO" = "ARCH" ]; then
INFO "WITH_BF_3DMOUSE = False"
fi
if $ALL_STATIC; then
INFO "LLIBS = [\""xml2"\", \""expat"\"] + LLIBS"
fi
INFO ""
INFO "NOTE: static build with scons are very tricky to set-up, if you choose that option"
INFO " you will likely have to edit these settings manually!"
INFO ""
}
#### "Main" ####
# Detect distribution type used on this machine
if [ -f /etc/debian_version ]; then
DISTRO="DEB"
install_DEB
elif [ -f /etc/arch-release ]; then
DISTRO="ARCH"
install_ARCH
elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
DISTRO="RPM"
install_RPM
else
ERROR "Failed to detect distribution type"
exit 1
fi
print_info | tee BUILD_NOTES.txt
INFO ""
INFO "This information has been written to BUILD_NOTES.txt"
INFO ""
# Switch back to user language.
LANG=LANG_BACK
export LANG
|