%define        JRE_NSVER         7
%define        pkgver            %(echo %version | tr _ -)
%define        realver           %(echo %version | cut -d_ -f1)
%define        MAJOR             %(echo %realver | cut -du -f1)
%define        MINOR             %(echo %realver | cut -du -f2)
%define        major             1.%{MAJOR}
%define        minor             0
%define        origin            sun
%define        javaver           %{major}.%{minor}
%define        jppname           java-%{javaver}-%{origin}
%define        javaws_ver        %{javaver}
%define        toplevel_dir      jdk%{javaver}_%{MINOR}
%define        distversion       %{realver}
%define        label             -%{name}
%define        jdklnk            jdk7-%{origin}
%define        jrelnk            jre7-%{origin}
%define        jdkdir            %{jppname}
%define        jredir            %{jdkdir}/jre
%define        jdkbindir         %{_jvmdir}/%{jdklnk}/bin
%define        jdklibdir         %{_jvmdir}/%{jdklnk}/lib
%define        jrebindir         %{_jvmdir}/%{jrelnk}/bin
%define        jvmjardir         %{_jvmjardir}/%{jppname}
%define        cgibindir         %{_var}/www/cgi-bin

Name:          sun-java7
Version:       @SRPMVERSION@
Release:       @SRPMRELEASE@
Epoch:         1
Summary:       Sun Java Developer's Kit
Group:         System/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@mambasoft.it>
URL:           http://www.oracle.com/technetwork/java/javase/overview/index.html
Source:        LICENSE
BuildRequires: jpackage-utils
Provides:      jdk = %{realver}
Provides:      jdk2 = %{realver}
License:       Oracle Binary Code License
Requires:      shared-mime-info
Requires:      desktop-file-utils
Requires:      sun-java7-runtime = %{epoch}:%{version}-%{release}
Requires:      menu-java
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
Sun Java Developer's Kit.

%package runtime
Summary:       Sun Java Platform Runtime Environment
Group:         System/Libraries/Java
#Obsoletes:     j2re
Provides:      j2re = %{realver}
Provides:      jre = %{realver}

%description runtime
Sun Java Platform Runtime Environment.

%prep
[ "%{toplevel_dir}" != / ] && rm -rf "%{toplevel_dir}"

%setup -q -T -c

#echo yes | MORE=10000
%ifarch %{ix86}
wget -nv --tries=2 --no-cookies --header \
   "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
   http://download.oracle.com/otn-pub/java/jdk/%{pkgver}/jdk-%{realver}-linux-i586.tar.gz
tar xf jdk-%{realver}-linux-i586.tar.gz
%endif
%ifarch x86_64
wget -nv --tries=2 --no-cookies --header \
   "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
   http://download.oracle.com/otn-pub/java/jdk/%{pkgver}/jdk-%{realver}-linux-x64.tar.gz
tar xf jdk-%{realver}-linux-x64.tar.gz
%endif
%ifarch arm
wget -nv --tries=2 --no-cookies --header \
   "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
   http://download.oracle.com/otn-pub/java/jdk/%{pkgver}/jdk-%{realver}-linux-arm-vfp-sflt.tar.gz
tar xf jdk-%{realver}-linux-arm-sfp.tar.gz
%endif

cd %{toplevel_dir}
#cp %{SOURCE5} ./construct.sh
#mkdir unbundle-jdk
#cd unbundle-jdk
#sh %{SOURCE0} --accept-license
chmod -R u+w *

#for pack in $(find . -name "*.pack"); do
#   bin/unpack200 $pack $(echo $pack | sed -e s:.pack::g).jar
#done

%install
cd %{toplevel_dir}
#construct.sh unbundle-jdk linux-jdk linux-jre
install -d -m 755 %{buildroot}%{_jvmdir}/%{jdkdir}
install -d -m 755 %{buildroot}%{_jvmdir}/%{jredir}

cat > bin/HtmlConverter << EOF
%{jrebindir}/java -jar %{jdklibdir}/htmlconverter.jar $*
EOF

sed -i "s|PATH=.*|PATH=%{jrebindir}|" bin/java-rmi.cgi
# main 
cp -a bin include lib src.zip %{buildroot}%{_jvmdir}/%{jdkdir}
# extensions
install -d -m 755 %{buildroot}%{jvmjardir}

pushd %{buildroot}%{jvmjardir}

   ln -s %{_jvmdir}/%{jredir}/lib/jsse.jar jsse-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/jce.jar jce-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-ldap-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-cos-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-rmi-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jaas-%{javaver}.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jdbc-stdext-%{javaver}.jar
   ln -s jdbc-stdext-%{javaver}.jar jdbc-stdext-3.0.jar
   ln -s %{_jvmdir}/%{jredir}/lib/rt.jar sasl-%{javaver}.jar
#  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar xml-commons-apis.jar
   for jar in *-%{javaver}.jar ; do
      #if [ %{realver} != %{javaver} ]; then
         #ln -fs ${jar} $(echo $jar | sed "s|-%{realver}.jar|-%{javaver}.jar|g")
      #fi
      ln -fs ${jar} $(echo $jar | sed "s|-%{javaver}.jar|.jar|g")
   done

popd

# rest of jre
cp -a jre/bin jre/lib %{buildroot}%{_jvmdir}/%{jredir}
#cp -a jre/javaws %{buildroot}%{_jvmdir}/%{jredir}
%ifnarch arm
cp -a jre/plugin %{buildroot}%{_jvmdir}/%{jredir}
%endif

# see <http://www.java.com/it/download/help/5000010500.xml#install>
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/icons/mini
%ifnarch arm
install -m 644 jre/plugin/desktop/%{origin}_java.png \
   %{buildroot}%{_datadir}/pixmaps/%{name}.png
ln -s %{_datadir}/pixmaps/%{name}.png %{buildroot}%{_datadir}/icons/mini/%{name}.png
install -d %{buildroot}%{_libdir}/mozilla/plugins
%endif
%ifarch %{ix86}
ln -s %{_jvmdir}/%{jredir}/plugin/i386/ns%{JRE_NSVER}/libjavaplugin_oji.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libjava7plugin_oji.so
ln -s %{_jvmdir}/%{jredir}/plugin/i386/ns%{JRE_NSVER}/libjavaplugin_oji.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libjava7plugin.so
ln -s %{_jvmdir}/%{jredir}/lib/i386/libjavaplugin_jni.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libjava7plugin_jni.so
ln -s %{_jvmdir}/%{jredir}/lib/i386/libjavaplugin_nscp.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libjava7plugin_nscp.so
ln -s %{_jvmdir}/%{jredir}/lib/i386/libnpjp2.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libnpjp2-7.so
%endif
%ifarch x86_64
ln -s %{_jvmdir}/%{jredir}/lib/amd64/libjavaplugin_jni.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libjava7plugin_jni.so
ln -s %{_jvmdir}/%{jredir}/lib/amd64/libnpjp2.so \
   %{buildroot}%{_libdir}/mozilla/plugins/libnpjp2-7.so
%endif

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

pushd %{buildroot}%{_jvmdir}
   ln -s %{jredir} %{jrelnk}
   ln -s %{jdkdir} %{jdklnk}
popd

pushd %{buildroot}%{_jvmjardir}
   ln -s %{jdkdir} %{jrelnk}
   ln -s %{jdkdir} %{jdklnk}
popd

mkdir -p %{buildroot}%{_mandir}/man1
for manpage in man/man1/*; do
   install -m 644 -p $manpage \
      %{buildroot}%{_mandir}/man1/`basename $manpage .1`-%{origin}7.1
done


mkdir -p %{buildroot}%{_jvmdir}/%{jdkdir}
#cp -a demo sample %{buildroot}%{_jvmdir}/%{jdkdir}


mkdir -p %{buildroot}%{_datadir}/mime/packages/
mkdir -p %{buildroot}%{_datadir}/applications

%ifnarch arm
for style in hicolor HighContrast HighContrastInverse LowContrast; do
   for size in 16 48; do
      for kind in apps mimetypes; do
         mkdir -p %{buildroot}%{_datadir}/icons/$style/${size}x${size}/$kind
         install -m 644 jre/lib/desktop/icons/$style/${size}x${size}/$kind/*.png \
            %{buildroot}%{_datadir}/icons/$style/${size}x${size}/$kind
      done
   done
done

rm -rf %{buildroot}%{_datadir}/icons/hicolor/48x48/mimetypes/gnome-mime-text-x-java.png
rm -rf %{buildroot}%{_datadir}/icons/hicolor/16x16/mimetypes/gnome-mime-text-x-java.png

cp -a jre/lib/desktop/mime/packages/* %{buildroot}%{_datadir}/mime/packages/
cp -a jre/lib/desktop/applications/%{origin}-java.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

mkdir -p %{buildroot}%{_datadir}/applications
if [ -e %{buildroot}%{_jvmdir}/%{jdkdir}/bin/jvisualvm ]; then
cat >> %{buildroot}%{_datadir}/applications/%{name}-jvisualvm.desktop << EOF
[Desktop Entry]
Name=Java VisualVM (%{name})
Comment=Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool
Exec=%{_jvmdir}/%{jdkdir}/bin/jvisualvm
Icon=%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
Terminal=false
Type=Application
Categories=Development;Profiling;
EOF
fi

# ControlPanel freedesktop.org menu entry
cat > %{buildroot}%{_datadir}/applications/%{name}-jcontrol.desktop << EOF
[Desktop Entry]
Name=Java Plugin Control Panel (%{name})
Comment=Java Control Panel
Exec=%{_jvmdir}/%{jdkdir}/bin/jcontrol
Icon=%{_datadir}/icons/hicolor/48x48/apps/sun-jcontrol.png
Terminal=false
Type=Application
Categories=Settings;Java;
EOF

# javaws freedesktop.org menu entry
cat > %{buildroot}%{_datadir}/applications/%{name}-javaws.desktop << EOF
[Desktop Entry]
Name=Java Web Start (%{name})
Comment=Java Application Launcher
MimeType=application/x-java-jnlp-file;
Exec=%{_jvmdir}/%{jredir}/bin/javaws %%u
Icon=%{_datadir}/icons/hicolor/48x48/apps/sun-javaws.png
Terminal=false
Type=Application
Categories=Settings;Java;
EOF
%endif

mkdir -p %{buildroot}%{_datadir}/fonts/ttf/j2se-%{origin}
mkdir -p %{buildroot}%{_datadir}/fonts/ttf/j2se-%{origin}-oblique

# move the fonts into a shared fonts directory
install -m 644 jre/lib/fonts/*.ttf \
	%{buildroot}%{_datadir}/fonts/ttf/j2se-%{origin}
install -m 644 jre/lib/oblique-fonts/*.ttf \
	%{buildroot}%{_datadir}/fonts/ttf/j2se-%{origin}-oblique

rm -rf %{buildroot}%{_jvmdir}/%{jredir}/lib/fonts
rm -rf %{buildroot}%{_jvmdir}/%{jredir}/lib/oblique-fonts
ln -s ../../../../../share/fonts/ttf/j2se-%{origin} \
   %{buildroot}%{_jvmdir}/%{jredir}/lib/fonts
ln -s ../../../../../share/fonts/ttf/j2se-%{origin}-oblique \
   %{buildroot}%{_jvmdir}/%{jredir}/lib/oblique-fonts

#install -d %{buildroot}%{_sysconfdir}/profile.d
#sed -i "s|__JDK__PREFIX__|%{_jvmdir}|" %{S:3}
#sed -i "s|__JRE__PREFIX__|%{_jvmdir}%{jrelnk}|" %{S:4}
#install -m0755 %{S:3} %{buildroot}%{_sysconfdir}/profile.d/%{jdklnk}.sh
#install -m0755 %{S:4} %{buildroot}%{_sysconfdir}/profile.d/%{jrelnk}.sh

mkdir %{buildroot}%{_javadir}-%{javaver}
mkdir %{buildroot}%{_jnidir}-%{javaver}

## FIXME: temporary workaround to provide openjdk (required by ooobuild-3.1.0.6 odk patch)
#ln -s  %{jdkdir} %{buildroot}%{_libdir}/jvm/java-%{MAJOR}-openjdk

pushd %{buildroot}%{_jvmdir}/%{jredir}/lib
for l in *.jar; do
ln -s ../jre/lib/$l %{buildroot}%{_jvmdir}/%{jdkdir}/lib/$l
done

install -d -m 0755 %{buildroot}%{_jvmdir}/%{jredir}/.systemPrefs
touch %{buildroot}%{_jvmdir}/%{jredir}/.systemPrefs/.systemRootModFile

#for file in %{buildroot}%{_jvmdir}/%{jdkdir}/bin/* %{buildroot}%{_jvmdir}/%{jredir}/bin/*
#do
#   chrpath --list $file && chrpath --delete $file || :
#done
#for file in $(find %{buildroot}%{_jvmdir}/%{jdkdir}/demo -name "*.so")
#do
#   chrpath --list $file && chrpath --delete $file || :
#done
#for file in $(find %{buildroot}%{_jvmdir}/%{jredir}/lib -name "*.so")
#do
#   chrpath --list $file && chrpath --delete $file || :
#done

# Remove requirements for old ffmpeg libraries
rm -f %{buildroot}%{_jvmdir}/%{jredir}/lib/*/fxavcodecplugin-52.so

%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}

%pre
if [ $1 -ge 1 ]; then
   # legacy cleanups
   for b in javac jar; do
      /usr/sbin/update-alternatives --remove $b \
         /opt/java/jdk/bin/$b  2>/dev/null
   done
fi
:

%post
if [ $1 -ge 1 ]; then
   # new install
   if ! echo ${PATH} | grep -q %{_jredir}/bin; then
      export PATH="$PATH:%{_jredir}/bin"
   fi
   for b in javac jar; do
      [ -L %{_bindir}/$b -a "`readlink %{_bindir}/$b`" != "%{_sysconfdir}/alternatives/$b" ] &&
         rm -f %{_bindir}/$b
      %{_sbindir}/update-alternatives \
         --install %{_bindir}/$b $b \
         %{_jvmdir}/%{jdklnk}/bin/$b 56
   done
   %{_sbindir}/update-alternatives \
      --install %{_jvmdir}/jdk jdk \
      %{_jvmdir}/%{jdklnk} 56
   %{_sbindir}/update-alternatives \
      --install %{_jvmjardir}/jdk jdk-exports \
      %{_jvmjardir}/%{jdklnk} 56
fi
:

%preun
if [ $1 -eq 0 ]; then
   for b in javac jar; do
      %{_sbindir}/update-alternatives --remove $b \
         %{_jvmdir}/%{jdklnk}/bin/$b
   done
   %{_sbindir}/update-alternatives --remove jdk \
      %{_jvmdir}/%{jdklnk}
   %{_sbindir}/update-alternatives --remove jdk-exports \
      %{_jvmjardir}/%{jdklnk}
fi
:

%pre runtime
if [ $1 -ge 1 ]; then
   [ -L %{_jvmdir}/%{jredir}/lib/fonts ] || rm -rf %{_jvmdir}/%{jredir}/lib/fonts
   [ -L %{_jvmdir}/%{jredir}/lib/oblique-fonts ] || rm -rf %{_jvmdir}/%{jredir}/lib/oblique-fonts
   [ -e %{_jvmdir}/%{jrelnk} ] && rm -rf %{_jvmdir}/%{jrelnk}
   [ -L %{_bindir}/java -a "`readlink %{_bindir}/java`" != "%{_sysconfdir}/alternatives/java" ] &&
      rm -f %{_bindir}/java

   if [ -d /opt/java/jre ]; then
      # legacy cleanups
      %{_sbindir}/update-alternatives --remove java \
         /opt/java/jre/bin/java 2>/dev/null
   fi

   %{_sbindir}/update-alternatives \
      --install %{_bindir}/java java \
      %{_jvmdir}/%{jrelnk}/bin/java 56
   %{_sbindir}/update-alternatives \
      --install %{_jvmdir}/jre jre \
      %{_jvmdir}/%{jrelnk} 56
   %{_sbindir}/update-alternatives \
      --install %{_jvmjardir}/jre jre-exports \
      %{_jvmjardir}/%{jrelnk} 56
fi
:

%post runtime
if [ -x %{_bindir}/fc-cache ]; then
   %{_bindir}/fc-cache %{_datadir}/fonts/ttf/j2se-%{origin}
   %{_bindir}/fc-cache %{_datadir}/fonts/ttf/j2se-%{origin}-oblique
fi

if ! echo ${PATH} | grep -q  %{_jvmdir}/jre/bin; then
   export PATH="$PATH: %{_jvmdir}/jre/bin"
fi

if [ -d %{_jvmdir}/%{jrelnk}/lib/security ]; then
   # Need to remove the old jars in order to support upgrading
   # update-alternatives fails silently if the link targets exist as files
   rm -f %{_jvmdir}/%{jrelnk}/lib/security/{local,US_export}_policy.jar
fi

%{_sbindir}/update-alternatives \
   --install %{_jvmdir}/%{jredir}/lib/oblique-fonts \
   oblique_fonts_%{javaver}_%{origin} %{_datadir}/fonts/ttf/j2se-%{origin}-oblique 56

%{_sbindir}/update-alternatives \
   --install %{_jvmdir}/%{jredir}/lib/fonts fonts_%{javaver}_%{origin} \
   %{_datadir}/fonts/ttf/j2se-%{origin} 56

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

%{_sbindir}/update-alternatives \
   --install %{_jvmdir}/%{jrelnk}/lib/security/US_export_policy.jar \
   jce_%{javaver}_%{origin}_us_export_policy %{_jvmprivdir}/%{name}/jce/vanilla/US_export_policy.jar 56
:

%preun runtime
if [ $1 -eq 0 ]; then
   %{_sbindir}/update-alternatives --remove java \
      %{_jvmdir}/%{jrelnk}/bin/java
   %{_sbindir}/update-alternatives --remove jre \
      %{_jvmdir}/%{jrelnk}
   %{_sbindir}/update-alternatives --remove jre-exports \
      %{_jvmjardir}/%{jrelnk}
fi
:

%postun runtime
if [ $1 -eq 0 ]; then
   if [ -x %{_bindir}/fc-cache ]; then
      %{_bindir}/fc-cache --system-only
   fi
   %{_sbindir}/update-alternatives \
      --remove jce_%{javaver}_%{origin}_local_policy \
      %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar
   %{_sbindir}/update-alternatives \
      --remove oblique_fonts_%{javaver}_%{origin} \
      %{_datadir}/fonts/ttf/j2se-%{origin}-oblique
   %{_sbindir}/update-alternatives \
      --remove fonts_%{javaver}_%{origin} \
      %{_datadir}/fonts/ttf/j2se-%{origin}
fi
:

%files
%defattr(-,root,root)
#%{_sysconfdir}/profile.d/%{jdklnk}.sh
%{_jvmdir}/%{jdklnk}
%{_jvmjardir}/%{jdklnk}
%{_jvmdir}/%{jdkdir}/bin
#%{_jvmdir}/%{jdkdir}/db
#%{_jvmdir}/%{jdkdir}/demo
%{_jvmdir}/%{jdkdir}/lib
%{_jvmdir}/%{jdkdir}/include
#%{_jvmdir}/%{jdkdir}/sample
%{_jvmdir}/%{jdkdir}/src.zip
%dir %{_javadir}-%{javaver}
%dir %{_jnidir}-%{javaver}
%{_mandir}/man1/appletviewer-sun7.1*
%{_mandir}/man1/apt-sun7.1*
%{_mandir}/man1/extcheck-sun7.1*
%{_mandir}/man1/idlj-sun7.1*
%{_mandir}/man1/jar-sun7.1*
%{_mandir}/man1/jarsigner-sun7.1*
%{_mandir}/man1/javac-sun7.1*
%{_mandir}/man1/javadoc-sun7.1*
%ifnarch arm
%{_mandir}/man1/javafxpackager-sun7.1*
%endif
%{_mandir}/man1/javah-sun7.1*
%{_mandir}/man1/javap-sun7.1*
%{_mandir}/man1/jcmd-sun7.1*
%{_mandir}/man1/jconsole-sun7.1*
%{_mandir}/man1/jdb-sun7.1*
%{_mandir}/man1/jhat-sun7.1*
%{_mandir}/man1/jinfo-sun7.1*
%{_mandir}/man1/jmap-sun7.1*
%{_mandir}/man1/jmc-sun7.1*
%{_mandir}/man1/jps-sun7.1*
%{_mandir}/man1/jrunscript-sun7.1*
%{_mandir}/man1/jsadebugd-sun7.1*
%{_mandir}/man1/jstack-sun7.1*
%{_mandir}/man1/jstat-sun7.1*
%{_mandir}/man1/jstatd-sun7.1*
%{_mandir}/man1/jvisualvm-sun7.1*
%{_mandir}/man1/native2ascii-sun7.1*
%{_mandir}/man1/policytool-sun7.1*
%{_mandir}/man1/rmic-sun7.1*
%{_mandir}/man1/schemagen-sun7.1*
%{_mandir}/man1/serialver-sun7.1*
%{_mandir}/man1/wsgen-sun7.1*
%{_mandir}/man1/wsimport-sun7.1*
%{_mandir}/man1/xjc-sun7.1*
%doc %{toplevel_dir}/COPYRIGHT %{toplevel_dir}/LICENSE
%doc %{toplevel_dir}/THIRDPARTYLICENSEREADME.txt
# %{toplevel_dir}/README*

%files runtime
%defattr(-,root,root)
#%{_sysconfdir}/profile.d/%{jrelnk}.sh
%dir %{_jvmdir}/%{jdkdir}
%dir %{_jvmdir}/%{jredir}
%dir %{_jvmdir}/%{jredir}/lib
%{_jvmdir}/%{jredir}/lib/*.jar
%{_jvmdir}/%{jredir}/lib/*.properties*
%{_jvmdir}/%{jredir}/lib/fontconfig*.bfc
%{_jvmdir}/%{jredir}/lib/classlist
%{_jvmdir}/%{jredir}/lib/jexec
%{_jvmdir}/%{jredir}/lib/*.txt
%{_jvmdir}/%{jredir}/lib/meta-index
#%{_jvmdir}/%{jredir}/lib/audio
%{_jvmdir}/%{jredir}/lib/cmm
%ifnarch arm
%{_jvmdir}/%{jredir}/lib/deploy
%{_jvmdir}/%{jredir}/lib/desktop
%{_jvmdir}/%{jredir}/lib/locale
%endif
%{_jvmdir}/%{jredir}/lib/ext
%ifarch %{ix86}
%{_jvmdir}/%{jredir}/lib/i386
%endif
%ifarch x86_64
%{_jvmdir}/%{jredir}/lib/amd64
%endif
%ifarch arm
%{_jvmdir}/%{jredir}/lib/arm
%endif
#%{_jvmdir}/%{jredir}/lib/im
%{_jvmdir}/%{jredir}/lib/images
%{_jvmdir}/%{jredir}/lib/management
%dir %{_jvmdir}/%{jredir}/lib/security
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/cacerts
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.policy
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/java.security
%ifnarch arm
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/javafx.policy
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/javaws.policy
%endif
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/blacklist
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/trusted.libraries
%ghost %{_jvmdir}/%{jredir}/lib/security/local_policy.jar
%ghost %{_jvmdir}/%{jredir}/lib/security/US_export_policy.jar
%dir %{_jvmdir}/%{jredir}/lib/jfr
%{_jvmdir}/%{jredir}/lib/jfr/*
%{_jvmdir}/%{jredir}/lib/currency.data
#%{_jvmdir}/%{jredir}/lib/servicetag
%{_jvmdir}/%{jredir}/.systemPrefs
%{_jvmdir}/%{jredir}/lib/zi

%{_jvmdir}/%{jredir}/lib/fonts
%{_jvmdir}/%{jredir}/lib/oblique-fonts

%dir %{_jvmprivdir}/%{name}
%dir %{_jvmprivdir}/%{name}/jce
%dir %{_jvmprivdir}/%{name}/jce/vanilla
%config(noreplace) %{_jvmprivdir}/%{name}/jce/vanilla/US_export_policy.jar
%config(noreplace) %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar
%{_jvmdir}/%{jredir}/bin
#%{_jvmdir}/%{jredir}/javaws
#%{_jvmdir}/%{jredir}/lib
%ifnarch arm
%{_jvmdir}/%{jredir}/plugin
%endif
%{_jvmdir}/%{jrelnk}
%{_jvmjardir}/%{jrelnk}
%{_jvmjardir}/%{jppname}/jaas*.jar
%{_jvmjardir}/%{jppname}/jce*jar
%{_jvmjardir}/%{jppname}/jdbc-stdext*jar
%{_jvmjardir}/%{jppname}/jndi*.jar
%{_jvmjardir}/%{jppname}/jsse*.jar
%{_jvmjardir}/%{jppname}/sasl*.jar
#%{_jvmjardir}/%{jppname}/xml-commons-apis.jar
%ifnarch arm
%{_libdir}/mozilla/plugins/libjava7plugin*.so
%{_libdir}/mozilla/plugins/libnpjp2-7.so
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-javaws.desktop
%{_datadir}/applications/%{name}-jcontrol.desktop
%{_datadir}/applications/%{name}-jvisualvm.desktop
%{_datadir}/icons/*/*x*/*/*.png
%{_datadir}/icons/mini/%{name}.png
%{_datadir}/mime/packages/x-java-*.xml
%{_datadir}/pixmaps/%{name}.png
%endif
%dir %{_datadir}/fonts/ttf/j2se-sun-oblique
%{_datadir}/fonts/ttf/j2se-sun-oblique/*.ttf
%dir %{_datadir}/fonts/ttf/j2se-sun
%{_datadir}/fonts/ttf/j2se-sun/*.ttf

%{_mandir}/man1/java-sun7.1*
%{_mandir}/man1/javaws-sun7.1*
%{_mandir}/man1/keytool-sun7.1*
%{_mandir}/man1/orbd-sun7.1*
%{_mandir}/man1/pack200-sun7.1*
%{_mandir}/man1/rmid-sun7.1*
%{_mandir}/man1/rmiregistry-sun7.1*
%{_mandir}/man1/servertool-sun7.1*
%{_mandir}/man1/tnameserv-sun7.1*
%{_mandir}/man1/unpack200-sun7.1*
%doc %{toplevel_dir}/jre/COPYRIGHT %{toplevel_dir}/jre/LICENSE
%doc %{toplevel_dir}/jre/THIRDPARTYLICENSEREADME.txt
#  %{toplevel_dir}/jre/README %{toplevel_dir}/jre/Welcome.html

%changelog
* Sat Oct 11 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 7u67_b01-1mamba
- fix x86_64 mozulla plugin symlinks
- support for pkg download code (b01) in version

* Fri Mar 26 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 7u51-2mamba
- update wget download string (see https://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/)
- dont' install fxavcodecplugin-52.so to remove dependencies on old libav library; fxavcodecplugin-53.so is provided requiring ffmpeg0

* Fri Jan 17 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 7u51-1mamba
- update to 7u51

* Sun Nov 03 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 7u45-1mamba
- update to 7u45

* Wed Apr 10 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 7u17-1mamba
- update to 7u17

* Sun Aug 19 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 7u6-2mamba
- rename to sun-java7

* Thu Aug 16 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 7u6-1mamba
- update to 7u6

* Tue Mar 27 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 6u26-2mamba
- don't obsolete jre and jdk

* Wed Jun 08 2011 Automatic Build System <autodist@mambasoft.it> 6u26-1mamba
- automatic update by autodist

* Wed Apr 27 2011 Automatic Build System <autodist@mambasoft.it> 6u25-1mamba
- automatic update by autodist

* Thu Feb 17 2011 Automatic Build System <autodist@mambasoft.it> 6u24-1mamba
- automatic update by autodist

* Wed Oct 13 2010 Automatic Build System <autodist@mambasoft.it> 6u22-1mamba
- automatic update to 6u22 by autodist

* Mon Jul 26 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 6u21-3mamba
- don't launch chrpath or executables won't find libraries because they are not in system path

* Wed Jul 21 2010 Stefano Cotta Ramusino <stefano.cotta@openmamba.org> 6u21-2mamba
- specfile fixes and cleanup
- fix broken fonts symlink
- edit %%post and %%postun runtime scripts

* Fri Jul 16 2010 Automatic Build System <autodist@mambasoft.it> 6u21-1mamba
- automatic update to 6u21 by autodist

* Mon Jun 14 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 6u20-2mamba
- link libnpjp2.so instead of libjavaplugin.so to /usr/lib/mozilla/plugins

* Fri Apr 16 2010 Automatic Build System <autodist@mambasoft.it> 6u20-1mamba
- automatic update to 6u20 by autodist

* Wed Mar 31 2010 Automatic Build System <autodist@mambasoft.it> 6u19-1mamba
- automatic update to 6u19 by autodist

* Thu Jan 21 2010 Automatic Build System <autodist@mambasoft.it> 6u18-1mamba
- automatic update to 6u18 by autodist

* Tue Nov 17 2009 Automatic Build System <autodist@mambasoft.it> 6u17-1mamba
- automatic update to 6u17 by autodist

* Wed Sep 23 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 6u16-2mamba
- fixed wrong symlink destination for jav for mozilla plugin files

* Mon Aug 17 2009 Automatic Build System <autodist@mambasoft.it> 6u16-1mamba
- automatic update to 6u16 by autodist

* Thu Aug 06 2009 Automatic Build System <autodist@mambasoft.it> 6u15-1mamba
- automatic update to 6u15 by autodist

* Mon Jul 13 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 6u14-2mamba
- create symlink of jre jar's into jdk lib directory

* Tue Jun 09 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 6u14-1mamba
- update to 6u14

* Fri Jun 05 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 6u13-4mamba
- manage /usr/lib/jvm/{jdk,jre} as alternatives
- remove profile files for setting JAVA_HOME (now handled by initscripts and alternatives)

* Thu Jun 04 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 6u13-3mamba
- added symlink in /usr/lib/jvm

* Mon Apr 20 2009 gil <puntogil@libero.it> 6u13-2mamba
- added requirement for menu-java

* Wed Mar 18 2009 gil <puntogil@libero.it> 6u13-1mamba
- update to 6u13
- edit spec file

* Tue Sep 23 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 6u7-1mamba
- automatic update to 6u7 by autodist

* Tue Mar 11 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.0-4mamba
- update to release 6u4
- manage /usr/bin/{java,javac,jar} using alternatives with priority 50

* Sat Apr 07 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.0-3mamba
- install into /opt/java

* Mon Feb 26 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.0-2qilnx
- check and handle a pre-existing /usr/java/jre%version dir

* Mon Feb 19 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.0-1qilnx
- new build under the Operating System Distributor License for Java (DLJ 1.1)

* Fri Feb 02 2007 Davide Madrisan <davide.madrisan@qilinux.it> 1.5-1qilnx
- get download parameters from a sysconfig file

* Tue Oct 31 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.5.0-8qilnx
- specfile updated to donwload latest jre version (1.5.0_09)

* Wed Jul 12 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.5.0-7qilnx
- added "provides j2re" (needed by the limewire rpm)

* Mon Apr 03 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.5.0-6qilnx
- updated javaurl

* Thu Feb 02 2006 Davide Madrisan <davide.madrisan@qilinux.it> 1.5.0-5qilnx
- fixed symbolic link in %{_libdir}/mozilla/plugins

* Tue Aug 23 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.5.0-4qilnx
- specfile updates for last jre version (1.5.0_04)

* Thu Jul 07 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.5.0-3qilnx
- remove %{javapath}/.systemPrefs if found

* Wed Apr 20 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.5.0-2qilnx
- enable resume of download
- remove requirements and provides

* Wed Apr 20 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.5.0-1qilnx
- specfile for new jre version (1.5.0)
- added automatic download and build support (this is a non distributable package)

* Mon Jul 12 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 1.4.2-2qilnx
- create symlinks for browser plugins to /usr/lib/mozilla/plugins

* Mon Oct 13 2003 Silvan Calarco <silvan.calarco@mambasoft.it> 1.4.2-1qilnx
- first build
