Index: trunk/mkspecs/os2-g++/cp_qmldir.cmd
===================================================================
--- trunk/mkspecs/os2-g++/cp_qmldir.cmd	(revision 1053)
+++ trunk/mkspecs/os2-g++/cp_qmldir.cmd	(revision 1053)
@@ -0,0 +1,130 @@
+/* REXX */
+/*
+ * Renames long DLL name to short name in the qmldir file.
+ */
+
+'@echo off'
+
+if (RxFuncQuery('SysLoadFuncs')) then do
+    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
+    call SysLoadFuncs
+end
+
+Globals = 'G.'
+
+parse arg aArgs
+
+aArgs = strip(aArgs)
+call TokenizeString aArgs, 'G.Args'
+if (G.Args.0 < 4) then do
+    say "Usage: cp_qmldir <qmldir_in> <qmldir_out> <target> <target_short>"
+    exit 255
+end
+
+qmldir_in = G.Args.1
+qmldir_out = G.Args.2
+target = G.Args.3
+target_short = G.Args.4
+
+rc = SysFileDelete(qmldir_out)
+if (rc \= 0 & rc \= 2) then do
+    say 'ERROR: Cannot delete "'qmldir_out'" (code 'rc').'
+    exit 1
+end
+
+if (stream(qmldir_in, 'C', 'QUERY EXISTS') == '') then do
+    say 'ERROR: Cannot find "'qmldir_in'".'
+    exit 1
+end
+
+do while lines(qmldir_in)
+    str = linein(qmldir_in)
+    parse var str s1 s2 .
+    if (s1 == 'plugin') then do
+        if (s2 == target) then
+            str = s1 target_short
+    end
+    rc = lineout(qmldir_out, str)
+    if (rc \= 0) then do
+        say 'ERROR: Cannot write to "'qmldir_out'".'
+        exit 1
+    end
+end
+call lineout qmldir_out
+
+exit rc
+
+/**
+ *  Returns a list of all words from the string as a stem.
+ *  Delimiters are spaces, tabs and new line characters.
+ *  Words containg spaces must be enclosed with double
+ *  quotes. Double quote symbols that need to be a part
+ *  of the word, must be doubled.
+ *
+ *  @param string   the string to tokenize
+ *  @param stem
+ *      the name of the stem. The stem must be global
+ *      (i.e. its name must start with 'G.!'), for example,
+ *      'G.!wordlist'.
+ *  @param leave_ws
+ *      1 means whitespace chars are considered as a part of words they follow.
+ *      Leading whitespace (if any) is always a part of the first word (if any).
+ *
+ *  @version 1.1
+ */
+TokenizeString: procedure expose (Globals)
+
+    parse arg string, stem, leave_ws
+    leave_ws = (leave_ws == 1)
+
+    delims  = '20090D0A'x
+    quote   = '22'x /* " */
+
+    num = 0
+    token = ''
+
+    len = length(string)
+    last_state = '' /* D - in delim, Q - in quotes, W - in word */
+    seen_QW = 0
+
+    do i = 1 to len
+        c = substr(string, i, 1)
+        /* determine a new state */
+        if (c == quote) then do
+            if (last_state == 'Q') then do
+                /* detect two double quotes in a row */
+                if (substr(string, i + 1, 1) == quote) then i = i + 1
+                else state = 'W'
+            end
+            else state = 'Q'
+        end
+        else if (verify(c, delims) == 0 & last_state \== 'Q') then do
+            state = 'D'
+        end
+        else do
+            if (last_state == 'Q') then state = 'Q'
+            else state = 'W'
+        end
+        /* process state transitions */
+        if ((last_state == 'Q' | state == 'Q') & state \== last_state) then c = ''
+        else if (state == 'D' & \leave_ws) then c = ''
+        if (last_state == 'D' & state \== 'D' & seen_QW) then do
+            /* flush the token */
+            num = num + 1
+            call value stem'.'num, token
+            token = ''
+        end
+        token = token||c
+        last_state = state
+        seen_QW = (seen_QW | state \== 'D')
+    end
+
+    /* flush the last token if any */
+    if (token \== '' | seen_QW) then do
+        num = num + 1
+        call value stem'.'num, token
+    end
+
+    call value stem'.0', num
+
+    return
Index: trunk/mkspecs/os2-g++/qmake.conf
===================================================================
--- trunk/mkspecs/os2-g++/qmake.conf	(revision 1051)
+++ trunk/mkspecs/os2-g++/qmake.conf	(revision 1053)
@@ -179,3 +179,5 @@
 QMAKE_ENDIF     = endif
 
+QMAKE_COPY_QMLDIR   = $(QMAKESPECDIR)\\cp_qmldir.cmd
+
 load(qt_config)
