changeset 3638:af91c561ff39

openscenegraph: allow cross compile to succeed * src/openscenegraph.mk: add -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED_EXITCODE=0, build out of source, enable static/dynamic libs * src/openscenegraph-1-fixes.patch: new file * dist-files.mk: added openscenegraph-1-fixes.patch
author John Donoghue
date Wed, 02 Jul 2014 15:27:12 -0400
parents 4866edf6f9f3
children feacee2273d9
files dist-files.mk src/openscenegraph-1-fixes.patch src/openscenegraph.mk
diffstat 3 files changed, 75 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Tue Jul 01 08:39:54 2014 -0400
+++ b/dist-files.mk	Wed Jul 02 15:27:12 2014 -0400
@@ -455,6 +455,7 @@
   opencsg-1-fixes.patch \
   opencsg.mk \
   openexr.mk \
+  openscenegraph-1-fixes.patch \
   openscenegraph.mk \
   openssl-1-fixes.patch \
   openssl.mk \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/openscenegraph-1-fixes.patch	Wed Jul 02 15:27:12 2014 -0400
@@ -0,0 +1,59 @@
+diff -ur OpenSceneGraph-3.2.0.orig/src/osgPlugins/osc/CMakeLists.txt OpenSceneGraph-3.2.0/src/osgPlugins/osc/CMakeLists.txt
+--- OpenSceneGraph-3.2.0.orig/src/osgPlugins/osc/CMakeLists.txt	2014-07-02 11:35:37.621624169 -0400
++++ OpenSceneGraph-3.2.0/src/osgPlugins/osc/CMakeLists.txt	2014-07-02 14:35:50.862890363 -0400
+@@ -35,7 +35,7 @@
+         ip/win32/NetworkingUtils.cpp
+         ip/win32/UdpSocket.cpp
+     )
+-    SET(TARGET_EXTERNAL_LIBRARIES "${TARGET_EXTERNAL_LIBRARIES};Ws2_32.lib;winmm")
++    SET(TARGET_EXTERNAL_LIBRARIES "${TARGET_EXTERNAL_LIBRARIES};ws2_32.lib;winmm")
+ ELSE()
+     SET(TARGET_SRC
+         ${TARGET_SRC}
+diff -ur OpenSceneGraph-3.2.0.orig/src/osgPlugins/vrml/CMakeLists.txt OpenSceneGraph-3.2.0/src/osgPlugins/vrml/CMakeLists.txt
+--- OpenSceneGraph-3.2.0.orig/src/osgPlugins/vrml/CMakeLists.txt	2014-07-02 11:35:37.621624169 -0400
++++ OpenSceneGraph-3.2.0/src/osgPlugins/vrml/CMakeLists.txt	2014-07-02 14:37:13.893542090 -0400
+@@ -27,7 +27,7 @@
+         PNG_LIBRARY
+         ZLIB_LIBRARY)
+     SET(TARGET_EXTERNAL_LIBRARIES
+-        Ws2_32.lib)
++        ws2_32.lib)
+ ELSE()
+     SET(TARGET_LIBRARIES_VARS
+         OPENVRML_LIBRARY)
+diff -ur OpenSceneGraph-3.2.0.orig/src/osgPlugins/xine/video_out_rgb.c OpenSceneGraph-3.2.0/src/osgPlugins/xine/video_out_rgb.c
+--- OpenSceneGraph-3.2.0.orig/src/osgPlugins/xine/video_out_rgb.c	2014-07-02 11:35:37.603623810 -0400
++++ OpenSceneGraph-3.2.0/src/osgPlugins/xine/video_out_rgb.c	2014-07-02 11:45:53.301901931 -0400
+@@ -81,6 +81,19 @@
+ 	ptr = NULL;\
+ }
+ 
++// xine removed the xine_xmalloc_aligned function in later versions
++#if ((XINE_MAJOR_VERSION<<8)|XINE_MINOR_VERSION) >= 0x102
++  static void * xine_xmalloc_aligned(size_t alignment, size_t size, void **base)
++  {
++    char * ptr;
++
++    *base = ptr = xine_xmalloc(size+alignment);
++    while((size_t)ptr % alignment)
++      ptr ++;
++    return *ptr;
++  } 
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+diff -ur OpenSceneGraph-3.2.0.orig/src/osgPlugins/ZeroConfDevice/CMakeLists.txt OpenSceneGraph-3.2.0/src/osgPlugins/ZeroConfDevice/CMakeLists.txt
+--- OpenSceneGraph-3.2.0.orig/src/osgPlugins/ZeroConfDevice/CMakeLists.txt	2014-07-02 11:35:37.596623671 -0400
++++ OpenSceneGraph-3.2.0/src/osgPlugins/ZeroConfDevice/CMakeLists.txt	2014-07-02 14:37:48.777236043 -0400
+@@ -19,7 +19,7 @@
+         mdns_win/dns_sd.h
+         mdns_win/dns-sd.c
+     )
+-    SET(TARGET_EXTERNAL_LIBRARIES "${TARGET_EXTERNAL_LIBRARIES};Ws2_32.lib;winmm")
++    SET(TARGET_EXTERNAL_LIBRARIES "${TARGET_EXTERNAL_LIBRARIES};ws2_32.lib;winmm")
+     SET(TARGET_LIBRARIES_VARS ZEROCONF_LIBRARY)
+     ADD_DEFINITIONS(-DNOT_HAVE_GETOPT)
+     ADD_DEFINITIONS(-DNOT_HAVE_SETLINEBUF)
--- a/src/openscenegraph.mk	Tue Jul 01 08:39:54 2014 -0400
+++ b/src/openscenegraph.mk	Wed Jul 02 15:27:12 2014 -0400
@@ -10,6 +10,12 @@
 $(PKG)_URL      := http://www.openscenegraph.org/downloads/developer_releases/$($(PKG)_FILE)
 $(PKG)_DEPS     := boost curl dcmtk ffmpeg freetype gdal giflib gta jasper jpeg libpng openal openexr poppler qt tiff xine-lib zlib
 
+ifeq ($(BUILD_SHARED),yes)
+    $(PKG)_SHARED := ON
+else
+    $(PKG)_SHARED := OFF
+endif
+
 define $(PKG)_UPDATE
     $(WGET) -q -O- 'http://www.openscenegraph.org/downloads/developer_releases/?C=M;O=D' | \
     $(SED) -n 's,.*OpenSceneGraph-\([0-9]*\.[0-9]*[02468]\.[^<]*\)\.zip.*,\1,p' | \
@@ -19,17 +25,19 @@
 endef
 
 define $(PKG)_BUILD
-    cd '$(1)' && cmake . \
+    mkdir -p '$(1)/.build'
+    cd '$(1)/.build' && cmake .. \
         -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
         -DCMAKE_CXX_FLAGS=-D__STDC_CONSTANT_MACROS \
-        -DCMAKE_HAVE_PTHREAD_H=OFF \
+        -DCMAKE_HAVE_PTHREAD_H=ON \
         -DPKG_CONFIG_EXECUTABLE='$(MXE_PKG_CONFIG)' \
-        -DDYNAMIC_OPENTHREADS=OFF \
-        -DDYNAMIC_OPENSCENEGRAPH=OFF \
+        -DDYNAMIC_OPENTHREADS=$($(PKG)_SHARED) \
+        -DDYNAMIC_OPENSCENEGRAPH=$($(PKG)_SHARED) \
         -DBUILD_OSG_APPLICATIONS=OFF \
         -DPOPPLER_HAS_CAIRO_EXITCODE=0 \
-        -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE=1
-    $(MAKE) -C '$(1)' -j '$(JOBS)' VERBOSE=1
-    $(MAKE) -C '$(1)' -j 1 install
+        -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE=1 \
+        -D_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED_EXITCODE=0
+    $(MAKE) -C '$(1)/.build' -j '$(JOBS)' VERBOSE=1
+    $(MAKE) -C '$(1)/.build' -j 1 install
 endef