Code

* src/main.cpp: Allow the user to override the locale directory by
[inkscape.git] / buildtool.cpp
index 8e0fd0e9da1735b0b3946728240f5f98df2e1c59..e2c28b4c0e56204bb76f5b3c976637ab44a8e881 100644 (file)
@@ -4,7 +4,7 @@
  * Authors:
  *   Bob Jamison
  *
- * Copyright (C) 2006 Bob Jamison
+ * Copyright (C) 2006-2007 Bob Jamison
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #include <errno.h>
 
 
-
-
-namespace buildtool
-{
-
-
-
-//########################################################################
-//########################################################################
-//##  U T I L
 //########################################################################
+//# Definition of gettimeofday() for those who don't have it
 //########################################################################
-
 #ifdef __WIN32__
 #include <sys/timeb.h>
 struct timezone {
@@ -94,6 +84,18 @@ static int gettimeofday (struct timeval *tv, struct timezone *tz)
 }
 #endif
 
+
+
+
+
+
+
+namespace buildtool
+{
+
+
+
+
 //########################################################################
 //########################################################################
 //##  R E G E X P
@@ -6498,7 +6500,7 @@ public:
             return false;
         if (!parent.getAttribute(elem, "strip", s))
             return false;
-        if (!getBool(s, doStrip))
+        if (s.size()>0 && !getBool(s, doStrip))
             return false;
         if (!parent.getAttribute(elem, "symfile", symFileName))
             return false;
@@ -6661,6 +6663,7 @@ public:
          name    = "msgfmt";
          command = "msgfmt";
          owndir  = false;
+         outName = "";
          }
 
     virtual ~TaskMsgFmt()
@@ -6702,8 +6705,17 @@ public:
                 destPath.append(subdir);
                 destPath.append("/");
                 }
-            destPath.append(fileName);
-            destPath[destPath.size()-2] = 'm';
+            //Pick the output file name
+            if (outName.size() > 0)
+                {
+                destPath.append(outName);
+                }
+            else
+                {
+                destPath.append(fileName);
+                destPath[destPath.size()-2] = 'm';
+                }
+
             String fullDest = parent.resolve(destPath);
 
             if (!isNewerThan(fullSource, fullDest))
@@ -6748,9 +6760,11 @@ public:
             command = s;
         if (!parent.getAttribute(elem, "todir", toDirName))
             return false;
+        if (!parent.getAttribute(elem, "out", outName))
+            return false;
         if (!parent.getAttribute(elem, "owndir", s))
             return false;
-        if (!getBool(s, owndir))
+        if (s.size()>0 && !getBool(s, owndir))
             return false;
             
         std::vector<Element *> children = elem->getChildren();
@@ -6769,10 +6783,11 @@ public:
 
 private:
 
-    String command;
-    String toDirName;
+    String  command;
+    String  toDirName;
+    String  outName;
     FileSet fileSet;
-    bool owndir;
+    bool    owndir;
 
 };
 
@@ -7506,7 +7521,7 @@ public:
      *
      */
     virtual String version()
-        { return "BuildTool v0.6, 2006 Bob Jamison"; }
+        { return "BuildTool v0.6.1, 2006 Bob Jamison"; }
 
     /**
      * Overload a <property>
@@ -7943,8 +7958,9 @@ bool Make::parsePropertyFile(const String &fileName,
             return false;
             }
         val = s.substr(p);
-        if (key.size()==0 || val.size()==0)
+        if (key.size()==0)
             continue;
+        //allow property to be set, even if val=""
 
         //trace("key:'%s' val:'%s'", key.c_str(), val.c_str());
         //See if we wanted to overload this property
@@ -7989,10 +8005,8 @@ bool Make::parseProperty(Element *elem)
                 {
                 if (!getAttribute(elem, "location", val))
                     return false;
-                if (val.size() > 0)
-                    {
-                    properties[attrVal] = val;
-                    }
+                //let the property exist, even if not defined
+                properties[attrVal] = val;
                 }
             //See if we wanted to overload this property
             std::map<String, String>::iterator iter =
@@ -8206,7 +8220,7 @@ timeDiffString(struct timeval &x, struct timeval &y)
     int millis  = (int)((microsX - microsY)/1000);
 
     int minutes = seconds/60;
-    seconds += minutes*60;
+    seconds -= minutes*60;
     char buf[80];
     snprintf(buf, 79, "%dm %d.%03ds", minutes, seconds, millis);
     String ret = buf;