Proposed patch for gcc/MinGW support
May 19, 2012 1:39 AM
Tags: none (add) #xmp #mingwThe patch below enables support for gcc/mingw and gcc/mingw64 support on windows.
- It adds a new target "i80386windows" in the makefiles
- It adds a few additional standard c includes (like <cstring>, <cstdio>)
- It replaces FindNextFile by FindNextFileW to correctly support unicode files on windows
- It is made to have no impact on other targets (linux,solaris,aix,hpux)
The patch is built on top of the 5.1.2 official release.
To get the patch file, simply cut&paste the blue lines below in a file, and apply the patch with you favorite tool.
I can also send the patch file on request.
If someone form Adobe reads this, it would be cool if it could be included in the next releases of the sdk ! ![]()
Matthieu
___________________
Index: build/gcc4/XMPCore.mak
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/build/gcc4/XMPCore.mak,v
retrieving revision 1.1
diff -u -r1.1 XMPCore.mak
--- build/gcc4/XMPCore.mak 19 May 2012 07:44:33 -0000 1.1
+++ build/gcc4/XMPCore.mak 19 May 2012 07:52:27 -0000
@@ -9,10 +9,12 @@
TargetOS = ${os}
ifneq "${TargetOS}" "i80386linux"
- ifneq "${TargetOS}" "sparcsolaris"
- ifneq "${TargetOS}" "rs6000aix"
- ifneq "${TargetOS}" "hppahpux"
- Error += Invalid target OS "${TargetOS}"
+ ifneq "${TargetOS}" "i80386windows"
+ ifneq "${TargetOS}" "sparcsolaris"
+ ifneq "${TargetOS}" "rs6000aix"
+ ifneq "${TargetOS}" "hppahpux"
+ Error += Invalid target OS "${TargetOS}"
+ endif
endif
endif
endif
@@ -22,6 +24,10 @@
ifeq "${TargetOS}" "i80386linux"
OSVer = linux2.6
endif
+ifeq "${TargetOS}" "i80386windows"
+ OSVer = windows7
+ EndianSetting = -DkBigEndianHost=0
+endif
ifeq "${TargetOS}" "sparcsolaris"
OSVer = solaris9
endif
@@ -121,7 +127,13 @@
CPPFlags =
-XMPDefines = -DUNIX_ENV=1 -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1 ${ModeOpt}
+ifeq "${TargetOS}" "i80386windows"
+ XMPDefines = -DWIN_ENV=1
+else
+ XMPDefines = -DUNIX_ENV=1
+endif
+
+XMPDefines += -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1 ${ModeOpt}
ifneq "${TargetArch}" "x64"
XMPDefines += -DXMP_64=0
@@ -169,6 +181,11 @@
LinkFlags += -Wl,-rpath,'$$ORIGIN'
endif
+ifeq "${TargetOS}" "i80386windows"
+ CompileFlags += -mtune=i686
+ LinkFlags += -Wl,-rpath,'$$ORIGIN'
+endif
+
ifeq "${TargetOS}" "sparcsolaris"
CompileFlags += -mcpu=ultrasparc
endif
@@ -298,7 +315,7 @@
@echo "# To build the Adobe XMP Core DLL:"
@echo "# make -f XMPCore.mak [os=<os>] [stage=<stage>] [arch=<arch>]"
@echo "# where"
- @echo "# os = i80386linux | sparcsolaris | rs6000aix | hppahpux"
+ @echo "# os = i80386linux | i80386windows | sparcsolaris | rs6000aix | hppahpux"
@echo "# stage = debug | release"
@echo "# arch = x86 | x64 (just say x86 for anything 32 bit)"
@echo "#"
Index: build/gcc4/XMPFiles.mak
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/build/gcc4/XMPFiles.mak,v
retrieving revision 1.1
diff -u -r1.1 XMPFiles.mak
--- build/gcc4/XMPFiles.mak 19 May 2012 07:44:33 -0000 1.1
+++ build/gcc4/XMPFiles.mak 19 May 2012 07:52:27 -0000
@@ -13,10 +13,12 @@
TargetOS = ${os}
ifneq "${TargetOS}" "i80386linux"
- ifneq "${TargetOS}" "sparcsolaris"
- ifneq "${TargetOS}" "rs6000aix"
- ifneq "${TargetOS}" "hppahpux"
- Error += Invalid target OS "${TargetOS}"
+ ifneq "${TargetOS}" "i80386windows"
+ ifneq "${TargetOS}" "sparcsolaris"
+ ifneq "${TargetOS}" "rs6000aix"
+ ifneq "${TargetOS}" "hppahpux"
+ Error += Invalid target OS "${TargetOS}"
+ endif
endif
endif
endif
@@ -28,6 +30,10 @@
OSVer = linux2.6
EndianSetting = -DkBigEndianHost=0
endif
+ifeq "${TargetOS}" "i80386windows"
+ OSVer = windows7
+ EndianSetting = -DkBigEndianHost=0
+endif
ifeq "${TargetOS}" "sparcsolaris"
OSVer = solaris9
EndianSetting = -DkBigEndianHost=1
@@ -133,7 +139,13 @@
CPPFlags =
-XMPDefines = -DUNIX_ENV=1 -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1 ${EndianSetting} ${ModeOpt}
+ifeq "${TargetOS}" "i80386windows"
+ XMPDefines = -DWIN_ENV=1
+else
+ XMPDefines = -DUNIX_ENV=1
+endif
+
+XMPDefines += -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1 ${EndianSetting} ${ModeOpt}
ifneq "${TargetArch}" "x64"
XMPDefines += -DXMP_64=0
@@ -182,6 +194,11 @@
LinkFlags += -Wl,-rpath,'$$ORIGIN'
endif
+ifeq "${TargetOS}" "i80386windows"
+ CompileFlags += -mtune=i686
+ LinkFlags += -Wl,-rpath,'$$ORIGIN'
+endif
+
ifeq "${TargetOS}" "sparcsolaris"
CompileFlags += -mcpu=ultrasparc
endif
@@ -351,7 +368,7 @@
@echo "# To build the Adobe XMPFiles DLL:"
@echo "# make -f XMPFiles.mak [os=<os>] [stage=<stage>] [arch=<arch>] "
@echo "# where"
- @echo "# os = i80386linux | sparcsolaris | rs6000aix | hppahpux"
+ @echo "# os = i80386linux | i80386windows | sparcsolaris | rs6000aix | hppahpux"
@echo "# stage = debug | release"
@echo "# arch = x86 | x64"
@echo "#"
Index: build/gcc4/XMPToolkit.mak
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/build/gcc4/XMPToolkit.mak,v
retrieving revision 1.1
diff -u -r1.1 XMPToolkit.mak
--- build/gcc4/XMPToolkit.mak 19 May 2012 07:44:33 -0000 1.1
+++ build/gcc4/XMPToolkit.mak 19 May 2012 07:52:27 -0000
@@ -16,10 +16,12 @@
TargetOS = ${os}
ifneq "${TargetOS}" "i80386linux"
- ifneq "${TargetOS}" "sparcsolaris"
- ifneq "${TargetOS}" "rs6000aix"
- ifneq "${TargetOS}" "hppahpux"
- Error += Invalid target OS "${TargetOS}"
+ ifneq "${TargetOS}" "i80386windows"
+ ifneq "${TargetOS}" "sparcsolaris"
+ ifneq "${TargetOS}" "rs6000aix"
+ ifneq "${TargetOS}" "hppahpux"
+ Error += Invalid target OS "${TargetOS}"
+ endif
endif
endif
endif
@@ -92,7 +94,7 @@
@echo "# To build XMPToolkit (XMPCore+XMPFiles):"
@echo "# make -f XMPToolkit.mak os=<os> stage=<stage> arch=<arch> (build|clean|rebuild|listOutput)"
@echo "# "
- @echo "# os = i80386linux | sparcsolaris | rs6000aix | hppahpux"
+ @echo "# os = i80386linux | i80386windows | sparcsolaris | rs6000aix | hppahpux"
@echo "# stage = debug | release"
@echo "# arch = x86 | x64 (just say x86 for anything 32 bit)"
@echo "#"
Index: source/XMPFiles/FormatSupport/XMPScanner.cpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/XMPFiles/FormatSupport/XMPScanner.cpp,v
retrieving revision 1.1
diff -u -r1.1 XMPScanner.cpp
--- source/XMPFiles/FormatSupport/XMPScanner.cpp 19 May 2012 07:44:23 -0000 1.1
+++ source/XMPFiles/FormatSupport/XMPScanner.cpp 19 May 2012 07:52:27 -0000
@@ -21,6 +21,7 @@
#include <cassert>
#include <string>
+#include <cstring>
#include <cstdlib>
#if DEBUG
Index: source/XMPFiles/XMPFiles_Impl.cpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/XMPFiles/XMPFiles_Impl.cpp,v
retrieving revision 1.1
diff -u -r1.1 XMPFiles_Impl.cpp
--- source/XMPFiles/XMPFiles_Impl.cpp 19 May 2012 07:44:28 -0000 1.1
+++ source/XMPFiles/XMPFiles_Impl.cpp 19 May 2012 07:52:27 -0000
@@ -444,7 +444,7 @@
if ( this->dirRef != 0 ) {
- found = FindNextFile ( this->dirRef, &childInfo );
+ found = FindNextFileW ( this->dirRef, &childInfo );
if ( ! found ) return false;
} else {
@@ -467,7 +467,7 @@
// Ignore all children with names starting in '.'. This covers ., .., .DS_Store, etc.
while ( found && (childInfo.cFileName[0] == '.') ) {
- found = FindNextFile ( this->dirRef, &childInfo );
+ found = FindNextFileW ( this->dirRef, &childInfo );
}
if ( ! found ) return false;
Index: source/XMPFiles/XMPFiles_Impl.hpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/XMPFiles/XMPFiles_Impl.hpp,v
retrieving revision 1.1
diff -u -r1.1 XMPFiles_Impl.hpp
--- source/XMPFiles/XMPFiles_Impl.hpp 19 May 2012 07:44:28 -0000 1.1
+++ source/XMPFiles/XMPFiles_Impl.hpp 19 May 2012 07:52:27 -0000
@@ -29,6 +29,8 @@
#include <map>
#include <cassert>
+#include <cstdio>
+#include <cstdlib>
#if XMP_WinBuild
#define snprintf _snprintf
Index: source/common/XMLParserAdapter.hpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/common/XMLParserAdapter.hpp,v
retrieving revision 1.1
diff -u -r1.1 XMLParserAdapter.hpp
--- source/common/XMLParserAdapter.hpp 19 May 2012 07:44:22 -0000 1.1
+++ source/common/XMLParserAdapter.hpp 19 May 2012 07:52:27 -0000
@@ -13,6 +13,7 @@
#include "XMP_Const.h"
#include <string>
+#include <cstring>
#include <vector>
// ===================================================================== ============================
Index: source/common/XML_Node.cpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/common/XML_Node.cpp,v
retrieving revision 1.1
diff -u -r1.1 XML_Node.cpp
--- source/common/XML_Node.cpp 19 May 2012 07:44:22 -0000 1.1
+++ source/common/XML_Node.cpp 19 May 2012 07:52:27 -0000
@@ -10,6 +10,7 @@
#include "XMLParserAdapter.hpp"
#include <map>
+#include <cstdio>
// ! Can't include XMP..._Impl.hpp - used by both Core and Files.
#define XMP_LitNMatch(s,l,n) (std::strncmp((s),(l),(n)) == 0)
Index: source/common/XMP_LibUtils.hpp
===================================================================
RCS file: /cvs/XMP-Toolkit-SDK/source/common/XMP_LibUtils.hpp,v
retrieving revision 1.1
diff -u -r1.1 XMP_LibUtils.hpp
--- source/common/XMP_LibUtils.hpp 19 May 2012 07:44:22 -0000 1.1
+++ source/common/XMP_LibUtils.hpp 19 May 2012 07:52:27 -0000
@@ -14,6 +14,8 @@
#include <map>
#include <string>
+#include <cstring>
+#include <cstdio>
#if XMP_DebugBuild
#include <cassert>