# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../sun-jdk-131/sun-jdk-131.conf
# Copyright (C) 2006 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---


. $base/package/*/*/java-sun-conf.in jre

# Overrule the existing preconf script with a new one.
java_preconf() {
	# eliminate interactivity and integrity checks.
	cp -v $java_srctar .
	sed -i 's,more <<,cat <<,' ${java_srctar##*/}
	sed -i 's,agreed=,agreed=1,' ${java_srctar##*/}

	# Here we hardcode the java extract dir. Since
	# java 1.3 is no longer maintained this is not
	# really a problem.
	java_home_original=jdk1.3.1_19

	# Ready to unpack/install the archive.
	sh ${java_srctar##*/}

	# Patch a few scripts to support x86-64 as well
	# in 32 bits modus.
	sed -i 's,ia32 | ia64,ia32 | x86_64 | ia64,' $java_home_original/bin/.java_wrapper
	sed -i 's,ia32 | ia64,ia32 | x86_64 | ia64,' $java_home_original/jre/bin/.java_wrapper
	sed -i 's,ia32 | ia64,ia32 | x86_64 | ia64 | i?86,' $java_home_original/bin/ControlPanel
	sed -i 's,ia32 | ia64,ia32 | x86_64 | ia64 | i?86,' $java_home_original/jre/bin/ControlPanel
	sed -i 's,i\[3-6\]86,i[3-6]86  | ia32 | x86_64 | ia64 | i?86,' $java_home_original/bin/realpath
	sed -i 's,i\[3-6\]86,i[3-6]86  | ia32 | x86_64 | ia64 | i?86,' $java_home_original/jre/bin/realpath

	# Patch the use of 'head -1' into 'head -n 1'
	sed -i 's,head -,head -n ,' $java_home_original/bin/.java_wrapper
	sed -i 's,head -,head -n ,' $java_home_original/jre/bin/.java_wrapper

	# To get a working java environment we need one thing more.
	# We need to ensure 'classic' behaviour. All others will result
	# in a missing 'libstdc++-libc6.1-1.so.2' library. Since this
	# package is only for a proof of concept I can live with this
	# behavior for the time being.
	cat <<-'EOT' > $java_home_original/jre/lib/jvm.cfg
	#
	# @(#)jvm.cfg   1.10 00/08/01
	#
	# Copyright 1999 by Sun Microsystems, Inc.,
	# 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
	# All rights reserved.
	#
	# List of JVMs that can be used as the first option to java, javac, etc.
	# Order is important -- first in this list is the default JVM.
	#
	# Remark:
	# Only classic is currently supported, since the others will result
	# in a missing library 'libstdc++-libc6.1-1.so.2'. Until this library
	# is available the other possible JVMs can not be used.
	# end remark
	#-client
	#-hotspot
	#-server
	-classic
	EOT
}