Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37047071
en ru br
Репозитории ALT
5.1: 1.6.0.22-alt0.M51.1
4.1: 1.6.0.10-alt0.M41.1
4.0: 1.6.0.10-alt0.M40.1
www.altlinux.org/Changes

Группа :: Система/Основа
Пакет: java-1.6.0-sun

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

#         --- note from viy at altlinux: ---
# as an effort to build compatible portable java environment,
# the JPackage Project was chosen as a new base of ALT java subsystem.
# JPackage specs have the following disclaimer:
# ====================================================
# Copyright (c) 2000-2007, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
%define major 1.6
%define minor 0
%define origin          sun
%define priority        1603
%define javaver         %major.%minor
%define buildver        10

%define jppname         java-%{javaver}-%{origin}
%define javaws_ver      %{javaver}

%define toplevel_dir    jdk%{javaver}_%{buildver}
%define distversion 6u10

%define altname  j2se%major-%origin
%define label -%{jppname}

%define sdklnk          java-%{javaver}-%{origin}
%define jrelnk          jre-%{javaver}-%{origin}
%define sdkdir          %{jppname}-%{version}
%define jredir          %{sdkdir}/jre
%define sdkbindir       %{_jvmdir}/%{sdklnk}/bin
%define sdklibdir       %{_jvmdir}/%{sdklnk}/lib
%define jrebindir       %{_jvmdir}/%{jrelnk}/bin
%define jvmjardir       %{_jvmjardir}/%{jppname}-%{version}

%define cgibindir       %{_var}/www/cgi-bin
# --- jpackage compatibility stuff ends here ---

%def_enable fonts
%def_disable alsa_subpackage
%def_enable jdbc_subpackage
%ifarch x86_64
%def_disable javaws
%def_disable moz_plugin
%def_disable desktop
%else
%def_enable javaws
%def_enable moz_plugin
%def_enable desktop
%endif
%def_with gcc32_abi

%ifarch x86_64
%define libarch    amd64
%else
%define libarch    i386
%endif

%define fontdir %_datadir/fonts/ttf/j2se-%origin
%define fontdir_oblique %_datadir/fonts/ttf/j2se-%origin-oblique

%if_with gcc32_abi
%define mozplugindir %{_jvmdir}/%{sdkdir}/jre/plugin/%libarch/ns7
%else
%define mozplugindir %{_jvmdir}/%{sdkdir}/jre/plugin/%libarch/ns7-gcc29
%endif
%define mozilla_java_plugin_so %mozplugindir/libjavaplugin_oji.so

# --- jpackage compatibility stuff starts here ---

#if jpackage-utils stuff (to remove ufter upgrade)
%define _jvmdir %{_prefix}/lib/jvm
%define _jvmjardir %{_prefix}/lib/jvm-exports
%define _jvmprivdir %{_prefix}/lib/jvm-private
%define _javadir        %{_datadir}/java
%define _jnidir        %{_prefix}/lib/java
#else
#Requires:       jpackage-utils >= 0:1.5.38
#BuildRequires:  jpackage-utils >= 0:1.5.38
Conflicts:      kaffe
#endif
#-----

Name:           %jppname
Version:        %{javaver}.%{buildver}
Release:        alt0.M41.1
Epoch:          0
Summary:        Java 2 Runtime Environment, Standard Edition
License:        Operating System Distributor License for Java version 1.1
Group:          System/Base
URL:            http://java.sun.com/j2se/%{javaver}
Packager:       Igor Yu. Vlasenko <viy at altlinux.org>

# --- jpackage compatibility stuff starts here ---

Provides:       jre-%{javaver}-%{origin} = %{epoch}:%{version}-%{release}
Provides:       jre-%{origin} = %{epoch}:%{version}-%{release}
Provides:       jre-%{javaver}, java-%{javaver}, jre = %{epoch}:%{javaver}
Provides:       java-%{origin} = %{epoch}:%{version}-%{release}
Provides:       java = %{epoch}:%{javaver}
Provides:       jndi = %{epoch}:%{version}, jndi-ldap = %{epoch}:%{version}
Provides:       jndi-cos = %{epoch}:%{version}, jndi-rmi = %{epoch}:%{version}
Provides:       jndi-dns = %{epoch}:%{version}
Provides:       jaas = %{epoch}:%{version}
Provides:       jsse = %{epoch}:%{version}
Provides:       jce = %{epoch}:%{version}
Provides:       jdbc-stdext = %{epoch}:3.0, jdbc-stdext = %{epoch}:%{version}
Provides:       java-sasl = %{epoch}:%{version}
# --- jpackage compatibility stuff ends here ---

Provides: j2se = %javaver
Provides: jre = %javaver, java2 = %javaver

Requires: fonts-ttf-j2se-%origin >= %version-%release
Requires: java-common
Requires: /proc
Requires(post,preun): alternatives >= 0.2.0

Source0: http://download.java.net/dlj/binaries/jdk-%distversion-dlj-linux-i586.bin
Source1: http://download.java.net/dlj/binaries/jdk-%distversion-dlj-linux-amd64.bin
Patch: visualvm-java-1.6.0-sun-alt-skip-autoreq.patch

ExclusiveArch: i586 x86_64

%ifarch x86_64
%define jdksource %SOURCE1
%else
%define jdksource %SOURCE0
%endif

# jpackage use perl -p -i -e, we use subst

# BuildPreReq: perl

BuildPreReq: browser-plugins-npapi-devel
BuildRequires: libalsa
BuildRequires: libunixODBC
#BuildRequires: xorg-x11-devel
BuildRequires: libX11 libXext libXi libXp libXt libXtst libSM libICE
BuildRequires: libstdc++3.3
BuildRequires: /proc
BuildRequires: shared-mime-info >= 0.15-alt2
BuildRequires: desktop-file-utils
### against #16510;
### found in plugin/i386/ns7/libjavaplugin_oji.so, but can be anywhere:
### yes, they doesn't link against stdc++!!!
Requires: libstdc++3.3

%set_compress_method none
%set_verify_elf_method none
############## altlinux 3.0 compatibility stuff ##############
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch
%ifnarch x86_64
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/client
%endif
# it is needed for those apps which links with libjvm.so
%add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/server
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/native_threads
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/headless
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/motif21
#add_findprov_lib_path %{_jvmdir}/%{jredir}/lib/%libarch/xawt
##Provides: libmawt.so
##Provides: libmawt.so(SUNWprivate_1.1)
##Provides: libmlib_image.so(VER_1.1)
#################################################################

%description
This package contains the Java Runtime Environment for %{name}.
Install this package if you need to run Java applications.

The Java Runtime Environment contains the Java virtual machine,
runtime class libraries, and Java application launcher that are
necessary to run programs written in the Java programming language.
It is not a development environment and does not contain development
tools such as compilers or debuggers.  For development tools, see the
Java SDK, Standard Edition.

%package        devel
Summary:        Java 2 SDK, Standard Edition
Group:          Development/Java
Provides: j2se-devel = %javaver
Provides: /usr/bin/javac
Provides: jdk = %javaver, j2sdk = %javaver
Requires: %name = %version-%release
Requires(post,preun): alternatives >= 0.2.0
Obsoletes: jdk-%origin j2sdk-%origin

# --- jpackage compatibility stuff starts here ---

Provides:       java-sdk-%{javaver}-%{origin} = %{epoch}:%{version}-%{release}
Provides:       java-sdk-%{origin} = %{epoch}:%{version}-%{release}
Provides:       java-sdk-%{javaver}, java-sdk = %{epoch}:%{javaver}
Provides:       java-devel-%{origin} = %{epoch}:%{version}-%{release}
Provides:       java-%{javaver}-devel, java-devel = %{epoch}:%{javaver}
# --- jpackage compatibility stuff ends here ---

%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.

Install this package if you need to develop and build Java applications.

%package source
Summary: Source files for the Java 2 SDK
Group: Development/Java

%description source
Java programming language source files for all classes that make up
the Java 2 core API.

%package        demo
Summary:        Demo applets and programs for the Java 2 SDK
Group: Development/Java
AutoReqProv: no

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

These include examples, with source code, of programming for the Java
platform that use Swing and other Java Foundation Classes, and the Java
Platform Debugger Architecture.

%if_enabled moz_plugin
%package -n mozilla-plugin-%name
Summary: Java Plug-In for Mozilla family browsers
Group: Networking/WWW
Provides: java2-plugin-mozilla = %javaver
Provides: %altname-plugin-mozilla
Obsoletes: %altname-plugin-mozilla
Provides: mozilla-plugin-%altname
Obsoletes: mozilla-plugin-%altname
Requires: %name = %version-%release
Requires: browser-plugins-npapi
Requires(post,preun): alternatives >= 0.2.0
# --- jpackage compatibility stuff starts here ---
Provides:       java-plugin = %{epoch}:%{javaver}, java-%{javaver}-plugin = %{epoch}:%{version}
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
# --- jpackage compatibility stuff ends here ---

%description -n mozilla-plugin-%name
This package contains Java(TM) 2 Plug-In for Mozilla family web browsers.
%endif # enabled moz_plugin

%if_enabled alsa_subpackage
%package        alsa
Summary:        ALSA support for %{name}
Group:          Development/Java
Requires:       %{name} = %{version}-%{release}

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

%if_enabled jdbc_subpackage
%package        jdbc
Summary:        Native library for JDBC support in Java
Group:          Development/Databases
Requires:       %name = %version-%release

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

%if_enabled javaws
%package javaws
Summary: Java Web Start
Group: Networking/Other
Requires: %name = %version-%release
Requires(post,preun): alternatives >= 0.2.0
# --- jpackage compatibility stuff starts here ---
Provides:       javaws = %{epoch}:%{javaws_ver}
Obsoletes:      javaws-menu
# --- jpackage compatibility stuff ends here ---

%description javaws
Java Web Start is a deployment solution for Java-technology-based
applications. It is the plumbing between the computer and the Internet
that allows the user to launch and manage applications right off the
Web. Java Web Start provides easy, one-click activation of
applications, and guarantees that you are always running the latest
version of the application, eliminating complicated installation or
upgrade procedures.

This package provides the Java Web Start installation that is bundled
with %{name} J2SE Runtime Environment.
%endif # enabled javaws

%if_enabled desktop
%package -n java-%{origin}-desktop
Summary: desktop resources for %{name}.
Group: Graphical desktop/GNOME
Requires(post,postun): shared-mime-info >= 0.15-alt2

%description -n java-%{origin}-desktop
Desktop resources, such as pixmaps, etc, for %{name},
that are shared between different versions of %{origin}
JVM.
%endif # enabled desktop

%if_enabled fonts
%package -n fonts-ttf-%name
Summary: TrueType fonts for %{name}.
Group: System/Fonts/True type
BuildRequires: mkfontscale
Requires: fontconfig
Provides: java_%origin-fonts = %version-%release
Obsoletes: j2se-%origin-fonts
Obsoletes: %altname-fonts
Provides: fonts-ttf-j2se-%origin = %version-%release
Obsoletes: fonts-ttf-j2se-%origin < %version-%release
# --- jpackage compatibility stuff starts here ---
Provides:       java-fonts = %{epoch}:%{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, java-1.5.0-fonts
# --- jpackage compatibility stuff ends here ---

%description -n fonts-ttf-%name
This package contains the TrueType fonts for %{origin} JVMs.
%endif # enabled fonts

%prep
#echo yes | MORE=10000 sh %jdksource
sh %jdksource --accept-license --unpack
%setup -T -D -n %{toplevel_dir}
# fix perms
chmod -R u+w *

%patch
cat >README.alt <<EOF
The Java 2 Runtime Environment and SDK, Standard Edition are distributed
within this and related packages as shown below:

%name - Java 2 Runtime Environment, Standard Edition
 (with notable omissions listed below).
%name-devel - Java 2 SDK, Standard Edition.
%name-source - Java 2 Standard Edition API source files.
%name-demo - Java 2 SDK demo applets and programs.
%name-jdbc - JDBC provider library using ODBC.
 This library was excluded from the
 %name package due to outstanding dependencies.
%name-javaws - Java Web Start software that is bundled with
 Java 2 Runtime Environment, Standard Edition
mozilla-plugin-%altname - Java 2 plug-in for Mozilla family browsers
fonts-ttf-%name - The TrueType fonts in %fontdir
 and %fontdir_oblique,
 shared between various installations of
 the Java 2 Runtime Environment.
java-%{origin}-desktop  - Java 2 desktop resources (pixmaps, etc)

See the README, LICENSE, COPYRIGHT, and THIRDPARTYLICENSEREADME.txt files
for copyright information, terms of use and redistribution covering contents
of these packages.

The packages should fullfill (most of) the requirements of JPackage
policy (www.jpackage.org). There are some historical minor differences
which should not break the compatibility.
EOF
# # # TODO: # # # # # # # # # # # # #
# # current difference with jpackage
# man pages:
# pack200/unpack200 moved from devel -- good: that's a bug in jpackage
# devel: (no /var/www/cgi-bin...),
# demo:
# are in lib, should be in share/shortlink
# fonts:
# alt specific font links
# TODO(?): spring off the x11-related libraries

%if_enabled fonts
mkdir fontdoc
cat > fontdoc/README.alt <<EOF
The fonts contained in this package are part of the
Java 2 Runtime Environment, Standard Edition (J2SE).
This package is required by packages containing various versions
of J2SE.

See the LICENSE, COPYRIGHT, and THIRDPARTYLICENSEREADME.txt files
for copyright information, terms of use and redistribution covering contents
of this package.
EOF
%endif # enabled fonts

%install
# .systemPrefs removed as they are not packaged in jpackage
#cp -a jre/.systemPrefs %buildroot%{_jvmdir}/%{jredir}
# ------------------------------------------

### jpackage ###


%if_enabled moz_plugin
## fix up ControlPanel APPHOME and bin locations
#%__subst 's|APPHOME=.*|APPHOME=%{_jvmdir}/%{jredir}|' jre/bin/ControlPanel
#%__subst 's|/usr/bin/||g' jre/bin/ControlPanel

# fix up (create new) HtmlConverter

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

# fix up java-rmi.cgi PATH

%__subst 's|PATH=.*|PATH=%{jrebindir}|' bin/java-rmi.cgi

# # install java-rmi-cgi

# install -D -m 755 bin/java-rmi.cgi $RPM_BUILD_ROOT%{cgibindir}/java-rmi-%{version}.cgi
%endif

# main files

install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir}
cp -a bin include lib src.zip $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir}
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{jredir}

# extensions handling

install -d -m 755 $RPM_BUILD_ROOT%{jvmjardir}
pushd $RPM_BUILD_ROOT%{jvmjardir}
  ln -s %{_jvmdir}/%{jredir}/lib/jsse.jar jsse-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/jce.jar jce-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-ldap-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-cos-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jndi-rmi-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jaas-%{version}.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar jdbc-stdext-%{version}.jar
  ln -s jdbc-stdext-%{version}.jar jdbc-stdext-3.0.jar
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar sasl-%{version}.jar
  # do we need version?; TODO: add provides to jvm?
  ln -s %{_jvmdir}/%{jredir}/lib/rt.jar xml-commons-apis.jar
  for jar in *-%{version}.jar ; do
     if [ x%{version} != x%{javaver} ]; then
        ln -fs ${jar} $(echo $jar | sed "s|-%{version}.jar|-%{javaver}.jar|g")
     fi
     ln -fs ${jar} $(echo $jar | sed "s|-%{version}.jar|.jar|g")
  done
popd

# rest of the jre

cp -a jre/bin jre/lib $RPM_BUILD_ROOT%{_jvmdir}/%{jredir}
%if_enabled javaws
cp -a jre/javaws $RPM_BUILD_ROOT%{_jvmdir}/%{jredir}
%endif
%if_enabled moz_plugin
cp -a jre/plugin $RPM_BUILD_ROOT%{_jvmdir}/%{jredir}
%endif
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{jredir}/lib/endorsed

# jce policy file handling

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

# versionless symlinks

pushd $RPM_BUILD_ROOT%{_jvmdir}
ln -s %{jredir} %{jrelnk}
ln -s %{sdkdir} %{sdklnk}
popd

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

# man pages

install -d -m 755 $RPM_BUILD_ROOT%{_man1dir}
for manpage in man/man1/*; do
 install -m 644 -p $manpage $RPM_BUILD_ROOT%{_man1dir}/`basename $manpage .1`%label.1
done

# demo

# install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
# cp -a demo $RPM_BUILD_ROOT%{_datadir}/%{name}
install -d -m755 %buildroot%{_jvmdir}/%{sdkdir}
cp -a demo sample %buildroot%{_jvmdir}/%{sdkdir}

# Remove unpackaged files

%if_with gcc32_abi
%__rm -f %buildroot%{_jvmdir}/%{jredir}/lib/%libarch/*_gcc29.so
%__rm -rf %buildroot%{_jvmdir}/%{jredir}/plugin/%libarch/*-gcc29
%endif

#####################################

# ------- alt linux specific -------#
#####################################

mkinstall_java_fonts() {
local JRE_FONT_DIR=$1
local INSTALL_FONT_DIR=$2
%if_enabled fonts
install -d -m755 %buildroot$INSTALL_FONT_DIR
# move the fonts into a shared fonts directory
install -m 644 %buildroot%{_jvmdir}/%{jredir}/lib/$JRE_FONT_DIR/*.ttf %buildroot$INSTALL_FONT_DIR/
# symlink jre to common location (TODO: think of alternatives)
rm -rf %buildroot%{_jvmdir}/%{jredir}/lib/$JRE_FONT_DIR
ln -s `relative $INSTALL_FONT_DIR %{_jvmdir}/%{jredir}/lib/` %buildroot%{_jvmdir}/%{jredir}/lib/$JRE_FONT_DIR
install -d -m755 %buildroot%_sysconfdir/X11/fontpath.d/
FONTNAME=${INSTALL_FONT_DIR/\/usr\/share\/fonts\/ttf\//}
ln -s `relative $INSTALL_FONT_DIR %_sysconfdir/X11/fontpath.d/` %buildroot%_sysconfdir/X11/fontpath.d/ttf-$FONTNAME:pri=50
mkfontscale %buildroot$INSTALL_FONT_DIR
ln -s fonts.scale %buildroot$INSTALL_FONT_DIR/fonts.dir
%endif # enabled fonts
}

mkinstall_java_fonts fonts %fontdir
mkinstall_java_fonts oblique-fonts %fontdir_oblique

# HACK around find-requires

%define __find_requires    $RPM_BUILD_ROOT/.find-requires
cat > $RPM_BUILD_ROOT/.find-requires <<EOF
#!/bin/sh
(/usr/lib/rpm/find-requires | grep -v %{_jvmdir}/%{sdkdir}) || :
EOF
chmod 755 $RPM_BUILD_ROOT/.find-requires
# end HACK around find-requires

%if_enabled desktop
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/mime/packages/
install -d -m 755 $RPM_BUILD_ROOT{%_desktopdir,%_datadir/desktop-directories,/etc/xdg/menus/applications-merged}
mv $RPM_BUILD_ROOT%{_jvmdir}/%{jrelnk}/lib/desktop/icons $RPM_BUILD_ROOT%{_datadir}/
mv $RPM_BUILD_ROOT%{_jvmdir}/%{jrelnk}/lib/desktop/mime/packages/* $RPM_BUILD_ROOT%{_datadir}/mime/packages/
mv $RPM_BUILD_ROOT%{_jvmdir}/%{jrelnk}/lib/desktop/applications/%{origin}-java.desktop $RPM_BUILD_ROOT%_desktopdir/
mv $RPM_BUILD_ROOT%{_jvmdir}/%{jrelnk}/lib/desktop/applications/%{origin}-javaws.desktop $RPM_BUILD_ROOT%_desktopdir/
# TODO: control panel is not plugin-specific
# $RPM_BUILD_ROOT%{_jvmdir}/%{jrelnk}/lib/desktop/applications/%{origin}-java.desktop
# TODO: the resources below are not sun-specific
cat > $RPM_BUILD_ROOT/etc/xdg/menus/applications-merged/java.menu <<'EOF'
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
   "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
   <Name>Applications</Name>
   <Menu>
       <Name>Settings</Name>
       <Menu>
           <Name>Java</Name>
           <Directory>java.directory</Directory>
           <Include>
               <Category>X-ALTLinux-Java</Category>
           </Include>
       </Menu>
   </Menu>
</Menu>
EOF
cat > %buildroot%_datadir/desktop-directories/java.directory <<'EOF'
[Desktop Entry]
Name=Java configuration
Icon=%{origin}-java
Type=Directory
EOF
%endif

%if_enabled moz_plugin
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -m 644 jre/plugin/desktop/%{origin}_java.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png
install -d -m 755 $RPM_BUILD_ROOT%{_niconsdir}
ln -s %{_datadir}/pixmaps/%{name}.png $RPM_BUILD_ROOT%{_niconsdir}/%{name}.png
%endif

##################################################

# --- alt linux specific, shared with openjdk ---#
##################################################

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications
if [ -e $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir}/bin/jvisualvm ]; then
 cat >> $RPM_BUILD_ROOT%{_datadir}/applications/%{name}-jvisualvm.desktop << EOF
[Desktop Entry]
Name=Java VisualVM (%{name})
Comment=Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool
Exec=jvisualvm
Icon=%{name}
Terminal=false
Type=Application
Categories=Development;Profiling;Java;X-ALTLinux-Java;X-ALTLinux-Java-%javaver-%{origin};
EOF
fi

%if_enabled moz_plugin
# ControlPanel freedesktop.org menu entry
cat >> $RPM_BUILD_ROOT%{_datadir}/applications/%{name}-control-panel.desktop << EOF
[Desktop Entry]
Name=Java Plugin Control Panel (%{name})
Comment=Java Control Panel
Exec=jcontrol
Icon=%{name}
Terminal=false
Type=Application
Categories=Settings;Java;X-ALTLinux-Java;X-ALTLinux-Java-%javaver-%{origin};
EOF

# javaws freedesktop.org menu entry

cat >> $RPM_BUILD_ROOT%{_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=%{name}
Terminal=false
Type=Application
Categories=Settings;Java;X-ALTLinux-Java;X-ALTLinux-Java-%javaver-%{origin};
EOF
%endif

# Install substitute rules for buildreq

echo java >j2se-buildreq-substitute
echo java-devel >j2se-devel-buildreq-substitute
mkdir -p %buildroot%_sysconfdir/buildreqs/packages/substitute.d
install -m644 j2se-buildreq-substitute \
   %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name
install -m644 j2se-devel-buildreq-substitute \
   %buildroot%_sysconfdir/buildreqs/packages/substitute.d/%name-devel

%__install -d %buildroot%_altdir

# J2SE alternative

%__cat <<EOF >%buildroot%_altdir/%altname-j2se
%{_bindir}/java %{jrebindir}/java %priority
%_man1dir/java.1.gz %_man1dir/java%{label}.1.gz %{jrebindir}/java
EOF
# binaries and manuals
for i in keytool policytool servertool pack200 unpack200 \
orbd rmid rmiregistry tnameserv
do
 %__cat <<EOF >>%buildroot%_altdir/%altname-j2se
%_bindir/$i %{_jvmdir}/%{jredir}/bin/$i %{jrebindir}/java
%_man1dir/$i.1.gz %_man1dir/${i}%{label}.1.gz %{jrebindir}/java
EOF
done

# ----- JPackage compatibility alternatives ------

%__cat <<EOF >>%buildroot%_altdir/%altname-j2se
%{_jvmdir}/jre %{_jvmdir}/%{jrelnk} %{jrebindir}/java
%{_jvmjardir}/jre %{_jvmjardir}/%{jrelnk} %{jrebindir}/java
%{_jvmdir}/jre-%{origin} %{_jvmdir}/%{jrelnk} %{jrebindir}/java
%{_jvmjardir}/jre-%{origin} %{_jvmjardir}/%{jrelnk} %{jrebindir}/java
%{_jvmdir}/jre-%{javaver} %{_jvmdir}/%{jrelnk} %{jrebindir}/java
%{_jvmjardir}/jre-%{javaver} %{_jvmjardir}/%{jrelnk} %{jrebindir}/java
EOF
%if_enabled moz_plugin
%__cat <<EOF >>%buildroot%_altdir/%altname-j2se
%{_bindir}/ControlPanel %{jrebindir}/ControlPanel %{jrebindir}/java
%{_bindir}/jcontrol %{jrebindir}/jcontrol %{jrebindir}/java
EOF
%endif
# JPackage specific: alternatives for security policy
%__cat <<EOF >>%buildroot%_altdir/%altname-j2se
%{_jvmdir}/%{jrelnk}/lib/security/local_policy.jar %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar %{priority}
%{_jvmdir}/%{jrelnk}/lib/security/US_export_policy.jar %{_jvmprivdir}/%{name}/jce/vanilla/US_export_policy.jar %{_jvmprivdir}/%{name}/jce/vanilla/local_policy.jar
EOF
# ----- end: JPackage compatibility alternatives ------


# Javac alternative

%__cat <<EOF >%buildroot%_altdir/%altname-javac
%_bindir/javac %{_jvmdir}/%{sdkdir}/bin/javac %priority
%_prefix/lib/jdk %{_jvmdir}/%{sdkdir} %{_jvmdir}/%{sdkdir}/bin/javac
%_man1dir/javac.1.gz %_man1dir/javac%{label}.1.gz %{_jvmdir}/%{sdkdir}/bin/javac
EOF

# binaries and manuals

for i in appletviewer extcheck idlj jar jarsigner javadoc javah javap jdb native2ascii rmic serialver apt jconsole jinfo jmap jps jsadebugd jstack jstat jstatd \
jhat jrunscript jvisualvm schemagen wsgen wsimport xjc
do
 if [ -e $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir}/bin/$i ]; then
 %__cat <<EOF >>%buildroot%_altdir/%altname-javac
%_bindir/$i %{_jvmdir}/%{sdkdir}/bin/$i %{_jvmdir}/%{sdkdir}/bin/javac
%_man1dir/$i.1.gz %_man1dir/${i}%{label}.1.gz %{_jvmdir}/%{sdkdir}/bin/javac
EOF
 fi
done
# binaries w/o manuals
for i in HtmlConverter
do
 %__cat <<EOF >>%buildroot%_altdir/%altname-javac
%_bindir/$i %{_jvmdir}/%{sdkdir}/bin/$i %{_jvmdir}/%{sdkdir}/bin/javac
EOF
done

# ----- JPackage compatibility alternatives ------

 %__cat <<EOF >>%buildroot%_altdir/%altname-javac
%_prefix/lib/j2se %{_jvmdir}/%{sdkdir} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmdir}/java %{_jvmdir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmjardir}/java %{_jvmjardir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmdir}/java-%{origin} %{_jvmdir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmjardir}/java-%{origin} %{_jvmjardir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmdir}/java-%{javaver} %{_jvmdir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
%{_jvmjardir}/java-%{javaver} %{_jvmjardir}/%{sdklnk} %{_jvmdir}/%{sdkdir}/bin/javac
EOF
# ----- end: JPackage compatibility alternatives ------


%if_enabled moz_plugin
# Mozilla plugin alternative
%__cat <<EOF >%buildroot%_altdir/%name-mozilla
%browser_plugins_path/libjavaplugin_oji.so %mozilla_java_plugin_so %priority
EOF
%endif # enabled moz_plugin

%if_enabled javaws
# Java Web Start alternative
%__cat <<EOF >%buildroot%_altdir/%altname-javaws
%_bindir/javaws %{jrebindir}/javaws %{jrebindir}/java
%_man1dir/javaws.1.gz %_man1dir/javaws%label.1.gz %{jrebindir}/java
EOF
# ----- JPackage compatibility alternatives ------
%__cat <<EOF >>%buildroot%_altdir/%altname-javaws
%{_datadir}/javaws %{jrebindir}/javaws %{jrebindir}/java
EOF
# ----- end: JPackage compatibility alternatives ------
%endif # enabled javaws

# hack (see #11383) to enshure that all man pages will be compressed

for i in $RPM_BUILD_ROOT%_man1dir/*.1; do
   [ -f $i ] && gzip -9 $i
done

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

# %ifnarch x86_64

# if [ -f %{_sysconfdir}/mime.types ]; then
#    %__subst 's|application/x-java-jnlp-file.*||g' %{_sysconfdir}/mailcap.bak 2>/dev/null
#    echo "type=application/x-java-jnlp-file; description=\"Java Web Start\"; exts=\"jnlp\"" >> %{_sysconfdir}/mailcap 2>/dev/null

#    %__subst 's|application/x-java-jnlp-file.*||g' %{_sysconfdir}/mime.types 2>/dev/null

#    echo "application/x-java-jnlp-file      jnlp" >> %{_sysconfdir}/mime.types 2>/dev/null
# fi
# %endif
# ----- JPackage stuff ------
%register_alternatives %altname-j2se

# though it is useless for openjdk, it is harmless

%pre
[ -L %{_jvmdir}/%{jredir}/lib/fonts ] || %__rm -rf %{_jvmdir}/%{jredir}/lib/fonts
[ -L %{_jvmdir}/%{jredir}/lib/oblique-fonts ] || %__rm -rf %{_jvmdir}/%{jredir}/lib/oblique-fonts

%preun
%unregister_alternatives %altname-j2se

%post devel
%register_alternatives %altname-javac
%update_menus

%preun devel
%unregister_alternatives %altname-javac

%postun devel
%clean_menus

%if_enabled desktop
%post -n java-%{origin}-desktop
%update_mimedb
%update_desktopdb

%postun -n java-%{origin}-desktop
%clean_mimedb
%clean_desktopdb
%endif

%if_enabled moz_plugin
%post -n mozilla-plugin-%name
if [ -d %browser_plugins_path ]; then
   %register_alternatives %name-mozilla
fi
%update_menus

%preun -n mozilla-plugin-%name
%unregister_alternatives %name-mozilla

%postun -n mozilla-plugin-%name
%clean_menus
%endif # enabled moz_plugin

%if_enabled javaws
%post javaws
%register_alternatives %altname-javaws
%update_menus
%update_desktopdb

%preun javaws
%unregister_alternatives %altname-javaws

%postun javaws
%clean_menus
%clean_desktopdb
%endif # enabled javaws

##################################################

# - END alt linux specific, shared with openjdk -#
##################################################

%if_enabled moz_plugin
%triggerpostun -n mozilla-plugin-%name -- %altname-plugin-mozilla
if [ -d %browser_plugins_path ]; then
%register_alternatives %name-mozilla
fi

%triggerpostun -n mozilla-plugin-%name -- mozilla-plugin-%altname
if [ -d %browser_plugins_path ]; then
%register_alternatives %name-mozilla
fi
%endif # enabled moz_plugin

%if_enabled fonts
%post -n fonts-ttf-%name
%_bindir/fc-cache %fontdir ||:
%_bindir/fc-cache %fontdir_oblique ||:

%postun -n fonts-ttf-%name
if [ "$1" = "0" ]; then
   %_bindir/fc-cache --system-only ||:
fi
%endif # enabled fonts

%files
%doc jre/COPYRIGHT jre/LICENSE jre/README jre/Welcome.html
%doc jre/THIRDPARTYLICENSEREADME.txt
%doc README.alt
# jpackage links #
%{jvmjardir}
%{_jvmdir}/%{jrelnk}
%{_jvmjardir}/%{jrelnk}
# jpackage dirs
%{_jvmdir}/%{jredir}/lib/endorsed
%_altdir/%altname-j2se
%_sysconfdir/buildreqs/packages/substitute.d/%name
%dir %{_jvmdir}/%{sdkdir}
%dir %{_jvmdir}/%{jredir}
%dir %{_jvmdir}/%{jredir}/lib
%dir %{_jvmdir}/%{jredir}/lib/management
%dir %{_jvmdir}/%{jredir}/lib/security
# .systemPrefs removed as they are not packaged in jpackage
#%{_jvmdir}/%{jredir}/.systemPrefs
%{_jvmdir}/%{jredir}/bin
%if_enabled javaws
%exclude %{_jvmdir}/%{jredir}/bin/javaws
%endif
%{_jvmdir}/%{jredir}/lib/%libarch
%if_enabled jdbc_subpackage
%exclude %{_jvmdir}/%{jredir}/lib/%libarch/libJdbcOdbc.so
%endif
%if_enabled alsa_subpackage
%exclude %{_jvmdir}/%{jredir}/lib/%libarch/libjsoundalsa.so
%endif
%{_jvmdir}/%{jredir}/lib/*.jar
%{_jvmdir}/%{jredir}/lib/*.txt
%{_jvmdir}/%{jredir}/lib/applet
%{_jvmdir}/%{jredir}/lib/audio
%{_jvmdir}/%{jredir}/lib/classlist
%{_jvmdir}/%{jredir}/lib/cmm
%{_jvmdir}/%{jredir}/lib/ext
%{_jvmdir}/%{jredir}/lib/fonts
%{_jvmdir}/%{jredir}/lib/im
%{_jvmdir}/%{jredir}/lib/images
%{_jvmdir}/%{jredir}/lib/servicetag
%if_enabled moz_plugin
# common between plugin and javaws (TODO: desktop)
%{_datadir}/pixmaps/%{name}.png
%{_niconsdir}/%{name}.png
%{_jvmdir}/%{jredir}/lib/locale
%exclude %{_jvmdir}/%{jredir}/lib/locale/*/LC_MESSAGES/sunw_java_plugin.mo
%exclude %{_jvmdir}/%{jredir}/lib/%libarch/libjavaplugin_jni.so
%exclude %{_jvmdir}/%{jredir}/lib/%libarch/libjavaplugin_nscp*.so
%exclude %{_jvmdir}/%{jredir}/lib/plugin.jar
%exclude %{_jvmdir}/%{jredir}/plugin
%endif
%{_jvmdir}/%{jredir}/lib/oblique-fonts
%{_jvmdir}/%{jredir}/lib/zi
%config(noreplace) %{_jvmdir}/%{jredir}/lib/*.properties
%config(noreplace) %{_jvmdir}/%{jredir}/lib/*.properties.??
%config(noreplace) %{_jvmdir}/%{jredir}/lib/fontconfig.bfc
%config(noreplace) %{_jvmdir}/%{jredir}/lib/fontconfig.properties.src
%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/management/*
%{_jvmdir}/%{jredir}/lib/fontconfig.*.bfc
%{_jvmdir}/%{jredir}/lib/fontconfig.*.properties.src
#%{_jvmdir}/%{jredir}/lib/security/*.jar
%{_jvmprivdir}/*
%ghost %{_jvmdir}/%{jredir}/lib/security/local_policy.jar
%ghost %{_jvmdir}/%{jredir}/lib/security/US_export_policy.jar
%_man1dir/java%label.1*
%_man1dir/keytool%label.1*
%_man1dir/orbd%label.1*
%_man1dir/policytool%label.1*
%_man1dir/rmid%label.1*
%_man1dir/rmiregistry%label.1*
%_man1dir/servertool%label.1*
%_man1dir/tnameserv%label.1*
%_man1dir/pack200%label.1*
%_man1dir/unpack200%label.1*
# new in 6
%{_jvmdir}/%{jredir}/lib/jexec
%{_jvmdir}/%{jredir}/lib/meta-index

%files devel
%doc *README* LICENSE COPYRIGHT
# jpackage short links #
%{_jvmdir}/%{sdklnk}
%{_jvmjardir}/%{sdklnk}
%_altdir/%altname-javac
%_sysconfdir/buildreqs/packages/substitute.d/%name-devel
%{_jvmdir}/%{sdkdir}/bin
%{_jvmdir}/%{sdkdir}/lib
%{_jvmdir}/%{sdkdir}/include
%_man1dir/appletviewer%label.1*
%_man1dir/extcheck%label.1*
%_man1dir/idlj%label.1*
%_man1dir/jar%label.1*
%_man1dir/jarsigner%label.1*
%_man1dir/javac%label.1*
%_man1dir/javadoc%label.1*
%_man1dir/javah%label.1*
%_man1dir/javap%label.1*
%_man1dir/jdb%label.1*
%_man1dir/native2ascii%label.1*
%_man1dir/rmic%label.1*
%_man1dir/serialver%label.1*
%_man1dir/apt%label.1*
%_man1dir/jconsole%label.1*
%_man1dir/jinfo%label.1*
%_man1dir/jmap%label.1*
%_man1dir/jps%label.1*
%_man1dir/jsadebugd%label.1*
%_man1dir/jstack%label.1*
%_man1dir/jstat%label.1*
%_man1dir/jstatd%label.1*
# new in 6
%_man1dir/jhat%label.1*
%_man1dir/jrunscript%label.1*
%_man1dir/jvisualvm%label.1*
%_man1dir/schemagen%label.1*
%_man1dir/wsgen%label.1*
%_man1dir/wsimport%label.1*
%_man1dir/xjc%label.1*
# new in 6
%{_datadir}/applications/%{name}-jvisualvm.desktop

%files source
%{_jvmdir}/%{sdkdir}/src.zip

%files demo
#todo
#%dir %{_datadir}/%{jppname}
#%{_datadir}/%{jppname}/demo
%{_jvmdir}/%{sdkdir}/demo
%{_jvmdir}/%{sdkdir}/sample

%if_enabled moz_plugin
%files -n mozilla-plugin-%name
%_altdir/%name-mozilla
%mozplugindir
%dir %{_jvmdir}/%{jredir}/plugin
%dir %{_jvmdir}/%{jredir}/plugin/%libarch
%{_jvmdir}/%{jredir}/lib/%libarch/libjavaplugin_jni.so
%{_jvmdir}/%{jredir}/lib/%libarch/libjavaplugin_nscp*.so
%{_jvmdir}/%{jredir}/lib/locale/*/LC_MESSAGES/sunw_java_plugin.mo
%{_jvmdir}/%{jredir}/lib/plugin.jar
%{_jvmdir}/%{jredir}/plugin/desktop
%{_datadir}/applications/%{name}-control-panel.desktop
%endif

%if_enabled alsa_subpackage
%files alsa
%{_jvmdir}/%{jredir}/lib/%libarch/libjsoundalsa.so
%endif

%if_enabled jdbc_subpackage
%files jdbc
%{_jvmdir}/%{jredir}/lib/%libarch/libJdbcOdbc.so
%endif

%if_enabled desktop
%files -n java-%{origin}-desktop
%{_datadir}/icons/*/*/*/*
%{_datadir}/mime/packages/*.xml
%_desktopdir/%{origin}-java.desktop
%_desktopdir/%{origin}-javaws.desktop
%_datadir/desktop-directories/java.directory
/etc/xdg/menus/applications-merged/java.menu
%if_enabled moz_plugin
%exclude %{_niconsdir}/%{name}.png
%endif
%endif

%if_enabled javaws
%files javaws
%doc README.alt
%_altdir/%altname-javaws
%{_jvmdir}/%{jredir}/bin/javaws
#%{_jvmdir}/%{jredir}/lib/javaws
%{_jvmdir}/%{jredir}/javaws
%config(noreplace) %{_jvmdir}/%{jredir}/lib/security/javaws.policy
%_man1dir/javaws%label.1*
%{_datadir}/applications/%{name}-javaws.desktop
# deploy.jar, javaws.jar: should be moved too
# new in 6
%{_jvmdir}/%{jredir}/lib/deploy
%endif

%if_enabled fonts
%files -n fonts-ttf-%name
%doc LICENSE COPYRIGHT
%doc fontdoc/README.alt
%_sysconfdir/X11/fontpath.d/*
%dir %fontdir
%fontdir/fonts.scale
%fontdir/fonts.dir
%fontdir/*.ttf
%dir %fontdir_oblique
%fontdir_oblique/fonts.scale
%fontdir_oblique/fonts.dir
%fontdir_oblique/*.ttf
%endif # enabled fonts


%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin