[PATCH] Some windows build enhancements

Mladen Turk <[email protected]>
Newsgroups gmane.comp.apache.apreq
Message-ID <[email protected]>
Hi,

libapreq is missing .rc file, so here is a standard ASF one.
Also, added APREQ_DECLARE_EXPORT/APREQ_DECLARE_STATIC
in the same way as APR declares so that dllexport/dllimport
get correctly handled.



Regards
--
(TM)
libapreq.rc (text/plain, 2.3 KB)
#include "apreq_version.h"

#define APREQ_COPYRIGHT "Copyright 2000-2008 The Apache Software " \
                      "Foundation or its licensors, as applicable."

#define APREQ_LICENSE "Licensed under the Apache License, Version 2.0 " \
                    "(the ""License""); you may not use this file except " \
                    "in compliance with the License.  You may obtain a " \
                    "copy of the License at\r\n\r\n" \
                    "http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n" \
                    "Unless required by applicable law or agreed to in " \
                    "writing, software distributed under the License is " \
                    "distributed on an ""AS IS"" BASIS, WITHOUT " \
                    "WARRANTIES OR CONDITIONS OF ANY KIND, either " \
                    "express or implied.  See the License for the " \
                    "specific language governing permissions and " \
                    "limitations under the License."

#define APREQ_DLL_BASENAME "libapreq-" APR_STRINGIFY(APREQ_MAJOR_VERSION)
#define APREQ_VERSION_STRING_CSV APREQ_MAJOR_VERSION ##, \
                             ##APREQ_MINOR_VERSION ##, \
                             ##APREQ_PATCH_VERSION


1 VERSIONINFO
 FILEVERSION APREQ_VERSION_STRING_CSV,0
 PRODUCTVERSION APREQ_VERSION_STRING_CSV,0
 FILEFLAGSMASK 0x3fL
#if defined(APREQ_IS_DEV_VERSION)
#if defined(_DEBUG)
 FILEFLAGS 0x03L
#else
 FILEFLAGS 0x02L
#endif
#else
#if defined(_DEBUG)
 FILEFLAGS 0x01L
#else
 FILEFLAGS 0x00L
#endif
#endif
#if defined(WINNT) || defined(WIN64)
 FILEOS 0x40004L
#else
 FILEOS 0x4L
#endif
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904b0"
    BEGIN
    VALUE "Comments", APREQ_LICENSE "\0"
      VALUE "CompanyName", "Apache Software Foundation\0"
      VALUE "FileDescription", "Apache HTTP Server Request Library\0"
      VALUE "FileVersion", APREQ_VERSION_STRING "\0"
      VALUE "InternalName", APREQ_DLL_BASENAME "\0"
      VALUE "LegalCopyright", APREQ_COPYRIGHT "\0"
      VALUE "OriginalFilename", APREQ_DLL_BASENAME ".dll\0"
      VALUE "ProductName", "Apache HTTP Server Project\0"
      VALUE "ProductVersion", APREQ_VERSION_STRING "\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 1200
  END
END
patch.txt (text/plain, 3.5 KB)
Index: include/apreq.h
===================================================================
--- include/apreq.h	(revision 651220)
+++ include/apreq.h	(working copy)
@@ -69,10 +69,18 @@
  * APREQ_DECLARE_DATA type apr_variable = value;
  */
 #define APREQ_DECLARE_DATA
-#else
+#elif defined (APREQ_DECLARE_STATIC)
+#define APREQ_DECLARE(type)             type __stdcall
+#define APREQ_DECLARE_NONSTD(type)      type
+#define APREQ_DECLARE_DATA
+#elif defined (APREQ_DECLARE_EXPORT)
 #define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
 #define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
 #define APREQ_DECLARE_DATA              __declspec(dllexport)
+#else
+#define APREQ_DECLARE(type)             __declspec(dllimport) type __stdcall
+#define APREQ_DECLARE_NONSTD(type)      __declspec(dllimport) type
+#define APREQ_DECLARE_DATA              __declspec(dllimport)
 #endif
 
 /**
Index: win32/apreq2_test.mak
===================================================================
--- win32/apreq2_test.mak	(revision 651220)
+++ win32/apreq2_test.mak	(working copy)
@@ -127,7 +127,7 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB"/YX /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /FD /GZ  /c 
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /FD /GZ  /c 
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(LIBDIR)\apreq2_test.bsc" 
 LIB32=link.exe -lib
Index: win32/libapreq2.mak
===================================================================
--- win32/libapreq2.mak	(revision 651220)
+++ win32/libapreq2.mak	(working copy)
@@ -68,6 +68,7 @@
         "$(INTDIR)\module_custom.obj" \
         "$(INTDIR)\module_cgi.obj" \
         "$(INTDIR)\error.obj" \
+        "$(INTDIR)\libprocrun.res" \
 	"$(APR_LIB)" \
 	"$(APU_LIB)"
 
@@ -78,8 +79,10 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /YX /FD /c 
+CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APREQ_DECLARE_EXPORT" /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /YX /FD /c 
 MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /i "$(APACHE)\include" /d "NDEBUG" /i "$(APREQ_HOME)\include"
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapreq2.bsc" 
 LINK32=link.exe
@@ -99,8 +102,10 @@
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /YX /FD /GZ  /c 
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APREQ_DECLARE_EXPORT" /I"$(APACHE)\include" /I"$(APREQ_HOME)\include" /YX /FD /GZ  /c 
 MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /i "$(APACHE)\include" /d "_DEBUG /i "$(APREQ_HOME)\include"
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapreq2.bsc" 
 LINK32=link.exe
@@ -208,5 +213,10 @@
 "$(INTDIR)\error.obj" : $(SOURCE) "$(INTDIR)"
         $(CPP) /Fo"$(INTDIR)\error.obj" $(CPP_PROJ) $(SOURCE)
 
+SOURCE=.\libapreq.rc
+
+"$(INTDIR)\libapreq.res" : $(SOURCE) "$(INTDIR)"
+	$(RSC) /fo"$(INTDIR)\libapreq.res" $(RSC_PROJ) $(SOURCE)
+
 !ENDIF
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.