This repository has been archived by the owner on Jan 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.it
executable file
·127 lines (115 loc) · 3.58 KB
/
build.it
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
require "./ext/Extensions.it";
function isDarwin() {
return @{
var s,e,o = $("uname");
if(s && e==0) return o[1].trim();
} == "Darwin";
}
target("icetea", "exe") {
title: "IceTea",
needs: ["icetea-scripts"],
input: pfs.glob("src", "*.cpp"),
init: function() {
cli.group "IceTea"
cli.insert {
longopt: "--it-optimize",
desc: "Run optimizations when compiling."
};
cli.insert {
longopt: "--it-debug",
desc: "Build IceTea with debug symbols enabled."
};
},
configure: function() {
detect.line "Do we want to optimize IceTea (aka. release build)?";
if(DEBUG && cli.check("--it-optimize")) {
detect.fail "Can not optimize on debug build."
} else if(!DEBUG && cli.check("--it-optimize")) {
detect.success "Yes.";
@settings.CXX.optimization = "size";
if(sys.type == "unix") {
for(var _,flag in [
"-ffunction-sections",
"-fdata-sections",
"-dead_strip"
]) {
if(detect.tryCompilerFlag(flag, "CXX")) {
@settings.LINK.flags[] = flag;
}
}
}
} else {
detect.status "No."
}
if(detect.lib("dl")) {
@settings.LINK.libraries[] = "dl";
}
@settings.CXX.shouldDebug = (DEBUG || cli.check("--it-debug"));
if(detect.lib("pthread")) {
@settings.LINK.libraries[] = "pthread";
} else if(detect.lib("pthreads")) {
@settings.LINK.libraries[] = "pthreads";
} else if(detect.tryCompilerFlag("-pthread", "CXX")) {
@settings.LINK.flags[] = "-pthread";
}
// TODO: Generate plugin listing and load that, instead of this.
if(detect.tryCompilerFlag("-all_load", "CXX")) {
@settings.LINK.flags[] = "-all_load";
}
var exts = IceTeaInternal.getExtensions();
for(var _,ext in exts) {
var extName = "icetea-${ext}";
@needs[] = extName;
}
return true;
},
settings: {
CXX: {
includeDirs: ["src"],
flags: [],
warnings: (sys.type == "unix" ? [
// ObjectScript
"no-switch"
] : []),
defines: [
// We can go all-out now. Include everything.
"ICETEA_FULL",
// Force IceTea into using INCBIN_EXTERNAL instead.
// Allows for the generated incbin script file to be used.
// Not needed on Windows.
"ICETEA_INCBIN_FORCE_EXTERNAL"
]
},
LINK: {
libraries: [],
flags: []
}
},
}
target("icetea-scripts","incbin") {
title: "IceTea internal scripts",
input: {
STD: "lib/std.os",
Underscore: "lib/underscore.os",
Configurable: "lib/configurable.os",
Detector: "lib/detect.os",
Autoconf: "lib/autoconf.os",
DetectorUtils: "lib/detect.utils.os",
libIceTea: "lib/IceTea.os",
InternalBootstrapIt: "bootstrap.it"
},
settings: {
INCBIN: {
includeDirs: [__DIR__]
}
},
for: "icetea"
}
action("tests"){|scheme|
require "tests/run_tests"
}
action("all") {
build: ["icetea"],
clean: ["icetea"],
install: ["icetea"]
}