summaryrefslogtreecommitdiff
path: root/extra/java7-openjdk/PKGBUILD
blob: e19cf6b5378bcc2ec55ab8ae4e259c834b50d118 (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
345
# $Id: PKGBUILD 150234 2012-02-15 16:00:28Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Guillaume ALAUX <guillaume@archlinux.org>

pkgname=('jre7-openjdk-headless' 'jre7-openjdk' 'jdk7-openjdk' 'openjdk7-src') 
 # ToDo -demo -doc packages, see Debian file lists http://packages.debian.org/source/wheezy/openjdk-7
pkgbase=java7-openjdk
_java_ver=7
_openjdk_build=b147
_openjdk_date=27_jun_2011
_icedtea_ver=2.1
_date=20110922

# check "${srcdir}/icedtea7"/Makefile.am
_CORBA_CHANGESET=5617f6c5cc94
_HOTSPOT_CHANGESET=0e651e004747
_JAXP_CHANGESET=1cf75c0e2c96
_JAXWS_CHANGESET=7edfbfe974f2
_JDK_CHANGESET=50f6f276a06c
_LANGTOOLS_CHANGESET=b534c4c6cd9b
_OPENJDK_CHANGESET=22cc03983e20

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

pkgver=${_java_ver}.${_openjdk_build}_${_icedtea_ver}
pkgrel=1
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'
             'rhino' 'libpulse>=0.9.11' 'zip' 'unzip' 'cpio' 'fastjar') # 'inetutils' 'grep') # fastjar`?
[ "$_bootstrap" = "1" ] && makedepends=(${makedepends[@]} 'eclipse-ecj')

_url=http://icedtea.classpath.org/hg/release/icedtea7-forest-2.1
source=(http://icedtea.classpath.org/download/source/icedtea-${_icedtea_ver}.tar.gz{,.sig}
        ${_url}/archive/${_OPENJDK_CHANGESET}.tar.gz						# openjdk.tar.gz
        ${_url}/corba/archive/${_CORBA_CHANGESET}.tar.gz					# corba.tar.gz
        ${_url}/jaxp/archive/${_JAXP_CHANGESET}.tar.gz						# jaxp.tar.gz
        ${_url}/jaxws/archive/${_JAXWS_CHANGESET}.tar.gz					# jaxws.tar.gz
        ${_url}/jdk/archive/${_JDK_CHANGESET}.tar.gz						# jdk.tar.gz
        ${_url}/langtools/archive/${_LANGTOOLS_CHANGESET}.tar.gz			# langtools.tar.gz
        ${_url}/hotspot/archive/${_HOTSPOT_CHANGESET}.tar.gz				# hotspot.tar.gz
        fontconfig-paths.diff
        fix_corba_cmds_path.diff
        openjdk7_fix_jdk_cmds_path.diff
        openjdk7_nonreparenting-wm.diff
        jdk7-openjdk.profile
        jdk7-openjdk.profile.csh
        jre7-openjdk.profile
        jre7-openjdk.profile.csh)
sha256sums=('8492920dccae8b76bcb41f91f8d98b2dc619380531a679f1f9ea4e166ad02ec6'
            '8d127e8397a0af3ffd8d1d96102a053d065d5507946f5c7118c0427668ac4227'
            'ada790b4754f521ebfad0dd909ea29b92b2b3c1b84b2e99d32673343727d95d7'
            '963915483530f311ff313635f79ed11ea7ce5a1c0dbee5d1acb1994132857fa3'
            '8ce48c704f38285207ee6dc56c45b2d214083b4d4d36be02901401b594ce701e'
            '823ca6b8fd780bf1b1565a90cfc8ec6f0ee422a5d25ffb20b1ce0272dc4955aa'
            '5f8b5edbebb358730425e64a31eaa11c346467ba10ffe1848f2d2ad2ea53bc3d'
            'c77dd42d83f06d18fa8aa65c93d137608a2e02cf24b68fc10d7b1c0bcc12a93c'
            'd68455e5cdb14280cd61155a4e9d531e90b073607f4367e93ead0fcf34476ae1'
            '9ad943ceb3dbcdf45d72974fc3667886a7ed65c69ab9abc17be5412827551a7f'
            '6384026ee4854a4ebcd5203845f0a56126aaf34517e99cfbc16c3ea353c55fe5'
            '9b3aa677773356d8b67300f99ad21118426e83f092392096726fcf123173008c'
            '14cf334b7e79e0086b446ba1b172b7cc4ad09668f52c9b12077020a3ded3c3e7'
            '2ec2c6d3a8b62c5743bf8c50c358d98f6a86219d1d8b70645bcc0e1707670410'
            '3f28f8bfc6dd105a07f747d7135c77a77de433e2b8647dd7520a900135203fbd'
            'faf5fbaf24c33c101d58bacf8b93c1dbe08a0cbde4c596d5b4a6e28dd4b18f0a'
            '84d3b91cc57c67b2cf2ddb7fe5abcf1e88b5a151565aaecf4b595c7ce8f3fee9')

#http://www.java.net/download/openjdk/jdk${_java_ver}/promoted/${_openjdk_build}/openjdk-${_java_ver}-fcs-src-${_openjdk_build}-${_openjdk_date}.zip

noextract=("${_OPENJDK_CHANGESET}.tar.gz"
           "${_CORBA_CHANGESET}.tar.gz"
           "${_JAXP_CHANGESET}.tar.gz"
           "${_JAXWS_CHANGESET}.tar.gz"
           "${_JDK_CHANGESET}.tar.gz"
           "${_LANGTOOLS_CHANGESET}.tar.gz"
           "${_HOTSPOT_CHANGESET}.tar.gz")

  _jvmdir=/usr/lib/jvm/java-7-openjdk
  
  [ "$CARCH" = "x86_64" ] && _JARCH=amd64
  [ "$CARCH" = "i686" ] && _JARCH=i386
  
build() {
  cd "${srcdir}/icedtea-${_icedtea_ver}"

  unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS
  
  # default is to build with first found java-environment found in our repos - is jdk7-openjdk
  [ -f /etc/profile.d/jdk.sh ] && . /etc/profile.d/jdk.sh
  
  unset MAKEFLAGS # parallel build is currently broken 
  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/fix_corba_cmds_path.diff patches/openjdk7_fix_jdk_cmds_path.diff patches/openjdk7_nonreparenting-wm.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 \
        --with-pkgversion="ArchLinux build ${pkgver}-${pkgrel}-${CARCH}" \
        --with-jdk-home=${JAVA_HOME} \
        --with-openjdk-src-zip=${srcdir}/${_OPENJDK_CHANGESET}.tar.gz \
        --with-hotspot-src-zip=${srcdir}/${_HOTSPOT_CHANGESET}.tar.gz \
        --with-corba-src-zip=${srcdir}/${_CORBA_CHANGESET}.tar.gz \
        --with-jaxp-src-zip=${srcdir}/${_JAXP_CHANGESET}.tar.gz \
        --with-jaxws-src-zip=${srcdir}/${_JAXWS_CHANGESET}.tar.gz \
        --with-jdk-src-zip=${srcdir}/${_JDK_CHANGESET}.tar.gz \
        --with-langtools-src-zip=${srcdir}/${_LANGTOOLS_CHANGESET}.tar.gz \
        --enable-pulse-java \
        --enable-nss \
        --with-rhino
	#--help

#     --enable-systemtap      Enable inclusion of SystemTap trace support - needs systemtab from AUR + --with-abs-install-dir=/usr/lib/jvm/java-7-openjdk The absolute path where the j2sdk-image dir will be installed
  
  make
}

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

package_jre7-openjdk-headless() {
  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - Minimal Java runtime - needed for executing non GUI Java programs"
  depends=('libjpeg-turbo' 'lcms2' 'nss'
           'ca-certificates-java' 'rhino')
  optdepends=('libcups: needed for Java Mauve support - libmawt.so'
              'fontconfig: needed for Java Mauve support - libmawt.so')
  provides=('java-runtime=7')
  conflicts=('java-runtime' 'openjdk6')
  #  replaces=('openjdk6') # once we remove openjdk6 pkg from the repos
  backup=(etc/profile.d/jre.sh
          etc/profile.d/jre.csh
          etc/java-7-openjdk/calendars.properties
          etc/java-7-openjdk/content-types.properties
          etc/java-7-openjdk/cursors/cursors.properties
          etc/java-7-openjdk/flavormap.properties
          etc/java-7-openjdk/fontconfig.bfc
          etc/java-7-openjdk/fontconfig.properties
          etc/java-7-openjdk/jvm.cfg
          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)
  install=jre7-openjdk-headless.install

  cd "${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/jre"

  mv lib/fontconfig.Ubuntu.properties.src lib/fontconfig.properties
  mv lib/fontconfig.Ubuntu.bfc lib/fontconfig.bfc
  rm -f lib/fontconfig.*.bfc
  rm -f lib/fontconfig.*.properties.src 
  rm -f lib/fontconfig.properties.src

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

  # Install man pages
  pushd ../../j2re-image/man
  install -m755 -d ${pkgdir}/usr/share/man/{,ja/}man1/
  install -m644 man1/*.1 ${pkgdir}/usr/share/man/man1
  install -m644 ja_JP.UTF-8/man1/*.1 ${pkgdir}/usr/share/man/ja/man1
  popd

  # more files that belong to the desktop package
  mkdir ${srcdir}/tmp-desktop-jre
  for file in \
	"/usr/lib/jvm/java-7-openjdk/jre/bin/policytool" \
	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/libjsoundalsa.so" \
	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/libpulse-java.so" \
	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/libsplashscreen.so" \
	"/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/xawt/libmawt.so" \
	"/usr/share/man/ja/man1/policytool.1" \
	"/usr/share/man/man1/policytool.1"; do
     dirname=`dirname $file`
     install -dm755 ${srcdir}/tmp-desktop-jre/$dirname || /bin/true
     # mv file from fakeinstall to pkgdir
     mv ${pkgdir}/$file ${srcdir}/tmp-desktop-jre$file
  done
  rmdir ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/xawt

  # Link binaries into /usr/bin
  pushd ${pkgdir}/${_jvmdir}/jre/bin
  install -m755 -d ${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 -m755 -d ${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 -m755 -d ${pkgdir}/usr/share/licenses/${pkgbase}/
  install -m644 ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README \
                 ${pkgdir}/usr/share/licenses/${pkgbase}
		 
  # Put some more files under backup control
  install -m755 -d ${pkgdir}/etc/java-7-openjdk/
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/*.properties* ${pkgdir}/etc/java-7-openjdk/
  # install dummy links to make them found by JAVA
  cd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/
  for file in `ls ${pkgdir}/etc/java-7-openjdk/*.properties*`; do
    ln -vsf /etc/java-7-openjdk/`basename $file` .
  done
  # some more
  install -m755 -d ${pkgdir}/etc/java-7-openjdk/{cursors,management,security}
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/images/cursors/cursors.properties ${pkgdir}/etc/java-7-openjdk/cursors/
  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/images/cursors/
    ln -vsf /etc/java-7-openjdk/cursors/cursors.properties .
  popd
  mv ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/jmxremote.password.template ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/jmxremote.password
  mv ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/snmp.acl.template ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/snmp.acl
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management/{management.properties,jmxremote.access,jmxremote.password,snmp.acl} ${pkgdir}/etc/java-7-openjdk/management/
  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/management
    ln -vsf /etc/java-7-openjdk/management/{management.properties,jmxremote.access,jmxremote.password,snmp.acl} .
  popd
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/security/{java.policy,java.security,nss.cfg} ${pkgdir}/etc/java-7-openjdk/security/
  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/security
    ln -vsf /etc/java-7-openjdk/security/{java.policy,java.security,nss.cfg} .
  popd
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/fontconfig.bfc ${pkgdir}/etc/java-7-openjdk/
  install -m644 ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/jvm.cfg ${pkgdir}/etc/java-7-openjdk/
  pushd ${pkgdir}/usr/lib/jvm/java-7-openjdk/jre/lib/${_JARCH}/
     ln -vsf /etc/java-7-openjdk/jvm.cfg .
  popd
}
	 
package_jre7-openjdk() {
  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs -Full Java runtime environment - needed for executing Java GUI and Webstart programs"
  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')
  install=jre7-openjdk.install
  conflicts=('openjdk6')
  
  mv ${srcdir}/tmp-desktop-jre/* ${pkgdir}
  # Link binaries into /usr/bin
  pushd ${pkgdir}/${_jvmdir}/jre/bin
  install -m755 -d ${pkgdir}/usr/bin/
  for file in *; do
    ln -sf ${_jvmdir}/jre/bin/${file} ${pkgdir}/usr/bin
  done
  popd
  
  cd "${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/jre"

  # Install icons and menu entries
  for s in 16 24 32 48 ; do
    install -m755 -d ${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 -m755 -d ${pkgdir}/usr/share/applications
  install -m644 ${srcdir}/icedtea-${_icedtea_ver}/{jconsole,policytool}.desktop ${pkgdir}/usr/share/applications
}

package_jdk7-openjdk() {
  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - SDK"
  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}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image"

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

  cp -a demo include lib sample ${pkgdir}/${_jvmdir}

  # 'bin' files
  pushd bin
  install -m755 -d ${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 -m755 -D bin/java-rmi.cgi ${pkgdir}/${_jvmdir}/bin/java-rmi.cgi

  # Set some variables
  install -m755 -d ${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
}

package_openjdk7-src() {
  pkgdesc="Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - sources"

  install -D ${srcdir}/icedtea-${_icedtea_ver}/openjdk.build/j2sdk-image/src.zip \
             ${pkgdir}/${_jvmdir}/src.zip
}