mkspecs/hb_functions.prf
changeset 23 e6ad4ef83b23
parent 21 4633027730f5
child 30 80e4d18b72f5
--- a/mkspecs/hb_functions.prf	Wed Aug 18 10:05:37 2010 +0300
+++ b/mkspecs/hb_functions.prf	Thu Sep 02 20:44:51 2010 +0300
@@ -65,6 +65,29 @@
     return(true)
 }
 
+# params: <path>
+# eg. foo_path = $$hbStripDriveLetter($$PWD)/foo.txt
+defineReplace(hbStripDriveLetter) {
+    stripped_path = $$1
+    symbian {
+        contains(QMAKE_HOST.os, Windows) {
+            colons_found = $$find( stripped_path, "\\:" )
+            !isEmpty(colons_found) {
+                stripped_path = $$section(stripped_path, ":", 1)
+            }         
+        }
+    }
+    return($$stripped_path)
+}
+
+# params: <sourcepath> <targetpath>
+# e.g. hbPrjExport("$${PWD}/foo.txt", "$${EPOCROOT}epoc32/release/foo.txt")
+defineTest(hbPrjExport) {
+    BLD_INF_RULES.prj_exports += "$$hbStripDriveLetter($$1) $$hbStripDriveLetter($$2)"
+    export(BLD_INF_RULES.prj_exports)
+    return(true)
+}
+
 # params: <collection>
 # NOTE: exports PUBLIC_HEADERS, RESTRICTED_HEADERS and CONVENIENCE_HEADERS
 # eg. hbExportHeaders(hbcore)
@@ -131,8 +154,10 @@
         system($$1 > $$DEVNULL 2>&1):return($$1)
 
         # host build is runnable?
-        hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
-        system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
+        !isEmpty(HB_BUILD_DIR) {
+            hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
+            system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
+        }
 
         # tool in HB_BIN_DIR?
         hbtoolcmd = $$hbNativePath($$HB_BIN_DIR/$$1)
@@ -142,8 +167,14 @@
         hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe"))
         system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
     }
-    # fall back to <builddir>/bin
-    return($$hbNativePath($$HB_BUILD_DIR/bin/$$1))
+
+    !isEmpty(HB_BUILD_DIR) {
+        # prefer <builddir>/bin
+        return($$hbNativePath($$HB_BUILD_DIR/bin/$$1))
+    } else {
+        # fall back to <bindir>
+        return($$hbNativePath($$HB_BIN_DIR/$$1))
+    }
 }
 
 # params: <file> <dir>