summaryrefslogtreecommitdiff
path: root/extra/java7-openjdk/PKGBUILD
blob: bb983cef3bc7fb772b78c314710c75a7f08185b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# $Id: PKGBUILD 215163 2014-06-14 19:17:13Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=('jre7-openjdk-headless' 'jre7-openjdk' 'jdk7-openjdk' 'openjdk7-src' 'openjdk7-doc')
pkgbase=java7-openjdk
_java_ver=7
_icedtea_ver=2.5.0

# check "${srcdir}/icedtea-${_icedtea_ver}"/Makefile.am
_JDK_UPDATE_VERSION=60

_bootstrap=0 # 0/1 for quick build or full bootstrap

pkgver=${_java_ver}.u${_JDK_UPDATE_VERSION}_${_icedtea_ver}
pkgrel=2
arch=('i686' 'x86_64')
url="http://icedtea.classpath.org"
license=('custom')
options=('!emptydirs')
makedepends=('jdk7-openjdk' 'libxp' 'libxslt'
             'alsa-lib' 'apache-ant>=1.8.1' 'giflib' 'libpng>=1.5.7' 'gtk2'
             'java-rhino' 'libpulse>=0.9.11' 'zip' 'unzip' 'cpio' 'fastjar' 'wget'
             'eclipse-ecj')

_icedtea_url=http://icedtea.classpath.org/download
_drops_url=${_icedtea_url}/drops/icedtea7/${_icedtea_ver:0:3}
source=(${_icedtea_url}/source/icedtea-${_icedtea_ver}.tar.gz
        ${_drops_url}/openjdk.tar.bz2
        ${_drops_url}/corba.tar.bz2
        ${_drops_url}/jaxp.tar.bz2
        ${_drops_url}/jaxws.tar.bz2
        ${_drops_url}/jdk.tar.bz2
        ${_drops_url}/langtools.tar.bz2
        ${_drops_url}/hotspot.tar.bz2
        fontconfig-paths.diff
        openjdk7_nonreparenting-wm.diff
        giflib_5.1.diff
        jdk7-openjdk.profile
        jdk7-openjdk.profile.csh
        jre7-openjdk.profile
        jre7-openjdk.profile.csh)

sha256sums=('4e369e35dbf37a5fcc1a837861a74609bf907d3d0b9be7ac98d4f9c99dba7100'
            '9a2f9486a48d51f84bdf9b9a52dc34fe90b886aa60ff5447b7f2502479065859'
            '1f9f07f31ce8588cd3cd12465f94e142c852c380059a3dab9831d86d3f264253'
            '59edb741e1b00243c040b399986960fad9e42f7e5dbe0a1e34798752b080c488'
            'ed3803635ed25f58cd86ad8ca27585f77cc50385da0342112980cc6ba8ff6028'
            '508b4e26704749172022c95f44c5aa9feb391e82b54a545fdb79f3a51c269f83'
            '0eb9c19cfbecfbc6ef1e37f475d73f16469b9e1d969f69b1af4b10cbc2415659'
            '645a43adaec3be3d3297479d134c02e444af9f0be33d35942f0ca863592fea26'
            '9ad943ceb3dbcdf45d72974fc3667886a7ed65c69ab9abc17be5412827551a7f'
            '56b919ababb13bd6afdcdaceb112b529b6e82539255f2dae9a7e5eb91645164b'
            '77fba3032edf6cce549cd4e174d9296684b20f4589dc59179fcc8cba7426a4e9'
            'bd55299e08e6f8e61ba5baad0990170891801a29a1e8137e502b5e8a10fc37ea'
            '3f28f8bfc6dd105a07f747d7135c77a77de433e2b8647dd7520a900135203fbd'
            'b7c045b08ad55a9f79390c104fa846d0e7dbb49fccffb2fab2a3824b6b19c9c8'
            '89d99d8ac269ca66e2e279aff652d5aac938a35faec93cd8cff8f048052bd3ce')

noextract=(openjdk.tar.gz
           corba.tar.gz
           jaxp.tar.gz
           jaxws.tar.gz
           jdk.tar.gz
           langtools.tar.gz
           hotspot.tar.gz)

[ "$CARCH" = "x86_64" ] && _JARCH=amd64
[ "$CARCH" = "i686" ]   && _JARCH=i386

_jvmdir=/usr/lib/jvm/java-7-openjdk
_imgdir="icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image"
_nonheadless=(bin/policytool
              lib/${_JARCH}/libjsoundalsa.so
              lib/${_JARCH}/libsplashscreen.so
              lib/${_JARCH}/xawt/libmawt.so)

build() {
  cd "${srcdir}/icedtea-${_icedtea_ver}"

  export ALT_PARALLEL_COMPILE_JOBS="${MAKEFLAGS/-j}"
  export HOTSPOT_BUILD_JOBS="${ALT_PARALLEL_COMPILE_JOBS}"

  . /etc/profile.d/apache-ant.sh

  cp "${srcdir}"/*.diff "${srcdir}"/icedtea-${_icedtea_ver}/patches
  export DISTRIBUTION_PATCHES="patches/fontconfig-paths.diff \
                               patches/openjdk7_nonreparenting-wm.diff \
                               patches/giflib_5.1.diff"

  if [ "$_bootstrap" = "1" ]; then
     BOOTSTRAPOPT="--enable-bootstrap --with-ecj-jar=/usr/share/java/ecj.jar"
   else
     BOOTSTRAPOPT="--disable-bootstrap"
  fi

  ./configure \
        ${BOOTSTRAPOPT} \
        --with-parallel-jobs="${MAKEFLAGS/-j}" \
        --disable-tests \
        --disable-downloading --disable-Werror \
        --with-pkgversion="Arch Linux build ${pkgver}-${pkgrel}-${CARCH}" \
        --with-jdk-home=${JAVA_HOME} \
        --with-openjdk-src-zip="${srcdir}/openjdk.tar.bz2" \
        --with-hotspot-src-zip="${srcdir}/hotspot.tar.bz2" \
        --with-corba-src-zip="${srcdir}/corba.tar.bz2" \
        --with-jaxp-src-zip="${srcdir}/jaxp.tar.bz2" \
        --with-jaxws-src-zip="${srcdir}/jaxws.tar.bz2" \
        --with-jdk-src-zip="${srcdir}/jdk.tar.bz2" \
        --with-langtools-src-zip="${srcdir}/langtools.tar.bz2" \
        --enable-nss \
        --with-rhino \
        --with-abs-install-dir=${_jvmdir}
    make
}

check() {
  cd "${srcdir}/icedtea-${_icedtea_ver}"
  make -k check
}

package_jre7-openjdk-headless() {
  pkgdesc='OpenJDK Java 7 headless runtime environment'
  depends=('libjpeg-turbo' 'lcms2' 'nss' 'ca-certificates-java')
  optdepends=('libcups: needed for Java Mauve support - libmawt.so'
              'fontconfig: needed for Java Mauve support - libmawt.so'
              'java-rhino: for some JavaScript support')
  provides=('java-runtime-headless=7')
  conflicts=('openjdk6')
  # Upstream config files that should go to etc and get backup
  _backup_etc=(etc/java-7-openjdk/${_JARCH}/jvm.cfg
               etc/java-7-openjdk/calendars.properties
               etc/java-7-openjdk/content-types.properties
               etc/java-7-openjdk/flavormap.properties
               etc/java-7-openjdk/fontconfig.bfc
               etc/java-7-openjdk/fontconfig.properties
               etc/java-7-openjdk/images/cursors/cursors.properties
               etc/java-7-openjdk/logging.properties
               etc/java-7-openjdk/management/jmxremote.access
               etc/java-7-openjdk/management/jmxremote.password
               etc/java-7-openjdk/management/management.properties
               etc/java-7-openjdk/management/snmp.acl
               etc/java-7-openjdk/net.properties
               etc/java-7-openjdk/psfont.properties.ja
               etc/java-7-openjdk/psfontj2d.properties
               etc/java-7-openjdk/security/java.policy
               etc/java-7-openjdk/security/java.security
               etc/java-7-openjdk/security/nss.cfg
               etc/java-7-openjdk/sound.properties
               etc/java-7-openjdk/tz.properties)
  backup=(${_backup_etc[@]}
          etc/profile.d/jre.sh
          etc/profile.d/jre.csh)
  install=jre7-openjdk-headless.install

  cd "${srcdir}/${_imgdir}/jre"

  install -d -m755 "${pkgdir}${_jvmdir}/jre"
  cp -a bin lib "${pkgdir}${_jvmdir}/jre"

  # Set config files
  mv "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.{Ubuntu.properties.src,properties}
  mv "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.{Ubuntu.bfc,bfc}
  mv "${pkgdir}${_jvmdir}"/jre/lib/management/jmxremote.password{.template,}
  mv "${pkgdir}${_jvmdir}"/jre/lib/management/snmp.acl{.template,}
  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.*.bfc
  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.*.properties.src
  rm -f "${pkgdir}${_jvmdir}"/jre/lib/fontconfig.properties.src

  # Remove 'non-headless' files
  for f in ${_nonheadless[@]}; do
    rm "${pkgdir}${_jvmdir}/jre/${f}"
  done

  # Man pages
  pushd "${pkgdir}${_jvmdir}/jre/bin"
  install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
  for file in *; do
    install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
      "${pkgdir}/usr/share/man/man1/${file}.1"
    install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
      "${pkgdir}/usr/share/man/ja/man1/${file}.1"
  done
  popd

  # Link binaries into /usr/bin
  pushd "${pkgdir}${_jvmdir}/jre/bin"
  install -d -m755 "${pkgdir}/usr/bin/"
  for file in *; do
    ln -sf ${_jvmdir}/jre/bin/${file} "${pkgdir}/usr/bin"
  done
  popd

  # Link JKS keystore from ca-certificates-java
  rm -f "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"
  ln -sf /etc/ssl/certs/java/cacerts "${pkgdir}${_jvmdir}/jre/lib/security/cacerts"

  # Set some variables
  install -d -m755 "${pkgdir}/etc/profile.d/"
  install -m755 "${srcdir}/jre7-openjdk.profile" "${pkgdir}/etc/profile.d/jre.sh"
  install -m755 "${srcdir}/jre7-openjdk.profile.csh" "${pkgdir}/etc/profile.d/jre.csh"

  # Install license
  install -d -m755 "${pkgdir}/usr/share/licenses/${pkgbase}/"
  install -m644 ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README \
                 "${pkgdir}/usr/share/licenses/${pkgbase}"
  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"

  # Move config files that were set in _backup_etc from ./lib to /etc
  for file in ${_backup_etc[@]}; do
    _filepkgpath=${_jvmdir}/jre/lib/${file#etc/java-7-openjdk/}
    install -D -m 644 "${pkgdir}${_filepkgpath}" "${pkgdir}/${file}"
    ln -sf /${file} "${pkgdir}${_filepkgpath}"
  done
}

package_jre7-openjdk() {
  pkgdesc='OpenJDK Java 7 full runtime environment'
  depends=('jre7-openjdk-headless' 'xdg-utils' 'hicolor-icon-theme')
  optdepends=('icedtea-web-java7: web browser plugin + Java Web Start'
             'alsa-lib: for basic sound support'
             'giflib: for gif format support'
             'libpulse: for advanced sound support'
             'gtk2: for the Gtk+ look and feel - desktop usage'
             'libxtst: linked in xawt/libmawt.so - desktop usage')
  provides=('java-runtime=7')
  conflicts=('openjdk6')
  install=jre7-openjdk.install

  cd "${srcdir}/${_imgdir}/jre"

  for f in ${_nonheadless[@]}; do
    install -D ${f} "${pkgdir}${_jvmdir}/jre/${f}"
  done

  # Link binaries into /usr/bin
  pushd "${pkgdir}${_jvmdir}/jre/bin"
  install -d -m755 "${pkgdir}/usr/bin/"
  for file in *; do
    ln -sf ${_jvmdir}/jre/bin/${file} "${pkgdir}/usr/bin"
  done
  popd

  # Man pages
  pushd "${pkgdir}${_jvmdir}/jre/bin"
  install -d -m 755 "${pkgdir}"/usr/share/man/{,ja/}man1/
  for file in *; do
    install -m 644 "${srcdir}/${_imgdir}/man/man1/${file}.1" \
      "${pkgdir}/usr/share/man/man1/${file}.1"
    install -m 644 "${srcdir}/${_imgdir}/man/ja/man1/${file}.1" \
      "${pkgdir}/usr/share/man/ja/man1/${file}.1"
  done
  popd

  # Install icons and menu entries
  for s in 16 24 32 48 ; do
    install -d -m755 "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/"
    install -m644 ../../../openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${s}.png \
                  "${pkgdir}/usr/share/icons/hicolor/${s}x${s}/apps/java.png"
  done

  # Install desktop files.
  install -d -m755 "${pkgdir}/usr/share/applications"
  install -m644 "${srcdir}/icedtea-${_icedtea_ver}/policytool.desktop" "${pkgdir}/usr/share/applications"

  # link license
  install -d -m755 "${pkgdir}/usr/share/licenses"
  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_jdk7-openjdk() {
  pkgdesc='OpenJDK Java 7 development kit'
  depends=('jre7-openjdk')
  provides=('java-environment=7')
  conflicts=('java-environment')
  replaces=('openjdk6')
  backup=(etc/profile.d/jdk.sh etc/profile.d/jdk.csh)

  cd "${srcdir}/${_imgdir}"

  # Main files
  install -d -m755 "${pkgdir}${_jvmdir}"

  cp -a include lib "${pkgdir}${_jvmdir}"

  # 'bin' files
  pushd bin
  install -d -m755 "${pkgdir}${_jvmdir}/bin/" \
                   "${pkgdir}"/usr/bin/ \
                   "${pkgdir}"/usr/share/man/{,ja/}man1/

  # 'java-rmi.cgi' will be handled separately as it should not be in the PATH and has no man page
  for b in $(ls | grep -v java-rmi.cgi); do
    if [ -e ../jre/bin/${b} ]; then
      # Provide a link of the jre binary in the jdk/bin/ directory
      ln -s ../jre/bin/${b} "${pkgdir}${_jvmdir}/bin/${b}"
    else
      # Copy binary to jdk/bin/
      install -m755 ${b} "${pkgdir}${_jvmdir}/bin/${b}"
      # Copy man page
      install -m644 ../man/man1/${b}.1 "${pkgdir}/usr/share/man/man1/${b}.1"
      install -m644 ../man/ja/man1/${b}.1 "${pkgdir}/usr/share/man/ja/man1/${b}.1"
      # Link from /bin/
      ln -s ${_jvmdir}/bin/${b} "${pkgdir}/usr/bin/${b}"
    fi
  done
  popd

  # Handling 'java-rmi.cgi' separately
  install -D -m755 bin/java-rmi.cgi "${pkgdir}${_jvmdir}/bin/java-rmi.cgi"

  # Install desktop files.
  install -d -m755 "${pkgdir}/usr/share/applications"
  install -m644 "${srcdir}/icedtea-${_icedtea_ver}/jconsole.desktop" "${pkgdir}/usr/share/applications"

  # Set some variables
  install -d -m755 "${pkgdir}/etc/profile.d/"
  install -m755 "${srcdir}/${pkgname}.profile" "${pkgdir}/etc/profile.d/jdk.sh"
  install -m755 "${srcdir}/${pkgname}.profile.csh" "${pkgdir}/etc/profile.d/jdk.csh"

  # Temporarily fixing FS#35141
  chmod go+r "${pkgdir}${_jvmdir}/lib/sa-jdi.jar"

  # link license
  install -d -m755 "${pkgdir}/usr/share/licenses"
  ln -sf /usr/share/licenses/${pkgbase} "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_openjdk7-src() {
  pkgdesc='OpenJDK Java 7 sources'
  replaces=('openjdk6-src')

  install -D "${srcdir}/${_imgdir}/src.zip" "${pkgdir}${_jvmdir}/src.zip"
}

package_openjdk7-doc() {
  pkgdesc='OpenJDK Java 7 documentation'

  install -d -m755 "${pkgdir}/usr/share/doc/openjdk7-doc"
  for i in "${srcdir}"/icedtea-${_icedtea_ver}/openjdk.build/docs/*; do
    cp -a $i "${pkgdir}/usr/share/doc/openjdk7-doc/"
  done
}