From e3ada8de4965ff07aee7b614c1dc4220dfb9933b Mon Sep 17 00:00:00 2001 From: Volker Grabsch Date: Wed, 27 Jan 2010 00:12:53 +0100 Subject: improvements for package openscenegraph (by Martin Lambers) * Add -DOSG_LIBRARY_STATIC to openscenegraph-osg.pc Cflags * Update the documentation * Update the openscenegraph-2-static.patch to a more general version that is now submitted to upstream * Add openscenegraph-4-png.patch from upstream SVN which fixes compilation with libpng-1.4. Remove openscenegraph-4-disable-png.patch and reenable the PNG plugin. --- doc/index.html | 33 +++++++++++++++------------------ src/openscenegraph-1-pkg-config.patch | 4 ++-- src/openscenegraph-2-static.patch | 19 ++++++------------- src/openscenegraph-4-disable-png.patch | 16 ---------------- src/openscenegraph-4-png.patch | 19 +++++++++++++++++++ 5 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 src/openscenegraph-4-disable-png.patch create mode 100644 src/openscenegraph-4-png.patch diff --git a/doc/index.html b/doc/index.html index ae70dd6..7b12275 100644 --- a/doc/index.html +++ b/doc/index.html @@ -364,32 +364,29 @@ AR=$(CROSS)ar

Step 5d: Cross compile your Project (OSG)

- Using static OpenSceneGraph libraries requires a few changes to your source: + Using static OpenSceneGraph libraries requires a few changes to your source. + The graphics subsystem and all plugins required by your application must be + referenced explicitly. Use a code block like the following:

- +
#ifdef OSG_LIBRARY_STATIC
+USE_GRAPHICSWINDOW()
+USE_OSGPLUGIN(<plugin1>)
+USE_OSGPLUGIN(<plugin2>)
+...
+#endif

Look at examples/osgstaticviewer/osgstaticviewer.cpp in the OpenSceneGraph source distribution for an example. This example can be - compiled with + compiled with the following command:

-
i686-pc-mingw32-g++ -DOSG_LIBRARY_STATIC \
+    
i686-pc-mingw32-g++ \
     -o osgstaticviewer.exe examples/osgstaticviewer/osgstaticviewer.cpp \
     `i686-pc-mingw32-pkg-config --cflags openscenegraph-osgViewer openscenegraph-osgPlugins` \
     `i686-pc-mingw32-pkg-config --static --libs openscenegraph-osgViewer openscenegraph-osgPlugins`
+

+ The i686-pc-mingw32-pkg-config command from mingw-cross-env will + automatically add -DOSG_LIBRARY_STATIC to your compiler flags. +

Further Steps

diff --git a/src/openscenegraph-1-pkg-config.patch b/src/openscenegraph-1-pkg-config.patch index 2860524..0b4d740 100644 --- a/src/openscenegraph-1-pkg-config.patch +++ b/src/openscenegraph-1-pkg-config.patch @@ -195,7 +195,7 @@ diff -uNr OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osg.pc.in +Conflicts: +Libs: -L${libdir} -losg +Libs.private: -lglu32 -lopengl32 -+Cflags: -I${includedir} ++Cflags: -I${includedir} -DOSG_LIBRARY_STATIC diff -uNr OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osgPlugins.pc.in OpenSceneGraph-2.8.2/packaging/pkgconfig/openscenegraph-osgPlugins.pc.in --- OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osgPlugins.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ OpenSceneGraph-2.8.2/packaging/pkgconfig/openscenegraph-osgPlugins.pc.in 2010-01-17 18:59:13.000000000 +0100 @@ -213,7 +213,7 @@ diff -uNr OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osgPlugin +Requires: openscenegraph-osgParticle openscenegraph-osgWidget openscenegraph-osgVolume openscenegraph-osgShadow openscenegraph-osgTerrain openscenegraph-osgFX openscenegraph-osgSim openscenegraph-osgText openscenegraph-osgAnimation openscenegraph-osgViewer openscenegraph-osgDB openscenegraph-osgUtil openscenegraph-osg openthreads +Conflicts: +Libs: -+Libs.private: -L${libdir}/osgPlugins-@OPENSCENEGRAPH_VERSION@ -losgdb_3dc -losgdb_3ds -losgdb_ac -losgdb_bmp -losgdb_bsp -losgdb_bvh -losgdb_cfg -losgdb_curl -losgdb_dds -losgdb_dot -losgdb_dw -losgdb_dxf -losgdb_exr -losgdb_freetype -losgdb_gdal -losgdb_geo -losgdb_gif -losgdb_glsl -losgdb_gz -losgdb_hdr -losgdb_ive -losgdb_jp2 -losgdb_jpeg -losgdb_logo -losgdb_lwo -losgdb_lws -losgdb_md2 -losgdb_mdl -losgdb_normals -losgdb_obj -losgdb_ogr -losgdb_openflight -losgdb_osg -losgdb_osga -losgdb_osganimation -losgdb_osgfx -losgdb_osgparticle -losgdb_osgshadow -losgdb_osgsim -losgdb_osgterrain -losgdb_osgtext -losgdb_osgtgz -losgdb_osgviewer -losgdb_osgvolume -losgdb_osgwidget -losgdb_pic -losgdb_pnm -losgdb_rgb -losgdb_rot -losgdb_scale -losgdb_shp -losgdb_stl -losgdb_tga -losgdb_tgz -losgdb_tiff -losgdb_trans -losgdb_txf -losgdb_txp -losgdb_vtf -losgdb_x -losgdb_zip -lcurl -lgnutls -lgcrypt -lgpg-error -lidn -lIlmImf -lHalf -lImath -lIlmThread -lIex -lfreetype -lgdal -ltiff -lgif -ljasper -ljpeg -liconv -lz -lws2_32 -lwinmm -lwldap32 ++Libs.private: -L${libdir}/osgPlugins-@OPENSCENEGRAPH_VERSION@ -losgdb_3dc -losgdb_3ds -losgdb_ac -losgdb_bmp -losgdb_bsp -losgdb_bvh -losgdb_cfg -losgdb_curl -losgdb_dds -losgdb_dot -losgdb_dw -losgdb_dxf -losgdb_exr -losgdb_freetype -losgdb_gdal -losgdb_geo -losgdb_gif -losgdb_glsl -losgdb_gz -losgdb_hdr -losgdb_ive -losgdb_jp2 -losgdb_jpeg -losgdb_logo -losgdb_lwo -losgdb_lws -losgdb_md2 -losgdb_mdl -losgdb_normals -losgdb_obj -losgdb_ogr -losgdb_openflight -losgdb_osg -losgdb_osga -losgdb_osganimation -losgdb_osgfx -losgdb_osgparticle -losgdb_osgshadow -losgdb_osgsim -losgdb_osgterrain -losgdb_osgtext -losgdb_osgtgz -losgdb_osgviewer -losgdb_osgvolume -losgdb_osgwidget -losgdb_pic -losgdb_png -losgdb_pnm -losgdb_rgb -losgdb_rot -losgdb_scale -losgdb_shp -losgdb_stl -losgdb_tga -losgdb_tgz -losgdb_tiff -losgdb_trans -losgdb_txf -losgdb_txp -losgdb_vtf -losgdb_x -losgdb_zip -lcurl -lgnutls -lgcrypt -lgpg-error -lidn -lIlmImf -lHalf -lImath -lIlmThread -lIex -lfreetype -lgdal -ltiff -lgif -ljasper -ljpeg -lpng -liconv -lz -lws2_32 -lwinmm -lwldap32 +Cflags: -I${includedir} diff -uNr OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osgShadow.pc.in OpenSceneGraph-2.8.2/packaging/pkgconfig/openscenegraph-osgShadow.pc.in --- OpenSceneGraph-2.8.2.orig/packaging/pkgconfig/openscenegraph-osgShadow.pc.in 1970-01-01 01:00:00.000000000 +0100 diff --git a/src/openscenegraph-2-static.patch b/src/openscenegraph-2-static.patch index 73405fa..cf90126 100644 --- a/src/openscenegraph-2-static.patch +++ b/src/openscenegraph-2-static.patch @@ -1,18 +1,11 @@ -This file is part of mingw-cross-env. -See doc/index.html or doc/README for further information. - -diff -uNr OpenSceneGraph-2.8.2.orig/src/osgPlugins/exr/ReaderWriterEXR.cpp OpenSceneGraph-2.8.2/src/osgPlugins/exr/ReaderWriterEXR.cpp --- OpenSceneGraph-2.8.2.orig/src/osgPlugins/exr/ReaderWriterEXR.cpp 2008-11-27 10:36:18.000000000 +0100 -+++ OpenSceneGraph-2.8.2/src/osgPlugins/exr/ReaderWriterEXR.cpp 2010-01-14 17:55:32.000000000 +0100 -@@ -4,11 +4,6 @@ ++++ OpenSceneGraph-2.8.2/src/osgPlugins/exr/ReaderWriterEXR.cpp 2010-01-26 21:36:31.000000000 +0100 +@@ -4,7 +4,7 @@ #include #include -#ifdef _WIN32 --//Make the half format work against openEXR libs --#define OPENEXR_DLL --#endif -- - #include - #include - #include ++#if defined _WIN32 && !defined OSG_LIBRARY_STATIC + //Make the half format work against openEXR libs + #define OPENEXR_DLL + #endif diff --git a/src/openscenegraph-4-disable-png.patch b/src/openscenegraph-4-disable-png.patch deleted file mode 100644 index 7a03a46..0000000 --- a/src/openscenegraph-4-disable-png.patch +++ /dev/null @@ -1,16 +0,0 @@ -This file is part of mingw-cross-env. -See doc/index.html or doc/README for further information. - -diff -uNr OpenSceneGraph-2.8.2.orig/src/osgPlugins/CMakeLists.txt OpenSceneGraph-2.8.2/src/osgPlugins/CMakeLists.txt ---- OpenSceneGraph-2.8.2.orig/src/osgPlugins/CMakeLists.txt 2009-01-14 21:32:06.000000000 +0100 -+++ OpenSceneGraph-2.8.2/src/osgPlugins/CMakeLists.txt 2010-01-15 06:54:16.000000000 +0100 -@@ -96,9 +96,6 @@ - IF(GIFLIB_FOUND) - ADD_SUBDIRECTORY(gif) - ENDIF(GIFLIB_FOUND) --IF(PNG_FOUND) -- ADD_SUBDIRECTORY(png) --ENDIF(PNG_FOUND) - IF(TIFF_FOUND) - ADD_SUBDIRECTORY(tiff) - ENDIF(TIFF_FOUND) diff --git a/src/openscenegraph-4-png.patch b/src/openscenegraph-4-png.patch new file mode 100644 index 0000000..1aa6f65 --- /dev/null +++ b/src/openscenegraph-4-png.patch @@ -0,0 +1,19 @@ +This file is part of mingw-cross-env. +See doc/index.html or doc/README for further information. + +--- OpenSceneGraph-2.8.2.orig/src/osgPlugins/png/ReaderWriterPNG.cpp ++++ OpenSceneGraph-2.8.2/src/osgPlugins/png/ReaderWriterPNG.cpp +@@ -179,5 +179,5 @@ + + fin.read((char*)header,8); +- if (fin.gcount() == 8 && png_check_sig(header, 8)) ++ if (fin.gcount() == 8 && png_sig_cmp(header, 0, 8) == 0) + png_set_read_fn(png,&fin,png_read_istream); //Use custom read function that will get data from istream + else +@@ -230,5 +230,5 @@ + png_set_palette_to_rgb(png); + if (color == PNG_COLOR_TYPE_GRAY && depth < 8) +- png_set_gray_1_2_4_to_8(png); ++ png_set_expand_gray_1_2_4_to_8(png); + if (png_get_valid(png, info, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha(png); -- cgit v0.12