Remove UTF-8 trademark symbol from package description
[sven/java-package.git] / lib / oracle-jdk.sh
1 # Detect product
2 j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
3 oracle_j2sdk_detect() {
4   j2se_release=0
5
6   # Update or GA release (jdk-7u15-linux-i586.tar.gz)
7   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-linux-(i586|x64|amd64|arm-vfp-hflt)\.(bin|tar\.gz) ]]
8   then
9     j2se_release=${BASH_REMATCH[1]}
10     j2se_update=${BASH_REMATCH[3]}
11     j2se_arch=${BASH_REMATCH[4]}
12     if [[ $j2se_update != "" ]]
13     then
14       j2se_version_name="$j2se_release Update $j2se_update"
15       j2se_version=${j2se_release}u${j2se_update}${revision}
16     else
17       j2se_version_name="$j2se_release GA"
18       j2se_version=${j2se_release}${revision}
19     fi
20   fi
21
22   # Early Access Release (jdk-8-ea-bin-b103-linux-i586-15_aug_2013.tar.gz)
23   if [[ $archive_name =~ jdk-([0-9]+)(u([0-9]+))?-(ea|fcs)(-bin)?-(b[0-9]+)-linux-(i586|x64|amd64|arm-vfp-hflt).*\.(bin|tar\.gz) ]]
24   then
25     j2se_release=${BASH_REMATCH[1]}
26     j2se_update=${BASH_REMATCH[3]}
27     j2se_build=${BASH_REMATCH[6]}
28     j2se_arch=${BASH_REMATCH[7]}
29     if [[ $j2se_update != "" ]]
30     then
31       j2se_version_name="$j2se_release Update $j2se_update Early Access Release Build $j2se_build"
32       j2se_version=${j2se_release}u${j2se_update}~ea-build-${j2se_build}${revision}
33     else
34       j2se_version_name="$j2se_release Early Access Release Build $j2se_build"
35       j2se_version=${j2se_release}~ea-build-${j2se_build}${revision}
36     fi
37   fi
38
39   if [[ $j2se_release > 0 ]]
40   then
41     j2se_priority=$((310 + $j2se_release))
42     j2se_expected_min_size=130 #Mb
43
44     # check if the architecture matches
45     let compatible=1
46
47     case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
48       i386|i486-linux-gnu)
49         if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
50         ;;
51       amd64|x86_64-linux-gnu)
52         if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
53         ;;
54       armhf|armel|arm-linux-gnueabihf|arm-linux-gnueabi)
55       case "$archive_name" in
56         "jdk-7u"[0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
57             j2se_version=1.7.0+update${archive_name:6:1}${revision}
58             j2se_expected_min_size=100 #Mb
59             j2se_priority=317
60             found=true
61             ;;
62         "jdk-7u"[0-9][0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
63             j2se_version=1.7.0+update${archive_name:6:2}${revision}
64             j2se_expected_min_size=60 #Mb
65             j2se_priority=317
66             found=true
67             ;;
68       esac
69       ;;
70     esac
71
72     if [[ $compatible == 0 ]]
73     then
74       echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
75       return
76     fi
77
78
79     cat << EOF
80
81 Detected product:
82     Java(TM) Development Kit (JDK)
83     Standard Edition, Version $j2se_version_name
84     Oracle(TM)
85 EOF
86     if read_yn "Is this correct [Y/n]: "; then
87       j2se_found=true
88       j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
89       j2se_vendor="oracle"
90       j2se_title="Java Platform, Standard Edition $j2se_release Development Kit"
91
92       j2se_install=oracle_j2sdk_install
93       j2se_remove=oracle_j2sdk_remove
94       j2se_jinfo=oracle_j2sdk_jinfo
95       j2se_control=oracle_j2sdk_control
96       if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
97         # javaws is not available for ARM
98         oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
99         oracle_jre_bin_jre="policytool"
100       else
101         oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
102         oracle_jre_bin_jre="javaws policytool"
103       fi
104       if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
105         oracle_no_man_jre_bin_jre="ControlPanel jcontrol"
106       fi
107       oracle_jre_lib_hl="jexec"
108       oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jcmd jconsole jdb jdeps jhat jinfo jmap jmc jps jrunscript jsadebugd jstack jstat jstatd jvisualvm native2ascii rmic schemagen serialver wsgen wsimport xjc"
109       j2se_package="$j2se_vendor-java$j2se_release-jdk"
110       j2se_run
111     fi
112   fi
113 }
114
115 oracle_j2sdk_install() {
116     cat << EOF
117 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
118     exit 0
119 fi
120
121 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
122 install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
123 if [ -n "$oracle_no_man_jre_bin_jre" ]; then
124     install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
125 fi
126 install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
127 install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
128
129 # No plugin for ARM architecture yet
130 if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
131 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
132 for b in $browser_plugin_dirs;do
133     install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
134 done
135 fi
136 EOF
137 }
138
139 oracle_j2sdk_remove() {
140     cat << EOF
141 if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
142     exit 0
143 fi
144
145 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
146 remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
147 if [ -n "$oracle_no_man_jre_bin_jre" ]; then
148     remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
149 fi
150 remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
151 remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
152
153 # No plugin for ARM architecture yet
154 if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
155 plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
156 for b in $browser_plugin_dirs;do
157     remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
158 done
159 fi
160 EOF
161 }
162
163 oracle_j2sdk_jinfo() {
164     cat << EOF
165 name=$j2se_name
166 priority=$j2se_priority
167 section=main
168 EOF
169     jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
170     jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
171     if [ -n "$oracle_no_man_jre_bin_jre" ]; then
172         jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
173     fi
174     jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
175     jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
176     if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
177         for b in $browser_plugin_dirs;do
178             echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
179         done
180     fi
181 }
182
183 oracle_j2sdk_control() {
184     build_depends="libasound2, libgl1-mesa-glx, libgtk2.0-0, libxslt1.1, libxtst6, libxxf86vm1"
185     j2se_control
186     java_browser_plugin="java-browser-plugin, "
187     depends="\${shlibs:Depends}"
188     if [ "${DEB_BUILD_ARCH:0:3}" = "arm" -a "${j2se_arch}" != "arm-vfp-hflt" ]; then
189         # ARM is only softfloat ATM so if building on armhf
190         # force the dependencies to pickup cross platform fu
191         if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
192             depends="libc6-armel, libsfgcc1, libsfstdc++6"
193         fi
194         # No browser on ARM yet
195         java_browser_plugin=""
196     fi
197     if [ "$create_cert_softlinks" == "true" ]; then
198         depends="$depends, ca-certificates-java"
199     fi
200     for i in `seq 5 ${j2se_release}`;
201     do
202         provides_runtime="${provides_runtime} java${i}-runtime,"
203         provides_headless="${provides_headless} java${i}-runtime-headless,"
204         provides_sdk="${provides_sdk} java${i}-sdk,"
205     done
206     cat << EOF
207 Package: $j2se_package
208 Architecture: $j2se_debian_arch
209 Depends: \${misc:Depends}, $depends
210 Recommends: netbase
211 Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, $provides_headless java-sdk, java2-sdk, $provides_sdk
212 Description: $j2se_title
213  The Java(TM) SE JDK is a development environment for building
214  applications, applets, and components that can be deployed on the
215  Java(TM) platform.
216  .
217  The Java(TM) SE JDK software includes tools useful for developing and
218  testing programs written in the Java programming language and running
219  on the Java platform. These tools are designed to be used from the
220  command line. Except for appletviewer, these tools do not provide a
221  graphical user interface.
222  .
223  This package has been automatically created with java-package ($version).
224 EOF
225 }