File 02_fix_generic_ftbfs.patch of Package java3d

--- a/j3d-core/build.xml
+++ b/j3d-core/build.xml
@@ -196,6 +196,15 @@
     <property name="install.bin" value="lib/ppc"/>
   </target>
 
+  <target name="setupLinuxGeneric" if="isLinuxGeneric">
+    <property name="isUnix" value="true"/>
+    <property name="shell" value="/bin/sh"/>
+    <property name="wstype" value="x11"/>
+    <property name="platformname" value="linux-generic"/>
+    <property name="platform" value="linux-generic"/>
+    <property name="install.bin" value="lib/${os.arch}"/>
+  </target>
+
     <!-- win32 should be rename as windows -->
   <target name="setupWindows" if="isWindowsOnX86">
     <property name="isWindows" value="true"/>
@@ -232,7 +241,7 @@
   </target>
 
   <target name="setupPlatform"
-       depends="init, setupBuildType, setupSolaris, setupSolarisX86, setupLinux, setupLinuxAmd64, setupLinuxIA64, setupLinuxPPC, setupWindows, setupWindowsAmd64, setupMacOSX, setupJogl">
+       depends="init, setupBuildType, setupSolaris, setupSolarisX86, setupLinux, setupLinuxAmd64, setupLinuxIA64, setupLinuxPPC, setupLinuxGeneric, setupWindows, setupWindowsAmd64, setupMacOSX, setupJogl">
     <property name="build-debug-gen" location="${build}/${platform}/debug/gen"/>
     <property name="build-opt-gen" location="${build}/${platform}/opt/gen"/>
     <property name="docname" value="${build.relprefix}-${version_file}-doc"/>
@@ -382,6 +391,13 @@
         <os name="linux" arch="ppc"/>
     </condition>
 
+    <condition property="isLinuxGeneric">
+      <or>
+        <os name="linux"/>
+        <os name="GNU/kFreeBSD"/>
+      </or>
+    </condition>
+
     <condition property="isSolarisOnSparc">
         <os name="SunOS" arch="sparc"/>
     </condition>   
--- a/j3d-core/src/native/build.xml
+++ b/j3d-core/src/native/build.xml
@@ -45,6 +45,13 @@
         <property name="osNativeScreenInfo" value="X11NativeScreenInfo"/>
   </target>
 
+  <target name="nativeSetup-debug-linux-generic" if="isLinuxGeneric">
+	<property name="bldFlag" value="-g -DDEBUG"/>
+	<property name="coreLibDependency" value="lib/${os.arch}/libj3dcore-ogl.so"/>
+	<property name="osNativeConfigTemplate3D" value="X11NativeConfigTemplate3D"/>
+	<property name="osNativeScreenInfo" value="X11NativeScreenInfo"/>
+  </target>
+
   <target name="nativeSetup-debug-win32" if="isWindowsOnX86">
 	<property name="bldFlag" 
 	         value="-DDEBUG -DWIN32 -D_WINDOWS"/>
@@ -62,7 +69,7 @@
         <property name="osNativeScreenInfo" value="Win32NativeScreenInfo"/>
   </target>
 
-  <target name="nativeSetup-debug" depends="nativeSetup-debug-solaris, nativeSetup-debug-solaris-x86, nativeSetup-debug-linux, nativeSetup-debug-linux-amd64, nativeSetup-debug-linux-ia64, nativeSetup-debug-linux-ppc, nativeSetup-debug-win32, nativeSetup-debug-winamd64">
+  <target name="nativeSetup-debug" depends="nativeSetup-debug-solaris, nativeSetup-debug-solaris-x86, nativeSetup-debug-linux, nativeSetup-debug-linux-amd64, nativeSetup-debug-linux-ia64, nativeSetup-debug-linux-ppc, nativeSetup-debug-linux-generic, nativeSetup-debug-win32, nativeSetup-debug-winamd64">
 	<property name="bldType" value="debug"/>
 	<property name="javahCoreSrc"     
 	 location="${src}/classes/share/javax/media/j3d"/>
@@ -112,6 +119,13 @@
         <property name="osNativeScreenInfo" value="X11NativeScreenInfo"/>
   </target>
   
+  <target name="nativeSetup-opt-linux-generic" if="isLinuxGeneric">
+	<property name="bldFlag" value="-O"/>
+	<property name="coreLibDependency" value="lib/${os.arch}/libj3dcore-ogl.so"/>
+	<property name="osNativeConfigTemplate3D" value="X11NativeConfigTemplate3D"/>
+	<property name="osNativeScreenInfo" value="X11NativeScreenInfo"/>
+  </target>
+
   <target name="nativeSetup-opt-win32" if="isWindowsOnX86">
 	<property name="bldFlag" 
 	         value="-DWIN32 -D_WINDOWS"/>
@@ -128,7 +142,7 @@
         <property name="osNativeScreenInfo" value="Win32NativeScreenInfo"/>
   </target>
 
-  <target name="nativeSetup-opt" depends="nativeSetup-opt-solaris, nativeSetup-opt-solaris-x86, nativeSetup-opt-linux, nativeSetup-opt-linux-amd64, nativeSetup-opt-linux-ia64, nativeSetup-opt-linux-ppc, nativeSetup-opt-win32, nativeSetup-opt-winamd64">
+  <target name="nativeSetup-opt" depends="nativeSetup-opt-solaris, nativeSetup-opt-solaris-x86, nativeSetup-opt-linux, nativeSetup-opt-linux-amd64, nativeSetup-opt-linux-ia64, nativeSetup-opt-linux-ppc, nativeSetup-opt-linux-generic, nativeSetup-opt-win32, nativeSetup-opt-winamd64">
 	<property name="bldType" value="opt"/>
 	<property name="javahCoreSrc"     
 	 location="${src}/classes/share/javax/media/j3d"/>
--- /dev/null
+++ b/j3d-core/src/native/ogl/build-linux-generic.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<!-- Ant file for building native ogl renderer files for Linux/x86 -->
+<project name="j3d-core native" default="compile">
+
+  <target name="init" depends="init-cg,init-nocg">
+    <!-- Create the build directories for linux -->
+    <mkdir dir="${build}/${platform}/${bldType}/native/ogl/objs"/>
+    <mkdir dir="${build}/${platform}/${bldType}/lib/${os.arch}"/>
+    
+    <property name="oglsrc"     location="${src}/native/ogl"/>
+  </target>
+
+  <target name="init-cg" if="build.cg">
+    <property name="cflags.cg"  value="-DCOMPILE_CG_SHADERS=1"/>
+  </target>
+
+  <target name="init-nocg" unless="build.cg">
+    <property name="cflags.cg"  value=""/>
+  </target>
+
+  <target name="compile-ogl">
+    <echo message="Executing native renderer build [${bldType}]"/>
+
+    <!-- Compile the c source files-->
+    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc" >
+	<arg line="-fPIC -I${oglsrc}  -I${java.home}/include -I${java.home}/include/linux -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c  ${oglsrc}/NativeScreenInfo.c  ${oglsrc}/NativeConfigTemplate3D.c  ${oglsrc}/MasterControl.c ${oglsrc}/GeometryArrayRetained.c  ${oglsrc}/Attributes.c  ${oglsrc}/CgShaderProgram.c  ${oglsrc}/GLSLShaderProgram.c  ${oglsrc}/Lights.c"/>
+    </exec>
+
+    <!-- Create the library file-->
+    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+	<arg line="-shared DrawingSurfaceObjectAWT.o  Canvas3D.o  GraphicsContext3D.o  NativeScreenInfo.o  NativeConfigTemplate3D.o  MasterControl.o GeometryArrayRetained.o  Attributes.o  CgShaderProgram.o  GLSLShaderProgram.o  Lights.o -Wl,-z,defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -L${java.home}/lib/${os.arch} -L${java.home}/lib -ljawt -L${java.home}/lib/${os.arch}/server -L${java.home}/lib/${os.arch}/client -L${java.home}/lib/server -L${java.home}/lib/client -ljvm  -o libj3dcore-ogl.so"/>
+    </exec>
+
+  </target>
+
+  <target name="compile-ogl-cg" if="build.cg">
+    <!-- Compile the wrapper -->
+    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+	<arg line="-fPIC -I${oglsrc}  -I${java.home}/include -I${java.home}/include/linux -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/>
+    </exec>
+
+    <!-- Create the wrapper library -->
+    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+	<arg line="CgWrapper.o -Wl,-z,defs -L/usr/X11R6/lib -ldl -lCg -lCgGL -lpthread -lGL -lX11 -lXext -lm -lnsl -o libj3dcore-ogl-cg.so"/>
+    </exec>
+
+  </target>
+
+  <target name="compile" depends="init,compile-ogl,compile-ogl-cg">
+
+    <!-- Copy the  library file -->
+    <copy todir="${build}/${platform}/${bldType}/lib/${os.arch}">
+          <fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
+                      includes="libj3dcore-ogl*.so"
+          />
+    </copy>
+
+  </target>
+
+  <target name="dist">
+    <!-- Create the distribution directory -->
+    <mkdir dir="${dist}/${platform}/lib/${os.arch}"/>
+
+    <!-- Copy the library files -->
+    <copy todir="${dist}/${platform}/lib/${os.arch}">
+          <fileset dir="${build}/${platform}/opt/lib/${os.arch}"
+                      includes="libj3dcore-ogl*.so"
+          />
+    </copy>
+
+  </target>
+
+</project>