summary refs log tree commit diff
path: root/pkgs/development/compilers/jdk/dlj-bundle-builder.sh
blob: 74772222b19e7a347a985596e3ab01a5080146f4 (plain) (blame)
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
source $stdenv/setup

echo "Unpacking distribution"
unzip ${src} || true

# set the dynamic linker of unpack200, necessary for construct script
echo "patching unpack200"
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" --set-rpath "" */bin/unpack200 || fail

echo "constructing JDK and JRE installations"
if test -z "$installjdk"; then
  sh ${construct} . tmp-linux-jdk tmp-linux-jre
  ensureDir $out
  cp -R tmp-linux-jre/* $out
else
  sh ${construct} . $out tmp-linux-jre
fi

echo "removing files at top level of installation"
for file in $out/*
do
  if test -f $file ; then
    rm $file
  fi
done
rm -rf $out/docs

# construct the rpath
rpath=
for i in $libraries; do
    rpath=$rpath${rpath:+:}$i/lib
done

if test -z "$installjdk"; then
  rpath=$rpath${rpath:+:}$out/lib/$architecture/jli
else
  rpath=$rpath${rpath:+:}$out/jre/lib/$architecture/jli
fi

# set all the dynamic linkers
find $out -type f -perm +100 \
    -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
    --set-rpath "$rpath" {} \;

function mozillaExtraLibPath() {
  p=$1
  if test -e "$p"; then
    echo "$libstdcpp5/lib" > $p/extra-library-path
  fi
}

if test -z "$pluginSupport"; then
  rm $out/bin/javaws
else
  source $makeWrapper

  mv $out/bin/javaws $out/bin/javaws.bin
  makeWrapper "$out/bin/javaws.bin" "$out/bin/javaws" \
    --suffix-each LD_LIBRARY_PATH ':' "$(addSuffix /lib $libPath)"

  mozillaExtraLibPath "$out/jre/plugin/i386/ns7"
  mozillaExtraLibPath "$out/plugin/i386/ns7"
fi

# Workaround for assertions in xlib, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6532373.
substituteInPlace $out/jre/lib/i386/xawt/libmawt.so --replace XINERAMA FAKEEXTN