changeset 4250:b5d3f276d44b

RT-31513 Script for setting up crosslibs for armv6hf OpenJFX build Use libraries from Raspbian 2013-05-25
author Daniel Blaukopf <daniel.blaukopf@oracle.com>
date Wed, 10 Jul 2013 12:22:38 +0300
parents 4a0f90adb523
children e03ba4c71157
files build.gradle buildSrc/armv6hf.gradle buildSrc/crosslibs/crosslibs-armv6hf.sh buildSrc/crosslibs/pkg-config modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c
diffstat 5 files changed, 276 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Wed Jul 10 11:18:27 2013 +0200
+++ b/build.gradle	Wed Jul 10 12:22:38 2013 +0300
@@ -441,7 +441,7 @@
         // check that all the dirs are really there
         def List<String> errors = []
         packages.each { pkgname->
-            def String basename = pkgname.substring(0,pkgname.indexOf("."))
+            def String basename = pkgname.substring(0,pkgname.lastIndexOf("."))
             def File pkgdir = file("$destdir/$basename")
 
             if (!pkgdir.isDirectory()) {
--- a/buildSrc/armv6hf.gradle	Wed Jul 10 11:18:27 2013 +0200
+++ b/buildSrc/armv6hf.gradle	Wed Jul 10 12:22:38 2013 +0300
@@ -26,12 +26,12 @@
 ext.ARMV6HF = [:]
 
 fetchExternalTools('ARMV6HF', 
-  ["armhf-raspberry-pi-05.tgz", 
+  ["armhf-raspberry-pi-08.tgz",
    "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tgz" ], 
   rootProject.CROSS_TOOLS_DIR, rootProject.IMPORT_CROSS_TOOLS)
 
 // Define the location of the sdk and toolchain
-def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armhf-raspberry-pi-05")
+def sdk=file("${rootProject.CROSS_TOOLS_DIR}/armhf-raspberry-pi-08")
 def compilerHome=file("${rootProject.CROSS_TOOLS_DIR}/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux")
 
 // Declare whether this particular target file applies to the current system
@@ -105,11 +105,13 @@
         "-I$sdk/usr/include",
         "-I$sdk/opt/vc/include",
         "-I$sdk/opt/vc/include/interface/vcos/pthreads",
+        "-I$sdk/opt/vc/include/interface/vmcs_host/linux",
         "-DOMAP3", "-DUSE_DISPMAN"].flatten();
 def extraLFlags = [
         "-I", "-L",
         linkFlags,
         "-L$sdk/lib/arm-linux/gnueabihf",
+        "-L$sdk/usr/lib",
         "-L$sdk/usr/lib/arm-linux-gnueabihf",
         "-L$sdk/opt/vc/lib"].flatten()
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/crosslibs/crosslibs-armv6hf.sh	Wed Jul 10 12:22:38 2013 +0300
@@ -0,0 +1,233 @@
+#!/bin/bash
+
+confirm() {
+    echo -n "Is this correct? [Y/n]: "
+    read -n 1 -r
+    echo
+    if [[ $REPLY == "y" || $REPLY == "Y" || $REPLY == "" ]]; then
+        CONFIRMED=1
+    else
+        CONFIRMED=0
+    fi
+}
+
+checkReinstall() {
+    if [[ -d $1 ]]; then
+        echo
+        echo $1 already exists.
+        echo -n "Delete and re-install? [y/N]: "
+        read -n 1 -r
+        echo
+        if [[ $REPLY == "y" || $REPLY == "Y" ]]; then
+            /bin/rm -rf $1
+        fi
+    fi
+}
+
+# Check whether or not FS points to the root filesystem of a Raspberry Pi
+testFS() {
+    if [[ -d $1/opt/vc/include && -d $1/lib/arm-linux-gnueabihf ]]; then
+        FS_OK=1
+    else
+        FS_OK=0
+    fi
+}
+
+installPiLibs() {
+    cat << EOF
+Run the following command on your Raspberry Pi:
+
+sudo apt-get install \\
+  libatk1.0-dev \\
+  libdirectfb-dev \\
+  libgtk2.0-dev \\
+  libgstreamer0.10-dev \\
+  libgstreamer-plugins-base0.10-dev \\
+  libudev-dev \\
+  libxml2-dev \\
+  libxslt1-dev \\
+  libxtst-dev
+
+Then shutdown your Pi and connect its SD card to this computer.
+Make sure its filesystem is mounted, then press ENTER.
+EOF
+
+    read
+    FS=
+    for filesystem in `mount -t ext4 | cut -f3 -d" "`; do
+        testFS $filesystem
+        if [[ $FS_OK -eq 1 ]]; then
+            FS=$filesystem
+        fi
+    done
+
+    if [[ -z "$FS" ]]; then
+        echo Raspberry Pi filesystem not found.
+    else
+        echo Reading Pi filesystem from $FS
+        confirm()
+        if [[ $CONFIRMED -eq 0 ]]; then
+            FS=
+        fi
+    fi
+
+    while [[ -z "$FS" ]]; do
+        echo -n "Enter the location of the filesystem: "
+        read -e FS
+        testFS $FS
+        if [[ $FS_OK -eq 0 ]]; then
+            echo "'"$FS"'" does not contain a Raspberry Pi root filesystem.
+            FS=
+        fi
+    done
+
+    echo Using $FS as the Raspberry Pi filesystem
+
+    echo Copying files to $PILIBS
+    mkdir -p $PILIBS
+    cd $FS
+    cp --parents -rdt $PILIBS \
+        usr/include/atk-1.0 \
+        usr/include/cairo \
+        usr/include/directfb \
+        usr/include/fontconfig \
+        usr/include/freetype2 \
+        usr/include/gdk-pixbuf-2.0/ \
+        usr/include/gio-unix-2.0/ \
+        usr/include/glib-2.0 \
+        usr/include/gstreamer-0.10 \
+        usr/include/gtk-2.0 \
+        usr/include/libudev.h \
+        usr/include/libpng12 \
+        usr/include/libxml2 \
+        usr/include/libxslt \
+        usr/include/linux \
+        usr/include/pango-1.0 \
+        usr/include/pixman-1 \
+        usr/include/X11 \
+        usr/include/xcb \
+        usr/include/zlib.h \
+        usr/lib/arm-linux-gnueabihf/glib-2.0/include \
+        usr/lib/arm-linux-gnueabihf/gtk-2.0/include \
+        opt/vc/include \
+        \
+        usr/lib/libudev* \
+        usr/lib/arm-linux-gnueabihf/libasound* \
+        usr/lib/arm-linux-gnueabihf/libatk-1.0* \
+        usr/lib/arm-linux-gnueabihf/libcairo* \
+        usr/lib/arm-linux-gnueabihf/libdirect* \
+        usr/lib/arm-linux-gnueabihf/libdirectfb* \
+        usr/lib/arm-linux-gnueabihf/libfontconfig* \
+        usr/lib/arm-linux-gnueabihf/libfreetype* \
+        usr/lib/arm-linux-gnueabihf/libfusion* \
+        usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgio-2.0* \
+        usr/lib/arm-linux-gnueabihf/libGL* \
+        usr/lib/arm-linux-gnueabihf/libglib-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgmodule-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgobject-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgst* \
+        usr/lib/arm-linux-gnueabihf/libgthread-2.0* \
+        usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0* \
+        usr/lib/arm-linux-gnueabihf/libm.* \
+        usr/lib/arm-linux-gnueabihf/libpango-1.0* \
+        usr/lib/arm-linux-gnueabihf/libpangocairo-1.0* \
+        usr/lib/arm-linux-gnueabihf/libpangoft2-1.0* \
+        usr/lib/arm-linux-gnueabihf/libpthread_nonshared.a \
+        usr/lib/arm-linux-gnueabihf/librt* \
+        usr/lib/arm-linux-gnueabihf/librt* \
+        usr/lib/arm-linux-gnueabihf/libX11* \
+        usr/lib/arm-linux-gnueabihf/libXau* \
+        usr/lib/arm-linux-gnueabihf/libxcb* \
+        usr/lib/arm-linux-gnueabihf/libXdmcp* \
+        usr/lib/arm-linux-gnueabihf/libXext* \
+        usr/lib/arm-linux-gnueabihf/libXtst.so* \
+        usr/lib/arm-linux-gnueabihf/libXxf86vm* \
+        usr/lib/arm-linux-gnueabihf/libxml2.so* \
+        usr/lib/arm-linux-gnueabihf/libxslt.so* \
+        usr/lib/arm-linux-gnueabihf/libz* \
+        opt/vc/lib \
+        \
+        usr/lib/pkgconfig \
+        usr/lib/arm-linux-gnueabihf/pkgconfig \
+        usr/share/pkgconfig \
+        lib/arm-linux-gnueabihf/libpthread* \
+        lib/arm-linux-gnueabihf/libudev* \
+        \
+        |& grep -v warning
+
+    testFS $PILIBS
+    if [[ $FS_OK -eq 0 ]]; then
+        echo Copy failed.
+        exit 1
+    fi
+
+    cat > $PILIBS/usr/lib/arm-linux-gnueabihf/libpthread.so << EOF
+OUTPUT_FORMAT(elf32-littlearm)
+GROUP ( ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread_nonshared.a )
+EOF
+    if [[ ! $? -eq 0 ]]; then
+        echo libpthread patch failed.
+        exit 1
+    fi
+
+# Install an alternative pkg-config
+    mkdir -p $PILIBS/bin || exit 1
+    cp $SCRIPTDIR/pkg-config $PILIBS/bin || exit 1
+    chmod +x $PILIBS/bin/pkg-config || exit 1
+
+# Patch package configuration files
+    find $PILIBS/usr -name "*.pc" | xargs sed -i -e "s:=/usr/:=\${prefix}/:"
+    if [[ ! $? -eq 0 ]]; then
+        echo pkg-config patch failed.
+        exit 1
+    fi
+}
+
+installCrossCompiler() {
+    echo
+    echo Fetching and unpacking compiler in $CROSSLIBS
+    echo
+    echo NOTE: if you use a proxy server then this download will probably fail. In that
+    echo case you need to set a value for the environment variable https_proxy and run
+    echo this script again.
+    echo
+    COMPILER_URL=https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2
+    CMD="wget $COMPILER_URL -O - | tar jx -C $CROSSLIBS"
+    echo $CMD
+    echo
+    /bin/sh -c "$CMD"
+}
+
+SCRIPTDIR=`dirname $0`
+SCRIPTDIR=`cd $SCRIPTDIR ; pwd`
+RT=`cd $SCRIPTDIR/../.. ; pwd`
+
+echo Using OpenJFX working directory at $RT
+confirm()
+if [[ $CONFIRMED -eq 0 ]]; then
+    echo -n "Enter the location of the OpenJFX working directory: "
+    read RT
+fi
+
+CROSSLIBS=`dirname $RT`/crosslibs
+echo Using crosslibs directory $CROSSLIBS
+
+mkdir -p $CROSSLIBS || exit 1
+
+PILIBS=$CROSSLIBS/armhf-raspberry-pi-08
+
+checkReinstall $PILIBS
+if [[ ! -d $PILIBS ]]; then
+    installPiLibs
+fi
+
+CROSSCOMPILER=$CROSSLIBS/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux
+checkReinstall $CROSSCOMPILER
+if [[ ! -d $CROSSCOMPILER ]]; then
+    installCrossCompiler
+fi
+
+echo Done.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildSrc/crosslibs/pkg-config	Wed Jul 10 12:22:38 2013 +0300
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+dir=${0%/*}
+if [[ "$dir" == */bin ]]
+then
+   dir=${dir%/bin}
+else
+   dir=${dir}/../
+fi
+
+SYSROOT=`cd ${dir} ; pwd`
+
+if [[ "$dir" == /* ]]
+then
+  SYSROOT=${dir}
+else
+  SYSROOT=${PWD}/${dir}
+fi
+
+export PKG_CONFIG_DIR=
+export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
+
+export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=true
+export PKG_CONFIG_ALLOW_SYSTEM_LIBS=true
+
+export PKG_CONFIG_TOP_BUILD_DIR=${SYSROOT}
+
+version=`pkg-config --version`
+if [[ "$version" > 0.22 ]]
+then
+    export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
+    exec pkg-config $@
+else
+    exec pkg-config \
+   --define-variable=prefix=$SYSROOT/usr \
+   "$@"
+fi
+
--- a/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c	Wed Jul 10 11:18:27 2013 +0200
+++ b/modules/graphics/src/main/native-prism-es2/eglfb/wrapped_egl.c	Wed Jul 10 12:22:38 2013 +0300
@@ -53,11 +53,6 @@
 
 #ifndef BCM_HOST_H
 #include "bcm_host.h"
-typedef struct {
-    DISPMANX_ELEMENT_HANDLE_T element;
-    int width;   /* This is necessary because dispmanx elements are not queriable. */
-    int height;
-} EGL_DISPMANX_WINDOW_T;
 #endif
 
 static void (*wr_bcm_host_init)(void);