summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2014-09-11 17:25:28 -0700
committerKhem Raj <raj.khem@gmail.com>2014-09-11 17:25:28 -0700
commit7d75cff3a28f9635efd6a85af0a374cb41538f58 (patch)
tree228078ef151eb305a8851a4415d13e8e3c4507a4
downloadmeta-clang-7d75cff3a28f9635efd6a85af0a374cb41538f58.tar.gz
Intial commit
Add clang recipes Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--COPYING.MIT17
-rw-r--r--README.md71
-rw-r--r--conf/layer.conf9
-rw-r--r--recipes-devtools/clang/clang.inc58
-rw-r--r--recipes-devtools/clang/clang/disable-xml2-config.patch208
-rw-r--r--recipes-devtools/clang/clang_git.bb33
-rw-r--r--recipes-devtools/clang/llvm-common.bb22
-rw-r--r--recipes-devtools/clang/llvm-common/llvm-config10
8 files changed, 428 insertions, 0 deletions
diff --git a/COPYING.MIT b/COPYING.MIT
new file mode 100644
index 0000000..fb950dc
--- /dev/null
+++ b/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in
9all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8b9961b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,71 @@
1# meta-clang (a C language family frontend and LLVM compiler backend)
2
3This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to your system
4C/C++ compiler for OpenEmbedded based distributions along with gcc
5
6# Getting Started
7
8```shell
9git clone git://github.com/openembedded/openembedded-core.git
10cd openembeeded-core
11git clone git://github.com/openembedded/bitbake.git
12git clone git://github.com/kraj/meta-clang.git
13
14$ . ./oe-init-build-env
15```
16
17Edit conf/bblayers.conf to add meta-musl to layer mix e.g.
18
19```python
20BBLAYERS ?= " \
21 /home/kraj/openembedded-core/meta-clang \
22 /home/kraj/openembedded-core/meta \
23 "
24```
25
26# Building
27
28Below we build for qemuarm machine as an example
29
30```shell
31$ MACHINE=qemuarm bitbake core-image-minimal
32```
33# Running
34
35```shell
36$ runqemu qemuarm
37```
38
39# Limitations
40
41Currently core-image-minimal is buildable/bootable for ARM, x86, x86_64
42based qemu machines
43MACHINE variable and TCLIBC variables can also be set in conf/local.conf to avoid typing it on commandline on any bitbake invocation
44
45
46# Dependencies
47
48```
49URI: git://github.com/openembedded/openembedded-core.git
50branch: master
51revision: HEAD
52
53URI: git://github.com/openembedded/bitbake.git
54branch: master
55revision: HEAD
56```
57
58Send pull requests to openembedded-devel@lists.openembedded.org with '[meta-clang]' in the subject'
59
60When sending single patches, please use something like:
61
62'git send-email -M -1 --to openembedded-devel@lists.openembedded.org --subject-prefix=meta-clang][PATCH'
63
64You are encouraged to fork the mirror on [github](https://github.com/kraj/meta-clang/)
65to share your patches, this is preferred for patch sets consisting of more than
66one patch. Other services like gitorious, repo.or.cz or self hosted setups are
67of course accepted as well, 'git fetch <remote>' works the same on all of them.
68We recommend github because it is free, easy to use, has been proven to be reliable
69and has a really good web GUI.
70
71Layer Maintainer: Khem Raj <raj.khem@gmail.com>
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 0000000..91c6ff0
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,9 @@
1# We have a conf and classes directory, append to BBPATH
2BBPATH .= ":${LAYERDIR}"
3
4# We have a recipes directory, add to BBFILES
5BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
6
7BBFILE_COLLECTIONS += "clang-layer"
8BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/"
9BBFILE_PRIORITY_clang-layer = "7"
diff --git a/recipes-devtools/clang/clang.inc b/recipes-devtools/clang/clang.inc
new file mode 100644
index 0000000..c4b58fc
--- /dev/null
+++ b/recipes-devtools/clang/clang.inc
@@ -0,0 +1,58 @@
1# LLVM does not provide ABI stability between different versions. For this
2# reason OE makes it possible to build and install different llvm versions
3# at the same time.
4#
5# This is true for the normal recipes as well as the native ones.
6#
7# All regular installation directories are prefixed with 'llvm${LLVM_RELEASE}'
8# e.g. "${STAGING_BINDIR}/llvm2.5" or "${STAGING_INCDIR}/llvm2.5"
9#
10# For your program or library that makes use of llvm you do should not need to
11# modify anything as long as it uses the results of various llvm-config
12# invocations. If you need customizations something is wrong and it needs to be
13# fixed (report bug).
14#
15# However the *recipe* for your program/library *must* declare
16# export WANT_LLVM_RELEASE = "<valid version number>"
17# The version number is picked up by a generic wrapper script which just calls
18# the variant of the specified version.
19
20DEPENDS = "libffi libxml2-native llvm-native zlib"
21
22inherit perlnative pythonnative cmake
23
24
25EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI=True \
26 -DLLVM_ENABLE_FFI=False \
27 -DCMAKE_SYSTEM_NAME=Linux \
28 "
29
30EXTRA_OECMAKE_append_class-native = "\
31 -DLLVM_TARGETS_TO_BUILD=host \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DCMAKE_INSTALL_PREFIX=${prefix} \
34 "
35EXTRA_OECMAKE_append_class-target = "\
36 -DCMAKE_CROSSCOMPILING=True \
37"
38EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1"
39
40do_configure() {
41 # Remove RPATHs
42 sed -i 's:$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))::g' ${S}/Makefile.rules
43 # Drop "svn" suffix from version string
44 sed -i 's/${PV}svn/${PV}/g' ${S}/configure
45
46 # Fix paths in llvm-config
47 sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp
48 sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
49 cmake ${S}
50}
51
52do_compile_class-native () {
53 oe_runmake
54}
55
56do_install_class-native () {
57 oe_runmake install DESTDIR=${D}
58}
diff --git a/recipes-devtools/clang/clang/disable-xml2-config.patch b/recipes-devtools/clang/clang/disable-xml2-config.patch
new file mode 100644
index 0000000..13edc56
--- /dev/null
+++ b/recipes-devtools/clang/clang/disable-xml2-config.patch
@@ -0,0 +1,208 @@
1Index: git/autoconf/configure.ac
2===================================================================
3--- git.orig/autoconf/configure.ac 2014-08-26 12:58:29.187543502 -0700
4+++ git/autoconf/configure.ac 2014-08-26 13:18:55.484200981 -0700
5@@ -1560,16 +1560,13 @@
6 dnl Check for libxml2
7 dnl Right now we're just checking for the existence, we could also check for a
8 dnl particular version via --version on xml2-config
9-AC_CHECK_PROGS(XML2CONFIG, xml2-config)
10-
11-AC_MSG_CHECKING(for libxml2 includes)
12-if test "x$XML2CONFIG" = "x"; then
13- AC_MSG_RESULT(xml2-config not found)
14-else
15- LIBXML2_INC=`$XML2CONFIG --cflags`
16- AC_MSG_RESULT($LIBXML2_INC)
17- AC_CHECK_LIB(xml2, xmlReadFile,[AC_DEFINE([CLANG_HAVE_LIBXML],1,[Define if we have libxml2])
18- LIBXML2_LIBS="-lxml2"])
19+PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],,
20+ [AC_MSG_ERROR([Could not find libxml-2.0])]
21+)
22+if test "x$LIBXML2_CFLAGS" != "x"; then
23+ LIBXML2_INC=${LIBXML2_CFLAGS}
24+ LIBXML2_LIBS=${LIBXML2_LIBS}
25+ AC_DEFINE([CLANG_HAVE_LIBXML],1,[Define if we have libxml2])
26 fi
27 AC_SUBST(LIBXML2_LIBS)
28 AC_SUBST(LIBXML2_INC)
29Index: git/configure
30===================================================================
31--- git.orig/configure 2014-08-26 12:58:29.194210168 -0700
32+++ git/configure 2014-08-26 13:19:00.424200963 -0700
33@@ -769,7 +769,6 @@
34 HAVE_TERMINFO
35 USE_OPROFILE
36 USE_INTEL_JITEVENTS
37-XML2CONFIG
38 LIBXML2_LIBS
39 LIBXML2_INC
40 CXXCPP
41@@ -10164,144 +10163,17 @@
42 _ACEOF
43
44
45-for ac_prog in xml2-config
46-do
47- # Extract the first word of "$ac_prog", so it can be a program name with args.
48-set dummy $ac_prog; ac_word=$2
49-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
50-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
51-if test "${ac_cv_prog_XML2CONFIG+set}" = set; then
52- echo $ECHO_N "(cached) $ECHO_C" >&6
53-else
54- if test -n "$XML2CONFIG"; then
55- ac_cv_prog_XML2CONFIG="$XML2CONFIG" # Let the user override the test.
56-else
57-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
58-for as_dir in $PATH
59-do
60- IFS=$as_save_IFS
61- test -z "$as_dir" && as_dir=.
62- for ac_exec_ext in '' $ac_executable_extensions; do
63- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
64- ac_cv_prog_XML2CONFIG="$ac_prog"
65- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
66- break 2
67- fi
68-done
69-done
70-IFS=$as_save_IFS
71-
72-fi
73-fi
74-XML2CONFIG=$ac_cv_prog_XML2CONFIG
75-if test -n "$XML2CONFIG"; then
76- { echo "$as_me:$LINENO: result: $XML2CONFIG" >&5
77-echo "${ECHO_T}$XML2CONFIG" >&6; }
78-else
79- { echo "$as_me:$LINENO: result: no" >&5
80-echo "${ECHO_T}no" >&6; }
81-fi
82-
83-
84- test -n "$XML2CONFIG" && break
85-done
86-
87-
88-{ echo "$as_me:$LINENO: checking for libxml2 includes" >&5
89-echo $ECHO_N "checking for libxml2 includes... $ECHO_C" >&6; }
90-if test "x$XML2CONFIG" = "x"; then
91- { echo "$as_me:$LINENO: result: xml2-config not found" >&5
92-echo "${ECHO_T}xml2-config not found" >&6; }
93-else
94- LIBXML2_INC=`$XML2CONFIG --cflags`
95- { echo "$as_me:$LINENO: result: $LIBXML2_INC" >&5
96-echo "${ECHO_T}$LIBXML2_INC" >&6; }
97- { echo "$as_me:$LINENO: checking for xmlReadFile in -lxml2" >&5
98-echo $ECHO_N "checking for xmlReadFile in -lxml2... $ECHO_C" >&6; }
99-if test "${ac_cv_lib_xml2_xmlReadFile+set}" = set; then
100- echo $ECHO_N "(cached) $ECHO_C" >&6
101-else
102- ac_check_lib_save_LIBS=$LIBS
103-LIBS="-lxml2 $LIBS"
104-cat >conftest.$ac_ext <<_ACEOF
105-/* confdefs.h. */
106-_ACEOF
107-cat confdefs.h >>conftest.$ac_ext
108-cat >>conftest.$ac_ext <<_ACEOF
109-/* end confdefs.h. */
110-
111-/* Override any GCC internal prototype to avoid an error.
112- Use char because int might match the return type of a GCC
113- builtin and then its argument prototype would still apply. */
114-#ifdef __cplusplus
115-extern "C"
116-#endif
117-char xmlReadFile ();
118-int
119-main ()
120-{
121-return xmlReadFile ();
122- ;
123- return 0;
124-}
125-_ACEOF
126-rm -f conftest.$ac_objext conftest$ac_exeext
127-if { (ac_try="$ac_link"
128-case "(($ac_try" in
129- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
130- *) ac_try_echo=$ac_try;;
131-esac
132-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
133- (eval "$ac_link") 2>conftest.er1
134- ac_status=$?
135- grep -v '^ *+' conftest.er1 >conftest.err
136- rm -f conftest.er1
137- cat conftest.err >&5
138- echo "$as_me:$LINENO: \$? = $ac_status" >&5
139- (exit $ac_status); } &&
140- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
141- { (case "(($ac_try" in
142- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
143- *) ac_try_echo=$ac_try;;
144-esac
145-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
146- (eval "$ac_try") 2>&5
147- ac_status=$?
148- echo "$as_me:$LINENO: \$? = $ac_status" >&5
149- (exit $ac_status); }; } &&
150- { ac_try='test -s conftest$ac_exeext'
151- { (case "(($ac_try" in
152- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
153- *) ac_try_echo=$ac_try;;
154-esac
155-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
156- (eval "$ac_try") 2>&5
157- ac_status=$?
158- echo "$as_me:$LINENO: \$? = $ac_status" >&5
159- (exit $ac_status); }; }; then
160- ac_cv_lib_xml2_xmlReadFile=yes
161-else
162- echo "$as_me: failed program was:" >&5
163-sed 's/^/| /' conftest.$ac_ext >&5
164-
165- ac_cv_lib_xml2_xmlReadFile=no
166-fi
167-
168-rm -f core conftest.err conftest.$ac_objext \
169- conftest$ac_exeext conftest.$ac_ext
170-LIBS=$ac_check_lib_save_LIBS
171-fi
172-{ echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlReadFile" >&5
173-echo "${ECHO_T}$ac_cv_lib_xml2_xmlReadFile" >&6; }
174-if test $ac_cv_lib_xml2_xmlReadFile = yes; then
175+PKG_CHECK_MODULES(LIBXML2, libxml-2.0,,
176+ AC_MSG_ERROR([Could not find libxml-2.0])
177+)
178+if test "x$LIBXML2_CFLAGS" != "x"; then
179+ LIBXML2_INC=${LIBXML2_CFLAGS}
180+ LIBXML2_LIBS=${LIBXML2_LIBS}
181
182 cat >>confdefs.h <<\_ACEOF
183 #define CLANG_HAVE_LIBXML 1
184 _ACEOF
185
186- LIBXML2_LIBS="-lxml2"
187-fi
188-
189 fi
190
191
192@@ -19700,7 +19572,6 @@
193 HAVE_TERMINFO!$HAVE_TERMINFO$ac_delim
194 USE_OPROFILE!$USE_OPROFILE$ac_delim
195 USE_INTEL_JITEVENTS!$USE_INTEL_JITEVENTS$ac_delim
196-XML2CONFIG!$XML2CONFIG$ac_delim
197 LIBXML2_LIBS!$LIBXML2_LIBS$ac_delim
198 LIBXML2_INC!$LIBXML2_INC$ac_delim
199 CXXCPP!$CXXCPP$ac_delim
200@@ -19729,7 +19600,7 @@
201 LTLIBOBJS!$LTLIBOBJS$ac_delim
202 _ACEOF
203
204- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
205+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
206 break
207 elif $ac_last_try; then
208 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
new file mode 100644
index 0000000..75120c1
--- /dev/null
+++ b/recipes-devtools/clang/clang_git.bb
@@ -0,0 +1,33 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler"
5HOMEPAGE = "http://clang.llvm.org/"
6LICENSE = "NCSA"
7SECTION = "devel"
8
9require clang.inc
10
11LLVM_RELEASE = "3.5"
12LLVM_DIR = "llvm${LLVM_RELEASE}"
13
14DEPENDS = "zlib libffi libxml2-native llvm-common"
15
16BRANCH ?= "master"
17LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=47e311aa9caedd1b3abf098bd7814d1d; \
18 file://tools/clang/LICENSE.TXT;md5=3954ab76dfb9ce9024cdce4c24268267; \
19 file://projects/compiler-rt/LICENSE.TXT;md5=1ee2b380c3e34d2dd756b922ab4f8b6c; \
20 "
21SRC_URI = "git://github.com/llvm-mirror/llvm.git;branch=${BRANCH};name=llvm \
22 git://github.com/llvm-mirror/clang.git;branch=${BRANCH};destsuffix=git/tools/clang;name=clang \
23 git://github.com/llvm-mirror/compiler-rt.git;branch=${BRANCH};destsuffix=git/projects/compiler-rt;name=compiler-rt \
24 "
25
26SRCREV_llvm = "${AUTOREV}"
27SRCREV_clang = "${AUTOREV}"
28SRCREV_compiler-rt = "${AUTOREV}"
29
30
31S = "${WORKDIR}/git"
32
33BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/clang/llvm-common.bb b/recipes-devtools/clang/llvm-common.bb
new file mode 100644
index 0000000..618cc1e
--- /dev/null
+++ b/recipes-devtools/clang/llvm-common.bb
@@ -0,0 +1,22 @@
1SUMMARY = "Helper script for OE's llvm support"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
4 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
5"
6
7SRC_URI = "file://llvm-config"
8
9ALLOW_EMPTY_${PN} = "1"
10SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_common_sysroot_preprocess"
11
12llvm_common_sysroot_preprocess() {
13 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
14 install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
15}
16
17do_install_class-native() {
18 install -d ${D}${bindir}
19 install -m 0755 ${WORKDIR}/llvm-config ${D}${bindir}
20}
21
22BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/clang/llvm-common/llvm-config b/recipes-devtools/clang/llvm-common/llvm-config
new file mode 100644
index 0000000..a9a416d
--- /dev/null
+++ b/recipes-devtools/clang/llvm-common/llvm-config
@@ -0,0 +1,10 @@
1#!/bin/sh
2# Wrapper script for real llvm-config. Simply calls
3
4if [ $WANT_LLVM_RELEASE ]; then
5 exec `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@}
6else
7 echo "The variable WANT_LLVM_RELEASE is not defined and exported"
8 echo "by your build recipe. Go figure."
9 exit 1
10fi