* Build networking components
authorCasper Hornstrup <chorns@users.sourceforge.net>
Sun, 16 Jan 2005 22:26:26 +0000 (22:26 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Sun, 16 Jan 2005 22:26:26 +0000 (22:26 +0000)
* WINE DLL support

svn path=/branches/xmlbuildsystem/; revision=13086

22 files changed:
reactos/drivers/net/dd/directory.xml [new file with mode: 0644]
reactos/drivers/net/dd/ne2000/ne2000.xml [new file with mode: 0644]
reactos/drivers/net/dd/pcnet/pcnet.xml [new file with mode: 0644]
reactos/drivers/net/directory.xml
reactos/drivers/net/ndis/ndis.xml [new file with mode: 0644]
reactos/drivers/net/npf/npf.xml [new file with mode: 0644]
reactos/drivers/net/tcpip/tcpip.xml [new file with mode: 0644]
reactos/drivers/net/tdi/tdi.xml [new file with mode: 0644]
reactos/drivers/net/wshtcpip/wshtcpip.xml [new file with mode: 0644]
reactos/lib/adns/adns.xml [new file with mode: 0644]
reactos/lib/directory.xml
reactos/lib/dnsapi/dnsapi.xml [new file with mode: 0644]
reactos/lib/iphlpapi/iphlpapi.xml [new file with mode: 0644]
reactos/lib/msvcrt/msvcrt.xml
reactos/lib/msvcrt/stdlib/wcstomb.c
reactos/lib/ws2_32/ws2_32.xml [new file with mode: 0644]
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/rbuild.h
reactos/tools/tools.xml
reactos/tools/winebuild/winebuild.xml [new file with mode: 0644]

diff --git a/reactos/drivers/net/dd/directory.xml b/reactos/drivers/net/dd/directory.xml
new file mode 100644 (file)
index 0000000..44def27
--- /dev/null
@@ -0,0 +1,6 @@
+<directory name="ne2000">\r
+       <xi:include href="ne2000/ne2000.xml" />\r
+</directory>\r
+<directory name="pcnet">\r
+       <xi:include href="pcnet/pcnet.xml" />\r
+</directory>\r
diff --git a/reactos/drivers/net/dd/ne2000/ne2000.xml b/reactos/drivers/net/dd/ne2000/ne2000.xml
new file mode 100644 (file)
index 0000000..3a15e15
--- /dev/null
@@ -0,0 +1,11 @@
+<module name="ne2000" type="kernelmodedriver">\r
+       <include base="ne2000">include</include>\r
+       <library>ndis</library>\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <directory name="ne2000">\r
+               <file>8390.c</file>\r
+               <file>main.c</file>\r
+       </directory>\r
+       <file>ne2000.rc</file>\r
+</module>\r
diff --git a/reactos/drivers/net/dd/pcnet/pcnet.xml b/reactos/drivers/net/dd/pcnet/pcnet.xml
new file mode 100644 (file)
index 0000000..d04c745
--- /dev/null
@@ -0,0 +1,11 @@
+<module name="pcnet" type="kernelmodedriver">\r
+       <include base="pcnet">.</include>\r
+       <define name="NDIS50_MINIPORT" />\r
+       <define name="__USE_W32API" />\r
+       <library>ndis</library>\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <file>pcnet.c</file>\r
+       <file>requests.c</file>\r
+       <file>pcnet.rc</file>\r
+</module>\r
index 87b1b49..1ce82d4 100644 (file)
@@ -1,3 +1,21 @@
 <directory name="afd">\r
        <xi:include href="afd/afd.xml" />\r
 </directory>\r
+<directory name="dd">\r
+       <xi:include href="dd/directory.xml" />\r
+</directory>\r
+<directory name="ndis">\r
+       <xi:include href="ndis/ndis.xml" />\r
+</directory>\r
+<directory name="npf">\r
+       <xi:include href="npf/npf.xml" />\r
+</directory>\r
+<directory name="tcpip">\r
+       <xi:include href="tcpip/tcpip.xml" />\r
+</directory>\r
+<directory name="tdi">\r
+       <xi:include href="tdi/tdi.xml" />\r
+</directory>\r
+<directory name="wshtcpip">\r
+       <xi:include href="wshtcpip/wshtcpip.xml" />\r
+</directory>\r
diff --git a/reactos/drivers/net/ndis/ndis.xml b/reactos/drivers/net/ndis/ndis.xml
new file mode 100644 (file)
index 0000000..7381801
--- /dev/null
@@ -0,0 +1,32 @@
+<module name="ndis" type="kernelmodedriver">\r
+       <importlibrary definition="ndis.def"></importlibrary>\r
+       <include base="ndis">include</include>\r
+       <define name="NDIS_WRAPPER" />\r
+       <define name="NDIS50" />\r
+       <define name="NDIS50_MINIPORT" />\r
+       <define name="BINARY_COMPATIBLE" />\r
+       <define name="__USE_W32API" />\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <directory name="ndis">\r
+               <file>40gone.c</file>\r
+               <file>50gone.c</file>\r
+               <file>buffer.c</file>\r
+               <file>cl.c</file>\r
+               <file>cm.c</file>\r
+               <file>co.c</file>\r
+               <file>config.c</file>\r
+               <file>control.c</file>\r
+               <file>efilter.c</file>\r
+               <file>hardware.c</file>\r
+               <file>io.c</file>\r
+               <file>main.c</file>\r
+               <file>memory.c</file>\r
+               <file>miniport.c</file>\r
+               <file>protocol.c</file>\r
+               <file>string.c</file>\r
+               <file>stubs.c</file>\r
+               <file>time.c</file>\r
+       </directory>\r
+       <file>ndis.rc</file>\r
+</module>\r
diff --git a/reactos/drivers/net/npf/npf.xml b/reactos/drivers/net/npf/npf.xml
new file mode 100644 (file)
index 0000000..50df90d
--- /dev/null
@@ -0,0 +1,28 @@
+<module name="npf" type="kernelmodedriver">\r
+       <include base="npf">include</include>\r
+       <include base="ntoskrnl">include</include>\r
+       <define name="WIN_NT_DRIVER" />\r
+       <define name="KQPC_TS" />\r
+       <define name="USE_KLOCKS" />\r
+       <define name="BINARY_COMPATIBLE" />\r
+       <library>ndis</library>\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <file>bucket_lookup.c</file>\r
+       <file>count_packets.c</file>\r
+       <file>dump.c</file>\r
+       <file>functions.c</file>\r
+       <file>jitter.c</file>\r
+       <file>memory_t.c</file>\r
+       <file>normal_lookup.c</file>\r
+       <file>openclos.c</file>\r
+       <file>packet.c</file>\r
+       <file>read.c</file>\r
+       <file>tcp_session.c</file>\r
+       <file>time_calls.c</file>\r
+       <file>tme.c</file>\r
+       <file>win_bpf_filter.c</file>\r
+       <file>win_bpf_filter_init.c</file>\r
+       <file>write.c</file>\r
+       <file>npf.rc</file>\r
+</module>\r
diff --git a/reactos/drivers/net/tcpip/tcpip.xml b/reactos/drivers/net/tcpip/tcpip.xml
new file mode 100644 (file)
index 0000000..96b675a
--- /dev/null
@@ -0,0 +1,40 @@
+<module name="tcpip" type="kernelmodedriver">\r
+       <importlibrary definition="tcpip.def"></importlibrary>\r
+       <include base="tcpip">include</include>\r
+       <include base="oskittcp">include</include>\r
+       <define name="_SEH_NO_NATIVE_NLG" />\r
+       <define name="NDIS40" />\r
+       <define name="__USE_W32API" />\r
+       <library>ip</library>\r
+       <library>oskittcp</library>\r
+       <library>ndis</library>\r
+       <library>rosrtl</library>\r
+       <library>pseh</library>\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <directory name="datalink">\r
+               <file>lan.c</file>\r
+       </directory>\r
+       <directory name="tcpip">\r
+               <file>buffer.c</file>\r
+               <file>bug.c</file>\r
+               <file>dispatch.c</file>\r
+               <file>fileobjs.c</file>\r
+               <file>iinfo.c</file>\r
+               <file>info.c</file>\r
+               <file>irp.c</file>\r
+               <file>lock.c</file>\r
+               <file>main.c</file>\r
+               <file>mockbuffer.c</file>\r
+               <file>mockbug.c</file>\r
+               <file>mocklock.c</file>\r
+               <file>mockpool.c</file>\r
+               <file>mockwait.c</file>\r
+               <file>ninfo.c</file>\r
+               <file>pool.c</file>\r
+               <file>proto.c</file>\r
+               <file>tinfo.c</file>\r
+               <file>wait.c</file>\r
+       </directory>\r
+       <file>tcpip.rc</file>\r
+</module>\r
diff --git a/reactos/drivers/net/tdi/tdi.xml b/reactos/drivers/net/tdi/tdi.xml
new file mode 100644 (file)
index 0000000..9f8be47
--- /dev/null
@@ -0,0 +1,19 @@
+<module name="tdi" type="kernelmodedriver">\r
+       <importlibrary definition="misc/tdi.def"></importlibrary>\r
+       <library>ntoskrnl</library>\r
+       <library>hal</library>\r
+       <directory name="cte">\r
+               <file>string.c</file>\r
+               <file>stubs.c</file>\r
+       </directory>\r
+       <directory name="misc">\r
+               <file>main.c</file>\r
+               <file>tdi.rc</file>\r
+       </directory>\r
+       <directory name="tdi">\r
+               <file>dereg.c</file>\r
+               <file>handler.c</file>\r
+               <file>obsolete.c</file>\r
+               <file>stubs.c</file>\r
+       </directory>\r
+</module>\r
diff --git a/reactos/drivers/net/wshtcpip/wshtcpip.xml b/reactos/drivers/net/wshtcpip/wshtcpip.xml
new file mode 100644 (file)
index 0000000..1632a1f
--- /dev/null
@@ -0,0 +1,11 @@
+<module name="wshtcpip" type="win32dll">\r
+       <importlibrary definition="wshtcpip.def"></importlibrary>\r
+       <include base="wshtcpip">.</include>\r
+       <define name="UNICODE" />\r
+       <define name="__USE_W32API" />\r
+       <library>ntdll</library>\r
+       <library>kernel32</library>\r
+       <library>ws2_32</library>\r
+       <file>wshtcpip.c</file>\r
+       <file>wshtcpip.rc</file>\r
+</module>\r
diff --git a/reactos/lib/adns/adns.xml b/reactos/lib/adns/adns.xml
new file mode 100644 (file)
index 0000000..784440f
--- /dev/null
@@ -0,0 +1,20 @@
+<module name="adns" type="staticlibrary">\r
+       <include base="adns">src</include>\r
+       <include base="adns">adns_win32</include>\r
+       <define name="ADNS_JGAA_WIN32" />\r
+       <directory name="adns_win32">\r
+               <file>adns_unix_calls.c</file>\r
+       </directory>\r
+       <directory name="src">\r
+               <file>check.c</file>\r
+               <file>event.c</file>\r
+               <file>general.c</file>\r
+               <file>parse.c</file>\r
+               <file>poll.c</file>\r
+               <file>query.c</file>\r
+               <file>reply.c</file>\r
+               <file>setup.c</file>\r
+               <file>transmit.c</file>\r
+               <file>types.c</file>\r
+       </directory>\r
+</module>\r
index 38bbfdd..5be1efe 100644 (file)
@@ -1,9 +1,18 @@
+<directory name="adns">\r
+       <xi:include href="adns/adns.xml" />\r
+</directory>\r
 <directory name="advapi32">\r
        <xi:include href="advapi32/advapi32.xml" />\r
 </directory>\r
+<directory name="dnsapi">\r
+       <xi:include href="dnsapi/dnsapi.xml" />\r
+</directory>\r
 <directory name="gdi32">\r
        <xi:include href="gdi32/gdi32.xml" />\r
 </directory>\r
+<directory name="iphlpapi">\r
+       <xi:include href="iphlpapi/iphlpapi.xml" />\r
+</directory>\r
 <directory name="kernel32">\r
        <xi:include href="kernel32/kernel32.xml" />\r
 </directory>\r
@@ -34,3 +43,6 @@
 <directory name="user32">\r
        <xi:include href="user32/user32.xml" />\r
 </directory>\r
+<directory name="ws2_32">\r
+       <xi:include href="ws2_32/ws2_32.xml" />\r
+</directory>\r
diff --git a/reactos/lib/dnsapi/dnsapi.xml b/reactos/lib/dnsapi/dnsapi.xml
new file mode 100644 (file)
index 0000000..0818f02
--- /dev/null
@@ -0,0 +1,26 @@
+<module name="dnsapi" type="win32dll">\r
+       <importlibrary definition="dnsapi.def" />\r
+       <include base="dnsapi">include</include>\r
+       <include base="adns">src</include>\r
+       <include base="adns">adns_win32</include>\r
+       <define name="_DISABLE_TIDENTS" />\r
+       <define name="ADNS_JGAA_WIN32" />\r
+       <define name="__USE_W32API" />\r
+       <library>adns</library>\r
+       <library>rosrtl</library>\r
+       <library>ntdll</library>\r
+       <library>kernel32</library>\r
+       <library>user32</library>\r
+       <library>msvcrt</library>\r
+       <library>ws2_32</library>\r
+       <library>iphlpapi</library>\r
+       <directory name="dnsapi">\r
+               <file>adns.c</file>\r
+               <file>context.c</file>\r
+               <file>free.c</file>\r
+               <file>names.c</file>\r
+               <file>query.c</file>\r
+               <file>stubs.c</file>\r
+       </directory>\r
+       <file>dnsapi.rc</file>\r
+</module>\r
diff --git a/reactos/lib/iphlpapi/iphlpapi.xml b/reactos/lib/iphlpapi/iphlpapi.xml
new file mode 100644 (file)
index 0000000..7b452b8
--- /dev/null
@@ -0,0 +1,27 @@
+<module name="iphlpapi" type="win32dll">\r
+       <dependency>winebuild</dependency>\r
+       <importlibrary definition="iphlpapi.def" />\r
+       <include base="iphlpapi">include</include>\r
+       <include base="ReactOS">include/wine</include>\r
+       <define name="YDEBUG" />\r
+       <define name="UNICODE" />\r
+       <define name="_UNICODE" />\r
+       <define name="__REACTOS__" />\r
+       <define name="__USE_W32API" />\r
+       <library>wine</library>\r
+<!--   <library>wine_uuid</library> -->\r
+       <library>rtl</library>\r
+       <library>ntdll</library>\r
+       <library>kernel32</library>\r
+       <library>advapi32</library>\r
+       <library>ws2_32</library>\r
+       <file>ifenum_reactos.c</file>\r
+       <file>ipstats_reactos.c</file>\r
+       <file>iphlpapi_main.c</file>\r
+       <file>media.c</file>\r
+       <file>registry.c</file>\r
+       <file>resinfo_reactos.c</file>\r
+       <file>route_reactos.c</file>\r
+       <file>iphlpapi.rc</file>\r
+       <file>iphlpapi.spec</file>\r
+</module>\r
index 41d808e..6fa550b 100644 (file)
                <file>swab.c</file>\r
                <file>wcstod.c</file>\r
                <file>wcstol.c</file>\r
-               <file>wcstom.c</file>\r
                <file>wcstomb.c</file>\r
                <file>wcstombs.c</file>\r
                <file>wcstoul.c</file>\r
index c0b5d99..32a3a43 100644 (file)
@@ -46,32 +46,6 @@ static const unsigned char encoding_byte[] =
 size_t
 __wcrtomb (char *s, wchar_t wc);
 
-/*
- * Convert WCHAR into its multibyte character representation,
- * putting this in S and returning its length.
- *
- * Attention: this function should NEVER be intentionally used.
- * The interface is completely stupid.  The state is shared between
- * all conversion functions.  You should use instead the restartable
- * version `wcrtomb'.
- *
- * @implemented
- */
-int
-wctomb (char *s, wchar_t wchar)
-{
-  /* If S is NULL the function has to return null or not null
-     depending on the encoding having a state depending encoding or
-     not.  This is nonsense because any multibyte encoding has a
-     state.  The ISO C amendment 1 corrects this while introducing the
-     restartable functions.  We simply say here all encodings have a
-     state.  */
-  if (s == NULL)
-    return 1;
-
-  return __wcrtomb (s, wchar);
-}
-
 
 size_t
 __wcrtomb (char *s, wchar_t wc)
diff --git a/reactos/lib/ws2_32/ws2_32.xml b/reactos/lib/ws2_32/ws2_32.xml
new file mode 100644 (file)
index 0000000..09e54a9
--- /dev/null
@@ -0,0 +1,26 @@
+<module name="ws2_32" type="win32dll">\r
+       <importlibrary definition="ws2_32.def" />\r
+       <include base="ws2_32">include</include>\r
+       <define name="_DISABLE_TIDENTS" />\r
+       <define name="UNICODE" />\r
+       <define name="LE" />\r
+       <define name="__USE_W32API" />\r
+       <define name="_WIN32_WINNT">0x0500</define>\r
+       <library>ntdll</library>\r
+       <library>kernel32</library>\r
+       <library>user32</library>\r
+       <library>advapi32</library>\r
+       <library>dnsapi</library>\r
+       <directory name="misc">\r
+               <file>bsd.c</file>\r
+               <file>catalog.c</file>\r
+               <file>dllmain.c</file>\r
+               <file>event.c</file>\r
+               <file>handle.c</file>\r
+               <file>ns.c</file>\r
+               <file>sndrcv.c</file>\r
+               <file>stubs.c</file>\r
+               <file>upcall.c</file>\r
+       </directory>\r
+       <file>ws2_32.rc</file>\r
+</module>\r
index 48caff5..cf4d39d 100644 (file)
@@ -166,8 +166,10 @@ MingwBackend::GenerateGlobalVariables ()
        fprintf ( fMakefile, "gcc = gcc\n" );\r
        fprintf ( fMakefile, "ld = ld\n" );\r
        fprintf ( fMakefile, "ar = ar\n" );\r
-       fprintf ( fMakefile, "dlltool = dlltool\n\n" );\r
-       fprintf ( fMakefile, "windres = windres\n\n" );\r
+       fprintf ( fMakefile, "dlltool = dlltool\n" );\r
+       fprintf ( fMakefile, "windres = windres\n" );\r
+       fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild\n" );\r
+       fprintf ( fMakefile, "\n" );\r
        GenerateGlobalCFlagsAndProperties (\r
                "=",\r
                ProjectNode.properties,\r
index 2507b79..3751437 100644 (file)
@@ -70,6 +70,15 @@ MingwModuleHandler::GetExtension ( const string& filename ) const
        return "";\r
 }\r
 \r
+string\r
+MingwModuleHandler::GetBasename ( const string& filename ) const\r
+{\r
+       size_t index = filename.find_last_of ( '.' );\r
+       if (index != string::npos)\r
+               return filename.substr ( 0, index );\r
+       return "";\r
+}\r
+\r
 string\r
 MingwModuleHandler::ReplaceExtension ( const string& filename,\r
                                           const string& newExtension ) const\r
@@ -80,6 +89,19 @@ MingwModuleHandler::ReplaceExtension ( const string& filename,
        return filename;\r
 }\r
 \r
+string\r
+MingwModuleHandler::GetActualSourceFilename ( const string& filename ) const\r
+{\r
+       string extension = GetExtension ( filename );\r
+       if ( extension == ".spec" || extension == "SPEC" )\r
+       {\r
+               string basename = GetBasename( filename );\r
+               return basename + ".stubs.c";\r
+       }\r
+       else\r
+               return filename;\r
+}\r
+\r
 string\r
 MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const\r
 {\r
@@ -120,6 +142,11 @@ MingwModuleHandler::GetModuleDependencies ( const Module& module ) const
                const Module* dependencyModule = dependency->dependencyModule;\r
                dependencies += dependencyModule->GetTargets ();\r
        }\r
+       string definitionDependencies = GetDefinitionDependencies ( module );\r
+       if ( dependencies.length () > 0 && definitionDependencies.length () > 0 )\r
+               dependencies += " " + definitionDependencies;\r
+       else if ( definitionDependencies.length () > 0 )\r
+               dependencies = definitionDependencies;\r
        return dependencies;\r
 }\r
 \r
@@ -143,7 +170,7 @@ MingwModuleHandler::GetSourceFilenames ( const Module& module ) const
 \r
        string sourceFilenames ( "" );\r
        for ( i = 0; i < module.files.size (); i++ )\r
-               sourceFilenames += " " + module.files[i]->name;\r
+               sourceFilenames += " " + GetActualSourceFilename ( module.files[i]->name );\r
        vector<If*> ifs = module.ifs;\r
        for ( i = 0; i < ifs.size(); i++ )\r
        {\r
@@ -152,7 +179,7 @@ MingwModuleHandler::GetSourceFilenames ( const Module& module ) const
                for ( j = 0; j < rIf.ifs.size(); j++ )\r
                        ifs.push_back ( rIf.ifs[j] );\r
                for ( j = 0; j < rIf.files.size(); j++ )\r
-                       sourceFilenames += " " + rIf.files[j]->name;\r
+                       sourceFilenames += " " + GetActualSourceFilename ( rIf.files[j]->name );\r
        }\r
        return sourceFilenames;\r
 }\r
@@ -164,6 +191,8 @@ MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) const
        string extension = GetExtension ( sourceFilename );\r
        if ( extension == ".rc" || extension == ".RC" )\r
                newExtension = ".coff";\r
+       else if ( extension == ".spec" || extension == ".SPEC" )\r
+               newExtension = ".stubs.o";\r
        else\r
                newExtension = ".o";\r
        return FixupTargetFilename ( ReplaceExtension ( sourceFilename,\r
@@ -314,7 +343,7 @@ MingwModuleHandler::GenerateMacro ( const char* assignmentOperation,
        }\r
        fprintf ( fMakefile, "\n" );\r
 }\r
-       \r
+\r
 void\r
 MingwModuleHandler::GenerateMacros (\r
        const char* assignmentOperation,\r
@@ -366,11 +395,15 @@ MingwModuleHandler::GenerateMacros (
                        assignmentOperation );\r
                for ( i = 0; i < files.size(); i++ )\r
                {\r
-                       fprintf (\r
-                               fMakefile,\r
-                               "%s%s",\r
-                               ( i%10 == 9 ? "\\\n\t" : " " ),\r
-                               GetObjectFilename(files[i]->name).c_str() );\r
+                       string extension = GetExtension ( files[i]->name );\r
+                       if ( extension != ".spec" && extension != ".SPEC" )\r
+                       {\r
+                               fprintf (\r
+                                       fMakefile,\r
+                                       "%s%s",\r
+                                       ( i%10 == 9 ? "\\\n\t" : " " ),\r
+                                       GetObjectFilename(files[i]->name).c_str() );\r
+                       }\r
                }\r
                fprintf ( fMakefile, "\n" );\r
        }\r
@@ -443,87 +476,155 @@ MingwModuleHandler::GenerateMacros (
                module.name.c_str () );\r
 }\r
 \r
-string\r
+void\r
 MingwModuleHandler::GenerateGccCommand ( const Module& module,\r
                                          const string& sourceFilename,\r
                                          const string& cc,\r
                                          const string& cflagsMacro ) const\r
 {\r
        string objectFilename = GetObjectFilename ( sourceFilename );\r
-       return ssprintf ( "%s -c %s -o %s %s\n",\r
-                             cc.c_str (),\r
-                             sourceFilename.c_str (),\r
-                             objectFilename.c_str (),\r
-                             cflagsMacro.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "%s: %s\n",\r
+                 objectFilename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                "\t%s -c %s -o %s %s\n",\r
+                cc.c_str (),\r
+                sourceFilename.c_str (),\r
+                objectFilename.c_str (),\r
+                cflagsMacro.c_str () );\r
 }\r
 \r
-string\r
+void\r
 MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module,\r
                                                   const string& sourceFilename,\r
                                                   const string& cc,\r
                                                   const string& cflagsMacro ) const\r
 {\r
        string objectFilename = GetObjectFilename ( sourceFilename );\r
-       return ssprintf ( "%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n",\r
-                         cc.c_str (),\r
-                         sourceFilename.c_str (),\r
-                         objectFilename.c_str (),\r
-                         cflagsMacro.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "%s: %s\n",\r
+                 objectFilename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n",\r
+                 cc.c_str (),\r
+                 sourceFilename.c_str (),\r
+                 objectFilename.c_str (),\r
+                 cflagsMacro.c_str () );\r
 }\r
 \r
-string\r
+void\r
 MingwModuleHandler::GenerateNasmCommand ( const Module& module,\r
                                           const string& sourceFilename,\r
                                           const string& nasmflagsMacro ) const\r
 {\r
        string objectFilename = GetObjectFilename ( sourceFilename );\r
-       return ssprintf ( "%s -f win32 %s -o %s %s\n",\r
-                             "nasm",\r
-                             sourceFilename.c_str (),\r
-                             objectFilename.c_str (),\r
-                             nasmflagsMacro.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "%s: %s\n",\r
+                 objectFilename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t%s -f win32 %s -o %s %s\n",\r
+                 "nasm",\r
+                 sourceFilename.c_str (),\r
+                 objectFilename.c_str (),\r
+                 nasmflagsMacro.c_str () );\r
 }\r
 \r
-string\r
+void\r
 MingwModuleHandler::GenerateWindresCommand ( const Module& module,\r
                                              const string& sourceFilename,\r
                                              const string& windresflagsMacro ) const\r
 {\r
        string objectFilename = GetObjectFilename ( sourceFilename );\r
-       return ssprintf ( "%s %s -o %s ${%s}\n",\r
-                             "${windres}",\r
-                             sourceFilename.c_str (),\r
-                             objectFilename.c_str (),\r
-                             windresflagsMacro.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "%s: %s\n",\r
+                 objectFilename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                "\t%s %s -o %s ${%s}\n",\r
+                "${windres}",\r
+                sourceFilename.c_str (),\r
+                objectFilename.c_str (),\r
+                windresflagsMacro.c_str () );\r
 }\r
 \r
-string\r
-MingwModuleHandler::GenerateCommand ( const Module& module,\r
-                                      const string& sourceFilename,\r
-                                      const string& cc,\r
-                                      const string& cflagsMacro,\r
-                                      const string& nasmflagsMacro,\r
-                                      const string& windresflagsMacro ) const\r
+void\r
+MingwModuleHandler::GenerateWinebuildCommands ( const Module& module,\r
+                                                const string& sourceFilename ) const\r
+{\r
+       string basename = GetBasename ( sourceFilename );\r
+       fprintf ( fMakefile,\r
+                 "%s.def: %s\n",\r
+                 basename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t%s --def=%s -o %s.def\n",\r
+                 "${winebuild}",\r
+                 sourceFilename.c_str (),\r
+                 basename.c_str () );\r
+\r
+       fprintf ( fMakefile,\r
+                 "%s.stubs.c: %s\n",\r
+                 basename.c_str (),\r
+                 sourceFilename.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t%s --pedll=%s -o %s.stubs.c\n",\r
+                 "${winebuild}",\r
+                 sourceFilename.c_str (),\r
+                 basename.c_str () );\r
+}\r
+\r
+void\r
+MingwModuleHandler::GenerateCommands ( const Module& module,\r
+                                       const string& sourceFilename,\r
+                                       const string& cc,\r
+                                       const string& cflagsMacro,\r
+                                       const string& nasmflagsMacro,\r
+                                       const string& windresflagsMacro ) const\r
 {\r
        string extension = GetExtension ( sourceFilename );\r
        if ( extension == ".c" || extension == ".C" )\r
-               return GenerateGccCommand ( module,\r
-                                           sourceFilename,\r
-                                           cc,\r
-                                           cflagsMacro );\r
+       {\r
+               GenerateGccCommand ( module,\r
+                                    sourceFilename,\r
+                                    cc,\r
+                                    cflagsMacro );\r
+               return;\r
+       }\r
        else if ( extension == ".s" || extension == ".S" )\r
-               return GenerateGccAssemblerCommand ( module,\r
-                                                    sourceFilename,\r
-                                                    cc,\r
-                                                    cflagsMacro );\r
+       {\r
+               GenerateGccAssemblerCommand ( module,\r
+                                             sourceFilename,\r
+                                             cc,\r
+                                             cflagsMacro );\r
+               return;\r
+       }\r
        else if ( extension == ".asm" || extension == ".ASM" )\r
-               return GenerateNasmCommand ( module,\r
-                                            sourceFilename,\r
-                                            nasmflagsMacro );\r
+       {\r
+               GenerateNasmCommand ( module,\r
+                                     sourceFilename,\r
+                                     nasmflagsMacro );\r
+               return;\r
+       }\r
        else if ( extension == ".rc" || extension == ".RC" )\r
-               return GenerateWindresCommand ( module,\r
-                                               sourceFilename,\r
-                                               windresflagsMacro );\r
+       {\r
+               GenerateWindresCommand ( module,\r
+                                        sourceFilename,\r
+                                        windresflagsMacro );\r
+               return;\r
+       }\r
+       else if ( extension == ".spec" || extension == ".SPEC" )\r
+       {\r
+               GenerateWinebuildCommands ( module,\r
+                                           sourceFilename );\r
+               GenerateGccCommand ( module,\r
+                                    GetActualSourceFilename ( sourceFilename ),\r
+                                    cc,\r
+                                    cflagsMacro );\r
+               return;\r
+       }\r
 \r
        throw InvalidOperationException ( __FILE__,\r
                                          __LINE__,\r
@@ -614,19 +715,14 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
        for ( i = 0; i < files.size (); i++ )\r
        {\r
                string sourceFilename = files[i]->name;\r
-               string objectFilename = GetObjectFilename ( sourceFilename );\r
-               fprintf ( fMakefile,\r
-                         "%s: %s\n",\r
-                         objectFilename.c_str (),\r
-                         sourceFilename.c_str () );\r
+               GenerateCommands ( module,\r
+                                  sourceFilename,\r
+                                  cc,\r
+                                  cflagsMacro,\r
+                                  nasmflagsMacro,\r
+                                  windresflagsMacro );\r
                fprintf ( fMakefile,\r
-                         "\t%s\n",\r
-                         GenerateCommand ( module,\r
-                                           sourceFilename,\r
-                                           cc,\r
-                                           cflagsMacro,\r
-                                           nasmflagsMacro,\r
-                                           windresflagsMacro ).c_str () );\r
+                         "\n" );\r
        }\r
 \r
        for ( i = 0; i < ifs.size(); i++ )\r
@@ -937,8 +1033,10 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ( const Module& module )
 {\r
        if ( module.importLibrary != NULL )\r
        {\r
-               fprintf ( fMakefile, "%s:\n",\r
-                         module.GetDependencyPath ().c_str () );\r
+               string definitionDependencies = GetDefinitionDependencies ( module );\r
+               fprintf ( fMakefile, "%s: %s\n",\r
+                         module.GetDependencyPath ().c_str (),\r
+                         definitionDependencies.c_str () );\r
 \r
                fprintf ( fMakefile,\r
                          "\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n",\r
@@ -948,6 +1046,44 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ( const Module& module )
        }\r
 }\r
 \r
+string\r
+MingwModuleHandler::GetSpecObjectDependencies ( const string& filename ) const\r
+{\r
+       string basename = GetBasename ( filename );\r
+       return basename + ".def" + " " + basename + ".stubs.c";\r
+}\r
+\r
+string\r
+MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const\r
+{\r
+       string dependencies;\r
+       for ( size_t i = 0; i < module.files.size (); i++ )\r
+       {\r
+               File& file = *module.files[i];\r
+               string extension = GetExtension ( file.name );\r
+               if ( extension == ".spec" || extension == ".SPEC" )\r
+               {\r
+                       if ( dependencies.length () > 0 )\r
+                               dependencies += " ";\r
+                       dependencies += GetSpecObjectDependencies ( file.name );\r
+               }\r
+       }\r
+       return dependencies;\r
+}\r
+\r
+string\r
+MingwModuleHandler::GetLinkingDependencies ( const Module& module ) const\r
+{\r
+       string dependencies = GetImportLibraryDependencies ( module );\r
+       string s = GetDefinitionDependencies ( module );\r
+       if ( s.length () > 0 )\r
+       {\r
+               dependencies += " ";\r
+               dependencies += s;\r
+       }\r
+       return dependencies;\r
+}\r
+\r
 \r
 static MingwBuildToolModuleHandler buildtool_handler;\r
 \r
@@ -1141,6 +1277,7 @@ MingwKernelModeDriverModuleHandler::Process ( const Module& module )
        GenerateInvocations ( module );\r
 }\r
 \r
+\r
 void\r
 MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( const Module& module )\r
 {\r
@@ -1253,8 +1390,8 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module
        static string ros_junk ( "$(ROS_TEMPORARY)" );\r
        string target ( FixupTargetFilename ( module.GetPath () ) );\r
        string workingDirectory = GetWorkingDirectory ( );\r
-       string archiveFilename = GetModuleArchiveFilename ( module );\r
-       string importLibraryDependencies = GetImportLibraryDependencies ( module );\r
+       string objectFilenames = GetObjectFilenames ( module );\r
+       string linkingDependencies = GetLinkingDependencies ( module );\r
 \r
        GenerateImportLibraryTargetIfNeeded ( module );\r
 \r
@@ -1264,14 +1401,14 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module
 \r
                fprintf ( fMakefile, "%s: %s %s\n",\r
                          target.c_str (),\r
-                         archiveFilename.c_str (),\r
-                         importLibraryDependencies.c_str () );\r
+                         objectFilenames.c_str (),\r
+                         linkingDependencies.c_str () );\r
 \r
                string linkerParameters ( "-Wl,--subsystem,console -Wl,--entry,_DllMain@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll" );\r
                GenerateLinkerCommand ( module,\r
                                 "${gcc}",\r
                                 linkerParameters,\r
-                                archiveFilename );\r
+                                objectFilenames );\r
        }\r
        else\r
        {\r
index 7cb54f8..66d76c6 100644 (file)
@@ -20,8 +20,10 @@ public:
 protected:\r
        std::string GetWorkingDirectory () const;\r
        std::string GetExtension ( const std::string& filename ) const;\r
+       std::string GetBasename ( const std::string& filename ) const;\r
        std::string ReplaceExtension ( const std::string& filename,\r
                                       const std::string& newExtension ) const;\r
+       std::string GetActualSourceFilename ( const std::string& filename ) const;\r
        std::string GetModuleArchiveFilename ( const Module& module ) const;\r
        std::string GetImportLibraryDependencies ( const Module& module ) const;\r
        std::string GetModuleDependencies ( const Module& module ) const;\r
@@ -46,6 +48,8 @@ protected:
                                     const std::string& linkerParameters,\r
                                     const std::string& objectFilenames ) const;\r
        void GenerateImportLibraryTargetIfNeeded ( const Module& module ) const;\r
+       std::string GetDefinitionDependencies ( const Module& module ) const;\r
+       std::string GetLinkingDependencies ( const Module& module ) const;\r
        static FILE* fMakefile;\r
 private:\r
        std::string ConcatenatePaths ( const std::string& path1,\r
@@ -79,26 +83,28 @@ private:
        std::string GenerateGccIncludeParameters ( const Module& module ) const;\r
        std::string GenerateGccParameters ( const Module& module ) const;\r
        std::string GenerateNasmParameters ( const Module& module ) const;\r
-       std::string GenerateGccCommand ( const Module& module,\r
-                                        const std::string& sourceFilename,\r
-                                        const std::string& cc,\r
-                                        const std::string& cflagsMacro ) const;\r
-       std::string GenerateGccAssemblerCommand ( const Module& module,\r
-                                                 const std::string& sourceFilename,\r
-                                                 const std::string& cc,\r
-                                                 const std::string& cflagsMacro ) const;\r
-       std::string GenerateNasmCommand ( const Module& module,\r
-                                         const std::string& sourceFilename,\r
-                                         const std::string& nasmflagsMacro ) const;\r
-       std::string GenerateWindresCommand ( const Module& module,\r
-                                            const std::string& sourceFilename,\r
-                                            const std::string& windresflagsMacro ) const;\r
-       std::string GenerateCommand ( const Module& module,\r
+       void GenerateGccCommand ( const Module& module,\r
+                                 const std::string& sourceFilename,\r
+                                 const std::string& cc,\r
+                                 const std::string& cflagsMacro ) const;\r
+       void GenerateGccAssemblerCommand ( const Module& module,\r
+                                          const std::string& sourceFilename,\r
+                                          const std::string& cc,\r
+                                          const std::string& cflagsMacro ) const;\r
+       void GenerateNasmCommand ( const Module& module,\r
+                                  const std::string& sourceFilename,\r
+                                  const std::string& nasmflagsMacro ) const;\r
+       void GenerateWindresCommand ( const Module& module,\r
                                      const std::string& sourceFilename,\r
-                                     const std::string& cc,\r
-                                     const std::string& cflagsMacro,\r
-                                     const std::string& nasmflagsMacro,\r
                                      const std::string& windresflagsMacro ) const;\r
+       void GenerateWinebuildCommands ( const Module& module,\r
+                                        const std::string& sourceFilename ) const;\r
+       void GenerateCommands ( const Module& module,\r
+                               const std::string& sourceFilename,\r
+                               const std::string& cc,\r
+                               const std::string& cflagsMacro,\r
+                               const std::string& nasmflagsMacro,\r
+                               const std::string& windresflagsMacro ) const;\r
        void GenerateObjectFileTargets ( const Module& module,\r
                                         const std::vector<File*>& files,\r
                                         const std::vector<If*>& ifs,\r
@@ -122,6 +128,7 @@ private:
                                        const std::string& ar,\r
                                        const std::string* clags ) const;\r
        std::string GetPreconditionDependenciesName ( const Module& module ) const;\r
+       std::string GetSpecObjectDependencies ( const std::string& filename ) const;\r
 };\r
 \r
 \r
index 6e04168..a7781d2 100644 (file)
@@ -108,7 +108,7 @@ public:
        bool HasImportLibrary () const;\r
        std::string GetTargetName () const;\r
        std::string GetDependencyPath () const;\r
-       std::string GetBasePath() const;\r
+       std::string GetBasePath () const;\r
        std::string GetPath () const;\r
        std::string GetPathWithPrefix ( const std::string& prefix ) const;\r
        std::string GetTargets () const;\r
index dc4f09c..a807939 100644 (file)
@@ -10,3 +10,6 @@
 <directory name="wmc">\r
        <xi:include href="wmc/wmc.xml" />\r
 </directory>\r
+<directory name="winebuild">\r
+       <xi:include href="winebuild/winebuild.xml" />\r
+</directory>\r
diff --git a/reactos/tools/winebuild/winebuild.xml b/reactos/tools/winebuild/winebuild.xml
new file mode 100644 (file)
index 0000000..daf8659
--- /dev/null
@@ -0,0 +1,13 @@
+<module name="winebuild" type="buildtool">\r
+       <include base="winebuild">.</include>\r
+       <include base="ReactOS">include/wine</include>\r
+       <define name="__USE_W32API" />\r
+       <file>import.c</file>\r
+       <file>main.c</file>\r
+       <file>mkstemps.c</file>\r
+       <file>parser.c</file>\r
+       <file>res16.c</file>\r
+       <file>res32.c</file>\r
+       <file>spec32.c</file>\r
+       <file>utils.c</file>\r
+</module>\r