diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2006-11-28 20:49:37 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2006-11-28 20:49:37 +0000 |
| commit | 8a974109ee71d4adcc06cd316b24e78ceaa06cbf (patch) | |
| tree | 72f333d9ff5eaa4eac1976cab44ac5e09b63acdb | |
| parent | fix 'strip' (diff) | |
| download | inkscape-8a974109ee71d4adcc06cd316b24e78ceaa06cbf.tar.gz inkscape-8a974109ee71d4adcc06cd316b24e78ceaa06cbf.zip | |
get it to work on linux
(bzr r2047)
| -rw-r--r-- | build.xml | 24 | ||||
| -rw-r--r-- | buildtool.cpp | 102 |
2 files changed, 91 insertions, 35 deletions
@@ -17,6 +17,13 @@ <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> <mkdir dir="${dist}"/> + <copy file="${src}/helper/sp-marshal.h.mingw" + tofile="${src}/helper/sp-marshal.h"/> + <copy file="${src}/helper/sp-marshal.cpp.mingw" + tofile="${src}/helper/sp-marshal.cpp"/> + <makefile file="inkscape_version.h"> + #define INKSCAPE_VERSION "${version}+devel" + </makefile> <makefile file="config.h"> #ifndef _CONFIG_H_ #define _CONFIG_H_ @@ -80,7 +87,8 @@ <target name="compile" depends="init" description="compile the source " > <!-- Compile from source to build --> - <cc cc="gcc" cxx="g++" destdir="${build}/obj"> + <cc cc="i686-pc-mingw32-gcc" cxx="i686-pc-mingw32-g++" + destdir="${build}/obj"> <fileset dir="${src}"> <!-- THINGS TO EXCLUDE --> <exclude name="ast/.*"/> @@ -145,8 +153,8 @@ <exclude name="removeoverlap/remove_rectangle_overlap-test.h"/> </fileset> <flags> - -Wall -g -O3 - -mms-bitfields + -Wall -O3 + -mms-bitfields </flags> <defines> -DVERSION=\"${version}\" @@ -188,7 +196,8 @@ </target> <target name="lib" depends="compile"> - <staticlib file="${build}/libinkscape.a"> + <staticlib command="i686-pc-mingw32-ar crsv" + file="${build}/libinkscape.a"> <fileset dir="${build}/obj"> <exclude name="main,o"/> <exclude name="winmain,o"/> @@ -204,15 +213,17 @@ </target> <target name="link" depends="lib"> - <rc command="windres -o" + <rc command="i686-pc-mingw32-windres" file="${src}/inkscape.rc" out="${build}/inkres.o"> <flags> --include-dir=${src} </flags> </rc> - <link command="g++" out="${build}/inkscape.exe" + <link command="i686-pc-mingw32-g++" out="${build}/inkscape.exe" strip="true" symfile="${build}/inkscape.dbg" + stripcommand="i686-pc-mingw32-strip" + objcopycommand="i686-pc-mingw32-objcopy" > <flags> </flags> @@ -305,7 +316,6 @@ <copy todir="${dist}/lib"> <fileset dir="${gtk}/lib/gtk-2.0"/> </copy> <copy todir="${dist}/lib"> <fileset dir="${gtk}/lib/glib-2.0"/> </copy> <copy todir="${dist}/lib"> <fileset dir="${gtk}/lib/locale"/> </copy> - <copy todir="${dist}/lib"> <fileset dir="${gtk}/lib/pango"/> </copy> <copy todir="${dist}"> <fileset dir="share"> <exclude name=".*\.am"/> diff --git a/buildtool.cpp b/buildtool.cpp index bfeea1b7a..ef80f872a 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -24,12 +24,12 @@ /** * To use this file, compile with: * <pre> - * g++ -O3 buildtool.cpp -o build.exe + * g++ -O3 buildtool.cpp -o btool.exe * (or whatever your compiler might be) * Then - * build + * btool * or - * build {target} + * btool {target} */ @@ -52,6 +52,10 @@ #endif +#include <errno.h> + + + namespace buildtool { @@ -3505,15 +3509,15 @@ bool MakeBase::executeCommand(const String &command, } errnum = pclose(f); } - outbuf = s; - if (errnum < 0) - { - error("exec of command '%s' failed : %s", + outbuf = s; + if (errnum != 0) + { + error("exec of command '%s' failed : %s", command.c_str(), strerror(errno)); - return false; - } - else - return true; + return false; + } + else + return true; #endif } @@ -3583,6 +3587,12 @@ bool MakeBase::listFiles(const String &baseDir, std::vector<String> subdirs; DIR *dir = opendir(dirNative.c_str()); + if (!dir) + { + error("Could not open directory %s : %s", + dirNative.c_str(), strerror(errno)); + return false; + } while (true) { struct dirent *de = readdir(dir); @@ -3937,9 +3947,14 @@ bool MakeBase::createDirectory(const String &dirname) } //## 3: now make +#ifdef __WIN32__ if (mkdir(cnative)<0) +#else + if (mkdir(cnative, S_IRWXU | S_IRWXG | S_IRWXO)<0) +#endif { - error("cannot make directory '%s'", cnative); + error("cannot make directory '%s' : %s", + cnative, strerror(errno)); return false; } @@ -6348,6 +6363,8 @@ public: type = TASK_LINK; name = "link"; command = "g++"; doStrip = false; + stripCommand = "strip"; + objcopyCommand = "objcopy"; } virtual ~TaskLink() @@ -6403,7 +6420,8 @@ public: if (symFileName.size()>0) { String symFullName = parent.resolve(symFileName); - cmd = "objcopy --only-keep-debug "; + cmd = objcopyCommand; + cmd.append(" --only-keep-debug "); cmd.append(getNativePath(fullTarget)); cmd.append(" "); cmd.append(getNativePath(symFullName)); @@ -6416,7 +6434,8 @@ public: if (doStrip) { - cmd = "strip "; + cmd = stripCommand; + cmd.append(" "); cmd.append(getNativePath(fullTarget)); if (!executeCommand(cmd, "", outbuf, errbuf)) { @@ -6435,6 +6454,14 @@ public: return false; if (s.size()>0) command = s; + if (!parent.getAttribute(elem, "objcopycommand", s)) + return false; + if (s.size()>0) + objcopyCommand = s; + if (!parent.getAttribute(elem, "stripcommand", s)) + return false; + if (s.size()>0) + stripCommand = s; if (!parent.getAttribute(elem, "out", fileName)) return false; if (!parent.getAttribute(elem, "strip", s)) @@ -6479,6 +6506,8 @@ private: FileSet fileSet; bool doStrip; String symFileName; + String stripCommand; + String objcopyCommand; }; @@ -6680,9 +6709,13 @@ public: virtual bool parse(Element *elem) { + String s; + if (!parent.getAttribute(elem, "command", s)) + return false; + if (s.size()>0) + command = s; if (!parent.getAttribute(elem, "todir", toDirName)) return false; - String s; if (!parent.getAttribute(elem, "owndir", s)) return false; if (!getBool(s, owndir)) @@ -6723,7 +6756,10 @@ class TaskRanlib : public Task public: TaskRanlib(MakeBase &par) : Task(par) - { type = TASK_RANLIB; name = "ranlib"; } + { + type = TASK_RANLIB; name = "ranlib"; + command = "ranlib"; + } virtual ~TaskRanlib() {} @@ -6732,7 +6768,8 @@ public: { String fullName = parent.resolve(fileName); //trace("fullDir:%s", fullDir.c_str()); - String cmd = "ranlib "; + String cmd = command; + cmd.append(" "); cmd.append(fullName); String outbuf, errbuf; if (!executeCommand(cmd, "", outbuf, errbuf)) @@ -6742,6 +6779,11 @@ public: virtual bool parse(Element *elem) { + String s; + if (!parent.getAttribute(elem, "command", s)) + return false; + if (s.size()>0) + command = s; if (!parent.getAttribute(elem, "file", fileName)) return false; if (fileName.size() == 0) @@ -6755,6 +6797,7 @@ public: private: String fileName; + String command; }; @@ -6769,7 +6812,7 @@ public: TaskRC(MakeBase &par) : Task(par) { type = TASK_RC; name = "rc"; - command = "windres -o"; + command = "windres"; } virtual ~TaskRC() @@ -6782,7 +6825,7 @@ public: if (!isNewerThan(fullFile, fullOut)) return true; String cmd = command; - cmd.append(" "); + cmd.append(" -o "); cmd.append(fullOut); cmd.append(" "); cmd.append(flags); @@ -7040,6 +7083,11 @@ public: virtual bool parse(Element *elem) { + String s; + if (!parent.getAttribute(elem, "command", s)) + return false; + if (s.size()>0) + command = s; if (!parent.getAttribute(elem, "file", fileName)) return false; @@ -7426,7 +7474,7 @@ public: * */ virtual String version() - { return "BuildTool v0.3, 2006 Bob Jamison"; } + { return "BuildTool v0.6, 2006 Bob Jamison"; } /** * Overload a <property> @@ -8109,17 +8157,15 @@ bool Make::run() */ bool Make::run(const String &target) { - status("##################################"); - status("# BuildTool"); - status("# version 0.5"); - status("# 21 Nov 06"); - status("##################################"); + status("####################################################"); + status("# %s", version().c_str()); + status("####################################################"); specifiedTarget = target; if (!run()) return false; - status("##################################"); - status("# BuildTool Completed"); - status("##################################"); + status("####################################################"); + status("# BuildTool Completed "); + status("####################################################"); return true; } |
