source: npl/java/openjdk/create_gcj_jvm.sh @ 981dbbc

perl-5.22
Last change on this file since 981dbbc was 981dbbc, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

build openjdk, not used yet

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[981dbbc]1#!/bin/bash
2
3# ---------------------------------------------------------------------------
4# This script creates a directory structure below /usr/lib/jvm and populates
5# it with symlinks to GCC binaries.
6# This will work as a compatibility layer to emulate an Oracle JDK/JRE.
7# This emulation is required in order to compile OpenJDK using GNU java.
8#
9# The same can automatically be achieved in Slackware's gcc packages if
10# the 'configure' command is called with the following additional parameters:
11#     --enable-java-home \
12#     --with-java-home=/usr/lib$LIBDIRSUFFIX/jvm/jre \
13#     --with-jvm-root-dir=/usr/lib$LIBDIRSUFFIX/jvm \
14#     --with-jvm-jar-dir=/usr/lib$LIBDIRSUFFIX/jvm/jvm-exports \
15#     --with-arch-directory=$LIB_ARCH \
16#
17# Author: Eric Hameleers <alien@slackware.com> December 2011
18# ---------------------------------------------------------------------------
19
20# Automatically determine the architecture we're building on:
21if [ -z "$ARCH" ]; then
22  case "$( uname -m )" in
23    i?86) export ARCH=i486 ;;
24    arm*) export ARCH=arm ;;
25    # Unless $ARCH is already set, use uname -m for all other archs:
26       *) export ARCH=$( uname -m ) ;;
27  esac
28fi
29
30if [ "$ARCH" = "i486" ]; then
31  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
32  LIBDIRSUFFIX=""
33  LIB_ARCH=i386
34elif [ "$ARCH" = "i686" ]; then
35  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
36  LIBDIRSUFFIX=""
37  LIB_ARCH=i386
38elif [ "$ARCH" = "x86_64" ]; then
39  SLKCFLAGS="-O2 -fPIC"
40  LIBDIRSUFFIX="64"
41  LIB_ARCH=amd64
42else
43  SLKCFLAGS="-O2"
44  LIBDIRSUFFIX=""
45  LIB_ARCH=$ARCH
46fi
47
48# Where does the OpenJDK SlackBuild expect the GNU java compatibility symlinks:
49JVM=${1:-/usr/lib${LIBDIRSUFFIX}/jvm}
50BINDIR=/usr/bin
51
52# What version of GCC do we have installed:
53GCJVER=$(gcj -dumpversion)
54
55# First, remove the old set of symlinks if they should exist:
56rm -fr $JVM
57
58# Create a JDK compatible directory structure for GNU java:
59mkdir -p $JVM
60mkdir -p $JVM/bin
61mkdir -p $JVM/jre/bin
62mkdir -p $JVM/jre/lib/${LIB_ARCH}/client
63mkdir -p $JVM/jre/lib/${LIB_ARCH}/server
64mkdir -p $JVM/lib
65
66ln -sf $BINDIR/gjar $JVM/bin/jar
67ln -sf $BINDIR/grmic $JVM/bin/rmic
68ln -sf $BINDIR/gjavah $JVM/bin/javah
69ln -sf $BINDIR/jcf-dump $JVM/bin/javap
70ln -sf $BINDIR/gappletviewer $JVM/bin/appletviewer
71ln -sf $BINDIR/grmiregistry $JVM/bin/rmiregistry
72ln -sf $BINDIR/grmiregistry $JVM/jre/bin/rmiregistry
73ln -sf $BINDIR/gkeytool $JVM/bin/keytool
74ln -sf $BINDIR/gkeytool $JVM/jre/bin/keytool
75ln -sf $BINDIR/gij $JVM/bin/java
76ln -sf $BINDIR/ecj $JVM/bin/javac
77ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/client/libjvm.so
78ln -sf /usr/lib/gcj-${GCJVER}-11/libjvm.so $JVM/jre/lib/${LIB_ARCH}/server/libjvm.so
79ln -sf /usr/lib/gcj-${GCJVER}-11/libjawt.so $JVM/jre/lib/${LIB_ARCH}/libjawt.so
80ln -sf /usr/share/java/libgcj-${GCJVER}.jar $JVM/jre/lib/rt.jar
81ln -sf /usr/share/java/libgcj-tools-${GCJVER}.jar $JVM/lib/tools.jar
82ln -sf /usr/include/c++/${GCJVER}/gnu/java $JVM/include
83
84# Add a Eclipse Java Compiler wrapper which is required
85# for bootstrapping OpenJDK using GNU java:
86cat <<EOT > /usr/bin/ecj
87#!/bin/sh
88
89CLASSPATH=/usr/share/java/ecj.jar\${CLASSPATH:+:}\$CLASSPATH \
90  java org.eclipse.jdt.internal.compiler.batch.Main "\$@"
91
92EOT
93chmod 755 /usr/bin/ecj
94
95
Note: See TracBrowser for help on using the repository browser.