From f808b531daba9771dbf0ffc1bd2d24e4e05bdfd5 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylvestre@debian.org>
Date: Thu, 28 Mar 2013 14:52:46 +0100
Subject: [PATCH] Factorize the arm detection and manage arm hard flot (armv4
 => armv7) Patch by Thomas Preud'homme <robotux@debian.org>
 & Sylvestre Ledru

---
 make/build-jogl.xml                         |   29 ++++++++++++++++------
 make/build-nativewindow.xml                 |   33 +++++++++++++++++--------
 make/build-newt.xml                         |   35 ++++++++++++++++++---------
 make/build.xml                              |    9 +++++++
 make/scripts/make.jogl.all.linux-armv7hf.sh |   27 +++++++++++++++++++++
 make/scripts/tests-armv7_armhf.sh           |    7 ++++++
 make/scripts/tests-linux-armv7hf.sh         |    7 ++++++
 7 files changed, 118 insertions(+), 29 deletions(-)
 create mode 100644 make/scripts/make.jogl.all.linux-armv7hf.sh
 create mode 100644 make/scripts/tests-armv7_armhf.sh
 create mode 100644 make/scripts/tests-linux-armv7hf.sh

diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index c481eb0..a54a59a 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -197,6 +197,19 @@
            <isset property="setup.noSWT"/> 
         </condition>
 
+        <condition property="isLinuxARM">
+            <and>
+                <istrue value="${isLinux}" />
+                <or>
+                    <os arch="arm" />
+                    <os arch="armv4" />
+                    <os arch="armv5" />
+                    <os arch="armv6" />
+                    <os arch="armv7" />
+                </or>
+            </and>
+        </condition>
+
         <property name="java.excludes.javadoc.packagenames"
                   value="jogamp.opengl.gl2.fixme.*,com.jogamp.audio.windows.waveout.TestSpatialization"/>
 
@@ -1108,7 +1121,7 @@
         <includepath path="/usr/local/include" />
       </compiler>
 
-      <compiler id="compiler.cfg.linux.armv6.jogl.x11" extends="compiler.cfg.linux.armv6">
+      <compiler id="compiler.cfg.linux.arm.jogl.x11" extends="compiler.cfg.linux">
         <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
         <compilerarg value="-idirafter" />
         <compilerarg value="/usr/include" />
@@ -1136,8 +1149,8 @@
         <syslibset libs="X11"/>
       </linker>
 
-      <linker id="linker.cfg.linux.armv6.jogl.x11" extends="linker.cfg.linux.armv6">
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11"/>
+      <linker id="linker.cfg.linux.arm.jogl.x11" extends="linker.cfg.linux">
+        <syslibset libs="X11"/>
       </linker>
 
       <linker id="linker.cfg.android.jogl" extends="linker.cfg.android">
@@ -1225,10 +1238,10 @@
       <property name="linker.cfg.id.os"                    value="linker.cfg.linux.amd64.jogl.x11" />
     </target>
     
-    <target name="c.configure.linux.armv6" if="isLinuxARMv6">
-      <echo message="Linux.armv6" />
-      <property name="compiler.cfg.id"                     value="compiler.cfg.linux.armv6.jogl.x11" />
-      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.armv6.jogl.x11" />
+    <target name="c.configure.linux.arm" if="isLinuxARM">
+      <echo message="Linux.arm" />
+      <property name="compiler.cfg.id"                     value="compiler.cfg.linux.arm.jogl.x11" />
+      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.arm.jogl.x11" />
     </target>
     
     <target name="c.configure.linux.ia64" if="isLinuxIA64">
@@ -1273,7 +1286,7 @@
       <property name="linker.cfg.id.os"                    value="linker.cfg.linux.jogl.x11" />
     </target>
 
-    <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />
+    <target name="c.configure.linux" depends="c.configure.linux.arm,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />
 
     <target name="c.configure.android" if="isAndroid">
       <echo message="Android" />
diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml
index d7ef73a..37b8957 100644
--- a/make/build-nativewindow.xml
+++ b/make/build-nativewindow.xml
@@ -88,6 +88,19 @@
            <isset property="setup.noAWT"/> 
         </condition>
 
+        <condition property="isLinuxARM">
+            <and>
+                <istrue value="${isLinux}" />
+                <or>
+                    <os arch="arm" />
+                    <os arch="armv4" />
+                    <os arch="armv5" />
+                    <os arch="armv6" />
+                    <os arch="armv7" />
+                </or>
+            </and>
+        </condition>
+
         <property name="java.excludes.all" value="${java.excludes.awt}" />
         <echo message="java.excludes.all: ${java.excludes.all}" />
     </target>
@@ -342,7 +355,7 @@
         <includepath path="/usr/local/include" />
       </compiler>
 
-      <compiler id="compiler.cfg.linux.armv6.nativewindow.x11" extends="compiler.cfg.linux.armv6">
+      <compiler id="compiler.cfg.linux.arm.nativewindow.x11" extends="compiler.cfg.linux">
         <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
         <compilerarg value="-idirafter" />
         <compilerarg value="/usr/include" />
@@ -395,10 +408,10 @@
         <syslibset libs="Xrender"/>
       </linker>
 
-      <linker id="linker.cfg.linux.armv6.nativewindow.x11" extends="linker.cfg.linux.armv6">
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11" />
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xxf86vm" />
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xrender" />
+      <linker id="linker.cfg.linux.arm.nativewindow.x11" extends="linker.cfg.linux">
+        <syslibset libs="X11" />
+        <syslibset libs="Xxf86vm" />
+        <syslibset libs="Xrender" />
       </linker>
 
       <linker id="linker.cfg.solaris.nativewindow.x11" extends="linker.cfg.solaris">
@@ -483,10 +496,10 @@
       <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.amd64.nativewindow.x11" />
     </target>
     
-    <target name="c.configure.linux.armv6" if="isLinuxARMv6">
-      <echo message="Linux.armv6" />
-      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.armv6.nativewindow.x11" />
-      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.armv6.nativewindow.x11" />
+    <target name="c.configure.linux.arm" if="isLinuxARM">
+      <echo message="Linux.arm" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.arm.nativewindow.x11" />
+      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.arm.nativewindow.x11" />
     </target>
     
     <target name="c.configure.linux.ia64" if="isLinuxIA64">
@@ -531,7 +544,7 @@
       <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
     </target>
 
-    <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />
+    <target name="c.configure.linux" depends="c.configure.linux.arm,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />
 
     <target name="c.configure.android" if="isAndroid">
       <echo message="Android" />
diff --git a/make/build-newt.xml b/make/build-newt.xml
index c3b5114..479d8f4 100644
--- a/make/build-newt.xml
+++ b/make/build-newt.xml
@@ -157,6 +157,19 @@
            <isset property="setup.noOpenGL"/>
         </condition>
 
+        <condition property="isLinuxARM">
+            <and>
+                <istrue value="${isLinux}" />
+                <or>
+                    <os arch="arm" />
+                    <os arch="armv4" />
+                    <os arch="armv5" />
+                    <os arch="armv6" />
+                    <os arch="armv7" />
+                </or>
+            </and>
+        </condition>
+
         <property name="java.excludes.all" value="${java.excludes.awt}, ${java.excludes.swt}, ${java.excludes.opengl}" />
         <echo message="java.excludes.all: ${java.excludes.all}" />
 
@@ -265,7 +278,7 @@
         <includepath path="/usr/local/include" />
       </compiler>
 
-      <compiler id="compiler.cfg.linux.armv6.newt.x11" extends="compiler.cfg.linux.armv6">
+      <compiler id="compiler.cfg.linux.arm.newt.x11" extends="compiler.cfg.linux">
         <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
         <compilerarg value="-idirafter" />
         <compilerarg value="/usr/include" />
@@ -320,13 +333,13 @@
         <!--syslibset libs="X11-xcb" /-->
       </linker>
 
-      <linker id="linker.cfg.linux.armv6.newt.x11" extends="linker.cfg.linux.armv6">
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11" />
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="Xrandr" />
+      <linker id="linker.cfg.linux.arm.newt.x11" extends="linker.cfg.linux">
+        <syslibset libs="X11" />
+        <syslibset libs="Xrandr" />
       </linker>
 
       <linker id="linker.cfg.android.newt" extends="linker.cfg.android">
-        <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="android" />
+        <syslibset libs="android" />
       </linker>
 
       <linker id="linker.cfg.solaris.newt.x11" extends="linker.cfg.solaris">
@@ -410,11 +423,11 @@
       <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
     </target>
 
-    <target name="c.configure.linux.armv6" if="isLinuxARMv6">
-      <echo message="Linux.armv6" />
-      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.armv6.newt.x11" />
-      <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.armv6.newt.x11"
-                                                            else="linker.cfg.linux.armv6">
+    <target name="c.configure.linux.arm" if="isLinuxARM">
+      <echo message="Linux.arm" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux.arm.newt.x11" />
+      <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.arm.newt.x11"
+                                                            else="linker.cfg.linux.arm">
           <isset property="isX11" />
       </condition>
       <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
@@ -486,7 +499,7 @@
       <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.newt.x11" />
     </target>
 
-    <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.armv6,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.linux.ia64,c.configure.x11" if="isLinux"/>
+    <target name="c.configure.linux" depends="c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.arm,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.linux.ia64,c.configure.x11" if="isLinux"/>
 
     <target name="c.configure.android" if="isAndroid">
       <echo message="Android" />
diff --git a/make/build.xml b/make/build.xml
index 44adf80..4e9d202 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -452,6 +452,15 @@
              basedir="${javadoc.root.path}"
              includes="jogl/**" />
     </target>
+    <target name="version" depends="init" description="Create Version.java">
+      <echo file="src/${package.dir}/Version.java" message="package ${package.name};${line.separator}" />
+      <echo file="src/${package.dir}/Version.java" append="true" message="public final class Version {${line.separator}" />
+      <echo file="src/${package.dir}/Version.java"
+            append="true"
+            message=" public static String VERSION=&quot;${buildtime}&quot;;${line.separator}" />
+      <echo file="src/${package.dir}/Version.java" append="true" message="}${line.separator}" />
+      <echo message="BUILD ${buildtime}" />
+</target>
 
 </project>
 
diff --git a/make/scripts/make.jogl.all.linux-armv7hf.sh b/make/scripts/make.jogl.all.linux-armv7hf.sh
new file mode 100644
index 0000000..5170810
--- /dev/null
+++ b/make/scripts/make.jogl.all.linux-armv7hf.sh
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+# arm-linux-gnueabihf == armhf triplet
+PATH=`pwd`/../../gluegen/make/lib/linux/arm-linux-gnueabihf/bin:$PATH
+export PATH
+
+#    -Dc.compiler.debug=true 
+#    -Dgluegen.cpptasks.detected.os=true \
+#    -DisUnix=true \
+#    -DisLinux=true \
+#    -DisLinuxARMv7=true \
+#    -DisX11=false \
+
+export TARGET_PLATFORM_ROOT=/
+export TARGET_PLATFORM_LIBS=/usr/lib/arm-linux-gnueabihf
+export TARGET_JAVA_LIBS=/usr/lib/jvm/java-6-openjdk-armhf/jre/lib/arm
+
+export GLUEGEN_CPPTASKS_FILE="../../gluegen/make/lib/gluegen-cpptasks-linux-armv7hf.xml"
+
+ant \
+    -Drootrel.build=build-linux-armv7hf \
+    -Dsetup.addNativeKD=true \
+    -Dsetup.addNativeOpenMAX=true \
+    -Dsetup.addNativeBroadcom=true \
+    -Djunit.run.arg0="-Dnewt.test.Screen.disableScreenMode" \
+    $* 2>&1 | tee make.jogl.all.linux-armv7hf.log
+
diff --git a/make/scripts/tests-armv7_armhf.sh b/make/scripts/tests-armv7_armhf.sh
new file mode 100644
index 0000000..5526e81
--- /dev/null
+++ b/make/scripts/tests-armv7_armhf.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+spath=`dirname $0`
+
+. $spath/tests.sh  `which java` -DummyArg ../build-linux-armv7hf $*
+
+
diff --git a/make/scripts/tests-linux-armv7hf.sh b/make/scripts/tests-linux-armv7hf.sh
new file mode 100644
index 0000000..5526e81
--- /dev/null
+++ b/make/scripts/tests-linux-armv7hf.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+spath=`dirname $0`
+
+. $spath/tests.sh  `which java` -DummyArg ../build-linux-armv7hf $*
+
+
-- 
1.7.10.4