From cc2b78d94e871828520e3d291d95c1ebe61431e5 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 18 Dec 2014 22:10:03 +0000
Subject: java7-openjdk: update to 7.u71_2.5.3

---
 abs/extra/java7-openjdk/PKGBUILD                   | 455 ++++++++++-----------
 abs/extra/java7-openjdk/disable_Werror.diff        |  11 -
 abs/extra/java7-openjdk/fix_corba_cmds_path.diff   |  29 --
 abs/extra/java7-openjdk/giflib_5.1.diff            |  14 +
 abs/extra/java7-openjdk/jdk7-openjdk.install       |  50 +++
 abs/extra/java7-openjdk/jdk7-openjdk.profile       |   6 -
 abs/extra/java7-openjdk/jdk7-openjdk.profile.csh   |   1 -
 .../java7-openjdk/jre7-openjdk-headless.install    |  43 +-
 abs/extra/java7-openjdk/jre7-openjdk.install       |  43 +-
 abs/extra/java7-openjdk/jre7-openjdk.profile       |   5 -
 abs/extra/java7-openjdk/jre7-openjdk.profile.csh   |   5 -
 .../java7-openjdk/openjdk7_fix_jdk_cmds_path.diff  |  36 --
 .../java7-openjdk/openjdk7_nonreparenting-wm.diff  |  26 +-
 13 files changed, 361 insertions(+), 363 deletions(-)
 delete mode 100644 abs/extra/java7-openjdk/disable_Werror.diff
 delete mode 100644 abs/extra/java7-openjdk/fix_corba_cmds_path.diff
 create mode 100644 abs/extra/java7-openjdk/giflib_5.1.diff
 create mode 100644 abs/extra/java7-openjdk/jdk7-openjdk.install
 delete mode 100644 abs/extra/java7-openjdk/jdk7-openjdk.profile
 delete mode 100644 abs/extra/java7-openjdk/jdk7-openjdk.profile.csh
 delete mode 100644 abs/extra/java7-openjdk/jre7-openjdk.profile
 delete mode 100644 abs/extra/java7-openjdk/jre7-openjdk.profile.csh
 delete mode 100644 abs/extra/java7-openjdk/openjdk7_fix_jdk_cmds_path.diff

diff --git a/abs/extra/java7-openjdk/PKGBUILD b/abs/extra/java7-openjdk/PKGBUILD
index d05bc06..06daab6 100644
--- a/abs/extra/java7-openjdk/PKGBUILD
+++ b/abs/extra/java7-openjdk/PKGBUILD
@@ -1,135 +1,113 @@
-# $Id: PKGBUILD 161798 2012-06-14 14:46:00Z andyrtr $
+# $Id$
 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
+# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
 # Contributor: Jan de Groot <jgc@archlinux.org>
-# Contributor: Guillaume ALAUX <guillaume@archlinux.org>
 
-pkgname=('jre7-openjdk-headless' 'jre7-openjdk' 'jdk7-openjdk' 'openjdk7-src') 
- # ToDo -demo -doc packages, see Debian file lists http://packages.debian.org/source/wheezy/openjdk-7
+pkgname=('jre7-openjdk-headless' 'jre7-openjdk' 'jdk7-openjdk' 'openjdk7-src' 'openjdk7-doc')
 pkgbase=java7-openjdk
 _java_ver=7
-_updatever=u5
-_openjdk_build=b21
-_openjdk_date=27_jun_2011
-_icedtea_ver=2.2.1
-_date=20110922
-
-# check "${srcdir}/icedtea7"/Makefile.am
-_CORBA_CHANGESET=38deb372c569
-_HOTSPOT_CHANGESET=889dffcf4a54
-_JAXP_CHANGESET=335fb0b059b7
-_JAXWS_CHANGESET=5471e01ef43b
-_JDK_CHANGESET=6c3b742b735d
-_LANGTOOLS_CHANGESET=beea46c7086b
-_OPENJDK_CHANGESET=0b776ef59474
+_icedtea_ver=2.5.3
+pkgver() {
+  _updatever=$(grep -E "^JDK_UPDATE_VERSION = (.)+" ${srcdir}/icedtea-${_icedtea_ver}/Makefile.am \
+    | sed -r 's/^JDK_UPDATE_VERSION = (.+)$/\1/')
+  echo ${_java_ver}.u${_updatever}_${_icedtea_ver}
+}
+pkgver=7.u71_2.5.3
+pkgrel=3
 
 _bootstrap=0 # 0/1 for quick build or full bootstrap
 
-pkgver=${_java_ver}.${_updatever}_${_icedtea_ver}
-pkgrel=1
 arch=('i686' 'x86_64')
-url="http://icedtea.classpath.org"
+url='http://icedtea.classpath.org'
 license=('custom')
 options=('!emptydirs')
 makedepends=('jdk7-openjdk' 'libxp' 'libxslt'
              'alsa-lib' 'apache-ant>=1.8.1' 'giflib' 'libpng>=1.5.7' 'gtk2'
-             'java-rhino'  'zip' 'unzip' 'cpio' 'fastjar') # 'inetutils' 'grep') # fastjar`?
-[ "$_bootstrap" = "1" ] && makedepends=(${makedepends[@]} 'eclipse-ecj')
-
-#http://www.java.net/download/openjdk/jdk${_java_ver}/promoted/${_openjdk_build}/openjdk-${_java_ver}-fcs-src-${_openjdk_build}-${_openjdk_date}.zip
-
-_url=http://icedtea.classpath.org/hg/release/icedtea7-forest-2.2
-source=(http://icedtea.classpath.org/download/source/icedtea-${_icedtea_ver}.tar.gz{,.sig}
-        ${_url}/archive/${_OPENJDK_CHANGESET}.tar.gz						# openjdk.tar.gz
-        ${_url}/corba/archive/${_CORBA_CHANGESET}.tar.gz					# corba.tar.gz
-        ${_url}/jaxp/archive/${_JAXP_CHANGESET}.tar.gz						# jaxp.tar.gz
-        ${_url}/jaxws/archive/${_JAXWS_CHANGESET}.tar.gz					# jaxws.tar.gz
-        ${_url}/jdk/archive/${_JDK_CHANGESET}.tar.gz						# jdk.tar.gz
-        ${_url}/langtools/archive/${_LANGTOOLS_CHANGESET}.tar.gz			# langtools.tar.gz
-        ${_url}/hotspot/archive/${_HOTSPOT_CHANGESET}.tar.gz				# hotspot.tar.gz
+             'java-rhino' 'zip' 'unzip' 'cpio' 'fastjar' 'wget'
+             'eclipse-ecj')
+
+_icedtea_url=http://icedtea.classpath.org/download
+_drops_url=${_icedtea_url}/drops/icedtea7/${_icedtea_ver}
+source=(${_icedtea_url}/source/icedtea-${_icedtea_ver}.tar.gz
+        icedtea_${_icedtea_ver}_openjdk.tar.bz2::${_drops_url}/openjdk.tar.bz2
+        icedtea_${_icedtea_ver}_corba.tar.bz2::${_drops_url}/corba.tar.bz2
+        icedtea_${_icedtea_ver}_jaxp.tar.bz2::${_drops_url}/jaxp.tar.bz2
+        icedtea_${_icedtea_ver}_jaxws.tar.bz2::${_drops_url}/jaxws.tar.bz2
+        icedtea_${_icedtea_ver}_jdk.tar.bz2::${_drops_url}/jdk.tar.bz2
+        icedtea_${_icedtea_ver}_langtools.tar.bz2::${_drops_url}/langtools.tar.bz2
+        icedtea_${_icedtea_ver}_hotspot.tar.bz2::${_drops_url}/hotspot.tar.bz2
         fontconfig-paths.diff
-        fix_corba_cmds_path.diff
-        openjdk7_fix_jdk_cmds_path.diff
         openjdk7_nonreparenting-wm.diff
-        disable_Werror.diff
-        jdk7-openjdk.profile
-        jdk7-openjdk.profile.csh
-        jre7-openjdk.profile
-        jre7-openjdk.profile.csh)
-sha256sums=('0f5ba163904f7c50374ab345216dd1b66c077fc431592eb3d4801f7ecda200b6'
-            '0c987bff8e490a57d1e16e328a54665073ef920166342a0a08e5593aa20cd215'
-            '15a6eab62f5108efbf7937b1de7697bd789971886fc1fc08ee8199e16a5c10fe'
-            'b892b0db6f3e4f89fd480d46ecb7c9ce5c71a884ae5bfe953b4bda9eedf7ea93'
-            'ff4ab3710fe316b7adc4e57d4d21ff967ca20e2ccc5267ac26b93cd22db8b3fd'
-            '1ef055749ee46ebf7a5be94403b461d8d32e95c98906da459aeb217a0784ff1d'
-            '48a513d18c919ec08d44cffdc12ae65f1e8942924c6cfcca5c1ffa8ca38afd0e'
-            '17055cf1490fab1cccc57bf3aa5b32d655c408859790c7f671bfde180ddf70cb'
-            'b29a8929bb4aadbc033e99dca6a381ca6342f0373b9c3f67827bfc025187ba41'
+        giflib_5.1.diff)
+
+sha256sums=('44df11ac8e5ace7194e7372ef169909e0dab31d6b2f6bbae9a9c33af2cc54540'
+            '3ba1a30762f5d5890e8ee6af11f52213ab9c574c01f07c75a081c42034f5d5c9'
+            '8ceb2cd60782b7fc14b88e3d366f273873fa5436cf0e36b86406c0905b7dc43c'
+            '2d13a82078f3f2b8831d1e670e5e75719336a56490df64f16ab7647674a272ef'
+            '5a63d85307203f1aed1e31459ad5e32687909e0640d424ff6f540d9b1cceeb1e'
+            '40c4dda969be0ecd213e79269184e19cfc32100b83777dc529b3cf4b6aa3e12f'
+            '516f6c21719f4b5a2092847c147cde7890c5a30d4aed9425ff667c0164ef1dd0'
+            '8c8e1f7e97f47fe4029e0b0ba42b3515474adabe64e1fbee15c0e2e22a13aa28'
             '9ad943ceb3dbcdf45d72974fc3667886a7ed65c69ab9abc17be5412827551a7f'
-            '7b2db65bfb9d5014e1522178d65cabf05dfa85e0926cde5648b5a338db376479'
-            'b742113dc6debc3eb92a246e442595481c04a2a3973e7902b86037acb50050ea'
-            'fd615f476ef17853ae55b7aee3c92b6738f9ea584e915749b1caa7fdc5ff9ca4'
-            'eb4c7f4cf50f5f74b683857f707bd21ec3847267e2e5e3173f42a6910a024f97'
-            '2ec2c6d3a8b62c5743bf8c50c358d98f6a86219d1d8b70645bcc0e1707670410'
-            '3f28f8bfc6dd105a07f747d7135c77a77de433e2b8647dd7520a900135203fbd'
-            'faf5fbaf24c33c101d58bacf8b93c1dbe08a0cbde4c596d5b4a6e28dd4b18f0a'
-            '84d3b91cc57c67b2cf2ddb7fe5abcf1e88b5a151565aaecf4b595c7ce8f3fee9')
-
-noextract=("${_OPENJDK_CHANGESET}.tar.gz"
-           "${_CORBA_CHANGESET}.tar.gz"
-           "${_JAXP_CHANGESET}.tar.gz"
-           "${_JAXWS_CHANGESET}.tar.gz"
-           "${_JDK_CHANGESET}.tar.gz"
-           "${_LANGTOOLS_CHANGESET}.tar.gz"
-           "${_HOTSPOT_CHANGESET}.tar.gz")
-
-  _jvmdir=/usr/lib/jvm/java-7-openjdk
-  
-  [ "$CARCH" = "x86_64" ] && _JARCH=amd64
-  [ "$CARCH" = "i686" ] && _JARCH=i386
-  
+            '56b919ababb13bd6afdcdaceb112b529b6e82539255f2dae9a7e5eb91645164b'
+            '77fba3032edf6cce549cd4e174d9296684b20f4589dc59179fcc8cba7426a4e9')
+
+noextract=(icedtea_${_icedtea_ver}_openjdk.tar.bz2
+           icedtea_${_icedtea_ver}_corba.tar.bz2
+           icedtea_${_icedtea_ver}_jaxp.tar.bz2
+           icedtea_${_icedtea_ver}_jaxws.tar.bz2
+           icedtea_${_icedtea_ver}_jdk.tar.bz2
+           icedtea_${_icedtea_ver}_langtools.tar.bz2
+           icedtea_${_icedtea_ver}_hotspot.tar.bz2)
+
+[ "$CARCH" = "x86_64" ] && _JARCH=amd64
+[ "$CARCH" = "i686" ]   && _JARCH=i386
+
+_jvmdir=/usr/lib/jvm/java-7-openjdk
+_imgdir="icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image"
+_nonheadless=(bin/policytool
+              lib/${_JARCH}/libjsoundalsa.so
+              lib/${_JARCH}/libsplashscreen.so
+              lib/${_JARCH}/xawt/libmawt.so)
+
 build() {
   cd "${srcdir}/icedtea-${_icedtea_ver}"
 
-  unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS
-  
-  # default is to build with first found java-environment found in our repos - is jdk7-openjdk
-  [ -f /etc/profile.d/jdk.sh ] && . /etc/profile.d/jdk.sh
-  
-#  unset MAKEFLAGS # parallel build is currently broken 
-
   export ALT_PARALLEL_COMPILE_JOBS="${MAKEFLAGS/-j}"
   export HOTSPOT_BUILD_JOBS="${ALT_PARALLEL_COMPILE_JOBS}"
 
   . /etc/profile.d/apache-ant.sh
 
-  cp ${srcdir}/*.diff ${srcdir}/icedtea-${_icedtea_ver}/patches
-  export DISTRIBUTION_PATCHES="patches/fontconfig-paths.diff patches/fix_corba_cmds_path.diff patches/openjdk7_fix_jdk_cmds_path.diff patches/openjdk7_nonreparenting-wm.diff patches/disable_Werror.diff"
+  cp "${srcdir}"/*.diff "${srcdir}"/icedtea-${_icedtea_ver}/patches
+  export DISTRIBUTION_PATCHES="patches/fontconfig-paths.diff \
+                               patches/openjdk7_nonreparenting-wm.diff \
+                               patches/giflib_5.1.diff"
 
   if [ "$_bootstrap" = "1" ]; then
      BOOTSTRAPOPT="--enable-bootstrap --with-ecj-jar=/usr/share/java/ecj.jar"
-   else 
+   else
      BOOTSTRAPOPT="--disable-bootstrap"
   fi
 
   ./configure \
-	$BOOTSTRAPOPT \
+        ${BOOTSTRAPOPT} \
         --with-parallel-jobs="${MAKEFLAGS/-j}" \
         --disable-tests \
-        --with-pkgversion="ArchLinux build ${pkgver}-${pkgrel}-${CARCH}" \
+        --disable-downloading --disable-Werror \
+        --with-pkgversion="Arch Linux build ${pkgver}-${pkgrel}-${CARCH}" \
         --with-jdk-home=${JAVA_HOME} \
-        --with-openjdk-src-zip=${srcdir}/${_OPENJDK_CHANGESET}.tar.gz \
-        --with-hotspot-src-zip=${srcdir}/${_HOTSPOT_CHANGESET}.tar.gz \
-        --with-corba-src-zip=${srcdir}/${_CORBA_CHANGESET}.tar.gz \
-        --with-jaxp-src-zip=${srcdir}/${_JAXP_CHANGESET}.tar.gz \
-        --with-jaxws-src-zip=${srcdir}/${_JAXWS_CHANGESET}.tar.gz \
-        --with-jdk-src-zip=${srcdir}/${_JDK_CHANGESET}.tar.gz \
-        --with-langtools-src-zip=${srcdir}/${_LANGTOOLS_CHANGESET}.tar.gz \
+        --with-openjdk-src-zip="${srcdir}/icedtea_${_icedtea_ver}_openjdk.tar.bz2" \
+        --with-hotspot-src-zip="${srcdir}/icedtea_${_icedtea_ver}_hotspot.tar.bz2" \
+        --with-corba-src-zip="${srcdir}/icedtea_${_icedtea_ver}_corba.tar.bz2" \
+        --with-jaxp-src-zip="${srcdir}/icedtea_${_icedtea_ver}_jaxp.tar.bz2" \
+        --with-jaxws-src-zip="${srcdir}/icedtea_${_icedtea_ver}_jaxws.tar.bz2" \
+        --with-jdk-src-zip="${srcdir}/icedtea_${_icedtea_ver}_jdk.tar.bz2" \
+        --with-langtools-src-zip="${srcdir}/icedtea_${_icedtea_ver}_langtools.tar.bz2" \
         --enable-nss \
         --with-rhino \
-        --with-abs-install-dir=${_jvmdir}
-	#--help
-	#--enable-systemtap      Enable inclusion of SystemTap trace support - needs systemtab from AUR
-
+        --with-abs-install-dir=${_jvmdir} \
+        --enable-infinality=no
+        # TODO latest version of openjdk will disable infinality by default
     make
 }
 
@@ -139,214 +117,193 @@ check() {
 }
 
 package_jre7-openjdk-headless() {
-  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - Minimal Java runtime - needed for executing non GUI Java programs"
-  depends=('libjpeg-turbo' 'lcms2' 'nss'
-           'ca-certificates-java' 'java-rhino')
-  optdepends=('libcups: needed for Java Mauve support - libmawt.so'
-              'fontconfig: needed for Java Mauve support - libmawt.so')
-  provides=('java-runtime-headless=7')
+  pkgdesc='OpenJDK Java 7 headless runtime environment'
+  depends=('java-runtime-common' 'libjpeg-turbo' 'lcms2' 'nss' 'ca-certificates-utils' 'libcups')
+  optdepends=('fontconfig: needed for Java Mauve support - libmawt.so'
+              'java-rhino: for some JavaScript support')
+  provides=('java-runtime-headless=7' 'java-runtime-headless-openjdk=7')
   conflicts=('openjdk6')
-  #  replaces=('openjdk6') # once we remove openjdk6 pkg from the repos
-  backup=(etc/profile.d/jre.sh
-          etc/profile.d/jre.csh
-          etc/java-7-openjdk/calendars.properties
-          etc/java-7-openjdk/content-types.properties
-          etc/java-7-openjdk/cursors/cursors.properties
-          etc/java-7-openjdk/flavormap.properties
-          etc/java-7-openjdk/fontconfig.bfc
-          etc/java-7-openjdk/fontconfig.properties
-          etc/java-7-openjdk/jvm.cfg
-          etc/java-7-openjdk/logging.properties
-          etc/java-7-openjdk/management/jmxremote.access
-          etc/java-7-openjdk/management/jmxremote.password
-          etc/java-7-openjdk/management/management.properties
-          etc/java-7-openjdk/management/snmp.acl
-          etc/java-7-openjdk/net.properties
-          etc/java-7-openjdk/psfont.properties.ja
-          etc/java-7-openjdk/psfontj2d.properties
-          etc/java-7-openjdk/security/java.policy
-          etc/java-7-openjdk/security/java.security
-          etc/java-7-openjdk/security/nss.cfg
-          etc/java-7-openjdk/sound.properties
-          etc/java-7-openjdk/tz.properties)
+  # TODO remove after some time
+  replaces=('jre7-openjdk-headless-wm')
+  # Upstream config files that should go to etc and get backup
+  _backup_etc=(etc/java-7-openjdk/${_JARCH}/jvm.cfg
+               etc/java-7-openjdk/calendars.properties
+               etc/java-7-openjdk/content-types.properties
+               etc/java-7-openjdk/flavormap.properties
+               etc/java-7-openjdk/fontconfig.bfc
+               etc/java-7-openjdk/fontconfig.properties
+               etc/java-7-openjdk/images/cursors/cursors.properties
+               etc/java-7-openjdk/logging.properties
+               etc/java-7-openjdk/management/jmxremote.access
+               etc/java-7-openjdk/management/jmxremote.password
+               etc/java-7-openjdk/management/management.properties
+               etc/java-7-openjdk/management/snmp.acl
+               etc/java-7-openjdk/net.properties
+               etc/java-7-openjdk/psfont.properties.ja
+               etc/java-7-openjdk/psfontj2d.properties
+               etc/java-7-openjdk/security/java.policy
+               etc/java-7-openjdk/security/java.security
+               etc/java-7-openjdk/security/nss.cfg
+               etc/java-7-openjdk/sound.properties
+               etc/java-7-openjdk/tz.properties)
+  backup=(${_backup_etc[@]})
   install=jre7-openjdk-headless.install
 
-  cd "${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/jre"
+  cd "${srcdir}/${_imgdir}/jre"
 
-  mv lib/fontconfig.Ubuntu.properties.src lib/fontconfig.properties
-  mv lib/fontconfig.Ubuntu.bfc lib/fontconfig.bfc
-  rm -f lib/fontconfig.*.bfc
-  rm -f lib/fontconfig.*.properties.src 
-  rm -f lib/fontconfig.properties.src
+  install -d -m755 "${pkgdir}${_jvmdir}/jre"
+  cp -a bin lib "${pkgdir}${_jvmdir}/jre"
 
-  install -d -m755 ${pkgdir}/${_jvmdir}/jre/
-  cp -a bin lib ${pkgdir}/${_jvmdir}/jre
+  # Set config files
+  mv "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.{Ubuntu.properties.src,properties}
+  mv "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.{Ubuntu.bfc,bfc}
+  mv "${pkgdir}${_jvmdir}"/jre/lib/management/jmxremote.password{.template,}
+  mv "${pkgdir}${_jvmdir}"/jre/lib/management/snmp.acl{.template,}
+  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.*.bfc
+  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.*.properties.src
+  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.properties.src
 
-  # Install man pages
-  pushd ../../j2re-image/man
-  install -m755 -d ${pkgdir}/usr/share/man/{,ja/}man1/
-  install -m644 man1/*.1 ${pkgdir}/usr/share/man/man1
-  install -m644 ja_JP.UTF-8/man1/*.1 ${pkgdir}/usr/share/man/ja/man1
-  popd
-
-  # more files that belong to the desktop package
-  mkdir ${srcdir}/tmp-desktop-jre
-  for file in \
-	"/usr/lib/jvm/java-7-openjdk/jre/bin/policytool" \
-	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/libjsoundalsa.so" \
-	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/libsplashscreen.so" \
-	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/xawt/libmawt.so" \
-	"/usr/share/man/ja/man1/policytool.1" \
-	"/usr/share/man/man1/policytool.1"; do
-     dirname=`dirname $file`
-     install -dm755 ${srcdir}/tmp-desktop-jre/$dirname || /bin/true
-     # mv file from fakeinstall to pkgdir
-     mv ${pkgdir}/$file ${srcdir}/tmp-desktop-jre$file
+  # Remove 'non-headless' files
+  for f in ${_nonheadless[@]}; do
+    rm "${pkgdir}${_jvmdir}/jre/${f}"
   done
-  rmdir ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/xawt
 
-  # Link binaries into /usr/bin
-  pushd ${pkgdir}/${_jvmdir}/jre/bin
-  install -m755 -d ${pkgdir}/usr/bin/
+  # Man pages
+  pushd "${pkgdir}${_jvmdir}/jre/bin"
+  install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
   for file in *; do
-    ln -sf ${_jvmdir}/jre/bin/${file} ${pkgdir}/usr/bin
+    install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
+      "${pkgdir}/usr/share/man/man1/${file}.1"
+    install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
+      "${pkgdir}/usr/share/man/ja/man1/${file}.1"
   done
   popd
 
-  # Link JKS keystore from ca-certificates-java
-  rm -f ${pkgdir}/${_jvmdir}/jre/lib/security/cacerts
-  ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}/${_jvmdir}/jre/lib/security/cacerts"
-
-  # Set some variables
-  install -m755 -d ${pkgdir}/etc/profile.d/
-  install -m755 ${srcdir}/jre7-openjdk.profile ${pkgdir}/etc/profile.d/jre.sh
-  install -m755 ${srcdir}/jre7-openjdk.profile.csh ${pkgdir}/etc/profile.d/jre.csh
+  # Link JKS keystore from ca-certificates-utils
+  rm -f "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
+  ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
 
   # Install license
-  install -m755 -d ${pkgdir}/usr/share/licenses/${pkgbase}/
+  install -d -m755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
   install -m644 ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README \
-                 ${pkgdir}/usr/share/licenses/${pkgbase}
-		 
-  # Put some more files under backup control
-  install -m755 -d ${pkgdir}/etc/java-7-openjdk/
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/*.properties* ${pkgdir}/etc/java-7-openjdk/
-  # install dummy links to make them found by JAVA
-  cd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/
-  for file in `ls ${pkgdir}/etc/java-7-openjdk/*.properties*`; do
-    ln -vsf /etc/java-7-openjdk/`basename $file` .
+                 "${pkgdir}/usr/share/licenses/${pkgbase}"
+  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
+
+  # Move config files that were set in _backup_etc from ./lib to /etc
+  for file in ${_backup_etc[@]}; do
+    _filepkgpath=${_jvmdir}/jre/lib/${file#etc/java-7-openjdk/}
+    install -D -m 644 "${pkgdir}${_filepkgpath}" "${pkgdir}/${file}"
+    ln -sf /${file} "${pkgdir}${_filepkgpath}"
   done
-  # some more
-  install -m755 -d ${pkgdir}/etc/java-7-openjdk/{cursors,management,security}
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/images/cursors/cursors.properties ${pkgdir}/etc/java-7-openjdk/cursors/
-  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/images/cursors/
-    ln -vsf /etc/java-7-openjdk/cursors/cursors.properties .
-  popd
-  mv ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/jmxremote.password.template ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/jmxremote.password
-  mv ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/snmp.acl.template ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/snmp.acl
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/{management.properties,jmxremote.access,jmxremote.password,snmp.acl} ${pkgdir}/etc/java-7-openjdk/management/
-  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management
-    ln -vsf /etc/java-7-openjdk/management/{management.properties,jmxremote.access,jmxremote.password,snmp.acl} .
-  popd
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/security/{java.policy,java.security,nss.cfg} ${pkgdir}/etc/java-7-openjdk/security/
-  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/security
-    ln -vsf /etc/java-7-openjdk/security/{java.policy,java.security,nss.cfg} .
-  popd
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/fontconfig.bfc ${pkgdir}/etc/java-7-openjdk/
-  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/jvm.cfg ${pkgdir}/etc/java-7-openjdk/
-  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/
-     ln -vsf /etc/java-7-openjdk/jvm.cfg .
-  popd
 }
-	 
+
 package_jre7-openjdk() {
-  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs -Full Java runtime environment - needed for executing Java GUI and Webstart programs"
-  depends=('jre7-openjdk-headless' 'xdg-utils' 'hicolor-icon-theme')
-  optdepends=('icedtea-web-java7: web browser plugin + Java Web Start'
+  pkgdesc='OpenJDK Java 7 full runtime environment'
+  depends=("jre7-openjdk-headless=${pkgver}-${pkgrel}" 'xdg-utils' 'hicolor-icon-theme')
+  optdepends=('icedtea-web: web browser plugin + Java Web Start'
              'alsa-lib: for basic sound support'
              'giflib: for gif format support'
              'gtk2: for the Gtk+ look and feel - desktop usage'
              'libxtst: linked in xawt/libmawt.so - desktop usage')
-  install=jre7-openjdk.install
-  provides=('java-runtime=7')
+  provides=('java-runtime=7' 'java-runtime-openjdk=7')
   conflicts=('openjdk6')
-  
-  mv ${srcdir}/tmp-desktop-jre/* ${pkgdir}
-  # Link binaries into /usr/bin
-  pushd ${pkgdir}/${_jvmdir}/jre/bin
-  install -m755 -d ${pkgdir}/usr/bin/
+  # TODO remove after some time
+  replaces=('jre7-openjdk-wm')
+  install=jre7-openjdk.install
+
+  cd "${srcdir}/${_imgdir}/jre"
+
+  for f in ${_nonheadless[@]}; do
+    install -D ${f} "${pkgdir}${_jvmdir}/jre/${f}"
+  done
+
+  # Man pages
+  pushd "${pkgdir}${_jvmdir}/jre/bin"
+  install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
   for file in *; do
-    ln -sf ${_jvmdir}/jre/bin/${file} ${pkgdir}/usr/bin
+    install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
+      "${pkgdir}/usr/share/man/man1/${file}.1"
+    install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
+      "${pkgdir}/usr/share/man/ja/man1/${file}.1"
   done
   popd
-  
-  cd "${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/jre"
-
-  # Install icons and menu entries
-  for s in 16 24 32 48 ; do
-    install -m755 -d ${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/
-    install -m644 ../../../openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${s}.png \
-                  ${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/java.png
+
+  for s in 16 24 32 48; do
+    install -D -m 644 \
+      "${srcdir}/icedtea-${_icedtea_ver}/openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${s}.png" \
+      "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/java.png"
   done
-  
+
   # Install desktop files.
-  install -m755 -d ${pkgdir}/usr/share/applications
-  install -m644 ${srcdir}/icedtea-${_icedtea_ver}/policytool.desktop ${pkgdir}/usr/share/applications
+  install -d -m755 "${pkgdir}/usr/share/applications"
+  install -m644 "${srcdir}/icedtea-${_icedtea_ver}/policytool.desktop" "${pkgdir}/usr/share/applications"
+
+  # link license
+  install -d -m755 "${pkgdir}/usr/share/licenses"
+  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
 }
 
 package_jdk7-openjdk() {
-  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - SDK"
-  depends=('jre7-openjdk')
-  provides=('java-environment=7')
-  conflicts=('java-environment')
-  #  replaces=('openjdk6')
-  backup=(etc/profile.d/jdk.sh etc/profile.d/jdk.csh)
+  pkgdesc='OpenJDK Java 7 development kit'
+  depends=('java-environment-common' "jre7-openjdk=${pkgver}-${pkgrel}")
+  provides=('java-environment=7' 'java-environment-openjdk=7')
+  replaces=('openjdk6' 'jdk7-openjdk-wm')
+  install=jdk7-openjdk.install
 
-  cd "${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image"
+  cd "${srcdir}/${_imgdir}"
 
   # Main files
-  install -m755 -d ${pkgdir}/${_jvmdir}/
+  install -d -m755 "${pkgdir}${_jvmdir}"
 
-  cp -a demo include lib sample ${pkgdir}/${_jvmdir}
+  cp -a include lib "${pkgdir}${_jvmdir}"
 
   # 'bin' files
   pushd bin
-  install -m755 -d ${pkgdir}/${_jvmdir}/bin/ \
-                   ${pkgdir}/usr/bin/ \
-                   ${pkgdir}/usr/share/man/{,ja/}man1/
+  install -d -m755 "${pkgdir}${_jvmdir}/bin/" \
+                   "${pkgdir}"/usr/share/man/{,ja/}man1/
 
   # 'java-rmi.cgi' will be handled separately as it should not be in the PATH and has no man page
   for b in $(ls | grep -v java-rmi.cgi); do
     if [ -e ../jre/bin/${b} ]; then
       # Provide a link of the jre binary in the jdk/bin/ directory
-      ln -s ../jre/bin/${b} ${pkgdir}/${_jvmdir}/bin/${b}
+      ln -s ../jre/bin/${b} "${pkgdir}${_jvmdir}/bin/${b}"
     else
       # Copy binary to jdk/bin/
-      install -m755 ${b} ${pkgdir}/${_jvmdir}/bin/${b}
+      install -m755 ${b} "${pkgdir}${_jvmdir}/bin/${b}"
       # Copy man page
-      install -m644 ../man/man1/${b}.1 ${pkgdir}/usr/share/man/man1/${b}.1
-      install -m644 ../man/ja/man1/${b}.1 ${pkgdir}/usr/share/man/ja/man1/${b}.1
-      # Link from /bin/
-      ln -s ${_jvmdir}/bin/${b} ${pkgdir}/usr/bin/${b}
+      install -m644 ../man/man1/${b}.1 "${pkgdir}/usr/share/man/man1/${b}.1"
+      install -m644 ../man/ja/man1/${b}.1 "${pkgdir}/usr/share/man/ja/man1/${b}.1"
     fi
   done
   popd
 
+  # Handling 'java-rmi.cgi' separately
+  install -D -m755 bin/java-rmi.cgi "${pkgdir}${_jvmdir}/bin/java-rmi.cgi"
+
   # Install desktop files.
-  install -m755 -d ${pkgdir}/usr/share/applications
-  install -m644 ${srcdir}/icedtea-${_icedtea_ver}/jconsole.desktop ${pkgdir}/usr/share/applications
+  install -d -m755 "${pkgdir}/usr/share/applications"
+  install -m644 "${srcdir}/icedtea-${_icedtea_ver}/jconsole.desktop" "${pkgdir}/usr/share/applications"
 
-  # Handling 'java-rmi.cgi' separately
-  install -m755 -D bin/java-rmi.cgi ${pkgdir}/${_jvmdir}/bin/java-rmi.cgi
+  # Temporarily fixing FS#35141
+  chmod go+r "${pkgdir}${_jvmdir}/lib/sa-jdi.jar"
 
-  # Set some variables
-  install -m755 -d ${pkgdir}/etc/profile.d/
-  install -m755 ${srcdir}/${pkgname}.profile ${pkgdir}/etc/profile.d/jdk.sh
-  install -m755 ${srcdir}/${pkgname}.profile.csh ${pkgdir}/etc/profile.d/jdk.csh
+  # link license
+  install -d -m755 "${pkgdir}/usr/share/licenses"
+  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
 }
 
 package_openjdk7-src() {
-  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - sources"
+  pkgdesc='OpenJDK Java 7 sources'
+  replaces=('openjdk6-src')
 
-  install -D ${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/src.zip \
-             ${pkgdir}/${_jvmdir}/src.zip
+  install -D "${srcdir}/${_imgdir}/src.zip" "${pkgdir}${_jvmdir}/src.zip"
+}
+
+package_openjdk7-doc() {
+  pkgdesc='OpenJDK Java 7 documentation'
+
+  install -d -m755 "${pkgdir}/usr/share/doc/openjdk7-doc"
+  for i in "${srcdir}"/icedtea-${_icedtea_ver}/openjdk.build/docs/*; do
+    cp -a $i "${pkgdir}/usr/share/doc/openjdk7-doc/"
+  done
 }
diff --git a/abs/extra/java7-openjdk/disable_Werror.diff b/abs/extra/java7-openjdk/disable_Werror.diff
deleted file mode 100644
index fa8887a..0000000
--- a/abs/extra/java7-openjdk/disable_Werror.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- openjdk/hotspot/make/linux/makefiles/gcc.make	2012-06-07 16:30:51.000000000 +0200
-+++ openjdk/hotspot/make/linux/makefiles/gcc.make.new	2012-06-14 15:32:44.967695139 +0200
-@@ -150,7 +150,7 @@
- endif
- 
- # Compiler warnings are treated as errors
--WARNINGS_ARE_ERRORS = -Werror
-+#WARNINGS_ARE_ERRORS = -Werror
- 
- # Except for a few acceptable ones
- # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
diff --git a/abs/extra/java7-openjdk/fix_corba_cmds_path.diff b/abs/extra/java7-openjdk/fix_corba_cmds_path.diff
deleted file mode 100644
index 7a3db95..0000000
--- a/abs/extra/java7-openjdk/fix_corba_cmds_path.diff
+++ /dev/null
@@ -1,29 +0,0 @@
---- openjdk/corba/make/common/shared/Defs-utils.gmk.old	2008-04-13 13:26:12.000000000 +0300
-+++ openjdk/corba/make/common/shared/Defs-utils.gmk	2008-04-14 15:35:13.000000000 +0300
-@@ -76,7 +76,7 @@
- CHMOD          = $(UTILS_COMMAND_PATH)chmod
- CMP            = $(UTILS_USR_BIN_PATH)cmp
- COMM           = $(UTILS_USR_BIN_PATH)comm
--COMPRESS       = $(UTILS_USR_BIN_PATH)compress
-+COMPRESS       = $(UTILS_COMMAND_PATH)compress
- CP             = $(UTILS_COMMAND_PATH)cp
- CPIO           = $(UTILS_COMMAND_PATH)cpio
- CUT            = $(UTILS_USR_BIN_PATH)cut
-@@ -125,7 +125,7 @@
- TAIL           = $(UTILS_USR_BIN_PATH)tail
- TAR            = $(UTILS_COMMAND_PATH)tar
- TEST           = $(UTILS_USR_BIN_PATH)test
--TOUCH          = $(UTILS_COMMAND_PATH)touch
-+TOUCH          = $(UTILS_USR_BIN_PATH)touch
- TR             = $(UTILS_USR_BIN_PATH)tr
- TRUE           = $(UTILS_COMMAND_PATH)true
- UNAME          = $(UTILS_COMMAND_PATH)uname
-@@ -176,7 +176,7 @@
-   # others have it in /usr/bin.
-   SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
- 		   $(wildcard $(UTILS_USR_BIN_PATH)sort))
--  NAWK           = $(USRBIN_PATH)gawk
-+  NAWK           = $(UTILS_COMMAND_PATH)gawk
-   # Intrinsic unix command, with backslash-escaped character interpretation
-   ECHO           = /bin/echo -e
-   # These are really in UTILS_USR_BIN_PATH on Linux (only sccs is not)
diff --git a/abs/extra/java7-openjdk/giflib_5.1.diff b/abs/extra/java7-openjdk/giflib_5.1.diff
new file mode 100644
index 0000000..a936157
--- /dev/null
+++ b/abs/extra/java7-openjdk/giflib_5.1.diff
@@ -0,0 +1,14 @@
+--- openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c.orig	2014-05-27 22:17:19.766866065 +0200
++++ openjdk/jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	2014-05-27 22:16:35.452894426 +0200
+@@ -310,7 +310,11 @@
+     free(pBitmapBits);
+     free(pOldBitmapBits);
+ 
++#if GIFLIB_MAJOR >= 5
++    DGifCloseFile(gif, NULL);
++#else
+     DGifCloseFile(gif);
++#endif
+ 
+     return 1;
+ }
diff --git a/abs/extra/java7-openjdk/jdk7-openjdk.install b/abs/extra/java7-openjdk/jdk7-openjdk.install
new file mode 100644
index 0000000..92b440e
--- /dev/null
+++ b/abs/extra/java7-openjdk/jdk7-openjdk.install
@@ -0,0 +1,50 @@
+THIS_JDK='java-7-openjdk'
+
+fix_default() {
+  if [ ! -x /usr/bin/java ]; then
+    /usr/bin/archlinux-java unset
+    echo ""
+  else
+    /usr/bin/archlinux-java get
+  fi
+}
+
+post_install() {
+  default=$(fix_default)
+  case ${default} in
+    "" | ${THIS_JDK}/jre)
+      /usr/bin/archlinux-java set ${THIS_JDK}
+      ;;
+    ${THIS_JDK})
+      # Nothing
+      ;;
+    *)
+      echo "Default Java environment is already set to '${default}'"
+      echo "See 'archlinux-java help' to change it"
+      ;;
+  esac
+
+  if [ ! -f /etc/ssl/certs/java/cacerts ]; then
+    /usr/bin/update-ca-trust
+  fi
+}
+
+post_upgrade() {
+  default=$(fix_default)
+  if [ -z "${default}" -o "x${default}" = "x${THIS_JDK}/jre" ]; then
+    /usr/bin/archlinux-java set ${THIS_JDK}
+  fi
+
+  if [ ! -f /etc/ssl/certs/java/cacerts ]; then
+    /usr/bin/update-ca-trust
+  fi
+}
+
+pre_remove() {
+  if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then
+    sudo /usr/bin/archlinux-java unset
+    if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then
+      sudo /usr/bin/archlinux-java set ${THIS_JDK}/jre
+    fi
+  fi
+}
diff --git a/abs/extra/java7-openjdk/jdk7-openjdk.profile b/abs/extra/java7-openjdk/jdk7-openjdk.profile
deleted file mode 100644
index 91265cc..0000000
--- a/abs/extra/java7-openjdk/jdk7-openjdk.profile
+++ /dev/null
@@ -1,6 +0,0 @@
-export J2SDKDIR=/usr/lib/jvm/java-7-openjdk
-export J2REDIR=$J2SDKDIR/jre
-export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
-
-# For non-reparenting window managers, enable '_JAVA_AWT_WM_NONREPARENTING'
-# in /etc/profile.d/jre7.sh
diff --git a/abs/extra/java7-openjdk/jdk7-openjdk.profile.csh b/abs/extra/java7-openjdk/jdk7-openjdk.profile.csh
deleted file mode 100644
index cc7dc8a..0000000
--- a/abs/extra/java7-openjdk/jdk7-openjdk.profile.csh
+++ /dev/null
@@ -1 +0,0 @@
-setenv J2SDKDIR "/usr/lib/jvm/java-7-openjdk"
diff --git a/abs/extra/java7-openjdk/jre7-openjdk-headless.install b/abs/extra/java7-openjdk/jre7-openjdk-headless.install
index 45f52fe..6f0ad5d 100644
--- a/abs/extra/java7-openjdk/jre7-openjdk-headless.install
+++ b/abs/extra/java7-openjdk/jre7-openjdk-headless.install
@@ -1,15 +1,48 @@
+THIS_JRE='java-7-openjdk/jre'
+
+fix_default() {
+  if [ ! -x /usr/bin/java ]; then
+    /usr/bin/archlinux-java unset
+    echo ""
+  else
+    /usr/bin/archlinux-java get
+  fi
+}
+
 post_install() {
+  default=$(fix_default)
+  case ${default} in
+    "")
+      /usr/bin/archlinux-java set ${THIS_JRE}
+      ;;
+    ${THIS_JRE} | ${THIS_JRE/\/jre})
+      # Nothing
+      ;;
+    *)
+      echo "Default Java environment is already set to '${default}'"
+      echo "See 'archlinux-java help' to change it"
+      ;;
+  esac
+
   if [ ! -f /etc/ssl/certs/java/cacerts ]; then
-    /usr/sbin/init-jks-keystore
+     /usr/bin/update-ca-trust
   fi
 }
 
 post_upgrade() {
+  if [ -z $(fix_default) ]; then
+    /usr/bin/archlinux-java set ${THIS_JRE}
+  fi
+
   if [ ! -f /etc/ssl/certs/java/cacerts ]; then
-    /usr/sbin/init-jks-keystore
+    /usr/bin/update-ca-trust
   fi
 }
 
-#post_remove() {
-#
-#}
+pre_remove() {
+  default=$(fix_default)
+  if [ "x${default/\/jre}" = "x${THIS_JRE/\/jre}" ]; then
+    /usr/bin/archlinux-java unset
+    echo "No Java environment is set as default anymore"
+  fi
+}
diff --git a/abs/extra/java7-openjdk/jre7-openjdk.install b/abs/extra/java7-openjdk/jre7-openjdk.install
index d98e79e..78e694f 100644
--- a/abs/extra/java7-openjdk/jre7-openjdk.install
+++ b/abs/extra/java7-openjdk/jre7-openjdk.install
@@ -1,18 +1,55 @@
+THIS_JRE='java-7-openjdk/jre'
+
+fix_default() {
+  if [ ! -x /usr/bin/java ]; then
+    /usr/bin/archlinux-java unset
+    echo ""
+  else
+    /usr/bin/archlinux-java get
+  fi
+}
+
 post_install() {
+  default=$(fix_default)
+  case ${default} in
+    "")
+      /usr/bin/archlinux-java set ${THIS_JRE}
+      ;;
+    ${THIS_JRE} | ${THIS_JRE/\/jre})
+      # Nothing
+      ;;
+    *)
+      echo "Default Java environment is already set to '${default}'"
+      echo "See 'archlinux-java help' to change it"
+      ;;
+  esac
+
   xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
-  echo "when you use a non-reparenting window manager"
-  echo "set _JAVA_AWT_WM_NONREPARENTING=1 in"
-  echo "/etc/profile.d/jre.sh"
+  echo "when you use a non-reparenting window manager,"
+  echo "set _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh"
+
 #  update-desktop-database -q
 }
 
 post_upgrade() {
+  if [ -z $(fix_default) ]; then
+    /usr/bin/archlinux-java set ${THIS_JRE}
+  fi
+
   xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+
 #  update-desktop-database -q
 }
 
+pre_remove() {
+  if [ "x$(fix_default)" = "x${THIS_JRE/\/jre}" ]; then
+    /usr/bin/archlinux-java unset
+    echo "No Java environment is set as default anymore"
+  fi
+}
 
 post_remove() {
   xdg-icon-resource forceupdate --theme hicolor 2> /dev/null
+
 #  update-desktop-database -q
 }
diff --git a/abs/extra/java7-openjdk/jre7-openjdk.profile b/abs/extra/java7-openjdk/jre7-openjdk.profile
deleted file mode 100644
index c86ce85..0000000
--- a/abs/extra/java7-openjdk/jre7-openjdk.profile
+++ /dev/null
@@ -1,5 +0,0 @@
-export J2REDIR=/usr/lib/jvm/java-7-openjdk/jre
-export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk/jre}
-
-# enable this for non-reparenting window managers
-#export _JAVA_AWT_WM_NONREPARENTING=1
diff --git a/abs/extra/java7-openjdk/jre7-openjdk.profile.csh b/abs/extra/java7-openjdk/jre7-openjdk.profile.csh
deleted file mode 100644
index a9aed27..0000000
--- a/abs/extra/java7-openjdk/jre7-openjdk.profile.csh
+++ /dev/null
@@ -1,5 +0,0 @@
-setenv J2REDIR "/usr/lib/jvm/java-7-openjdk/jre"
-setenv JAVA_HOME "/usr/lib/jvm/java-7-openjdk/jre"
-
-# enable this for non-reparenting window managers
-#setenv _JAVA_AWT_WM_NONREPARENTING 1
diff --git a/abs/extra/java7-openjdk/openjdk7_fix_jdk_cmds_path.diff b/abs/extra/java7-openjdk/openjdk7_fix_jdk_cmds_path.diff
deleted file mode 100644
index 6cac91d..0000000
--- a/abs/extra/java7-openjdk/openjdk7_fix_jdk_cmds_path.diff
+++ /dev/null
@@ -1,36 +0,0 @@
---- openjdk/jdk/make/common/shared/Defs-utils.gmk.old	2011-08-06 15:46:01.000000000 +0200
-+++ openjdk/jdk/make/common/shared/Defs-utils.gmk	2011-08-06 15:59:26.000000000 +0200
-@@ -91,7 +91,7 @@
- CHMOD          = $(UTILS_COMMAND_PATH)chmod
- CMP            = $(UTILS_USR_BIN_PATH)cmp
- COMM           = $(UTILS_USR_BIN_PATH)comm
--COMPRESS       = $(UTILS_USR_BIN_PATH)compress
-+COMPRESS       = $(UTILS_COMMAND_PATH)compress
- CP             = $(UTILS_COMMAND_PATH)cp
- CPIO           = $(UTILS_COMMAND_PATH)cpio
- CUT            = $(UTILS_USR_BIN_PATH)cut
-@@ -101,13 +101,13 @@
- DIRNAME        = $(UTILS_USR_BIN_PATH)dirname
- DUMP           = $(UTILS_CCS_BIN_PATH)dump
- ECHO           = $(UTILS_COMMAND_PATH)echo
--EGREP          = $(UTILS_COMMAND_PATH)egrep
-+EGREP          = $(UTILS_USR_BIN_PATH)egrep
- EXPR           = $(UTILS_USR_BIN_PATH)expr
- FILE           = $(UTILS_USR_BIN_PATH)file
- FIND           = $(UTILS_USR_BIN_PATH)find
- FMT            = $(UTILS_COMMAND_PATH)fmt
- GDB            = $(UTILS_USR_BIN_PATH)gdb
--GREP           = $(UTILS_COMMAND_PATH)grep
-+GREP           = $(UTILS_USR_BIN_PATH)grep
- GUNZIP         = $(UTILS_COMMAND_PATH)gunzip
- # GZIP is used for solaris. Linux and windows use tar czf
- GZIP           = $(UTILS_COMMAND_PATH)gzip
-@@ -140,7 +140,7 @@
- TAIL           = $(UTILS_USR_BIN_PATH)tail
- TAR            = $(UTILS_COMMAND_PATH)tar
- TEST           = $(UTILS_USR_BIN_PATH)test
--TOUCH          = $(UTILS_COMMAND_PATH)touch
-+TOUCH          = $(UTILS_USR_BIN_PATH)touch
- TR             = $(UTILS_USR_BIN_PATH)tr
- TRUE           = $(UTILS_COMMAND_PATH)true
- UNAME          = $(UTILS_COMMAND_PATH)uname
diff --git a/abs/extra/java7-openjdk/openjdk7_nonreparenting-wm.diff b/abs/extra/java7-openjdk/openjdk7_nonreparenting-wm.diff
index 22d54fc..fb4710c 100644
--- a/abs/extra/java7-openjdk/openjdk7_nonreparenting-wm.diff
+++ b/abs/extra/java7-openjdk/openjdk7_nonreparenting-wm.diff
@@ -1,16 +1,16 @@
---- openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java.orig	2011-08-07 18:45:05.000000000 +0200
-+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java	2011-08-07 18:45:54.000000000 +0200
-@@ -103,7 +103,8 @@
-         COMPIZ_WM = 12,
+--- openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java.orig	2013-10-16 16:17:14.000000000 +0200
++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWM.java	2013-10-21 20:57:34.768580842 +0200
+@@ -105,7 +105,8 @@
          LG3D_WM = 13,
          CWM_WM = 14,
--        MUTTER_WM = 15;
-+        MUTTER_WM = 15,
-+        OTHER_NONREPARENTING_WM = 16;
+         MUTTER_WM = 15,
+-        MARCO_WM = 16;
++        MARCO_WM = 16,
++        OTHER_NONREPARENTING_WM = 17;
      public String toString() {
          switch  (WMID) {
            case NO_WM:
-@@ -583,7 +584,7 @@
+@@ -591,7 +592,7 @@
      // TODO: according to wikipedia, compiz is now reparenting. This should
      // probably be updated.
      static boolean isNonReparentingWM() {
@@ -19,7 +19,7 @@
      }
  
      /*
-@@ -771,9 +772,17 @@
+@@ -781,9 +782,17 @@
               * supports WIN or _NET wm spec.
               */
              else if (l_net_protocol.active()) {
@@ -28,18 +28,18 @@
 +                    awt_wmgr = XWM.OTHER_NONREPARENTING_WM;
 +                } else {
 +                    awt_wmgr = XWM.OTHER_WM;
-+				}
++                }
              } else if (win.active()) {
 -                awt_wmgr = XWM.OTHER_WM;
 +                if (XToolkit.getEnv("_JAVA_AWT_WM_NONREPARENTING") != null) {
 +                    awt_wmgr = XWM.OTHER_NONREPARENTING_WM;
 +                } else {
 +                    awt_wmgr = XWM.OTHER_WM;
-+				}
++                }
              }
              /*
               * Check for legacy WMs.
-@@ -784,6 +793,8 @@
+@@ -794,6 +803,8 @@
                  awt_wmgr = XWM.MOTIF_WM;
              } else if (isOpenLook()) {
                  awt_wmgr = XWM.OPENLOOK_WM;
@@ -48,7 +48,7 @@
              } else {
                  awt_wmgr = XWM.OTHER_WM;
              }
-@@ -1298,6 +1309,7 @@
+@@ -1309,6 +1320,7 @@
                    res = new Insets(28, 6, 6, 6);
                    break;
                case NO_WM:
-- 
cgit v0.12

