aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-21 22:24:48 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-21 22:24:48 +0000
commit97c0fcbbef19012f825cba0fc3f16037322ce84c (patch)
tree4169f36e050f4df84280c948148f8f054c37091e
parent8ebc3f17961ef6a0cf708cc6bdca948d77817ee0 (diff)
downloadbuild-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.gz
build-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.bz2
build-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.xz
build-97c0fcbbef19012f825cba0fc3f16037322ce84c.zip
We're getting closer and closer, qt4 is more configurable and gets QT flags
for you for CXXFLAGS and LDFLAGS, added a bunch more stuff and fixed a strange function input bug.
-rw-r--r--default.bld4
-rw-r--r--share/autoinclude/general-rules.bld8
-rw-r--r--share/include/qt4.bld63
-rw-r--r--src/build.y12
-rw-r--r--src/context.cpp2
-rw-r--r--src/functionast.cpp16
6 files changed, 94 insertions, 11 deletions
diff --git a/default.bld b/default.bld
index 19b66bf..8fc8fb4 100644
--- a/default.bld
+++ b/default.bld
@@ -29,7 +29,7 @@ action "clean"
29 29
30action "devinstall" 30action "devinstall"
31{ 31{
32 if "$(id -u)" != "0\n" then 32 if "$(id -u)" != "0" then
33 { 33 {
34 error "You can only install as the root user, su then run this."; 34 error "You can only install as the root user, su then run this.";
35 } 35 }
@@ -38,7 +38,7 @@ action "devinstall"
38 38
39action "viminstall" 39action "viminstall"
40{ 40{
41 if "$(id -u)" != "0\n" then 41 if "$(id -u)" != "0" then
42 { 42 {
43 error "You can only install as the root user, su then run this."; 43 error "You can only install as the root user, su then run this.";
44 } 44 }
diff --git a/share/autoinclude/general-rules.bld b/share/autoinclude/general-rules.bld
index 46720c6..30a4376 100644
--- a/share/autoinclude/general-rules.bld
+++ b/share/autoinclude/general-rules.bld
@@ -78,7 +78,7 @@ rule "lib"
78rule "cpp" 78rule "cpp"
79{ 79{
80 input "*.cpp"; 80 input "*.cpp";
81 output cppToObj(); 81 output INPUT.cppToObj();
82// output replace(".cpp", ".o"); 82// output replace(".cpp", ".o");
83 requires getMakeDeps("${CXX} ${CXXFLAGS} -M ${INPUT}"); 83 requires getMakeDeps("${CXX} ${CXXFLAGS} -M ${INPUT}");
84 profile "build" 84 profile "build"
@@ -91,7 +91,7 @@ rule "cpp"
91rule "c" 91rule "c"
92{ 92{
93 input "*.c"; 93 input "*.c";
94 output cToObj(); 94 output INPUT.cToObj();
95// output replace(".c", ".o"); 95// output replace(".c", ".o");
96 requires getMakeDeps("${CC} ${CFLAGS} -M ${INPUT}"); 96 requires getMakeDeps("${CC} ${CFLAGS} -M ${INPUT}");
97 profile "build" 97 profile "build"
@@ -115,8 +115,8 @@ rule "bison"
115rule "flex" 115rule "flex"
116{ 116{
117 input "*.l"; 117 input "*.l";
118 output replace(".l", ".yy.c"); 118 output INPUT.replace(".l", ".yy.c");
119 output replace(".l", ".yy.h"); 119 output INPUT.replace(".l", ".yy.h");
120 profile "build" 120 profile "build"
121 { 121 {
122 execute("${FLEX} ${FLEXFLAGS} ${INPUT}"); 122 execute("${FLEX} ${FLEXFLAGS} ${INPUT}");
diff --git a/share/include/qt4.bld b/share/include/qt4.bld
index 749cc52..a5a7867 100644
--- a/share/include/qt4.bld
+++ b/share/include/qt4.bld
@@ -1,4 +1,58 @@
1 1
2function qt_getCXXFLAGS()
3{
4 if QTDIR == null then
5 {
6 error "QTDIR is not set, cannot find QT tools.";
7 }
8
9 ret = "-D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LI "
10 "-DQT_SHARED -I${QTDIR}/mkspecs/linux-g++ "
11 "$(PKG_CONFIG_PATH=PKG_CONFIG_PATH:${QTDIR}/lib/pkgconfig "
12 "pkg-config --cflags QtCore QtGui ice glu x11 xext libpng freetype2 "
13 "gobject-2.0 sm xrender fontconfig gthread-2.0 glib-2.0)";
14 if UI_DIR != null then
15 {
16 ret += "-I${UI_DIR}";
17 }
18 if RCC_DIR != null then
19 {
20 ret += "-I${RCC_DIR}";
21 }
22 if MOC_DIR != null then
23 {
24 ret += "-I${MOC_DIR}";
25 }
26 return ret;
27}
28
29function qt_getLDFLAGS()
30{
31 if QTDIR == null then
32 {
33 error "QTDIR is not set, cannot find QT tools.";
34 }
35
36 return "-Wl,-rpath,${QTDIR}/lib $(PKG_CONFIG_PATH="
37 "PKG_CONFIG_PATH:${QTDIR}/lib/pkgconfig "
38 "pkg-config --libs QtCore QtGui ice glu x11 xext libpng freetype2 "
39 "gobject-2.0 sm xrender fontconfig gthread-2.0 glib-2.0) -laudio -lz "
40 "-lm -ldl";
41}
42
43function qt_getToolPath( TOOL, DEFAULT )
44{
45 if QTDIR == null then
46 {
47 error "QTDIR is not set, cannot find QT tools.";
48 }
49 if TOOL == null then
50 {
51 return "${QTDIR}/bin/${DEFAULT}";
52 }
53 return TOOL;
54}
55
2function qt_uiToH() 56function qt_uiToH()
3{ 57{
4 if "${UI_DIR}" == "" then 58 if "${UI_DIR}" == "" then
@@ -22,7 +76,8 @@ rule "qt_ui"
22 tag "headers"; 76 tag "headers";
23 profile "build" 77 profile "build"
24 { 78 {
25 execute("${QTDIR}/bin/uic -o ${OUTPUT} ${INPUT}"); 79 UIC = qt_getToolPath( UIC, "uic" );
80 execute("${UIC} -o ${OUTPUT} ${INPUT}");
26 } 81 }
27} 82}
28 83
@@ -48,8 +103,9 @@ rule "qt_rcc"
48 output INPUT.qt_qrcToCpp(); 103 output INPUT.qt_qrcToCpp();
49 profile "build" 104 profile "build"
50 { 105 {
106 RCC = qt_getToolPath( RCC, "rcc" );
51 NAME = INPUT.fileName().replace(".qrc",""); 107 NAME = INPUT.fileName().replace(".qrc","");
52 execute("${QTDIR}/bin/rcc -name ${NAME} -o ${OUTPUT} ${INPUT}"); 108 execute("${RCC} -name ${NAME} -o ${OUTPUT} ${INPUT}");
53 } 109 }
54} 110}
55 111
@@ -90,7 +146,8 @@ rule "qt_moc"
90 output INPUT.qt_hToMocCpp(); 146 output INPUT.qt_hToMocCpp();
91 profile "build" 147 profile "build"
92 { 148 {
93 execute("${QTDIR}/bin/moc -o${OUTPUT} ${INPUT}"); 149 MOC = qt_getToolPath( MOC, "moc" );
150 execute("${MOC} -o${OUTPUT} ${INPUT}");
94 } 151 }
95} 152}
96 153
diff --git a/src/build.y b/src/build.y
index a6618e4..3e9c8fd 100644
--- a/src/build.y
+++ b/src/build.y
@@ -188,7 +188,7 @@ value_mods:
188 188
189value_core: variable 189value_core: variable
190 | literal 190 | literal
191 | function 191 | function_no_input
192 | list 192 | list
193 ; 193 ;
194 194
@@ -254,6 +254,16 @@ function: UNDEF '(' {
254 } 254 }
255 ; 255 ;
256 256
257function_no_input: UNDEF '(' {
258 bld.xAst.addNode( AstNode::typeNull );
259 bld.xAst.addNode( AstNode::typeFunction );
260 bld.xAst.openBranch();
261 bld.xAst.addNode( AstNode::typeString, $1 );
262 } func_params ')' {
263 bld.xAst.closeNode();
264 }
265 ;
266
257requires: TOK_REQUIRES { 267requires: TOK_REQUIRES {
258 bld.xAst.addNode( AstNode::typeRequires ); 268 bld.xAst.addNode( AstNode::typeRequires );
259 bld.xAst.openBranch(); 269 bld.xAst.openBranch();
diff --git a/src/context.cpp b/src/context.cpp
index bc48def..e9330e5 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -232,6 +232,8 @@ Bu::FString Context::expand( const Bu::FString &sInS )
232 char buf[4096]; 232 char buf[4096];
233 sBuf.append( buf, p.read( buf, 4096 ) ); 233 sBuf.append( buf, p.read( buf, 4096 ) );
234 } 234 }
235 sBuf = sBuf.replace("\n", " ").replace("\r", " ");
236 sBuf.trimBack(' ');
235 sRet.append( sBuf ); 237 sRet.append( sBuf );
236 } catch(...) 238 } catch(...)
237 { 239 {
diff --git a/src/functionast.cpp b/src/functionast.cpp
index 0d9a938..ceee460 100644
--- a/src/functionast.cpp
+++ b/src/functionast.cpp
@@ -4,6 +4,9 @@
4#include "runner.h" 4#include "runner.h"
5#include "context.h" 5#include "context.h"
6 6
7#include <bu/sio.h>
8using namespace Bu;
9
7FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : 10FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) :
8 pRoot( pRoot ), 11 pRoot( pRoot ),
9 pRunner( pRunner ) 12 pRunner( pRunner )
@@ -22,9 +25,20 @@ Bu::FString FunctionAst::getName() const
22 return sName; 25 return sName;
23} 26}
24 27
25Variable FunctionAst::call( Variable &input, VarList /*lParams*/ ) 28Variable FunctionAst::call( Variable &input, VarList lParams )
26{ 29{
27 pContext->pushScope(); 30 pContext->pushScope();
31
32 AstBranch::NodeList::const_iterator vName =
33 (*(pRoot->getBranchBegin()+1)).begin();
34 VarList::iterator vValue = lParams.begin();
35 for( ; vName && vValue; vName++, vValue++ )
36 {
37 pContext->addVariable(
38 dynamic_cast<const AstLeaf *>(*vName)->getStrValue(),
39 *vValue
40 );
41 }
28 pContext->addVariable("INPUT", input ); 42 pContext->addVariable("INPUT", input );
29 Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); 43 Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() );
30 pContext->popScope(); 44 pContext->popScope();