@port-labs/jq-node-bindings 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +5 -0
- package/.jshintignore +1 -0
- package/.jshintrc +23 -0
- package/binding.gyp +56 -0
- package/configure +26 -0
- package/deps/jq/.gitattributes +2 -0
- package/deps/jq/.travis.yml +53 -0
- package/deps/jq/AUTHORS +73 -0
- package/deps/jq/COPYING +70 -0
- package/deps/jq/ChangeLog +1349 -0
- package/deps/jq/Makefile.am +198 -0
- package/deps/jq/NEWS +88 -0
- package/deps/jq/README.md +64 -0
- package/deps/jq/builtin.c +1684 -0
- package/deps/jq/builtin.h +10 -0
- package/deps/jq/bytecode.c +161 -0
- package/deps/jq/bytecode.h +92 -0
- package/deps/jq/compile-ios.sh +102 -0
- package/deps/jq/compile.c +1210 -0
- package/deps/jq/compile.h +101 -0
- package/deps/jq/config/m4/check-math-func.m4 +4 -0
- package/deps/jq/config/m4/find-func-no-libs.m4 +8 -0
- package/deps/jq/config/m4/find-func-no-libs2.m4 +62 -0
- package/deps/jq/config/m4/find-func.m4 +9 -0
- package/deps/jq/config/m4/misc.m4 +3 -0
- package/deps/jq/configure.ac +221 -0
- package/deps/jq/docs/Gemfile +7 -0
- package/deps/jq/docs/Gemfile.lock +63 -0
- package/deps/jq/docs/README.md +25 -0
- package/deps/jq/docs/Rakefile +145 -0
- package/deps/jq/docs/content/1.tutorial/default.yml +327 -0
- package/deps/jq/docs/content/2.download/default.yml +117 -0
- package/deps/jq/docs/content/3.manual/manual.yml +2878 -0
- package/deps/jq/docs/content/3.manual/v1.3/manual.yml +1270 -0
- package/deps/jq/docs/content/3.manual/v1.4/manual.yml +1672 -0
- package/deps/jq/docs/content/index/index.yml +51 -0
- package/deps/jq/docs/default_manpage.md +22 -0
- package/deps/jq/docs/public/.htaccess +28 -0
- package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +1058 -0
- package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
- package/deps/jq/docs/public/bootstrap/css/bootstrap.css +5224 -0
- package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +9 -0
- package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
- package/deps/jq/docs/public/bootstrap/js/bootstrap.js +2027 -0
- package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +6 -0
- package/deps/jq/docs/public/css/base.scss +99 -0
- package/deps/jq/docs/public/jq.png +0 -0
- package/deps/jq/docs/public/robots.txt +2 -0
- package/deps/jq/docs/site.yml +18 -0
- package/deps/jq/docs/templates/default.liquid +34 -0
- package/deps/jq/docs/templates/index.liquid +60 -0
- package/deps/jq/docs/templates/manual.liquid +122 -0
- package/deps/jq/docs/templates/shared/_footer.liquid +5 -0
- package/deps/jq/docs/templates/shared/_head.liquid +12 -0
- package/deps/jq/docs/templates/shared/_header.liquid +26 -0
- package/deps/jq/exec_stack.h +112 -0
- package/deps/jq/execute.c +1155 -0
- package/deps/jq/inject_errors.c +112 -0
- package/deps/jq/jq.1.default +39 -0
- package/deps/jq/jq.1.prebuilt +3075 -0
- package/deps/jq/jq.h +60 -0
- package/deps/jq/jq.spec +70 -0
- package/deps/jq/jq_parser.h +9 -0
- package/deps/jq/jq_test.c +346 -0
- package/deps/jq/jv.c +1333 -0
- package/deps/jq/jv.h +240 -0
- package/deps/jq/jv_alloc.c +179 -0
- package/deps/jq/jv_alloc.h +27 -0
- package/deps/jq/jv_aux.c +619 -0
- package/deps/jq/jv_dtoa.c +4275 -0
- package/deps/jq/jv_dtoa.h +22 -0
- package/deps/jq/jv_file.c +49 -0
- package/deps/jq/jv_parse.c +852 -0
- package/deps/jq/jv_print.c +348 -0
- package/deps/jq/jv_unicode.c +96 -0
- package/deps/jq/jv_unicode.h +11 -0
- package/deps/jq/jv_utf8_tables.h +37 -0
- package/deps/jq/lexer.c +2442 -0
- package/deps/jq/lexer.h +362 -0
- package/deps/jq/lexer.l +184 -0
- package/deps/jq/libm.h +160 -0
- package/deps/jq/linker.c +393 -0
- package/deps/jq/linker.h +7 -0
- package/deps/jq/locfile.c +91 -0
- package/deps/jq/locfile.h +29 -0
- package/deps/jq/m4/ax_compare_version.m4 +177 -0
- package/deps/jq/m4/ax_prog_bison_version.m4 +68 -0
- package/deps/jq/main.c +566 -0
- package/deps/jq/opcode_list.h +44 -0
- package/deps/jq/parser.c +3914 -0
- package/deps/jq/parser.h +193 -0
- package/deps/jq/parser.y +923 -0
- package/deps/jq/scripts/crosscompile +42 -0
- package/deps/jq/scripts/gen_utf8_tables.py +32 -0
- package/deps/jq/scripts/version +5 -0
- package/deps/jq/setup.sh +33 -0
- package/deps/jq/tests/jq.test +1235 -0
- package/deps/jq/tests/jqtest +5 -0
- package/deps/jq/tests/mantest +7 -0
- package/deps/jq/tests/modules/.jq +5 -0
- package/deps/jq/tests/modules/a.jq +2 -0
- package/deps/jq/tests/modules/b/b.jq +2 -0
- package/deps/jq/tests/modules/c/c.jq +16 -0
- package/deps/jq/tests/modules/c/d.jq +1 -0
- package/deps/jq/tests/modules/data.json +4 -0
- package/deps/jq/tests/modules/lib/jq/e/e.jq +1 -0
- package/deps/jq/tests/modules/lib/jq/f.jq +1 -0
- package/deps/jq/tests/modules/syntaxerror/syntaxerror.jq +1 -0
- package/deps/jq/tests/modules/test_bind_order.jq +4 -0
- package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
- package/deps/jq/tests/modules/test_bind_order1.jq +2 -0
- package/deps/jq/tests/modules/test_bind_order2.jq +2 -0
- package/deps/jq/tests/onig.supp +21 -0
- package/deps/jq/tests/onig.test +85 -0
- package/deps/jq/tests/onigtest +5 -0
- package/deps/jq/tests/setup +36 -0
- package/deps/jq/tests/shtest +205 -0
- package/deps/jq/tests/torture/input0.json +7 -0
- package/deps/jq/util.c +462 -0
- package/deps/jq/util.h +64 -0
- package/deps/jq.gyp +35 -0
- package/index.d.ts +3 -0
- package/jest.config.js +10 -0
- package/lib/index.js +14 -0
- package/package.json +48 -0
- package/reports/jest-port-api.xml +35 -0
- package/src/binding.cc +177 -0
- package/src/binding.h +13 -0
- package/test/santiy.test.js +122 -0
- package/util/configure.js +27 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include <stdint.h>
|
|
3
|
+
#include <stdlib.h>
|
|
4
|
+
|
|
5
|
+
#include "bytecode.h"
|
|
6
|
+
#include "jv_alloc.h"
|
|
7
|
+
|
|
8
|
+
// flags, length
|
|
9
|
+
#define NONE 0, 1
|
|
10
|
+
#define CONSTANT OP_HAS_CONSTANT, 2
|
|
11
|
+
#define VARIABLE (OP_HAS_VARIABLE | OP_HAS_BINDING), 3
|
|
12
|
+
#define GLOBAL (OP_HAS_CONSTANT | OP_HAS_VARIABLE | OP_HAS_BINDING | OP_IS_CALL_PSEUDO), 4
|
|
13
|
+
#define BRANCH OP_HAS_BRANCH, 2
|
|
14
|
+
#define CFUNC (OP_HAS_CFUNC | OP_HAS_BINDING), 3
|
|
15
|
+
#define UFUNC (OP_HAS_UFUNC | OP_HAS_BINDING | OP_IS_CALL_PSEUDO), 4
|
|
16
|
+
#define DEFINITION (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 0
|
|
17
|
+
#define CLOSURE_REF_IMM (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 2
|
|
18
|
+
|
|
19
|
+
#define OP(name, imm, in, out) \
|
|
20
|
+
{name, #name, imm, in, out},
|
|
21
|
+
|
|
22
|
+
static const struct opcode_description opcode_descriptions[] = {
|
|
23
|
+
#include "opcode_list.h"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
static const struct opcode_description invalid_opcode_description = {
|
|
27
|
+
-1, "#INVALID", 0, 0, 0, 0
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const struct opcode_description* opcode_describe(opcode op) {
|
|
32
|
+
if ((int)op >= 0 && (int)op < NUM_OPCODES) {
|
|
33
|
+
return &opcode_descriptions[op];
|
|
34
|
+
} else {
|
|
35
|
+
return &invalid_opcode_description;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
int bytecode_operation_length(uint16_t* codeptr) {
|
|
41
|
+
int length = opcode_describe(*codeptr)->length;
|
|
42
|
+
if (*codeptr == CALL_JQ || *codeptr == TAIL_CALL_JQ) {
|
|
43
|
+
length += codeptr[1] * 2;
|
|
44
|
+
}
|
|
45
|
+
return length;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static void dump_code(int indent, struct bytecode* bc) {
|
|
49
|
+
int pc = 0;
|
|
50
|
+
while (pc < bc->codelen) {
|
|
51
|
+
printf("%*s", indent, "");
|
|
52
|
+
dump_operation(bc, bc->code + pc);
|
|
53
|
+
printf("\n");
|
|
54
|
+
pc += bytecode_operation_length(bc->code + pc);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static void symbol_table_free(struct symbol_table* syms) {
|
|
59
|
+
jv_mem_free(syms->cfunctions);
|
|
60
|
+
jv_free(syms->cfunc_names);
|
|
61
|
+
jv_mem_free(syms);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void dump_disassembly(int indent, struct bytecode* bc) {
|
|
65
|
+
if (bc->nclosures > 0) {
|
|
66
|
+
printf("%*s[params: ", indent, "");
|
|
67
|
+
jv params = jv_object_get(jv_copy(bc->debuginfo), jv_string("params"));
|
|
68
|
+
for (int i=0; i<bc->nclosures; i++) {
|
|
69
|
+
if (i) printf(", ");
|
|
70
|
+
jv name = jv_array_get(jv_copy(params), i);
|
|
71
|
+
printf("%s", jv_string_value(name));
|
|
72
|
+
jv_free(name);
|
|
73
|
+
}
|
|
74
|
+
jv_free(params);
|
|
75
|
+
printf("]\n");
|
|
76
|
+
}
|
|
77
|
+
dump_code(indent, bc);
|
|
78
|
+
for (int i=0; i<bc->nsubfunctions; i++) {
|
|
79
|
+
struct bytecode* subfn = bc->subfunctions[i];
|
|
80
|
+
jv name = jv_object_get(jv_copy(subfn->debuginfo), jv_string("name"));
|
|
81
|
+
printf("%*s%s:%d:\n", indent, "", jv_string_value(name), i);
|
|
82
|
+
jv_free(name);
|
|
83
|
+
dump_disassembly(indent+2, subfn);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static struct bytecode* getlevel(struct bytecode* bc, int level) {
|
|
88
|
+
while (level > 0) {
|
|
89
|
+
bc = bc->parent;
|
|
90
|
+
level--;
|
|
91
|
+
}
|
|
92
|
+
return bc;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void dump_operation(struct bytecode* bc, uint16_t* codeptr) {
|
|
96
|
+
int pc = codeptr - bc->code;
|
|
97
|
+
printf("%04d ", pc);
|
|
98
|
+
const struct opcode_description* op = opcode_describe(bc->code[pc++]);
|
|
99
|
+
printf("%s", op->name);
|
|
100
|
+
if (op->length > 1) {
|
|
101
|
+
uint16_t imm = bc->code[pc++];
|
|
102
|
+
if (op->op == CALL_JQ || op->op == TAIL_CALL_JQ) {
|
|
103
|
+
for (int i=0; i<imm+1; i++) {
|
|
104
|
+
uint16_t level = bc->code[pc++];
|
|
105
|
+
uint16_t idx = bc->code[pc++];
|
|
106
|
+
jv name;
|
|
107
|
+
if (idx & ARG_NEWCLOSURE) {
|
|
108
|
+
idx &= ~ARG_NEWCLOSURE;
|
|
109
|
+
name = jv_object_get(jv_copy(getlevel(bc,level)->subfunctions[idx]->debuginfo),
|
|
110
|
+
jv_string("name"));
|
|
111
|
+
} else {
|
|
112
|
+
name = jv_array_get(jv_object_get(jv_copy(getlevel(bc,level)->debuginfo),
|
|
113
|
+
jv_string("params")), idx);
|
|
114
|
+
}
|
|
115
|
+
printf(" %s:%d",
|
|
116
|
+
jv_string_value(name),
|
|
117
|
+
idx);
|
|
118
|
+
jv_free(name);
|
|
119
|
+
if (level) {
|
|
120
|
+
printf("^%d", level);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} else if (op->op == CALL_BUILTIN) {
|
|
124
|
+
int func = bc->code[pc++];
|
|
125
|
+
jv name = jv_array_get(jv_copy(bc->globals->cfunc_names), func);
|
|
126
|
+
printf(" %s", jv_string_value(name));
|
|
127
|
+
jv_free(name);
|
|
128
|
+
} else if (op->flags & OP_HAS_BRANCH) {
|
|
129
|
+
printf(" %04d", pc + imm);
|
|
130
|
+
} else if (op->flags & OP_HAS_CONSTANT) {
|
|
131
|
+
printf(" ");
|
|
132
|
+
jv_dump(jv_array_get(jv_copy(bc->constants), imm), 0);
|
|
133
|
+
} else if (op->flags & OP_HAS_VARIABLE) {
|
|
134
|
+
uint16_t v = bc->code[pc++];
|
|
135
|
+
jv name = jv_array_get(jv_object_get(jv_copy(getlevel(bc,imm)->debuginfo), jv_string("locals")), v);
|
|
136
|
+
printf(" $%s:%d",
|
|
137
|
+
jv_string_value(name),
|
|
138
|
+
v);
|
|
139
|
+
jv_free(name);
|
|
140
|
+
if (imm) {
|
|
141
|
+
printf("^%d", imm);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
printf(" %d", imm);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
void bytecode_free(struct bytecode* bc) {
|
|
150
|
+
if (!bc)
|
|
151
|
+
return;
|
|
152
|
+
jv_mem_free(bc->code);
|
|
153
|
+
jv_free(bc->constants);
|
|
154
|
+
for (int i=0; i<bc->nsubfunctions; i++)
|
|
155
|
+
bytecode_free(bc->subfunctions[i]);
|
|
156
|
+
if (!bc->parent)
|
|
157
|
+
symbol_table_free(bc->globals);
|
|
158
|
+
jv_mem_free(bc->subfunctions);
|
|
159
|
+
jv_free(bc->debuginfo);
|
|
160
|
+
jv_mem_free(bc);
|
|
161
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#ifndef BYTECODE_H
|
|
2
|
+
#define BYTECODE_H
|
|
3
|
+
#include <stdint.h>
|
|
4
|
+
|
|
5
|
+
#include "jv.h"
|
|
6
|
+
|
|
7
|
+
typedef enum {
|
|
8
|
+
#define OP(name, imm, in, out) name,
|
|
9
|
+
#include "opcode_list.h"
|
|
10
|
+
#undef OP
|
|
11
|
+
} opcode;
|
|
12
|
+
|
|
13
|
+
enum {
|
|
14
|
+
NUM_OPCODES =
|
|
15
|
+
#define OP(name, imm, in, out) +1
|
|
16
|
+
#include "opcode_list.h"
|
|
17
|
+
#undef OP
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
enum {
|
|
21
|
+
OP_HAS_CONSTANT = 2,
|
|
22
|
+
OP_HAS_VARIABLE = 4,
|
|
23
|
+
OP_HAS_BRANCH = 8,
|
|
24
|
+
OP_HAS_CFUNC = 32,
|
|
25
|
+
OP_HAS_UFUNC = 64,
|
|
26
|
+
OP_IS_CALL_PSEUDO = 128,
|
|
27
|
+
OP_HAS_BINDING = 1024,
|
|
28
|
+
// NOTE: Not actually part of any op -- a pseudo-op flag for special
|
|
29
|
+
// handling of `break`.
|
|
30
|
+
OP_BIND_WILDCARD = 2048,
|
|
31
|
+
};
|
|
32
|
+
struct opcode_description {
|
|
33
|
+
opcode op;
|
|
34
|
+
const char* name;
|
|
35
|
+
|
|
36
|
+
int flags;
|
|
37
|
+
|
|
38
|
+
// length in 16-bit units
|
|
39
|
+
int length;
|
|
40
|
+
|
|
41
|
+
int stack_in, stack_out;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const struct opcode_description* opcode_describe(opcode op);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#define MAX_CFUNCTION_ARGS 10
|
|
48
|
+
typedef void (*cfunction_ptr)();
|
|
49
|
+
struct cfunction {
|
|
50
|
+
cfunction_ptr fptr;
|
|
51
|
+
const char* name;
|
|
52
|
+
int nargs;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
struct symbol_table {
|
|
56
|
+
struct cfunction* cfunctions;
|
|
57
|
+
int ncfunctions;
|
|
58
|
+
jv cfunc_names;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// The bytecode format matters in:
|
|
62
|
+
// execute.c - interpreter
|
|
63
|
+
// compile.c - compiler
|
|
64
|
+
// bytecode.c - disassembler
|
|
65
|
+
|
|
66
|
+
#define ARG_NEWCLOSURE 0x1000
|
|
67
|
+
|
|
68
|
+
struct bytecode {
|
|
69
|
+
uint16_t* code;
|
|
70
|
+
int codelen;
|
|
71
|
+
|
|
72
|
+
int nlocals;
|
|
73
|
+
int nclosures;
|
|
74
|
+
|
|
75
|
+
jv constants; // JSON array of constants
|
|
76
|
+
struct symbol_table* globals;
|
|
77
|
+
|
|
78
|
+
struct bytecode** subfunctions;
|
|
79
|
+
int nsubfunctions;
|
|
80
|
+
|
|
81
|
+
struct bytecode* parent;
|
|
82
|
+
|
|
83
|
+
jv debuginfo;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
void dump_disassembly(int, struct bytecode* code);
|
|
87
|
+
void dump_operation(struct bytecode* bc, uint16_t* op);
|
|
88
|
+
|
|
89
|
+
int bytecode_operation_length(uint16_t* codeptr);
|
|
90
|
+
void bytecode_free(struct bytecode* bc);
|
|
91
|
+
|
|
92
|
+
#endif
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# old values
|
|
4
|
+
OLD_CFLAGS=$CFLAGS
|
|
5
|
+
OLD_LDFLAGS=$LDFLAGS
|
|
6
|
+
ORIG_PWD=`pwd`
|
|
7
|
+
|
|
8
|
+
# For parallelism in make
|
|
9
|
+
NJOBS="-j`sysctl -n hw.ncpu || echo 1`"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Get oniguruma
|
|
13
|
+
rm -rf $PWD/build/ios onig-5.9.5
|
|
14
|
+
echo "Downloading oniguruma 5.9.5"
|
|
15
|
+
curl http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.5.tar.gz | tar xz
|
|
16
|
+
cd onig-5.9.5
|
|
17
|
+
|
|
18
|
+
# So, we need to remake the configure scripts so that the arm64 architecture
|
|
19
|
+
# exists in config.sub. In order to keep autoreconf from failing, create
|
|
20
|
+
# NEWS and ChangeLog.
|
|
21
|
+
touch NEWS ChangeLog
|
|
22
|
+
autoreconf -fi >/dev/null 2>&1
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
CC=`xcrun -f clang`
|
|
28
|
+
cd $ORIG_PWD
|
|
29
|
+
|
|
30
|
+
autoreconf -fi
|
|
31
|
+
for arch in i386 x86_64 armv7 armv7s arm64; do
|
|
32
|
+
|
|
33
|
+
# Some of the architectures are a bit different...
|
|
34
|
+
if [[ "$arch" = "i386" || "$arch" = "x86_64" ]]
|
|
35
|
+
then
|
|
36
|
+
SYSROOT=`xcrun -f --sdk iphonesimulator --show-sdk-path`
|
|
37
|
+
else
|
|
38
|
+
SYSROOT=`xcrun -f --sdk iphoneos --show-sdk-path`
|
|
39
|
+
fi
|
|
40
|
+
if [[ "$arch" = "arm64" ]]
|
|
41
|
+
then
|
|
42
|
+
HOST="aarch64-apple-darwin"
|
|
43
|
+
else
|
|
44
|
+
HOST="$arch-apple-darwin"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
CFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_CFLAGS"
|
|
48
|
+
LDFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_LDFLAGS"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Build oniguruma for this architecture
|
|
53
|
+
cd onig-5.9.5
|
|
54
|
+
CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --disable-shared --enable-static --host=$HOST --prefix=$ORIG_PWD/build/ios/$arch
|
|
55
|
+
STATUS=$?
|
|
56
|
+
if [ $STATUS -ne 0 ]
|
|
57
|
+
then
|
|
58
|
+
echo "Failed to configure oniguruma for architecture $arch. Check `pwd`/config.log for details."
|
|
59
|
+
cd $PWD
|
|
60
|
+
exit $STATUS
|
|
61
|
+
fi
|
|
62
|
+
make clean
|
|
63
|
+
make $NJBOS install
|
|
64
|
+
STATUS=$?
|
|
65
|
+
if [ $STATUS -ne 0 ]
|
|
66
|
+
then
|
|
67
|
+
echo "Failed to make oniguruma for architecture $arch."
|
|
68
|
+
cd $PWD
|
|
69
|
+
exit $STATUS
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# Build jq for this architecture
|
|
75
|
+
cd $ORIG_PWD
|
|
76
|
+
CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --disable-shared --enable-static -host=$HOST --prefix=$ORIG_PWD/build/ios/$arch --with-oniguruma=$ORIG_PWD/build/ios/$arch
|
|
77
|
+
STATUS=$?
|
|
78
|
+
if [ $STATUS -ne 0 ]
|
|
79
|
+
then
|
|
80
|
+
echo "Failed to configure jq for architecture $arch"
|
|
81
|
+
exit $STATUS
|
|
82
|
+
fi
|
|
83
|
+
make clean
|
|
84
|
+
make $NJOBS install
|
|
85
|
+
STATUS=$?
|
|
86
|
+
if [ $STATUS -ne 0 ]
|
|
87
|
+
then
|
|
88
|
+
echo "Failed to make jq for architecture $arch"
|
|
89
|
+
exit $STATUS
|
|
90
|
+
fi
|
|
91
|
+
done
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# lipo together the different architectures into a universal 'fat' file
|
|
95
|
+
lipo -create -output $ORIG_PWD/build/ios/libonig.a $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}/lib/libonig.a
|
|
96
|
+
lipo -create -output $ORIG_PWD/build/ios/libjq.a $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}/lib/libjq.a
|
|
97
|
+
|
|
98
|
+
# copy the products into the destination directory and clean up the single-architecture files.
|
|
99
|
+
cp $ORIG_PWD/build/ios/i386/include/*.h $ORIG_PWD/build/ios/
|
|
100
|
+
rm -rf $ORIG_PWD/build/ios/{i386,x86_64,armv7,armv7s,arm64}
|
|
101
|
+
|
|
102
|
+
echo "Products are in $ORIG_PWD/build/ios"
|