diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2006-11-18 13:05:09 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2006-11-18 13:05:09 +0000 |
| commit | 59798fd82f69e3e3a72ff41a00e171c6707c4397 (patch) | |
| tree | adaaa5f00572df81c5dd7f66a84cf2956fea1d98 | |
| parent | remove g++ 4.1.1 compiler errors (diff) | |
| download | inkscape-59798fd82f69e3e3a72ff41a00e171c6707c4397.tar.gz inkscape-59798fd82f69e3e3a72ff41a00e171c6707c4397.zip | |
Add dll capabilities
(bzr r1981)
| -rw-r--r-- | build.xml | 18 | ||||
| -rw-r--r-- | build28.xml | 18 | ||||
| -rw-r--r-- | buildtool.cpp | 397 |
3 files changed, 296 insertions, 137 deletions
@@ -81,21 +81,21 @@ <cc cc="gcc" cxx="g++" destdir="${build}/obj"> <fileset dir="${src}"> <!-- THINGS TO EXCLUDE --> - <exclude name="ast"/> - <exclude name="bonobo"/> + <exclude name="ast/.*"/> + <exclude name="bonobo/.*"/> <exclude name="deptool.cpp"/> <exclude name="dialogs/filedialog-win32.cpp"/> <exclude name="display/testnr.cpp"/> <exclude name="display/bezier-utils-test.cpp"/> <exclude name="dom/jsdombind.cpp"/> - <exclude name="dom/work"/> + <exclude name="dom/work/.*"/> <exclude name="dom/odf/SvgOdg.cpp"/> <exclude name="extension/api.cpp"/> - <exclude name="extension/dxf2svg"/> + <exclude name="extension/dxf2svg/.*"/> <exclude name="extension/internal/gnome.cpp"/> <exclude name="extension/script/bindtest.cpp"/> <exclude name="extension/script/cpptest.cpp"/> - <exclude name="extension/plugin"/> + <exclude name="extension/plugin/.*"/> <exclude name="extract-uri-test.cpp"/> <exclude name="helper/units-test.cpp"/> <exclude name="inkview.cpp"/> @@ -115,7 +115,7 @@ <exclude name="round-test.cpp"/> <exclude name="sp-gradient-test.cpp"/> <exclude name="svg/ftos.cpp"/> - <exclude name="utest"/> + <exclude name="utest/.*"/> <exclude name="widgets/test-widgets.cpp"/> <exclude name="xml/quote-test.cpp"/> <exclude name="xml/repr-action-test.cpp"/> @@ -123,7 +123,7 @@ <!--JABBER--> <exclude name="pedro/pedrogui.cpp"/> <exclude name="pedro/pedrogui.h"/> - <exclude name="pedro/work"/> + <exclude name="pedro/work/.*"/> <!--WHITEBOARD--> <exclude name="ui/dialog/session-player.cpp"/> <exclude name="ui/dialog/whiteboard-connect.cpp"/> @@ -186,12 +186,12 @@ </target> <target name="lib" depends="compile"> - <ar file="${build}/libinkscape.a"> + <staticlib file="${build}/libinkscape.a"> <fileset dir="${build}/obj"> <exclude name="main,o"/> <exclude name="winmain,o"/> </fileset> - </ar> + </staticlib> </target> <target name="i18n" depends="compile"> diff --git a/build28.xml b/build28.xml index 8906be17b..5acbf67d7 100644 --- a/build28.xml +++ b/build28.xml @@ -23,21 +23,21 @@ <cc cc="gcc" cxx="g++" destdir="${build}/obj">
<fileset dir="${src}">
<!-- THINGS TO EXCLUDE -->
- <exclude name="ast"/>
- <exclude name="bonobo"/>
+ <exclude name="ast/.*"/>
+ <exclude name="bonobo/.*"/>
<exclude name="deptool.cpp"/>
<exclude name="dialogs/filedialog-win32.cpp"/>
<exclude name="display/testnr.cpp"/>
<exclude name="display/bezier-utils-test.cpp"/>
<exclude name="dom/jsdombind.cpp"/>
- <exclude name="dom/work"/>
+ <exclude name="dom/work/.*"/>
<exclude name="dom/odf/SvgOdg.cpp"/>
<exclude name="extension/api.cpp"/>
- <exclude name="extension/dxf2svg"/>
+ <exclude name="extension/dxf2svg/.*"/>
<exclude name="extension/internal/gnome.cpp"/>
<exclude name="extension/script/bindtest.cpp"/>
<exclude name="extension/script/cpptest.cpp"/>
- <exclude name="extension/plugin"/>
+ <exclude name="extension/plugin/.*"/>
<exclude name="extract-uri-test.cpp"/>
<exclude name="helper/units-test.cpp"/>
<exclude name="inkview.cpp"/>
@@ -57,7 +57,7 @@ <exclude name="round-test.cpp"/>
<exclude name="sp-gradient-test.cpp"/>
<exclude name="svg/ftos.cpp"/>
- <exclude name="utest"/>
+ <exclude name="utest/.*"/>
<exclude name="widgets/test-widgets.cpp"/>
<exclude name="xml/quote-test.cpp"/>
<exclude name="xml/repr-action-test.cpp"/>
@@ -65,7 +65,7 @@ <!--JABBER-->
<exclude name="pedro/pedrogui.cpp"/>
<exclude name="pedro/pedrogui.h"/>
- <exclude name="pedro/work"/>
+ <exclude name="pedro/work/.*"/>
<!--WHITEBOARD-->
<exclude name="ui/dialog/session-player.cpp"/>
<exclude name="ui/dialog/whiteboard-connect.cpp"/>
@@ -127,12 +127,12 @@ </target>
<target name="lib" depends="compile">
- <ar file="${build}/libinkscape.a">
+ <staticlib file="${build}/libinkscape.a">
<fileset dir="${build}/obj">
<exclude name="main,o"/>
<exclude name="winmain,o"/>
</fileset>
- </ar>
+ </staticlib>
</target>
<target name="i18n" depends="compile">
diff --git a/buildtool.cpp b/buildtool.cpp index cb87693f3..90ccd6966 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -240,7 +240,7 @@ static int trex_newnode(TRex *exp, TRexNodeType type) if(type == OP_EXPR) n.right = exp->_nsubexpr++; if(exp->_nallocated < (exp->_nsize + 1)) { - int oldsize = exp->_nallocated; + //int oldsize = exp->_nallocated; exp->_nallocated *= 2; exp->_nodes = (TRexNode *)realloc(exp->_nodes, exp->_nallocated * sizeof(TRexNode)); } @@ -4882,7 +4882,8 @@ public: /** * Load a dependency file, generating one if necessary */ - std::vector<DepRec> getDepFile(const String &fileName); + std::vector<DepRec> getDepFile(const String &fileName, + bool forceRefresh); /** * Save a dependency file @@ -5449,7 +5450,7 @@ std::vector<DepRec> DepTool::loadDepFile(const String &depFile) Element *root = parser.parseFile(depFile.c_str()); if (!root) { - error("Could not open %s for reading", depFile.c_str()); + //error("Could not open %s for reading", depFile.c_str()); return result; } @@ -5521,14 +5522,26 @@ std::vector<DepRec> DepTool::loadDepFile(const String &depFile) /** * This loads the dependency cache. */ -std::vector<DepRec> DepTool::getDepFile(const String &depFile) +std::vector<DepRec> DepTool::getDepFile(const String &depFile, + bool forceRefresh) { - std::vector<DepRec> result = loadDepFile(depFile); - if (result.size() == 0) + std::vector<DepRec> result; + if (forceRefresh) { generateDependencies(depFile); result = loadDepFile(depFile); } + else + { + //try once + result = loadDepFile(depFile); + if (result.size() == 0) + { + //fail? try again + generateDependencies(depFile); + result = loadDepFile(depFile); + } + } return result; } @@ -5553,7 +5566,6 @@ public: typedef enum { TASK_NONE, - TASK_AR, TASK_CC, TASK_COPY, TASK_DELETE, @@ -5565,6 +5577,8 @@ public: TASK_MSGFMT, TASK_RANLIB, TASK_RC, + TASK_SHAREDLIB, + TASK_STATICLIB, TASK_STRIP, TASK_TSTAMP } TaskType; @@ -5666,111 +5680,6 @@ protected: - -/** - * Run the "ar" command to archive .o's into a .a - */ -class TaskAr : public Task -{ -public: - - TaskAr(MakeBase &par) : Task(par) - { - type = TASK_AR; name = "ar"; - command = "ar crv"; - } - - virtual ~TaskAr() - {} - - virtual bool execute() - { - //trace("###########HERE %d", fileSet.size()); - bool doit = false; - - String fullOut = parent.resolve(fileName); - //trace("ar fullout: %s", fullOut.c_str()); - - if (!listFiles(parent, fileSet)) - return false; - String fileSetDir = fileSet.getDirectory(); - - for (unsigned int i=0 ; i<fileSet.size() ; i++) - { - String fname; - if (fileSetDir.size()>0) - { - fname.append(fileSetDir); - fname.append("/"); - } - fname.append(fileSet[i]); - String fullName = parent.resolve(fname); - //trace("ar : %s/%s", fullOut.c_str(), fullName.c_str()); - if (isNewerThan(fullName, fullOut)) - doit = true; - } - //trace("Needs it:%d", doit); - if (!doit) - { - return true; - } - - String cmd = command; - cmd.append(" "); - cmd.append(fullOut); - for (unsigned int i=0 ; i<fileSet.size() ; i++) - { - String fname; - if (fileSetDir.size()>0) - { - fname.append(fileSetDir); - fname.append("/"); - } - fname.append(fileSet[i]); - String fullName = parent.resolve(fname); - - cmd.append(" "); - cmd.append(fullName); - } - - String outString, errString; - if (!executeCommand(cmd.c_str(), "", outString, errString)) - { - error("AR problem: %s", errString.c_str()); - return false; - } - - return true; - } - - virtual bool parse(Element *elem) - { - if (!parent.getAttribute(elem, "file", fileName)) - return false; - - std::vector<Element *> children = elem->getChildren(); - for (unsigned int i=0 ; i<children.size() ; i++) - { - Element *child = children[i]; - String tagName = child->getName(); - if (tagName == "fileset") - { - if (!parseFileSet(child, parent, fileSet)) - return false; - } - } - return true; - } - -private: - - String command; - String fileName; - FileSet fileSet; - -}; - - /** * This task runs the C/C++ compiler. The compiler is invoked * for all .c or .cpp files which are newer than their correcsponding @@ -5801,10 +5710,19 @@ public: if (!listFiles(parent, fileSet)) return false; + bool refreshCache = false; + String fullName = parent.resolve("build.dep"); + if (isNewerThan(parent.getURI().getPath(), fullName)) + { + trace("regenerating cache"); + refreshCache = true; + } + DepTool depTool; depTool.setSourceDirectory(source); depTool.setFileList(fileSet.getFiles()); - std::vector<DepRec> deps = depTool.getDepFile("build.dep"); + std::vector<DepRec> deps = + depTool.getDepFile("build.dep", refreshCache); String incs; incs.append("-I"); @@ -6430,8 +6348,11 @@ public: virtual bool parse(Element *elem) { - if (!parent.getAttribute(elem, "command", command)) + String s; + if (!parent.getAttribute(elem, "command", s)) return false; + if (s.size()>0) + command = s; if (!parent.getAttribute(elem, "out", fileName)) return false; @@ -6505,6 +6426,7 @@ public: } for (unsigned int i=0 ; i<text.size() ; i++) fputc(text[i], f); + fputc('\n', f); fclose(f); return true; } @@ -6804,6 +6726,241 @@ private: /** + * Collect .o's into a .so or DLL + */ +class TaskSharedLib : public Task +{ +public: + + TaskSharedLib(MakeBase &par) : Task(par) + { + type = TASK_SHAREDLIB; name = "dll"; + command = "ar crv"; + } + + virtual ~TaskSharedLib() + {} + + virtual bool execute() + { + //trace("###########HERE %d", fileSet.size()); + bool doit = false; + + String fullOut = parent.resolve(fileName); + //trace("ar fullout: %s", fullOut.c_str()); + + if (!listFiles(parent, fileSet)) + return false; + String fileSetDir = fileSet.getDirectory(); + + for (unsigned int i=0 ; i<fileSet.size() ; i++) + { + String fname; + if (fileSetDir.size()>0) + { + fname.append(fileSetDir); + fname.append("/"); + } + fname.append(fileSet[i]); + String fullName = parent.resolve(fname); + //trace("ar : %s/%s", fullOut.c_str(), fullName.c_str()); + if (isNewerThan(fullName, fullOut)) + doit = true; + } + //trace("Needs it:%d", doit); + if (!doit) + { + return true; + } + + String cmd = "dllwrap"; + cmd.append(" -o "); + cmd.append(fullOut); + if (defFileName.size()>0) + { + cmd.append(" --def "); + cmd.append(defFileName); + cmd.append(" "); + } + if (impFileName.size()>0) + { + cmd.append(" --implib "); + cmd.append(impFileName); + cmd.append(" "); + } + for (unsigned int i=0 ; i<fileSet.size() ; i++) + { + String fname; + if (fileSetDir.size()>0) + { + fname.append(fileSetDir); + fname.append("/"); + } + fname.append(fileSet[i]); + String fullName = parent.resolve(fname); + + cmd.append(" "); + cmd.append(fullName); + } + cmd.append(" "); + cmd.append(libs); + + String outString, errString; + if (!executeCommand(cmd.c_str(), "", outString, errString)) + { + error("<sharedlib> problem: %s", errString.c_str()); + return false; + } + + return true; + } + + virtual bool parse(Element *elem) + { + if (!parent.getAttribute(elem, "file", fileName)) + return false; + if (!parent.getAttribute(elem, "import", impFileName)) + return false; + if (!parent.getAttribute(elem, "def", defFileName)) + return false; + + std::vector<Element *> children = elem->getChildren(); + for (unsigned int i=0 ; i<children.size() ; i++) + { + Element *child = children[i]; + String tagName = child->getName(); + if (tagName == "fileset") + { + if (!parseFileSet(child, parent, fileSet)) + return false; + } + else if (tagName == "libs") + { + if (!parent.getValue(child, libs)) + return false; + libs = strip(libs); + } + } + return true; + } + +private: + + String command; + String fileName; + String defFileName; + String impFileName; + FileSet fileSet; + String libs; + +}; + + +/** + * Run the "ar" command to archive .o's into a .a + */ +class TaskStaticLib : public Task +{ +public: + + TaskStaticLib(MakeBase &par) : Task(par) + { + type = TASK_STATICLIB; name = "staticlib"; + command = "ar crv"; + } + + virtual ~TaskStaticLib() + {} + + virtual bool execute() + { + //trace("###########HERE %d", fileSet.size()); + bool doit = false; + + String fullOut = parent.resolve(fileName); + //trace("ar fullout: %s", fullOut.c_str()); + + if (!listFiles(parent, fileSet)) + return false; + String fileSetDir = fileSet.getDirectory(); + + for (unsigned int i=0 ; i<fileSet.size() ; i++) + { + String fname; + if (fileSetDir.size()>0) + { + fname.append(fileSetDir); + fname.append("/"); + } + fname.append(fileSet[i]); + String fullName = parent.resolve(fname); + //trace("ar : %s/%s", fullOut.c_str(), fullName.c_str()); + if (isNewerThan(fullName, fullOut)) + doit = true; + } + //trace("Needs it:%d", doit); + if (!doit) + { + return true; + } + + String cmd = command; + cmd.append(" "); + cmd.append(fullOut); + for (unsigned int i=0 ; i<fileSet.size() ; i++) + { + String fname; + if (fileSetDir.size()>0) + { + fname.append(fileSetDir); + fname.append("/"); + } + fname.append(fileSet[i]); + String fullName = parent.resolve(fname); + + cmd.append(" "); + cmd.append(fullName); + } + + String outString, errString; + if (!executeCommand(cmd.c_str(), "", outString, errString)) + { + error("<staticlib> problem: %s", errString.c_str()); + return false; + } + + return true; + } + + virtual bool parse(Element *elem) + { + if (!parent.getAttribute(elem, "file", fileName)) + return false; + + std::vector<Element *> children = elem->getChildren(); + for (unsigned int i=0 ; i<children.size() ; i++) + { + Element *child = children[i]; + String tagName = child->getName(); + if (tagName == "fileset") + { + if (!parseFileSet(child, parent, fileSet)) + return false; + } + } + return true; + } + +private: + + String command; + String fileName; + FileSet fileSet; + +}; + + +/** * Strip an executable */ class TaskStrip : public Task @@ -6882,9 +7039,7 @@ Task *Task::createTask(Element *elem) String tagName = elem->getName(); //trace("task:%s", tagName.c_str()); Task *task = NULL; - if (tagName == "ar") - task = new TaskAr(parent); - else if (tagName == "cc") + if (tagName == "cc") task = new TaskCC(parent); else if (tagName == "copy") task = new TaskCopy(parent); @@ -6906,6 +7061,10 @@ Task *Task::createTask(Element *elem) task = new TaskRanlib(parent); else if (tagName == "rc") task = new TaskRC(parent); + else if (tagName == "sharedlib") + task = new TaskSharedLib(parent); + else if (tagName == "staticlib") + task = new TaskStaticLib(parent); else if (tagName == "strip") task = new TaskStrip(parent); else if (tagName == "tstamp") @@ -7820,8 +7979,8 @@ bool Make::run(const String &target) { status("##################################"); status("# BuildTool"); - status("# version 0.3"); - status("# 16 Nov 06"); + status("# version 0.4"); + status("# 17 Nov 06"); status("##################################"); specifiedTarget = target; if (!run()) |
