%define        origin           sun
%define        priority         1600
%define        javaver          1.6.0
%define        cvsver           6u20
%define        over             %{cvsver}
%define        buildver         20

%define        cvsversion       %{cvsver}

%define        javaws_ver       %{javaver}
%define        javaws_version   %{cvsversion}

%define        ubuntu_svnrev    r273

%define        jdkbundle        jdk%{javaver}_%{buildver}
%define        sdklnk           java-%{javaver}-%{origin}
%define        jrelnk           jre-%{javaver}-%{origin}
%define        sdkdir           %{name}-%{version}
%define        jredir           %{sdkdir}/jre
%define        sdkbindir        %{_jvmdir}/%{sdklnk}/bin
%define        sdklibdir        %{_jvmdir}/%{sdklnk}/lib
%define        jrebindir        %{_jvmdir}/%{jrelnk}/bin
%define        jvmjardir        %{_jvmjardir}/%{name}-%{version}

%define fontdir                 %{_datadir}/fonts/java

%ifarch %{ix86}
%define        target_cpu       i586
%define        pluginname       %{_jvmdir}/%{jredir}/plugin/i386/ns7/libjavaplugin_oji.so
%endif
%ifarch x86_64
%define        target_cpu       amd64
%endif

%define        cgibindir        %{_var}/www/cgi-bin

# Avoid RPM 4.2+'s internal dep generator, it may produce bogus
# Provides/Requires here.
%define _use_internal_dependency_generator 0

# This prevents aggressive stripping.
%define        debug_package    %{nil}

Name:           java-%{javaver}-%{origin}
Version:        %{javaver}.%{buildver}
Release:        1%{?_dist_release}
Summary:        Java Runtime Environment for %{name}
Summary(ja):    Java 実行環境 (%{name})
License:        Operating System Distributor License for Java (DLJ)
Group:          Development/Languages
URL:            http://java.sun.com/j2se/%{javaver}
Source0:        http://download.java.net/dlj/binaries/jdk-%{cvsversion}-dlj-linux-i586.bin
Source1:        http://download.java.net/dlj/binaries/jdk-%{cvsversion}-dlj-linux-amd64.bin
# svn co -%{ubuntu_svnrev} --username guest --password "" https://jdk-distros.dev.java.net/svn/jdk-distros/trunk/linux/ubuntu/sun-java6/debian/
Source2:        jdk-6-dlj-ubuntu-%{ubuntu_svnrev}.tar.bz2
# fontconfig.properties
Source10:	fontconfig.Vine5.properties
# (anssi) make javaws entry really point to javaws and create a different
# entry for the cache viewer where to it pointed previously (#31347):
Patch0:         jdk6-fix-javaws-desktop.patch
Provides:       jre-%{javaver}-%{origin} = %{version}-%{release}
Provides:       jre-%{origin} = %{version}-%{release}
Provides:       jre-%{javaver} java-%{javaver} jre = %{javaver}
Provides:       java-%{origin} = %{version}-%{release}
Provides:       java = %{javaver}
Provides:       %{name} = %{version}-%{release}
Requires(post): alternatives
Requires(postun): alternatives
Requires:       jpackage-utils >= 1.7.4
ExclusiveArch:  %{ix86} x86_64
BuildArch:	i586 x86_64
BuildRequires:  jpackage-utils >= 1.7.4 sed desktop-file-utils
%ifnarch x86_64
Provides:       javaws = %{javaws_ver}
%endif
Provides:       jndi = %{version} jndi-ldap = %{version}
Provides:       jndi-cos = %{version} jndi-rmi = %{version}
Provides:       jndi-dns = %{version}
Provides:       jaas = %{version}
Provides:       jsse = %{version}
Provides:       jce = %{version}
Provides:       jdbc-stdext = 3.0 jdbc-stdext = %{version}
Provides:       java-sasl = %{version}
%ifnarch x86_64
Obsoletes:      javaws-menu
Provides:       javaws-menu
%endif
# DLJ license requires these to be part of the JRE
Requires:       %{name}-plugin = %{version}-%{release}
Requires:       %{name}-alsa = %{version}-%{release}
Requires:       %{name}-jdbc = %{version}-%{release}
Requires:       %{name}-fonts = %{version}-%{release}
Provides:       j2re = %{version}-%{release}
Provides:       jre2 = %{version}-%{release}
Obsoletes:      j2re < %{version}-%{release}
Obsoletes:      jre2 < %{version}-%{release}
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

%description
This package contains the Java Runtime Environment for %{name}

%package devel
Summary:        Java Development Kit for %{name}
Group:          Development/Languages
Requires(post): alternatives
Requires(postun): alternatives
Provides:       java-sdk-%{javaver}-%{origin} = %{version}-%{release}
Provides:       java-sdk-%{origin} = %{version}-%{release}
Provides:       java-sdk-%{javaver} java-sdk = %{javaver} jdk = %{javaver}
Provides:       java-devel-%{origin} = %{version}-%{release}
Provides:       java-%{javaver}-devel java-devel = %{javaver}
Requires:       %{name} = %{version}-%{release}
Provides:       jdk = %{version}-%{release}
Provides:       jdk2 = %{version}-%{release}
Provides:       j2sdk = %{version}-%{release}
Obsoletes:      jdk < %{version}-%{release}
Obsoletes:      jdk2 < %{version}-%{release}
Obsoletes:      j2sdk < %{version}-%{release}

%description devel
The Java(tm) Development Kit (JDK(tm)) contains the software and tools that
developers need to compile, debug, and run applets and applications
written using the Java programming language.

%package src
Summary:        Source files for %{name}
Group:          Development/Languages
Requires:       %{name} = %{version}-%{release}

%description src
This package contains source files for %{name}.

%package demo
Summary:        Demonstration files for %{name}
Group:          Development/Languages
Requires:       %{name} = %{version}-%{release}
# Without this a requirement on libjava_crw_demo_g.so is added which
# is not in the main java package. libjava_crw_demo.so is but not "_g".
AutoReq:        0

%description demo
This package contains demonstration files for %{name}.

%package plugin
Summary:        Browser plugin files for %{name}
Group:          Applications/Internet
Requires(post): alternatives
Requires(postun): alternatives
Requires:       %{name} = %{version}-%{release}
Provides:       java-plugin = %{javaver} java-%{javaver}-plugin = %{version}
Provides:       %{name}-plugin = %{version}-%{release}
Conflicts:      java-%{javaver}-ibm-plugin java-%{javaver}-blackdown-plugin
Conflicts:      java-%{javaver}-bea-plugin
Obsoletes:      java-1.3.1-plugin java-1.4.0-plugin java-1.4.1-plugin java-1.4.2-plugin

%description plugin
This package contains browser plugin files for %{name}.
Note!  This package supports browsers built with GCC 3.2 and later.

%package fonts
Summary:        TrueType fonts for %{origin} JVMs
Group:          User Interface/X
Requires(post): alternatives
Requires(postun): alternatives
Requires:       %{name} = %{version}-%{release}
Requires:	freetype-utils
%if %{_dist_release}=="vl4"
Requires:       XOrg-font-utils
%else
Requires:       xorg-x11-font-utils
%endif
Requires(post): fontconfig
Requires(postun): fontconfig
Provides:       java-fonts = %{javaver} java-%{javaver}-fonts
Conflicts:      java-%{javaver}-ibm-fonts java-%{javaver}-blackdown-fonts
Conflicts:      java-%{javaver}-bea-fonts
Obsoletes:      java-1.3.1-fonts java-1.4.0-fonts java-1.4.1-fonts java-1.4.2-fonts

%description fonts
This package contains the TrueType fonts for %{origin} JVMs.

%package alsa
Summary:        ALSA support for %{name}
Group:          Development/Languages
Requires:       %{name} = %{version}-%{release}
Provides:       %{name}-alsa = %{version}-%{release}

%description alsa
This package contains Advanced Linux Sound Architecture (ALSA) support
libraries for %{name}.

%package jdbc
Summary:        JDBC/ODBC bridge driver for %{name}
Group:          Development/Languages
Requires:       %{name} = %{version}-%{release}
Provides:       %{name}-jdbc = %{version}-%{release}
AutoReq:        0

%description jdbc
This package contains the JDBC/ODBC bridge driver for %{name}.

%prep
%setup -q -T -c -n %{name}-%{version} -a2
%patch0 -p0
%ifarch %{ix86}
sh %{SOURCE0} --accept-license --unpack
%else
sh %{SOURCE1} --accept-license --unpack
%endif
cd %{jdkbundle}
%ifarch x86_64
rm -f man/man1/javaws.1
%endif

# fix perms
chmod -R go=u-w *
chmod -R u+w *

%build
for xdgmenu in debian/*desktop.in; do
        sed $xdgmenu \
        -e "s#@vendor@#Sun#g" \
        -e "s#@RELEASE@#%{javaver}#g" \
        -e "s#/@basedir@/bin#%{jrebindir}#g" \
        -e "s#Icon=.*#Icon=%{name}#g" \
        -e "s#@ia32txt@##g" \
        > %{name}-`echo $xdgmenu|cut -d- -f2|cut -d. -f1-2`
done
sed -i -e "s#%{jrebindir}#%{sdkbindir}#g" %{name}-jconsole.desktop
mv %{name}-java.desktop debian/sharedmimeinfo %{jdkbundle}/jre/lib

%ifnarch x86_64
#sed -i -e "s#PATH=/usr/local/java/bin#PATH=%{jrebindir}#" %{jdkbundle}/bin/java-rmi.cgi

# fix up (create new) HtmlConverter
#cat >%{jdkbundle}/bin/HtmlConverter << EOF
#%{jrebindir}/java -jar %{sdklibdir}/htmlconverter.jar $*
#EOF
%endif

%install
rm -rf %{buildroot}

cd %{jdkbundle}
%ifnarch x86_64
# install java-rmi-cgi
install -m755 bin/java-rmi.cgi -D %{buildroot}%{cgibindir}/java-rmi-%{version}.cgi
%endif

# main files
install -d %{buildroot}%{_jvmdir}/%{sdkdir}
cp -a COPYRIGHT LICENSE THIRDPARTYLICENSEREADME.txt bin include lib %{buildroot}%{_jvmdir}/%{sdkdir}
install -m644 src.zip -D %{buildroot}%{_prefix}/src/%{name}-%{version}.zip
ln -s %{_prefix}/src/%{name}-%{version}.zip %{buildroot}%{_jvmdir}/%{sdkdir}/src.zip

install -d %{buildroot}%{_jvmdir}/%{jredir}

# extensions handling
install -d %{buildroot}%{jvmjardir}
pushd %{buildroot}%{jvmjardir}
   ln -s %{_jvmdir}/%{jredir}/lib/jsse.jar jsse-%{version}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/jce.jar jce-%{version}.jar
   for jar in jndi jndi-ldap jndi-cos jndi-rmi jaas jdbc-stdext sasl; do
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar $jar-%{version}.jar; done
   ln -s jdbc-stdext-%{version}.jar jdbc-stdext-3.0.jar
   for jar in *-%{version}.jar ; do
      if [ x%{version} != x%{javaver} ]; then
         ln -fs ${jar} $(echo $jar | sed "s|-%{version}.|-%{javaver}.|g")
      fi
      ln -fs ${jar} $(echo $jar | sed "s|-%{version}.|.|g")
   done
popd

# rest of the jre
cp -a jre/bin jre/lib %{buildroot}%{_jvmdir}/%{jredir}
cp -a jre/javaws jre/plugin %{buildroot}%{_jvmdir}/%{jredir}
install -d %{buildroot}%{_jvmdir}/%{jredir}/lib/endorsed

# jce policy file handling
install -d %{buildroot}%{_jvmprivdir}/%{name}/jce/vanilla
for file in local_policy.jar US_export_policy.jar; do
  ln -s %{_jvmdir}/%{jredir}/lib/security/$file \
    %{buildroot}%{_jvmprivdir}/%{name}/jce/vanilla
  # for ghosts
  touch %{buildroot}%{_jvmdir}/%{jredir}/lib/security/$file
done

# versionless symlinks
pushd %{buildroot}%{_jvmdir}
ln -s %{jredir} %{jrelnk}
ln -s %{sdkdir} %{sdklnk}
popd

pushd %{buildroot}%{_jvmjardir}
ln -s %{sdkdir} %{jrelnk}
ln -s %{sdkdir} %{sdklnk}
popd

%ifnarch x86_64

install -m644 jre/plugin/desktop/sun_java.png -D %{buildroot}%{_datadir}/pixmaps/%{name}.png

for desktop in ../*.desktop; do
    desktop-file-install --vendor="" \
        --remove-category="Application" \
        --remove-category="X-Red-Hat-Base" \
        --remove-category="AdvancedSettings" \
        --add-category="X-MandrivaLinux-System-SunJava%{over}" \
        --dir %{buildroot}%{_datadir}/applications $desktop
done
%endif

# make sure that this directory exist so update-alternatvies won't fail if shared-mime-info isn't installed
install -d %{buildroot}%{_datadir}/mime/packages

# man pages
install -d %{buildroot}%{_mandir}/man1
pushd man
for manpage in man1/*; do
    #iconv -f iso-8859-1 -t utf-8 $manpage -o %{buildroot}%{_mandir}/man1/`basename $manpage .1`-%{name}.1
    install -m644 $manpage -D $RPM_BUILD_ROOT%{_mandir}/man1/`basename $manpage .1`-%{name}.1
    [ -f ja_JP.eucJP/$manpage ] && install -m644 ja_JP.eucJP/$manpage -D $RPM_BUILD_ROOT%{_mandir}/ja/man1/`basename $manpage .1`-%{name}.1
done
popd

# demo
install -d %{buildroot}%{_datadir}/%{name}
cp -a demo %{buildroot}%{_datadir}/%{name}
ln -s %{_datadir}/%{name}/demo %{buildroot}%{_jvmdir}

### font handling
# (anssi) This dir is used with java-1.5.0-sun as well, do not modify to avoid conflicts
install -d %{buildroot}%{fontdir}
ln -s %{_sysconfdir}/java/font.properties %{buildroot}%{_jvmdir}/%{jredir}/lib

# fontconfig.properties
install -m644 %{SOURCE10} %{buildroot}%{_jvmdir}/%{jredir}/lib/fontconfig.Vine5.properties
ln -sf fontconfig.Vine5.properties %{buildroot}%{_jvmdir}/%{jredir}/lib/fontconfig.properties

# These %ghost'd files are created properly in %post  -- Rex
touch %{buildroot}%{fontdir}/{fonts.{alias,dir,scale,cache-1},XftCache,encodings.dir}

# fontpath.d symlink
mkdir -p %{buildroot}%_sysconfdir/X11/fontpath.d/
ln -s ../../..%{fontdir} \
    %{buildroot}%_sysconfdir/X11/fontpath.d/java:pri=50

# make sure that plugin dir exists so update-alternatives won't fail if mozilla/firefox isn't installed
install -d %{buildroot}%{_libdir}/mozilla/plugins

cd ..

# Most of this shamelessly stolen from redhat's kdebase-2.2.2 specfile
find %{buildroot}%{_jvmdir}/%{jredir} -type d \
| sed 's|'%{buildroot}'|%dir |' >  %{name}-%{version}-all.files
find %{buildroot}%{_jvmdir}/%{jredir} -type f -o -type l \
| sed 's|'%{buildroot}'||'      >> %{name}-%{version}-all.files

grep plugin  %{name}-%{version}-all.files | sort \
> %{name}-%{version}-plugin.files
grep Jdbc    %{name}-%{version}-all.files | sort \
> %{name}-%{version}-jdbc.files
grep -F alsa.so %{name}-%{version}-all.files | sort \
> %{name}-%{version}-alsa.files
cat %{name}-%{version}-all.files \
| grep -v plugin \
| grep -v Jdbc \
| grep -v lib/fonts \
| grep -vF alsa.so \
| grep -v jre/lib/security \
> %{name}-%{version}.files

%ifarch x86_64
%define        jreext        %{nil}
%else
%define        jreext        javaws
%endif
%define        jrebin        keytool orbd policytool rmid rmiregistry servertool tnameserv
%define        jreman        java %{jreext} %{jrebin}
%ifarch        x86_64
%define        jdkext        %{nil}
%else
%define        jdkext        HtmlConverter
%endif
%define        jdkboth        appletviewer extcheck idlj jar jarsigner javadoc javah javap jdb jvisualvm native2ascii rmic serialver jconsole pack200 unpack200 apt jinfo jmap jps jsadebugd jstack jstat jstatd jhat jrunscript schemagen wsgen wsimport xjc 
%define        jdkman        %{jdkboth} javac
%define        jdkbin        %{jdkboth} %{jdkext}

%define _extension .gz
for man in %{jreman}; do
echo %{_mandir}/man1/${man}-%{name}.1%{_extension} >> %{name}-%{version}.files
echo %{_mandir}/ja/man1/${man}-%{name}.1%{_extension} >> %{name}-%{version}.files
done
rm -f %{name}-%{version}-devel.files
for man in %{jdkman}; do
echo %{_mandir}/man1/${man}-%{name}.1%{_extension} >> %{name}-%{version}-devel.files
echo %{_mandir}/ja/man1/${man}-%{name}.1%{_extension} >> %{name}-%{version}-devel.files
done

%clean
rm -rf %{buildroot}

%post
update-alternatives --install %{_bindir}/java java %{jrebindir}/java %{priority}%{expand:%(for bin in %{jrebin}; do echo -n -e \ \\\\\\n\
--slave %{_bindir}/${bin}                        ${bin}                        %{jrebindir}/${bin}; done)}%{expand:%(for man in %{jreman}; do echo -n -e \ \\\\\\n\
--slave %{_mandir}/man1/${man}.1%{_extension}        ${man}.1%{_extension}        %{_mandir}/man1/${man}-%{name}.1%{_extension}; done)}%{expand:%(for man in %{jreman}; do echo -n -e \ \\\\\\n\
--slave %{_mandir}/ja/man1/${man}.1%{_extension}        ${man}%{_extension}.ja        %{_mandir}/ja/man1/${man}-%{name}.1%{_extension}; done)} \
%ifnarch x86_64
--slave        %{_bindir}/ControlPanel                   ControlPanel                %{jrebindir}/ControlPanel \
--slave        %{_datadir}/javaws                        javaws                        %{jrebindir}/javaws \
%endif
--slave %{_datadir}/mime/packages/java.xml        java.xml                %{_jvmdir}/%{jrelnk}/lib/sharedmimeinfo \
--slave        %{_jvmdir}/jre                                jre                        %{_jvmdir}/%{jrelnk} \
--slave        %{_jvmjardir}/jre                        jre_exports                %{_jvmjardir}/%{jrelnk}

update-alternatives \
    --install \
        %{_jvmdir}/%{jrelnk}/lib/security/local_policy.jar \
        jce_%{javaver}_%{origin}_local_policy \
        %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar \
        %{priority} \
    --slave \
        %{_jvmdir}/%{jrelnk}/lib/security/US_export_policy.jar \
        jce_%{javaver}_%{origin}_us_export_policy \
        %{_jvmprivdir}/%{name}/jce/vanilla/US_export_policy.jar

update-alternatives --install %{_jvmdir}/jre-%{origin} jre_%{origin} %{_jvmdir}/%{jrelnk} %{priority} \
--slave %{_jvmjardir}/jre-%{origin}        jre_%{origin}_exports        %{_jvmjardir}/%{jrelnk}

update-alternatives --install %{_jvmdir}/jre-%{javaver} jre_%{javaver} %{_jvmdir}/%{jrelnk} %{priority} \
--slave %{_jvmjardir}/jre-%{javaver}        jre_%{javaver}_exports      %{_jvmjardir}/%{jrelnk}

# fix broken symlink if it's there
if ! [ -e %{_bindir}/java ]; then
	update-alternatives --auto java
fi

%post devel
update-alternatives --install %{_bindir}/javac javac %{sdkbindir}/javac %{priority}%{expand:%(for bin in %{jdkbin}; do echo -n -e \ \\\\\\n\
--slave %{_bindir}/${bin}                        ${bin}                        %{sdkbindir}/${bin}; done)}%{expand:%(for man in %{jdkman}; do echo -n -e \ \\\\\\n\
--slave %{_mandir}/man1/${man}.1%{_extension}        ${man}.1%{_extension}        %{_mandir}/man1/${man}-%{name}.1%{_extension}; done)}%{expand:%(for man in %{jdkman}; do echo -n -e \ \\\\\\n\
--slave %{_mandir}/ja/man1/${man}.1%{_extension}        ${man}%{_extension}.ja        %{_mandir}/ja/man1/${man}-%{name}.1%{_extension}; done)} \
--slave %{_jvmdir}/java                         java_sdk                %{_jvmdir}/%{sdklnk} \
--slave %{_jvmjardir}/java                      java_sdk_exports        %{_jvmjardir}/%{sdklnk}

update-alternatives --install %{_jvmdir}/java-%{origin} java_sdk_%{origin} %{_jvmdir}/%{sdklnk} %{priority} \
--slave %{_jvmjardir}/java-%{origin}        java_sdk_%{origin}_exports        %{_jvmjardir}/%{sdklnk}

update-alternatives --install %{_jvmdir}/java-%{javaver} java_sdk_%{javaver} %{_jvmdir}/%{sdklnk} %{priority} \
--slave %{_jvmjardir}/java-%{javaver}        java_sdk_%{javaver}_exports      %{_jvmjardir}/%{sdklnk}

# fix broken symlink if it's there
if ! [ -e %{_bindir}/javac ]; then
	update-alternatives --auto javac
fi

%post plugin
update-alternatives --install %{_libdir}/mozilla/plugins/libjavaplugin_jni.so libjavaplugin_jni.so %{pluginname} %{priority}

%postun plugin
if ! [ -e "%{pluginname}" ]; then
    update-alternatives --remove libjavaplugin_jni.so %{pluginname}
fi

%postun
if ! [ -e "%{jrebindir}/java" ]; then
    update-alternatives --remove java %{jrebindir}/java
    update-alternatives --remove \
        jce_%{javaver}_%{origin}_local_policy \
        %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar
    update-alternatives --remove jre_%{origin}  %{_jvmdir}/%{jrelnk}
    update-alternatives --remove jre_%{javaver} %{_jvmdir}/%{jrelnk}
fi

%postun devel
if ! [ -e "%{sdkbindir}/javac" ]; then
    update-alternatives --remove javac %{sdkbindir}/javac
    update-alternatives --remove java_sdk_%{origin}  %{_jvmdir}/%{sdklnk}
    update-alternatives --remove java_sdk_%{javaver} %{_jvmdir}/%{sdklnk}
fi

%post fonts
%define fonts LucidaBrightItalic.ttf LucidaSansDemiBold.ttf LucidaTypewriterBold.ttf LucidaBrightDemiItalic.ttf LucidaBrightRegular.ttf LucidaSansRegular.ttf LucidaTypewriterRegular.ttf

update-alternatives \
    --install %{fontdir}/LucidaBrightDemiBold.ttf LucidaBrightDemiBold.ttf  %{_jvmdir}/%{jredir}/lib/fonts/LucidaBrightDemiBold.ttf %{priority} \
    %{expand:%(for font in %{fonts}; do echo -n -e \ \\\\\\n\
    --slave %{fontdir}/$font        $font        %{_jvmdir}/%{jredir}/lib/fonts/$font; done)}

mkfontscale %{fontdir}
mkfontdir %{fontdir}
fc-cache

%postun fonts
if ! [ -e %{_jvmdir}/%{jredir}/lib/fonts/LucidaBrightDemiBold.ttf ]; then
    update-alternatives --remove LucidaBrightDemiBold.ttf %{_jvmdir}/%{jredir}/lib/fonts/LucidaBrightDemiBold.ttf
    fc-cache
fi

if [ -d %{fontdir} ]; then
    mkfontscale %{fontdir}
    mkfontdir %{fontdir}
fi


# (Anssi 02/2008) The previous versions of this package were buggy and did
# not always remove the old alternative, causing it to be left enabled,
# leading to broken symlinks.
%posttrans
if ! [ -e %{_bindir}/java ]; then
	update-alternatives --auto java
fi
%posttrans devel
if ! [ -e %{_bindir}/javac ]; then
	update-alternatives --auto javac
fi

%posttrans plugin
if ! [ -e %{_libdir}/mozilla/plugins/libjavaplugin_jni.so ]; then
	update-alternatives --auto libjavaplugin_jni.so
fi

%posttrans fonts
if ! [ -e %{fontdir}/LucidaBrightDemiBold.ttf ]; then
	update-alternatives --auto LucidaBrightDemiBold.ttf
fi

%files -f %{name}-%{version}.files
%defattr(-,root,root,-)
%doc %{jdkbundle}/jre/{COPYRIGHT,LICENSE,README}
%doc %{jdkbundle}/jre/Welcome.html
%dir %{_jvmdir}/%{sdkdir}
%{_jvmdir}/%{sdkdir}/COPYRIGHT
%{_jvmdir}/%{sdkdir}/LICENSE
%{_jvmdir}/%{sdkdir}/THIRDPARTYLICENSEREADME.txt
%{jvmjardir}
%{_jvmdir}/%{jredir}/lib/fonts
%dir %{_jvmdir}/%{jredir}/lib/security
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/blacklist
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/cacerts
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.policy
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.security
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/trusted.libraries
%ifnarch x86_64
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/javaws.policy
%endif
%{_jvmdir}/%{jredir}/lib/security/local_policy.jar
%{_jvmdir}/%{jredir}/lib/security/US_export_policy.jar
%{_jvmdir}/%{jrelnk}
%{_jvmjardir}/%{jrelnk}
%{_jvmprivdir}/*
%ifnarch x86_64
%{_datadir}/applications/*.desktop
%exclude %{_datadir}/applications/%{name}-jconsole.desktop
%{_datadir}/pixmaps/*.png
%endif
%dir %{_datadir}/mime
%dir %{_datadir}/mime/packages

%files devel -f %{name}-%{version}-devel.files
%defattr(-,root,root,-)
%doc %{jdkbundle}/{COPYRIGHT,LICENSE,README.html}
%dir %{_jvmdir}/%{sdkdir}/bin
%dir %{_jvmdir}/%{sdkdir}/include
%dir %{_jvmdir}/%{sdkdir}/lib
%{_jvmdir}/%{sdkdir}/bin/*
%{_jvmdir}/%{sdkdir}/include/*
%{_jvmdir}/%{sdkdir}/lib/*
%{_jvmdir}/%{sdklnk}
%{_jvmjardir}/%{sdklnk}
%ifnarch x86_64
%{cgibindir}/java-rmi-%{version}.cgi
%{_datadir}/applications/%{name}-jconsole.desktop
%endif

%files src
%defattr(-,root,root,-)
%{_jvmdir}/%{sdkdir}/src.zip
%{_prefix}/src/%{name}-%{version}.zip

%files demo
%defattr(-,root,root,-)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/demo
%{_jvmdir}/demo

%files alsa -f %{name}-%{version}-alsa.files
%defattr(-,root,root,-)

%files jdbc -f %{name}-%{version}-jdbc.files
%defattr(-,root,root,-)

%files plugin -f %{name}-%{version}-plugin.files
%defattr(-,root,root,-)
%dir %{_libdir}/mozilla
%dir %{_libdir}/mozilla/plugins

%files fonts
%defattr(0644,root,root,0755)
%{_jvmdir}/%{jredir}/lib/fonts/*.ttf
%dir %{fontdir}
%config(noreplace) %{fontdir}/fonts.alias
%ghost %{fontdir}/fonts.dir
%ghost %{fontdir}/fonts.scale
%ghost %{fontdir}/fonts.cache-1
%ghost %{fontdir}/XftCache
%ghost %{fontdir}/encodings.dir
%{_sysconfdir}/X11/fontpath.d/java:pri=50


%changelog
* Wed Apr 21 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.0.20-1
- update to 6u20

* Sat Apr 10 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.0.19-1
- update to 6u19

* Fri Nov 06 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.17-1
- update to 6u17

* Wed Aug 05 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.15-1
- update to 6u15

* Tue Jun 09 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.14-1
- update to 6u14
- add fontconfig.properties
- enable plugin on x86_64

* Thu Apr 30 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.6.0.13-1
- update to 6u13
- run update-alternatives --auto at %%post section if necessary

* Fri Jul 11 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.07-1
- update to 6u7

* Sun May 04 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.06-2
- change Group: to Development/Languages

* Sun Apr 20 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.06-1
- update to 6u6

* Wed Apr 16 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6.0.05-1
- initial build for Vine Linux based on Mandriva package

* Thu Mar 27 2008 Anssi Hannula <anssi@mandriva.org> 1.6.0.05-1mdv2008.1
+ Revision: 190664
- new version

* Sat Mar 01 2008 Anssi Hannula <anssi@mandriva.org> 1.6.0.04-1.0.2mdv2008.1
+ Revision: 177366
- add workarounds for buggy scripts of earlier versions

* Wed Feb 06 2008 Anssi Hannula <anssi@mandriva.org> 1.6.0.04-1.0.1mdv2008.1
+ Revision: 163152
- add proper requires on update-alternatives
- adapt postun update-alternatives calls to alternatives policy (#37507)

* Tue Jan 22 2008 David Walluck <walluck@mandriva.org> 1.6.0.04-1.0.0mdv2008.1
+ Revision: 156375
- fix mixed use of tabs and spaces
- 6u4
- ubuntu r273
- add back BuildRoot
- fix tabs
- jdk-6-dlj-ubuntu 265

  + Thierry Vignaud <tvignaud@mandriva.com>
    - kill re-definition of %%buildroot on Pixel's request

* Thu Nov 01 2007 David Walluck <walluck@mandriva.org> 1.6.0.03-1.0.1mdv2008.1
+ Revision: 104748
- add jdk-6-dlj-ubuntu-r258.tar.bz2
- 1.6.0.03
- jdk-6-dlj-ubuntu-r258

* Thu Sep 27 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.9mdv2008.0
+ Revision: 93208
- make sure all installed subpackages are of compatible arch

* Sun Sep 16 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.8mdv2008.0
+ Revision: 87491
- provide obsoleted packages
- obsolete j2sdk as well, encountered in x86_64 restricted media

* Sat Sep 15 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.7mdv2008.0
+ Revision: 86313
- remove icon extension from .desktop
- add missing jre_sun and jre_1.6.0 alternatives
- obsolete the sun java packages in the restricted repository (Anne Nicolas)

* Mon Aug 20 2007 Herton Ronaldo Krzesinski <herton@mandriva.com.br> 1.6.0.02-1.0.6mdv2008.0
+ Revision: 68046
- Removed menu and directory xdg files (java-sun-directory.xdg,
  java-sun-menu.xdg), they duplicate current menu entries shown and are
  not needed by new mandriva menu structure (Closes: #32676).

* Tue Aug 07 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.5mdv2008.0
+ Revision: 59958
- use ExclusiveArch instead of BuildArch

* Fri Aug 03 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.4mdv2008.0
+ Revision: 58548
- fix jre alternatives to point to the jre bindir instead of sdk bindir
  (fixes bug #32241)

* Wed Aug 01 2007 Anssi Hannula <anssi@mandriva.org> 1.6.0.02-1.0.3mdv2008.0
+ Revision: 57646
- fix Web Start entry to not start Cache Viewer but to run the jnlp file
  presented as argument, and create a separate menu entry for Cache Viewer
  (fixes bug #31347)

* Tue Jul 31 2007 Herton Ronaldo Krzesinski <herton@mandriva.com.br> 1.6.0.02-1.0.2mdv2008.0
+ Revision: 57069
- Bump release to rebuild because of build system upload error.

* Tue Jul 24 2007 David Walluck <walluck@mandriva.org> 1.6.0.02-1.0.1mdv2008.0
+ Revision: 54885
- 1.6.0u2
- remove java.sh and java.csh scripts

* Mon Jul 09 2007 Ademar de Souza Reis Jr <ademar@mandriva.com.br> 1.6.0.0-9mdv2008.0
+ Revision: 50623
- fix fontconfig support (call fc-cache on %%post{,un})
- fontpath.d conversion (#31756)
  (chkfontpath was not being called, only the dependency was
  there, which I assume was a bug)

* Mon Jun 25 2007 Thierry Vignaud <tvignaud@mandriva.com> 1.6.0.0-8mdv2008.0
+ Revision: 44016
- rebuild for missing package

* Thu Jun 21 2007 Thierry Vignaud <tvignaud@mandriva.com> 1.6.0.0-7mdv2008.0
+ Revision: 42292
- fix group


* Tue Mar 20 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 1.6.0.0-6mdv2007.1
+ Revision: 146976
- do not run update-alternatives --remove during upgrade (fixes #29705)
- kill off java.desktop, there already exists matching and more correct
  mime types (fixes #27739)

* Wed Mar 14 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 1.6.0.0-4mdv2007.1
+ Revision: 143782
- fix category in menu item

* Wed Feb 21 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 1.6.0.0-3mdv2007.1
+ Revision: 124137
- bump release, last seems to get stuck in queue..
- add environment variables
- set JAVA_HOME
- make version in menu category consistent with Sun's

* Wed Feb 21 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 1.6.0.0-2mdv2007.1
+ Revision: 123808
- add sources :)
- fix menu
- add mime type
- provide jdk

* Thu Feb 15 2007 Per Øyvind Karlsen <pkarlsen@mandriva.com> 1.6.0.0-1mdv2007.1
+ Revision: 121247
- add desktop-file-utils to buildrequires
- remove lzma from buildrequires
- use bzip2 in stead of lzma (lzma still not in main..)
  fix installation of menu
- ensure that plugins dir exists for update-alternatives
- fix update-alternatives removal for plugin
- remove kaffe conflict
- Import java-1.6.0-sun

