Package: java-package
Version: 0.50
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu quantal ubuntu-patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * Add support for Oracle Java 7 JDK for ARM.

Note that this is a little kludgy; the Oracle JDK for ARM lacks some
features that the JDK's for x86 archs have such as plugins and javaws.

I've tested this with Java 7u6 for ARM from the Oracle website.

Thanks for considering the patch.


- -- System Information:
Debian Release: wheezy/sid
  APT prefers quantal-updates
  APT policy: (500, 'quantal-updates'), (500, 'quantal-security'), (500, 
'quantal')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5.0-14-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJQUErUAAoJEL/srsug59jDtbMQAJKeC2SPnsMIoKeaJyYIjeiJ
RjzHfN6oMrF94ZBtXhdQ6iDOeuqh5czEKeNscwrDVh9sqauQdQ6CHBIeptM7hkPN
YCQeHJFvGjYBv8x4baU2Xr8YPthV/yiUoxlXsj3XElbRqUR5H7hlV6APhFcjNxTe
jLtqC4sJ7YNTmjmVC1YxVbPpvslowpvfFLxn7TioDAYJdjaAEcN0j45ZNYVdpIOC
74xZ3tNniO2qv7EcbjnQFBW+JB+x4F3EvojUJcwg187VQh4zdUL5qHnnn/74Bdge
cA6Epc9ipLopmRC2HGTUTA7G6o8CtRCFz64B86xArceuYNr602eiblXNYk/4MZRV
QatuFgpR13yN3doyp5LT1xGX1yHv9vB1ji5VWI1b9RnzdFfI8liJDZPOJc2PcQhp
/GaUZMvH4eqEtw0uUq+XlBZDJzuPYa9n+ijcLwniOPRwG7ctfwXlcQwmMOi8jCCo
jLkC3lNnJ7DBf9bmvx94uvTQHICE7BAQ1m1JUxGsCSDQCZ3FjGFWGoA+AyRw4LUY
o/z94TUwUTsQbL7UPQMB8PsCVz7A7YVHYff3EM/zqrZmK0VkXhJ8Or1Wr+DMM+kg
kbmo41Nc7/DpTXmHmu5MVxt8DGyiZDqSmqdOtINjh7HGjrWIn0ITQU9HIwqRn7Lr
am8bOmozK7ibXSsd8mxZ
=+nQj
-----END PGP SIGNATURE-----
=== modified file 'lib/j2sdk.sh'
--- lib/j2sdk.sh	2011-12-22 11:42:13 +0000
+++ lib/j2sdk.sh	2012-09-07 13:13:45 +0000
@@ -1,12 +1,23 @@
 
 j2sdk_control() {
     j2se_control
+    java_browser_plugin="java-browser-plugin, "
+    depends="\${shlibs:Depends}"
+    if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
+        # ARM is only softfloat ATM so if building on armhf
+        # force the dependencies to pickup cross platform fu
+        if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
+            depends="libc6-armel, libsfgcc1, libsfstdc++6"
+        fi
+        # No browser on ARM yet
+        java_browser_plugin=""
+    fi
     cat << EOF
 Package: $j2se_package
 Architecture: any
-Depends: \${shlibs:Depends}
+Depends: $depends
 Recommends: netbase, libx11-6 | xlibs, libasound2, libgtk1.2, libstdc++5
-Provides: java-virtual-machine, java-runtime, java2-runtime, java-browser-plugin, java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, java-sdk, java2-sdk, j2sdk$j2se_release, j2re$j2se_release
+Provides: java-virtual-machine, java-runtime, java2-runtime, $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, java-sdk, java2-sdk, j2sdk$j2se_release, j2re$j2se_release
 Replaces: ${j2se_package}debian
 Description: $j2se_title
  The Java(TM) 2 SDK is a development environment for building

=== modified file 'lib/oracle-j2sdk.sh'
--- lib/oracle-j2sdk.sh	2011-12-22 11:42:13 +0000
+++ lib/oracle-j2sdk.sh	2012-09-07 12:29:27 +0000
@@ -36,6 +36,16 @@
 	    ;;
       esac
       ;;
+    armhf|armel|arm-linux-gnueabihf|arm-linux-gnueabi)
+      case "$archive_name" in
+    "jdk-7u"[0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
+        j2se_version=1.7.0+update${archive_name:6:1}${revision}
+        j2se_expected_min_size=100 #Mb
+        j2se_priority=317
+        found=true
+        ;;
+      esac
+      ;;
   esac
   if [[ -n "$found" ]]; then
 	cat << EOF
@@ -55,9 +65,16 @@
 	    j2se_install=oracle_j2sdk_install
 	    j2se_remove=oracle_j2sdk_remove
 	    j2se_jinfo=oracle_j2sdk_jinfo
-	    oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
-	    oracle_jre_bin_jre="javaws policytool"
-	    oracle_no_man_jre_bin_jre="ControlPanel"
+        if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
+    	    oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+            oracle_jre_bin_jre="policytool"
+        else
+            oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+            oracle_jre_bin_jre="javaws policytool"
+        fi
+        if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+    	    oracle_no_man_jre_bin_jre="ControlPanel"
+        fi
 	    oracle_jre_lib_hl="jexec"
 	    oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
 	    j2sdk_run
@@ -73,13 +90,18 @@
 
 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
-install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+    install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+fi
 install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
 install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
 
-plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
-install_browser_plugin "/usr/lib/iceweasel/plugins" "libjavaplugin.so" "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-install_browser_plugin "/usr/lib/chromium/plugins" "libjavaplugin.so" "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+# No plugin for ARM architecture yet
+if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+    plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
+    install_browser_plugin "/usr/lib/iceweasel/plugins" "libjavaplugin.so" "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+    install_browser_plugin "/usr/lib/chromium/plugins" "libjavaplugin.so" "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+fi
 EOF
 }
 
@@ -91,13 +113,18 @@
 
 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
-remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+    remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+fi
 remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
 remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
 
-plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
-remove_browser_plugin "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-remove_browser_plugin "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+# No plugin for ARM architecture yet
+if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+    plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
+    remove_browser_plugin "iceweasel-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+    remove_browser_plugin "chromium-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+fi
 EOF
 }
 
@@ -109,9 +136,13 @@
 EOF
     jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
     jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
-    jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
+    if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+        jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
+    fi
     jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
     jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
-    echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
-    echo "plugin chromium-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
+    if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+        echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
+        echo "plugin chromium-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
+    fi
 }

Reply via email to