Skip to content

Commit f52254c

Browse files
committed
Add support for leJOS JDK bundling
1 parent c67770f commit f52254c

File tree

5 files changed

+91
-1
lines changed

5 files changed

+91
-1
lines changed

scripts/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ev3dev-lang-java:jdk-stretch
22

33
# copy build patches & scripts
44
COPY *.patch *.sh /opt/jdkcross/
5-
RUN chmod +x /opt/jdkcross/*.sh
5+
COPY lejos/ /opt/jdkcross/lejos/
6+
RUN chmod +x /opt/jdkcross/*.sh /opt/jdkcross/lejos/*.sh
67

78
# this directory should be mounted
89
VOLUME /build

scripts/config.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ BUILDDIR="/build"
88
JDKDIR="/build/jdk"
99
# output images directory
1010
IMAGEDIR="/build/jdk/build/linux-arm-normal-client-release/images"
11+
# lejos temp directory
12+
LEJOSDIR="/build/lejos"
1113

1214
##
1315
## Version-specific configuration
@@ -45,6 +47,8 @@ IMAGEDIR="/build/jdk/build/linux-arm-normal-client-release/images"
4547
# Download URL
4648
#HOSTJDK_URL="https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz"
4749

50+
# leJOS JRI name
51+
#LEJOS_NAME=openjdk9-jri
4852

4953
# OpenJDK 9
5054
if [ "$JDKVER" -eq "9" ]; then
@@ -55,6 +59,7 @@ if [ "$JDKVER" -eq "9" ]; then
5559
HOSTJDK="$BUILDDIR/jdk-9.0.4"
5660
HOSTJDK_FILE="$BUILDDIR/openjdk-9.0.4_linux-x64_bin.tar.gz"
5761
HOSTJDK_URL="https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz"
62+
LEJOS_NAME=openjdk9-jri
5863

5964
# OpenJDK 10
6065
elif [ "$JDKVER" -eq "10" ]; then
@@ -65,6 +70,7 @@ elif [ "$JDKVER" -eq "10" ]; then
6570
HOSTJDK="$BUILDDIR/jdk-10"
6671
HOSTJDK_FILE="$BUILDDIR/openjdk-10_linux-x64_bin.tar.gz"
6772
HOSTJDK_URL="https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz"
73+
LEJOS_NAME=openjdk10-jri
6874

6975
# invalid or unset version
7076
else

scripts/lejos/build.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e
3+
4+
cd "$(dirname ${BASH_SOURCE[0]})"
5+
source ../config.sh
6+
SCRIPTDIR="$SCRIPTDIR/.."
7+
8+
# temp directory
9+
rm -rf "$LEJOSDIR"
10+
mkdir -p "$LEJOSDIR/deb" "$LEJOSDIR/root"
11+
12+
echo "copy in JRI"
13+
cp -rf --preserve=links "$IMAGEDIR/jri-ev3" "$LEJOSDIR/jri"
14+
15+
echo "download DEB packages"
16+
cd "$LEJOSDIR/deb"
17+
apt-get download `cat "$SCRIPTDIR/lejos/pkgs.txt"`
18+
19+
echo "extract them"
20+
find . -type f -exec dpkg-deb -x {} ../root \;
21+
22+
echo "remove unnecessary stuff"
23+
cd "$LEJOSDIR/root"
24+
rm -rf ./bin ./sbin ./etc ./usr/bin ./usr/sbin ./usr/share
25+
26+
echo "move root to jri"
27+
mv "$LEJOSDIR/root" "$LEJOSDIR/jri/sysroot"
28+
29+
echo "install dynamic linking wrappers"
30+
cd "$LEJOSDIR/jri/bin"
31+
32+
for exe in `ls`; do
33+
mv "$exe" "$exe.real"
34+
ln -s "wrapper.sh" "$exe"
35+
done
36+
37+
cp "$SCRIPTDIR/lejos/wrapper.sh" .
38+
39+
echo "cleanup"
40+
rm -rf "$LEJOSDIR/deb"
41+
42+
echo "create archive"
43+
cd "$LEJOSDIR"
44+
mv "jri" "$LEJOS_NAME"
45+
tar -cf - "$LEJOS_NAME" | pigz -9 > "$BUILDDIR/lejos-$LEJOS_NAME.tar.gz"

scripts/lejos/pkgs.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
gcc-6-base:armel
2+
libasound2-data
3+
libasound2:armel
4+
libavahi-client3:armel
5+
libavahi-common-data:armel
6+
libavahi-common3:armel
7+
libc-bin:armel
8+
libc6:armel
9+
libcomerr2:armel
10+
libcups2:armel
11+
libdbus-1-3:armel
12+
libffi6:armel
13+
libgcc1:armel
14+
libgmp10:armel
15+
libgnutls30:armel
16+
libgssapi-krb5-2:armel
17+
libhogweed4:armel
18+
libidn11:armel
19+
libk5crypto3:armel
20+
libkeyutils1:armel
21+
libkrb5-3:armel
22+
libkrb5support0:armel
23+
libnettle6:armel
24+
libp11-kit0:armel
25+
libpng16-16:armel
26+
libsystemd0:armel
27+
libtasn1-6:armel
28+
zlib1g:armel
29+
libexpat1:armel
30+
libfreetype6:armel

scripts/lejos/wrapper.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
DIR=`dirname "$0"`
3+
DIR=`eval "cd \"$DIR\" && pwd"`
4+
SYSDIR="$DIR/../sysroot"
5+
SYSDIR=`eval "cd \"$SYSDIR\" && pwd"`
6+
7+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SYSDIR/lib:$SYSDIR/lib/arm-linux-gnueabi:$SYSDIR/usr/lib:$SYSDIR/usr/lib/arm-linux-gnueabi:$SYSDIR/usr/lib/arm-linux-gnueabi/gconv"
8+
exec "$SYSDIR/lib/ld-linux.so.3" "$DIR/$0.real" "$@"

0 commit comments

Comments
 (0)