mkspecs/hb_functions.prf
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 7 923ff622b8b9
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/mkspecs/hb_functions.prf	Thu Jul 15 14:03:49 2010 +0100
+++ b/mkspecs/hb_functions.prf	Thu Jul 22 16:36:53 2010 +0100
@@ -48,25 +48,25 @@
     LIBRARY = $$last(PARTS)
 
     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
+    INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
+    DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
 
     LIBS *= -L$${HB_BUILD_DIR}/lib
     LIBS *= -l$$hbLibraryTarget($$LIBRARY)
-    QMAKE_RPATHDIR *= $${HB_BUILD_DIR}/lib
     unix:HB_COVERAGE_EXCLUDE += \"*/$$COLLECTION/*\"
 
     export(LIBS)
     export(INCLUDEPATH)
     export(DEPENDPATH)
-    export(QMAKE_RPATHDIR)
     export(HB_COVERAGE_EXCLUDE)
     return(true)
 }
 
 # params: <collection>
-# NOTE: PUBLIC_HEADERS, INTERNAL_HEADERS, CONVENIENCE_HEADERS
+# NOTE: exports PUBLIC_HEADERS, RESTRICTED_HEADERS and CONVENIENCE_HEADERS
 # eg. hbExportHeaders(hbcore)
 defineTest(hbExportHeaders) {
     for(PUBLIC_HEADER, PUBLIC_HEADERS) {
@@ -74,12 +74,11 @@
         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(PUBLIC_HEADER))
         BLD_INF_RULES.prj_exports *= "$$PUBLIC_HEADER $$EXPORT_PATH"
     }
-    # DO NOT EXPORT PRIVATE HEADERS!
-    #for(INTERNAL_HEADER, INTERNAL_HEADERS) {
-    #    INTERNAL_HEADER = $$section(INTERNAL_HEADER, ":", 1)
-    #    EXPORT_PATH = $$sprintf($$HB_PRIVATE_EXPORT_DIR, $$1, $$basename(INTERNAL_HEADER))
-    #    BLD_INF_RULES.prj_exports *= "$$INTERNAL_HEADER $$EXPORT_PATH"
-    #}
+    for(RESTRICTED_HEADER, RESTRICTED_HEADERS) {
+        RESTRICTED_HEADER = $$section(RESTRICTED_HEADER, ":", 1)
+        EXPORT_PATH = $$sprintf($$HB_RESTRICTED_EXPORT_DIR, $$1, $$basename(RESTRICTED_HEADER))
+        BLD_INF_RULES.prj_exports *= "$$RESTRICTED_HEADER $$EXPORT_PATH"
+    }
     for(CONVENIENCE_HEADER, CONVENIENCE_HEADERS) {
         CONVENIENCE_HEADER = $$section(CONVENIENCE_HEADER, ":", 1)
         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(CONVENIENCE_HEADER))
@@ -92,9 +91,7 @@
 # params: -
 # eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd
 defineTest(hbUnixStyle) {
-    symbian|win32:!win32-g++ {
-        unixstyle = false
-    } else:win32-g++:isEmpty(QMAKE_SH) {
+    contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
         unixstyle = false
     } else {
         unixstyle = true
@@ -105,29 +102,67 @@
 # params: <path>
 # eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features)
 defineReplace(hbNativePath) {
-    hbUnixStyle() {
-        return($$quote(\"$$replace(1, "\\", "/")\"))
+    contains(QMAKE_HOST.os, Windows) {
+        isEmpty(QMAKE_SH) {
+            1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
+            1 = $$replace(1, /, $$QMAKE_DIR_SEP)
+        } else {
+            1 = $$replace(1, \\\\, /)
+            1 = $$replace(1, /, /)
+        }
     } else {
-        return($$quote(\"$$replace(1, "/", "\\")\"))
+        1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
+        1 = $$replace(1, /, $$QMAKE_DIR_SEP)
     }
+    
+    return($$quote(\"$$1\"))
 }
 
 # params: <tool name>
 # eg. hbfoo.command = $$hbToolCommand(hbfoo)
 defineReplace(hbToolCommand) {
-    # tool in PATH?
-    hbUnixStyle():DEVNULL = /dev/null
-    else:DEVNULL = nul
-    system($$1 > $$DEVNULL 2>&1):return($$1)
+    symbian {
+        # tool in PATH?
+        exists(/dev/null) {
+            DEVNULL = /dev/null
+        } else {
+            DEVNULL = nul
+        }
+        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)
+        # host build is runnable?
+        hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
+        system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
 
-    # pre-built tool is runnable?
-    hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe"))
-    system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
+        # tool in HB_BIN_DIR?
+        hbtoolcmd = $$hbNativePath($$HB_BIN_DIR/$$1)
+        system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
 
+        # pre-built tool is runnable?
+        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))
 }
+
+# params: <file> <dir>
+defineReplace(hbCopyCommand) {
+    file = $$hbNativePath($$1)
+    dir = $$hbNativePath($$2)
+
+    contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
+        chk_dir_exists = if not exist $$dir
+        mkdir = mkdir $$dir
+        copy = copy /y $$file $$dir
+    } else {
+        chk_dir_exists = test -d $$dir
+        mkdir = mkdir -p $$dir
+        copy = cp $$file $$dir
+    }
+
+    hbUnixStyle(): chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir
+    else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir
+
+    return(($$chk_dir_exists_mkdir) && $$copy)
+}