89 } |
89 } |
90 |
90 |
91 # params: - |
91 # params: - |
92 # eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd |
92 # eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd |
93 defineTest(hbUnixStyle) { |
93 defineTest(hbUnixStyle) { |
94 symbian|win32:!win32-g++ { |
94 contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) { |
95 unixstyle = false |
|
96 } else:win32-g++:isEmpty(QMAKE_SH) { |
|
97 unixstyle = false |
95 unixstyle = false |
98 } else { |
96 } else { |
99 unixstyle = true |
97 unixstyle = true |
100 } |
98 } |
101 return($$unixstyle) |
99 return($$unixstyle) |
102 } |
100 } |
103 |
101 |
104 # params: <path> |
102 # params: <path> |
105 # eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features) |
103 # eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features) |
106 defineReplace(hbNativePath) { |
104 defineReplace(hbNativePath) { |
107 hbUnixStyle() { |
105 contains(QMAKE_HOST.os, Windows) { |
108 return($$quote(\"$$replace(1, "\\", "/")\")) |
106 isEmpty(QMAKE_SH) { |
|
107 1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP) |
|
108 1 = $$replace(1, /, $$QMAKE_DIR_SEP) |
|
109 } else { |
|
110 1 = $$replace(1, \\\\, /) |
|
111 1 = $$replace(1, /, /) |
|
112 } |
109 } else { |
113 } else { |
110 return($$quote(\"$$replace(1, "/", "\\")\")) |
114 1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP) |
|
115 1 = $$replace(1, /, $$QMAKE_DIR_SEP) |
111 } |
116 } |
|
117 |
|
118 return($$quote(\"$$1\")) |
112 } |
119 } |
113 |
120 |
114 # params: <tool name> |
121 # params: <tool name> |
115 # eg. hbfoo.command = $$hbToolCommand(hbfoo) |
122 # eg. hbfoo.command = $$hbToolCommand(hbfoo) |
116 defineReplace(hbToolCommand) { |
123 defineReplace(hbToolCommand) { |
117 # tool in PATH? |
124 symbian { |
118 hbUnixStyle():DEVNULL = /dev/null |
125 # tool in PATH? |
119 else:DEVNULL = nul |
126 exists(/dev/null) { |
120 system($$1 > $$DEVNULL 2>&1):return($$1) |
127 DEVNULL = /dev/null |
|
128 } else { |
|
129 DEVNULL = nul |
|
130 } |
|
131 system($$1 > $$DEVNULL 2>&1):return($$1) |
121 |
132 |
122 # host build is runnable? |
133 # host build is runnable? |
123 hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1) |
134 hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1) |
124 system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd) |
135 system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd) |
125 |
136 |
126 # pre-built tool is runnable? |
137 # tool in HB_BIN_DIR? |
127 hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe")) |
138 hbtoolcmd = $$hbNativePath($$HB_BIN_DIR/$$1) |
128 system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd) |
139 system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd) |
129 |
140 |
|
141 # pre-built tool is runnable? |
|
142 hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe")) |
|
143 system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd) |
|
144 } |
130 # fall back to <builddir>/bin |
145 # fall back to <builddir>/bin |
131 return($$hbNativePath($$HB_BUILD_DIR/bin/$$1)) |
146 return($$hbNativePath($$HB_BUILD_DIR/bin/$$1)) |
132 } |
147 } |
133 |
148 |
134 # params: <file> <dir> |
149 # params: <file> <dir> |
135 defineReplace(hbCopyCommand) { |
150 defineReplace(hbCopyCommand) { |
136 file = $$hbNativePath($$1) |
151 file = $$hbNativePath($$1) |
137 dir = $$hbNativePath($$2) |
152 dir = $$hbNativePath($$2) |
138 |
153 |
139 chk_dir_exists = $$QMAKE_CHK_DIR_EXISTS $$dir |
154 contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) { |
140 mkdir = $$QMAKE_MKDIR $$dir |
155 chk_dir_exists = if not exist $$dir |
141 copy = $$QMAKE_COPY $$file $$dir |
156 mkdir = mkdir $$dir |
|
157 copy = copy /y $$file $$dir |
|
158 } else { |
|
159 chk_dir_exists = test -d $$dir |
|
160 mkdir = mkdir -p $$dir |
|
161 copy = cp $$file $$dir |
|
162 } |
142 |
163 |
143 hbUnixStyle():chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir |
164 hbUnixStyle(): chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir |
144 else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir |
165 else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir |
145 |
166 |
146 return(($$chk_dir_exists_mkdir) && $$copy) |
167 return(($$chk_dir_exists_mkdir) && $$copy) |
147 } |
168 } |