aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xClientHamr/GuiLua/build.lua23
-rwxr-xr-xClientHamr/GuiLua/build.sh26
-rwxr-xr-xClientHamr/extantz/build.lua26
-rwxr-xr-xClientHamr/extantz/build.sh29
-rwxr-xr-xLuaSL/build.lua25
-rwxr-xr-xLuaSL/build.sh69
-rwxr-xr-xbuild.lua86
-rwxr-xr-xbuild.sh40
8 files changed, 160 insertions, 164 deletions
diff --git a/ClientHamr/GuiLua/build.lua b/ClientHamr/GuiLua/build.lua
new file mode 100755
index 0000000..3fcfffb
--- /dev/null
+++ b/ClientHamr/GuiLua/build.lua
@@ -0,0 +1,23 @@
1#!/usr/bin/env lua
2
3local dir = ...
4
5if 'nil' == type(dir) then
6 local build, err = loadfile('../../build.lua')
7 if build then
8 setfenv(build, getfenv(2))
9 build('')
10 else
11 print("ERROR - " .. err)
12 end
13 dir = readCommand('pwd')
14end
15
16LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS
17
18removeFiles(dir, {'test_c.so', 'GuiLua.o', 'libGuiLua.so', 'skang'})
19
20runCommand('C modules', dir, 'gcc ' .. CFLAGS .. ' -fPIC -shared -o test_c.so test_c.c')
21runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c GuiLua.c')
22runCommand('C libraries', dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libGuiLua.so -o libGuiLua.so GuiLua.o')
23runCommand('C apps', dir, 'gcc ' .. CFLAGS .. ' -Wl,-export-dynamic -o skang skang.c ' .. LDFLAGS .. ' -lGuiLua ' .. libs)
diff --git a/ClientHamr/GuiLua/build.sh b/ClientHamr/GuiLua/build.sh
deleted file mode 100755
index c405bb2..0000000
--- a/ClientHamr/GuiLua/build.sh
+++ /dev/null
@@ -1,26 +0,0 @@
1#! /bin/bash
2
3export LOCALDIR=`pwd`
4
5# No need for a make file, or dependencies, the entire thing takes only a few seconds to build.
6
7CFLAGS="-g -Wall -I include -I $LOCALDIR"
8CFLAGS="$CFLAGS -I ../../libraries"
9CFLAGS="$CFLAGS $(pkg-config --cflags luajit)"
10CFLAGS="$CFLAGS $(pkg-config --cflags elementary)"
11CFLAGS="$CFLAGS -DPACKAGE_BIN_DIR=\"$LOCALDIR\""
12CFLAGS="$CFLAGS -DPACKAGE_LIB_DIR=\"$LOCALDIR\""
13CFLAGS="$CFLAGS -DPACKAGE_DATA_DIR=\"$LOCALDIR\" $CFLAGOPTS"
14
15LDFLAGS="-L $LOCALDIR $(pkg-config --libs-only-L luajit) -L lib -L /usr/lib -L /lib"
16libs="$(pkg-config --cflags --libs elementary) $(pkg-config --libs luajit) -lpthread -lm -ldl"
17
18echo "clean"
19rm -f test_c.so GuiLua.o libGuiLua.so skang
20echo "C modules"
21gcc $CFLAGS -fPIC -shared -o test_c.so test_c.c
22gcc $CFLAGS -fPIC -c GuiLua.c
23echo "C libraries"
24gcc $CFLAGS -shared -Wl,-soname,libGuiLua.so -o libGuiLua.so GuiLua.o
25echo "C apps"
26gcc $CFLAGS -Wl,-export-dynamic -o skang skang.c $LDFLAGS -lGuiLua $libs
diff --git a/ClientHamr/extantz/build.lua b/ClientHamr/extantz/build.lua
new file mode 100755
index 0000000..d53449e
--- /dev/null
+++ b/ClientHamr/extantz/build.lua
@@ -0,0 +1,26 @@
1#!/usr/bin/env lua
2
3local dir = ...
4
5if 'nil' == type(dir) then
6 local build, err = loadfile('../../build.lua')
7 if build then
8 setfenv(build, getfenv(2))
9 build('')
10 else
11 print("ERROR - " .. err)
12 end
13 dir = readCommand('pwd')
14end
15
16CFLAGS = CFLAGS .. ' -I../../libraries/irrlicht-1.8.1/include -I/usr/X11R6/include'
17LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux'
18libs = libs .. ' -lIrrlicht -lGL -lbz2'
19
20removeFiles(dir, {'extantz', 'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'extantz.edj'})
21
22runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc extantz.edj')
23runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -O3 -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS)
24runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -O3 -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS)
25runCommand('extantz', dir, 'g++ ' .. CFLAGS .. ' -O3 -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS)
26runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' extantz.c crappisspuke.o CDemo.o extantzCamera.o -o extantz ' .. LDFLAGS .. ' ' .. libs .. ' && strip extantz')
diff --git a/ClientHamr/extantz/build.sh b/ClientHamr/extantz/build.sh
deleted file mode 100755
index d3ad3b0..0000000
--- a/ClientHamr/extantz/build.sh
+++ /dev/null
@@ -1,29 +0,0 @@
1#! /bin/bash
2
3export LOCALDIR=`pwd`
4
5# No need for a make file, or dependencies, the entire thing takes only a few seconds to build.
6
7CFLAGS="-g -Wall -I include -I $LOCALDIR"
8CFLAGS="$CFLAGS -I ../../libraries -I../../libraries/irrlicht-1.8.1/include -I/usr/X11R6/include"
9CFLAGS="$CFLAGS $(pkg-config --cflags luajit)"
10CFLAGS="$CFLAGS $(pkg-config --cflags elementary)"
11CFLAGS="$CFLAGS $(pkg-config --cflags ephysics)"
12CFLAGS="$CFLAGS -DPACKAGE_BIN_DIR=\"$LOCALDIR\""
13CFLAGS="$CFLAGS -DPACKAGE_LIB_DIR=\"$LOCALDIR\""
14CFLAGS="$CFLAGS -DPACKAGE_DATA_DIR=\"$LOCALDIR\" $CFLAGOPTS"
15
16LDFLAGS="-L $LOCALDIR $(pkg-config --libs-only-L luajit) -L lib -L /usr/lib -L /lib -L../../libraries/irrlicht-1.8.1/lib/Linux "
17libs="$(pkg-config --cflags --libs elementary) $(pkg-config --libs luajit) -lpthread -lm -ldl -lIrrlicht -lGL -lbz2"
18
19echo "clean"
20rm -f extantz crappisspuke.o CDemo.o extantzCamera.o extantz.edj
21echo "edje"
22edje_cc -id images extantz.edc extantz.edj
23echo "Irrlicht"
24#g++ -O3 -ffast-math crappisspuke.cpp -o crappisspuke -I../../libraries/irrlicht-1.8/include -I/usr/X11R6/include -L../../libraries/irrlicht-1.8/lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor && ./crappisspuke
25g++ $CFLAGS -O3 -ffast-math -c crappisspuke.cpp -o crappisspuke.o $LDFLAGS
26g++ $CFLAGS -O3 -ffast-math -c CDemo.cpp -o CDemo.o $LDFLAGS
27echo "extantz"
28g++ $CFLAGS -O3 -ffast-math -c extantzCamera.cpp -o extantzCamera.o $LDFLAGS
29gcc $CFLAGS extantz.c crappisspuke.o CDemo.o extantzCamera.o -o extantz $LDFLAGS $libs && strip extantz
diff --git a/LuaSL/build.lua b/LuaSL/build.lua
new file mode 100755
index 0000000..ea2151d
--- /dev/null
+++ b/LuaSL/build.lua
@@ -0,0 +1,25 @@
1#!/usr/bin/env lua
2
3local dir = ...
4
5if 'nil' == type(dir) then
6 local build, err = loadfile('../build.lua')
7 if build then
8 setfenv(build, getfenv(2))
9 build('')
10 else
11 print("ERROR - " .. err)
12 end
13 dir = readCommand('pwd')
14end
15
16dir = dir .. '/src'
17
18removeFiles(dir, {'../LuaSL', '*.o', '*.output', '*.backup', '../*.edj', 'LuaSL_lexer.h', 'LuaSL_lexer.c', 'LuaSL_lemon_yaccer.h', 'LuaSL_lemon_yaccer.c', 'LuaSL_lemon_yaccer.out'})
19
20-- Run lemon first, flex depends on it to define the symbol values.
21runCommand('lemon', dir, '../../libraries/lemon/lemon -s -T../../libraries/lemon/lempar.c LuaSL_lemon_yaccer.y')
22runCommand('flex', dir, 'flex -C --outfile=LuaSL_lexer.c --header-file=LuaSL_lexer.h LuaSL_lexer.l')
23runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' LuaSL.edc ../LuaSL.edj')
24compileFiles('../LuaSL', dir, {'LuaSL_main', 'LuaSL_compile', 'LuaSL_threads', 'LuaSL_utilities', 'LuaSL_lexer', 'LuaSL_lemon_yaccer'})
25compileFiles('../LuaSL_test', dir, {'LuaSL_test', 'LuaSL_utilities'})
diff --git a/LuaSL/build.sh b/LuaSL/build.sh
deleted file mode 100755
index 8d776d6..0000000
--- a/LuaSL/build.sh
+++ /dev/null
@@ -1,69 +0,0 @@
1#! /bin/bash
2
3export LOCALDIR=`pwd`
4
5# No need for a make file, or dependencies, the entire thing takes only a few seconds to build.
6
7CFLAGS="-g -Wall -Wunreachable-code -I include -I $LOCALDIR"
8CFLAGS="$CFLAGS -I ../../libraries"
9CFLAGS="$CFLAGS $(pkg-config --cflags luajit)"
10CFLAGS="$CFLAGS $(pkg-config --cflags eo)"
11CFLAGS="$CFLAGS $(pkg-config --cflags eet)"
12CFLAGS="$CFLAGS $(pkg-config --cflags ecore-con)"
13CFLAGS="$CFLAGS $(pkg-config --cflags ecore-evas)"
14CFLAGS="$CFLAGS $(pkg-config --cflags ecore-file)"
15CFLAGS="$CFLAGS $(pkg-config --cflags edje)"
16CFLAGS="$CFLAGS -DPACKAGE_BIN_DIR=\"$LOCALDIR\""
17CFLAGS="$CFLAGS -DPACKAGE_LIB_DIR=\"$LOCALDIR\""
18CFLAGS="$CFLAGS -DPACKAGE_DATA_DIR=\"$LOCALDIR\" $CFLAGOPTS"
19
20LDFLAGS="$(pkg-config --libs-only-L luajit) -L lib -L /usr/lib -L /lib"
21libs="$(pkg-config --libs edje) $libs $(pkg-config --libs luajit)"
22
23LFLAGS="-d"
24EDJE_FLAGS="-id images -fd fonts"
25# Dunno why I needed this, not gonna work with a packaged LuaJIT anyway.
26#LD_RUN_PATH="../../libraries/LuaJIT-2.0.2/src:"
27
28cd src
29echo "clean"
30rm -f ../LuaSL *.o *.output *.backup ../luac.out ../*.edj LuaSL_lexer.h LuaSL_lexer.c LuaSL_lemon_yaccer.h LuaSL_lemon_yaccer.c LuaSL_lemon_yaccer.out
31
32# Run lemon first, flex depends on it to define the symbol values.
33command="../../libraries/lemon/lemon -s -T../../libraries/lemon/lempar.c LuaSL_lemon_yaccer.y"
34echo "lemon"
35$command
36
37command="flex -C --outfile=LuaSL_lexer.c --header-file=LuaSL_lexer.h LuaSL_lexer.l"
38echo "flex"
39$command
40
41command="edje_cc $EDJE_FLAGS LuaSL.edc ../LuaSL.edj"
42echo "edje_cc"
43$command
44
45names="LuaSL_main LuaSL_compile LuaSL_threads LuaSL_utilities LuaSL_lexer LuaSL_lemon_yaccer"
46objects=""
47for i in $names
48do
49 command="gcc $CFLAGS -c -o $i.o $i.c"
50 echo $i
51 $command
52 objects="$objects $i.o"
53done
54command="gcc $CFLAGS -o ../LuaSL $objects $LDFLAGS $libs"
55echo "LuaSL"
56$command
57
58names="LuaSL_test LuaSL_utilities"
59objects=""
60for i in $names
61do
62 command="gcc $CFLAGS -c -o $i.o $i.c"
63 echo $i
64 $command
65 objects="$objects $i.o"
66done
67command="gcc $CFLAGS -o ../LuaSL_test $objects $LDFLAGS $libs"
68echo "LuaSL_test"
69$command
diff --git a/build.lua b/build.lua
new file mode 100755
index 0000000..de337de
--- /dev/null
+++ b/build.lua
@@ -0,0 +1,86 @@
1#!/usr/bin/env lua
2
3local args = ...
4local tmpFile = os.tmpname()
5
6readCommand = function (command)
7 os.execute(command .. ' >' .. tmpFile)
8 local tf = io.open(tmpFile, 'r')
9 local result = tf:read()
10 tf:close()
11 return result
12end
13
14pkgConfig = function (what, name)
15 return readCommand('pkg-config --' .. what .. ' ' .. name)
16end
17
18removeFiles = function (dir, files)
19 print('clean')
20 for i, v in ipairs(files) do
21 os.execute('rm -f ' .. dir .. '/' .. v)
22 end
23end
24
25runCommand = function (name, dir, command)
26 if name then print('\n' .. name) end
27 os.execute('cd ' .. dir .. '; ' .. command)
28end
29
30compileFiles = function (name, dir, files)
31 local objects = ''
32 print('\n' .. name)
33 for i, v in ipairs(files) do
34 print(' ' .. v)
35 os.execute('cd ' .. dir .. '; gcc ' .. CFLAGS .. ' -c -o ' .. v .. '.o ' .. v .. '.c')
36 objects = objects .. ' ' .. v .. '.o'
37 end
38 os.execute('cd ' .. dir .. '; gcc ' .. CFLAGS .. ' -o ' .. name .. ' ' .. objects .. ' ' .. LDFLAGS .. ' ' .. libs)
39end
40
41local buildSub = function (name, dir)
42 print('_______________ BUILDING ' .. name .. ' _______________')
43 local build, err = loadfile(LOCALDIR .. '/' .. dir .. '/build.lua')
44 if build then
45 setfenv(build, getfenv(2))
46 build(LOCALDIR .. '/' .. dir)
47 else
48 print("ERROR - " .. err)
49 end
50end
51
52-- Likely this will fail, coz Lua likes to strip out environmont variables.
53-- On the other hand, there's a more direct way to get to environment variables, it would fail to.
54CFLAGOPTS = readCommand('echo "$CFLAGOPTS"')
55
56LOCALDIR = readCommand('pwd')readCommand('pwd')
57CFLAGS = '-g -Wall -I include -I ' .. LOCALDIR .. ' -I ../../libraries'
58CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'luajit')
59CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'eo')
60CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'eet')
61CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'ecore-con')
62CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'ecore-evas')
63CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'ecore-file')
64CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'edje')
65CFLAGS = CFLAGS .. ' ' .. pkgConfig('cflags', 'elementary')
66CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. LOCALDIR .. '\\"'
67CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. LOCALDIR .. '\\"'
68CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. LOCALDIR .. '\\"'
69CFLAGS = CFLAGS .. ' ' .. CFLAGOPTS
70
71LDFLAGS = '-L ' .. LOCALDIR .. ' ' .. pkgConfig('libs-only-L', 'luajit') .. ' -L lib -L /usr/lib -L /lib'
72libs = pkgConfig('libs', 'elementary') .. ' ' .. pkgConfig('libs', 'luajit') .. ' -lpthread -lm'
73LFLAGS = '-d'
74EDJE_FLAGS = '-id images -fd fonts'
75
76
77if 'nil' == type(args) then
78 print('_______________ BUILDING lemon _______________')
79 removeFiles(LOCALDIR .. '/libraries/lemon', {'*.o', 'lemon'})
80 compileFiles('lemon', LOCALDIR .. '/libraries/lemon', {'lemon'})
81 print('_______________ BUILDING Irrlicht _______________')
82 runCommand('Irrlicht', 'libraries/irrlicht-1.8.1/source/Irrlicht', 'make')
83 buildSub('LuaSL', 'LuaSL')
84 buildSub('GuiLua', 'ClientHamr/GuiLua')
85 buildSub('extantz', 'ClientHamr/extantz')
86end
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 28c03f7..0000000
--- a/build.sh
+++ /dev/null
@@ -1,40 +0,0 @@
1#! /bin/bash
2
3wd=$(pwd)
4
5echo "_______________ BUILDING lemon _______________"
6cd $wd/libraries/lemon
7rm -f *.o lemon
8
9CFLAGS="-g -Wall -I include $CFLAGOPTS"
10LDFLAGS="-L lib -L /usr/lib -L /lib"
11LFLAGS="-d"
12
13names="lemon"
14objects=""
15for i in $names
16do
17 command="gcc $CFLAGS -c -o $i.o $i.c"
18 echo $command
19 $command
20 objects="$objects $i.o"
21done
22command="gcc $CFLAGS -o lemon $objects $LDFLAGS $libs"
23echo $command
24$command
25
26echo "_______________ BUILDING Irrlicht _______________"
27cd $wd/libraries/irrlicht-1.8.1/source/Irrlicht
28make
29
30echo "_______________ BUILDING LuaSL _______________"
31cd $wd/LuaSL
32./build.sh
33
34echo "_______________ BUILDING GuiLua _______________"
35cd $wd/ClientHamr/GuiLua
36./build.sh
37
38echo "_______________ BUILDING extantz _______________"
39cd $wd/ClientHamr/extantz
40./build.sh