diff options
Diffstat (limited to 'src/libraries/build.lua')
-rwxr-xr-x | src/libraries/build.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/libraries/build.lua b/src/libraries/build.lua new file mode 100755 index 0000000..6566e66 --- /dev/null +++ b/src/libraries/build.lua | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/usr/bin/env lua | ||
2 | |||
3 | local dir = ... | ||
4 | |||
5 | if 'nil' == type(dir) then | ||
6 | local build, err = loadfile('../../build.lua') | ||
7 | if build then | ||
8 | setfenv(build, getfenv(2)) | ||
9 | build(2) | ||
10 | else | ||
11 | print("ERROR - " .. err) | ||
12 | end | ||
13 | dir = workingDir | ||
14 | end | ||
15 | |||
16 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS | ||
17 | |||
18 | removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so'}) | ||
19 | |||
20 | runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -fPIC -c LumbrJack.c') | ||
21 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so -o ' .. lib_d .. '/libLumbrJack.so LumbrJack.o') | ||
22 | |||
23 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c Runnr.c') | ||
24 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libRunnr.so -o ' .. lib_d .. '/libRunnr.so Runnr.o') | ||
25 | |||
26 | -- For Elm apps, these are all centrally controlled in libSledjHamr. | ||
27 | CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. bin_d .. '\\"' | ||
28 | CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. lib_d .. '\\"' | ||
29 | CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. data_d .. '\\"' | ||
30 | CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | ||
31 | |||
32 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') | ||
33 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') | ||