Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/build_all/tirtos/package.bld

raw
1 /*
2 * ======== package.bld ========
3 */
4
5 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
6 var Pkg = xdc.useModule('xdc.bld.PackageContents');
7
8 /* make command to search for the srcs */
9 Pkg.makePrologue = "vpath %.c ../../src ../../adapters";
10
11 /* lib/ is a generated directory that 'xdc clean' should remove */
12 Pkg.generatedFiles.$add("lib/");
13
14 var SRCS = [
15 "agenttime.c",
16 "azure_base64.c",
17 "buffer.c",
18 "consolelogger.c",
19 "constbuffer.c",
20 "crt_abstractions.c",
21 "doublylinkedlist.c",
22 "gballoc.c",
23 "hmac.c",
24 "hmacsha256.c",
25 "httpapi_tirtos.c",
26 "httpapiex.c",
27 "httpapiexsas.c",
28 "httpheaders.c",
29 "lock_pthreads.c",
30 "map.c",
31 "platform_stub.c",
32 "sastoken.c",
33 "sha1.c",
34 "sha224.c",
35 "sha384-512.c",
36 "strings.c",
37 "string_tokenizer.c",
38 "threadapi_pthreads.c",
39 "tickcounter_tirtos.c",
40 "urlencode.c",
41 "usha.c",
42 "vector.c",
43 "xlogging.c",
44 "optionhandler.c"
45 ];
46
47 /* Paths to external source libraries */
48 xdcargs = java.lang.System.getenv("XDCARGS").split(" ");
49
50 var slIncs = "";
51 var ndkIncs = "";
52 var wolfsslIncs = "";
53 var commonIncs = "-I../../inc -I../../inc/azure_c_shared_utility -I../../pal/linux ";
54 var pthreadIncs = "";
55
56 /* Parse out the XDCARGS options for the library source paths */
57 for (x = 0; x < xdcargs.length; x++) {
58
59 if (xdcargs[x].match(/^CC3200SDK=/)) {
60 slIncs = (xdcargs[x] + "").replace(/'/g, '');
61 slIncs = slIncs.substring(slIncs.indexOf('=') + 1);
62 if (slIncs != "") {
63 slIncs += "/simplelink";
64 slIncs = "-I" + slIncs + " -I" + slIncs + "/include ";
65 }
66 }
67
68 if (xdcargs[x].match(/^NDK=/)) {
69 ndkIncs = (xdcargs[x] + "").replace(/'/g, '');
70 ndkIncs = ndkIncs.substring(ndkIncs.indexOf('=') + 1);
71 if (ndkIncs != "") {
72 ndkIncs = "-I" + ndkIncs + "/packages/ti/ndk/inc/bsd ";
73 }
74 }
75
76 if (xdcargs[x].match(/^BIOS=/)) {
77 pthreadIncs = (xdcargs[x] + "").replace(/'/g, '');
78 pthreadIncs = pthreadIncs.substring(pthreadIncs.indexOf('=') + 1);
79 if (pthreadIncs != "") {
80 pthreadIncs = "-I" + pthreadIncs + "/packages/ti/sysbios/posix ";
81 }
82 }
83
84 if (xdcargs[x].match(/^WOLFSSL=/)) {
85 wolfsslIncs = (xdcargs[x] + "").replace(/'/g, '');
86 wolfsslIncs = wolfsslIncs.substring(wolfsslIncs.indexOf('=') + 1);
87 if (wolfsslIncs != "") {
88 wolfsslIncs = "-I" + wolfsslIncs;
89 }
90 }
91 }
92
93 if (ndkIncs != "") {
94
95 if (wolfsslIncs == "") {
96 print("Warning: Cannot find WolfSSL directory: '" + wolfsslPath
97 + "'. Skipping TLS support build.");
98 wolfsslIncs = "";
99 }
100
101 var wolfsslPath = wolfsslIncs.substring(2);
102 try {
103 var f = new java.io.File(wolfsslPath);
104 if (!f.exists()) {
105 print("Warning: Cannot find WolfSSL directory: '" + wolfsslPath
106 + "'. Skipping TLS support build.");
107 wolfsslIncs = "";
108 }
109 }
110 catch(e) {
111 print("Warning: Cannot find WolfSSL directory: '" + wolfsslPath
112 + "'. Skipping TLS support build.");
113 wolfsslIncs = "";
114 }
115 }
116
117 for (var i = 0; i < Build.targets.length; i++) {
118 var profile = "release";
119 var target = Build.targets[i];
120 var extraOpts = commonIncs + pthreadIncs;
121
122 if (slIncs != "") {
123 Pkg.addLibrary("lib/common_sl", target, { profile: profile,
124 defs: "-DNET_SL -DREFCOUNT_ATOMIC_DONTCARE " + extraOpts, incs: slIncs
125 }).addObjects(SRCS);
126 }
127
128 if (ndkIncs != "") {
129 if (wolfsslIncs != "") {
130 Pkg.addLibrary("lib/common_ndk_wolfssl", target, {
131 profile: profile,
132 defs: "-DNET_NDK -DNET_WOLFSSL -DWOLFSSL_TIRTOS "
133 + extraOpts,
134 incs: ndkIncs + wolfsslIncs
135 }).addObjects(SRCS)
136 }
137
138 Pkg.addLibrary("lib/common_ndk", target, { profile: profile,
139 defs: "-DNET_NDK " + extraOpts, incs: ndkIncs
140 }).addObjects(SRCS);
141 }
142 }