summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/openjdk6/PKGBUILD
blob: 22ee813c117ab81fbe7ec7ce62bb9099a60fe45a (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
# $Id: PKGBUILD 29222 2009-03-06 20:55:45Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=openjdk6
pkgver=1.5
_icedteaver=1.5pre
pkgrel=0.1
_date=20090305
pkgdesc='Free Java environment based on OpenJDK 6.0 with IcedTea6 replacing binary plugs.'
url='http://icedtea.classpath.org'
arch=('i686' 'x86_64')
license=('GPL')
_openjdk_version=b14
_openjdk_date=25_nov_2008
_hotspotver=fc6a5ae3fef5 # what it downlopads itself / remove from configure to get it
depends=('gcc-libs' 'xdg-utils' 'hicolor-icon-theme')
makedepends=('alsa-lib' 'libxtst' 'giflib' 'libxp' 'gtk2' 'nspr' 'zlib' 'freetype2' 'libjpeg' 'libx11' 'libcups' 'patch' 'xalan-java' 'xulrunner>=1.9.0.3' 'apache-ant>=1.7.0' 'autoconf' 'unzip' 'rhino' 'mercurial')
conflicts=('java-environment' 'java-runtime')
provides=('java-environment=6' 'java-runtime=6')
options=(!emptydirs)
install=openjdk6.install
source=(http://download.java.net/openjdk/jdk6/promoted/${_openjdk_version}/openjdk-6-src-${_openjdk_version}-${_openjdk_date}.tar.gz
	#http://icedtea.classpath.org/download/source/icedtea6-${_icedteaver}.tar.gz
	ftp://ftp.archlinux.org/other/openjdk6/icedtea6-${_date}.tar.bz2
	http://hg.openjdk.java.net/jdk7/hotspot/hotspot/archive/${_hotspotver}.tar.gz
	fix_jdk_cmds_path.diff
	fix_corba_cmds_path.diff
	gcjwebplugin_xulrunner.diff
	aatext_by_default.diff
	fontconfig-paths.diff
	openjdk6.profile)
noextract=(openjdk-6-src-${_openjdk_version}-${_openjdk_date}.tar.gz ${_hotspotver}.tar.gz)
md5sums=('9f9773a822156dd3d576d83d794364ce'
         'd57bf545dc50d41588b43112393dac26'
         '1c3510387dccdb4907d0fd2f1c58e372'
         '5da3e39fa60985576c4f37d1491efbe2'
         'f7e7a212e50abb56a6ef1a2b1bd27405'
         'ed2e808df2d2fc2ea7dae5139d475192'
         'ef60d567c0d9bad111212851220deafd'
         '104380f0b900c840141e572a7fb70c27'
         'd0703088e10aa957c037644ab88d716d')

build() {
  # for hg checkout install mercurial and
#  mkdir ${srcdir}/icedtea6-${_date}
#  cd ${srcdir}/icedtea6-${_date}
#  hg clone http://icedtea.classpath.org/hg/icedtea6 || return 1
#  tar -cvjf ../../icedtea6-${_date}.tar.bz2 *
#  return 1

  unset JAVA_HOME
  unset CLASSPATH
  if [ "${CARCH}" = "x86_64" ]; then
    _arch=amd64
  else
    _arch=i586
  fi
  _javaver=1.6.0
  _jvmdir=/usr/lib/jvm/java-${_javaver}-openjdk

  cd ${srcdir}/icedtea6
#  cd ${srcdir}/icedtea6-${_icedteaver}
  ln -s ${srcdir}/openjdk-6-src-${_openjdk_version}-${_openjdk_date}.tar.gz .
  ln -s ${srcdir}/${_hotspotver}.tar.gz .

  # fix xulrunner linking
  patch -Np0 -i ${srcdir}/gcjwebplugin_xulrunner.diff || return 1

  cp ${srcdir}/*.diff ${srcdir}/icedtea6/patches/
#  cp ${srcdir}/*.diff ${srcdir}/icedtea6-${_icedteaver}/patches/
  export DISTRIBUTION_PATCHES="patches/fix_jdk_cmds_path.diff patches/fix_corba_cmds_path.diff patches/aatext_by_default.diff patches/fontconfig-paths.diff"

  ./autogen.sh
  autoreconf # needed due to mercurial build

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

  if [ -x ${_jvmdir}/bin/javac ]; then
    JCONF="--with-openjdk --with-openjdk-home=${_jvmdir}"
  elif [ -x /opt/java/bin/javac ]; then
    JCONF="--with-openjdk --with-openjdk-home=/opt/java"
  elif [ -x /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/bin/javac ]; then
    JCONF="--with-gcj-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0 --with-javac"
  elif [ -x /usr/lib/java-${_javaver}-openjdk/bin/javac ]; then
    JCONF="--with-openjdk --with-openjdk-home=/usr/lib/java-${_javaver}-openjdk" 
    # ^ only fallback to build with broken 1.2-3, can be removed later
  else
    echo "No supported java installation found, install either openjdk6, jdk or java-gcj-compat"
    return 1
  fi

  ./configure --with-parallel-jobs=${HOTSPOT_BUILD_JOBS} \
	--with-xalan2-jar=/usr/share/java/xalan.jar \
	--with-hotspot-src-zip=${_hotspotver}.tar.gz \
	--with-pkgversion=ArchLinux-${pkgver}-${pkgrel}-$CARCH  $JCONF
  LD_PRELOAD="" make || return 1
  
  install -m755 -d ${pkgdir}/${_jvmdir}/jre

  pushd ${srcdir}/icedtea6/openjdk/control/build/linux-${_arch}/j2sdk-image
#  pushd ${srcdir}/icedtea6-${_icedteaver}/openjdk/control/build/linux-${_arch}/j2sdk-image
   # Install main files.
  cp -a bin include lib src.zip ${pkgdir}/${_jvmdir}/ || return 1
  cp -a jre/bin jre/lib ${pkgdir}/${_jvmdir}/jre/ || return 1

  mv ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.Ubuntu.properties.src \
     ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.properties.src || return 1
  mv ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.Ubuntu.bfc \
     ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.bfc || return 1
  rm -f ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.*.bfc
  rm -f ${pkgdir}/${_jvmdir}/jre/lib/fontconfig.*.properties.src

   # Install man pages.
  install -m755 -d ${pkgdir}/usr/share/man/man1
  install -m644 man/man1/*.1 ${pkgdir}/usr/share/man/man1/ || return 1

   # Install demos and samples.
  cp -a demo ${pkgdir}/${_jvmdir}/ || return 1
  install -m755 -d sample/rmi
  mv bin/java-rmi.cgi sample/rmi || return 1
  cp -a sample ${pkgdir}/${_jvmdir}/ || return 1
  popd

  # 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 || return 1
  done

  # Install desktop files.
  install -m755 -d ${pkgdir}/usr/share/{applications,pixmaps}
  install -m644 javaws.png ${pkgdir}/usr/share/pixmaps || return 1
  install -m644 {javaws,jconsole,policytool}.desktop ${pkgdir}/usr/share/applications || return 1

  # link the mozilla-plugin
  install -m755 -d ${pkgdir}/usr/lib/mozilla/plugins/
  ln -sf ${_jvmdir}/jre/lib/${_arch/i586/i386}/IcedTeaPlugin.so ${pkgdir}/usr/lib/mozilla/plugins/ || return 1

  # link binaries into /usr/bin
  install -m755 -d ${pkgdir}/usr/bin
  pushd ${pkgdir}/${_jvmdir}/bin
  for file in *; do
    ln -sf ${_jvmdir}/bin/${file} \
      ${pkgdir}/usr/bin || return 1
  done
  popd
 
  # set some variables
  install -m755 -d ${pkgdir}/etc/profile.d
  install -m755 ${srcdir}/openjdk6.profile ${pkgdir}/etc/profile.d/openjdk6.sh || return 1
}