[gnome-continuous] Attempt at building LLVM inside Continuous



commit 8bd27c7e84c57e3169b348b58ec45138e766505e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Mar 1 14:51:28 2017 +0000

    Attempt at building LLVM inside Continuous
    
    Various projects are starting to depend on versions of LLVM newer than
    the 3.3 version that we have in our Yocto base.
    
    Yocto is stuck to LLVM 3.3 because after that release LLVM switched to
    CMake and dropped autotools. Finding a modern recipe for building LLVM
    in our Yocto base is a lost cause, since everyone seems to be building
    either Clang or embedded copies of LLVM, these days.

 manifest.json                     |    5 ++
 patches/llvm-cmake-buildapi.patch |  130 +++++++++++++++++++++++++++++++++++++
 2 files changed, 135 insertions(+), 0 deletions(-)
---
diff --git a/manifest.json b/manifest.json
index f06455e..2205a51 100644
--- a/manifest.json
+++ b/manifest.json
@@ -366,6 +366,11 @@
 
                {"src": "fd:xorg/lib/libpciaccess"},
 
+                {"src": "tarball:http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz";,
+                 "name": "llvm",
+                 "checksum": "1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee",
+                 "patches": ["llvm-cmake-buildapi.patch"]},
+
                {"src": "fd-mesa:drm",
                 "config-opts": ["--disable-valgrind"]},
 
diff --git a/patches/llvm-cmake-buildapi.patch b/patches/llvm-cmake-buildapi.patch
new file mode 100644
index 0000000..7493e80
--- /dev/null
+++ b/patches/llvm-cmake-buildapi.patch
@@ -0,0 +1,130 @@
+From c165e7db796a1df227b88967f7811c5698e5ddfd Mon Sep 17 00:00:00 2001
+From: Emmanuele Bassi <ebassi gnome org>
+Date: Wed, 1 Mar 2017 14:47:45 +0000
+Subject: [PATCH] Implement build-api for LLVM
+
+See:
+
+  https://github.com/cgwalters/build-api
+
+This `configure` script calls CMake and generates a dummy Makefile.
+---
+ configure | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 98 insertions(+), 10 deletions(-)
+
+diff --git a/configure b/configure
+index bab3a0d..6555f90 100755
+--- a/configure
++++ b/configure
+@@ -1,10 +1,98 @@
+-#! /bin/sh
+-echo "################################################################################"
+-echo "################################################################################"
+-echo "The LLVM project no longer supports building with configure & make."
+-echo ""
+-echo "Please migrate to the CMake-based build system."
+-echo "For more information see: http://llvm.org/docs/CMake.html";
+-echo "################################################################################"
+-echo "################################################################################"
+-exit 1
++#!/bin/bash
++# configure script adapter for cmake
++# Copyright 2010, 2011, 2013 Colin Walters <walters verbum org>
++# Copyright 2017 Emmanuele Bassi <ebassi gnome org>
++# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
++
++# Little helper function for reading args from the commandline.
++# it automatically handles -a b and -a=b variants, and returns 1 if
++# we need to shift $3.
++read_arg() {
++    # $1 = arg name
++    # $2 = arg value
++    # $3 = arg parameter
++    local rematch='^[^=]*=(.*)$'
++    if [[ $2 =~ $rematch ]]; then
++        read "$1" <<< "${BASH_REMATCH[1]}"
++    else
++        read "$1" <<< "$3"
++        # There is no way to shift our callers args, so
++        # return 1 to indicate they should do it instead.
++        return 1
++    fi
++}
++
++sanitycheck() {
++    # $1 = arg name
++    # $1 = arg command
++    # $2 = arg alternates
++    local cmd=$( which $2 2>/dev/null )
++    if [ -x "$cmd" ]; then
++        read "$1" <<< "$cmd"
++        return 0
++    fi
++    test -z $3 || {
++        for alt in $3; do
++            cmd=$( which $alt 2>/dev/null )
++            if [ -x "$cmd" ]; then
++                read "$1" <<< "$cmd"
++                return 0
++            fi
++        done
++    }
++    echo -e "\e[1;31mERROR\e[0m: Command '$2' not found"
++    exit 1
++}
++
++sanitycheck CMAKE 'cmake'
++sanitycheck NINJA 'ninja' 'ninja-build'
++
++while (($# > 0)); do
++    case "${1%%=*}" in
++        --prefix) read_arg prefix "$@" || shift;;
++        --bindir) read_arg bindir "$@" || shift;;
++        --sbindir) read_arg sbindir "$@" || shift;;
++        --libexecdir) read_arg libexecdir "$@" || shift;;
++        --datarootdir) read_arg datarootdir "$@" || shift;;
++        --datadir) read_arg datadir "$@" || shift;;
++        --sysconfdir) read_arg sysconfdir "$@" || shift;;
++        --libdir) read_arg libdir "$@" || shift;;
++        --mandir) read_arg mandir "$@" || shift;;
++        --includedir) read_arg includedir "$@" || shift;;
++      *) echo "Ignoring unknown option '$1'";;
++    esac
++    shift
++done
++
++srcdir=$(dirname $0)
++
++# Defaults
++test -z ${prefix} && prefix="/usr/local"
++test -z ${bindir} && bindir=${prefix}/bin
++test -z ${sbindir} && sbindir=${prefix}/sbin
++test -z ${libexecdir} && libexecdir=${prefix}/bin
++test -z ${datarootdir} && datarootdir=${prefix}/share
++test -z ${datadir} && datadir=${datarootdir}
++test -z ${sysconfdir} && sysconfdir=${prefix}/etc
++test -z ${libdir} && libdir=${prefix}/lib
++test -z ${mandir} && mandir=${prefix}/share/man
++test -z ${includedir} && includedir=${prefix}/include
++
++cat > Makefile <<END
++# Generated by configure; do not edit
++
++all:
++      CC=\$(CC) CXX=\$(CXX) ${NINJA}
++
++install:
++      DESTDIR="\$(DESTDIR)" ${NINJA} install
++END
++
++
++exec ${CMAKE} \
++     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
++     -DLLVM_TOOLS_BINARY_DIR:PATH=${bindir} \
++     -DLLVM_MAIN_INCLUDE_DIR:PATH=${includedir} \
++     -DLLVM_LIBRARY_DIR:PATH=${libdir} \
++     -GNinja \
++     ${srcdir}
+-- 
+2.9.3
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]