Package: libopencascade6.2
Version: 6.2-3
Severity: normal
Tags: patch
Adam, you wrote in http://www.opencascade.org/org/forum/thread_13630/
> After compiling OCC on Linux/AMD64 (specifically, Debian unstable using my
> packages), UndefinedHandleAddress is defined as its 64-bit version in the
> libraries. Unfortunately, Standard_Macro.hxx does not define it while
> compiling a new binary, so there is an inconsistent UndefinedHandleAddress due
> presumably to the inconsistent definition of _OCC64.
Here is a patch to ensure that _OCC64 is defined if needed in
Standard_Macro.hxx
Denis
Fix 64-bit detection
diff --git a/debian/occ6.2.patch b/debian/occ6.2.patch
index e1fef02..469da2e 100644
--- a/debian/occ6.2.patch
+++ b/debian/occ6.2.patch
@@ -1,12 +1,13 @@
diff -aur occ6.2/ros/configure.in mod/ros/configure.in
--- occ6.2/ros/configure.in 2007-08-28 13:07:07.000000000 -0500
+++ mod/ros/configure.in 2007-08-29 14:54:32.207292566 -0500
-@@ -629,6 +629,24 @@
+@@ -629,6 +629,26 @@
CXXFLAGS="$CXXFLAGS_save"
],[AC_MSG_WARN(No --with-stlport-library=DIR was specified)])
+
+# Test for 64-bit platforms
++OCC_define_OCC64="#undef _OCC64"
+AC_CHECK_HEADERS( [stdlib.h inttypes.h stdint.h] )
+AC_MSG_CHECKING([if platform is 64-bit])
+AC_TRY_COMPILE(
@@ -20,12 +21,78 @@ diff -aur occ6.2/ros/configure.in mod/ros/configure.in
+],
+[size_t j;
+ uint64_t* i = &j;
-+], [AC_MSG_RESULT([yes]); CPPFLAGS="$CPPFLAGS -D_OCC64"],
++], [AC_MSG_RESULT([yes]); OCC_define_OCC64="#define _OCC64 1"],
+ [AC_MSG_RESULT([no])] )
++AC_SUBST(OCC_define_OCC64)
+
AC_ENABLE_DEBUG(yes)
AC_DISABLE_PRODUCTION
+@@ -746,4 +764,5 @@
+ adm/make/WOKSH/Makefile \
+ adm/make/WOKLibs/Makefile \
+ adm/make/TKjcas/Makefile \
++inc/Standard_Macro.hxx \
+ ])
+--- /dev/null
++++ mod/ros/inc/Standard_Macro.hxx.in
+@@ -0,0 +1,56 @@
++#ifndef _Standard_Macro_HeaderFile
++# define _Standard_Macro_HeaderFile
++
++# define Handle(ClassName) Handle_##ClassName
++# define Oid(ClassName) Oid_##ClassName
++
++# define STANDARD_TYPE(aType) aType##_Type_()
++
++# if defined(WNT) && !defined(HAVE_NO_DLL)
++
++# ifndef Standard_EXPORT
++# define Standard_EXPORT __declspec( dllexport )
++// For global variables :
++# define Standard_EXPORTEXTERN __declspec( dllexport ) extern
++# define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
++# endif /* Standard_EXPORT */
++
++# ifndef Standard_IMPORT
++# define Standard_IMPORT __declspec( dllimport ) extern
++# define Standard_IMPORTC extern "C" __declspec( dllimport )
++# endif /* Standard_IMPORT */
++
++# else /* WNT */
++
++# ifndef Standard_EXPORT
++# define Standard_EXPORT
++// For global variables :
++# define Standard_EXPORTEXTERN extern
++# define Standard_EXPORTEXTERNC extern "C"
++# endif /* Standard_EXPORT */
++
++# ifndef Standard_IMPORT
++# define Standard_IMPORT extern
++# define Standard_IMPORTC extern "C"
++# endif /* Standard_IMPORT */
++
++# endif /* WNT */
++
++# ifndef __Standard_API
++//# ifdef WNT
++# if !defined(WNT) || defined(__Standard_DLL) || defined(__FSD_DLL) || defined(__MMgt_DLL) || defined(__OSD_DLL) || defined(__Plugin_DLL) || defined(__Quantity_DLL) || defined(__Resource_DLL) || defined(__SortTools_DLL) || defined(__StdFail_DLL) || defined(__Storage_DLL) || defined(__TColStd_DLL) || defined(__TCollection_DLL) || defined(__TShort_DLL) || defined(__Units_DLL) || defined(__UnitsAPI_DLL) || defined(__Dico_DLL)
++# define __Standard_API Standard_EXPORT
++# define __Standard_APIEXTERN Standard_EXPORTEXTERN
++# else
++# define __Standard_API Standard_IMPORT
++# define __Standard_APIEXTERN Standard_IMPORT
++# endif // __Standard_DLL
++//# else
++//# define __Standard_API
++//# endif // WNT
++# endif // __Standard_API
++
++// Define _OCC64 variable on 64-bit platforms
[EMAIL PROTECTED]@
++
++#endif
diff -aur occ6.2/ros/configure.in mod/ros/configure.in
--- occ6.2/ros/configure.in 2007-08-28 13:07:07.000000000 -0500
+++ mod/ros/configure.in 2007-08-29 14:54:32.207292566 -0500
diff --git a/debian/rules b/debian/rules
index 55d77ce..463fcbc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -59,7 +59,7 @@ install: build
$(MAKE) -C ros install DESTDIR=$(CURDIR)/debian/tmp
# Why doesn't OpenCASCADE install its own headers??
cp -a ros/inc debian/tmp/usr/
- rm -f debian/tmp/usr/inc/config.h
+ rm -f debian/tmp/usr/inc/config.h debian/tmp/usr/inc/Standard_Macro.hxx.in
cp -a ros/config.h debian/tmp/usr/inc/
install -d debian/tmp/usr/include
mv debian/tmp/usr/inc debian/tmp/usr/include/opencascade