summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-09-06 20:57:55 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2017-09-18 10:16:12 +0200
commita3e6631543caefb1ca200b6b3652924b92ba3875 (patch)
treed76ab91244b00cec01d68762ba8cec1325011897
parent4a45235796df0ca1b3bca5407b9615281cf8889d (diff)
downloadmeta-openembedded-a3e6631543caefb1ca200b6b3652924b92ba3875.tar.gz
leveldb: Fix build with clang
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch36
-rw-r--r--meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch43
-rw-r--r--meta-oe/recipes-extended/leveldb/leveldb_git.bb4
3 files changed, 82 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch
new file mode 100644
index 000000000..bbabf688d
--- /dev/null
+++ b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch
@@ -0,0 +1,36 @@
1From 5fd0918df2bb30e8f3edb2ee895d178edbf26f40 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 4 Sep 2017 22:38:03 -0700
4Subject: [PATCH 1/2] build_detect_platform: Check for __SSE4_2__
5
6just using -msse4.2 is not enough, especially with clang
7where it may accept -msse4.2 even during cross compiling
8for say arm, however the difference is that builtin defines
9wont be defined.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13Upstream-Status: Pending
14
15 build_detect_platform | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18Index: git/build_detect_platform
19===================================================================
20--- git.orig/build_detect_platform
21+++ git/build_detect_platform
22@@ -230,13 +230,12 @@ EOF
23 rm -f $CXXOUTPUT 2>/dev/null
24
25 # Test if gcc SSE 4.2 is supported
26- $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -msse4.2 2>/dev/null <<EOF
27+ $CXX $CXXFLAGS -Werror -x c++ - -o $CXXOUTPUT -msse4.2 -dD -E 2>/dev/null | fgrep __SSE4_2__ $CXXOUTPUT 2>/dev/null <<EOF
28 int main() {}
29 EOF
30 if [ "$?" = 0 ]; then
31 PLATFORM_SSEFLAGS="-msse4.2"
32 fi
33-
34 rm -f $CXXOUTPUT 2>/dev/null
35 fi
36
diff --git a/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch b/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch
new file mode 100644
index 000000000..fc708b23a
--- /dev/null
+++ b/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch
@@ -0,0 +1,43 @@
1From 1ed8cec1fcf666904bb3ebd29fc85e235b72d122 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 4 Sep 2017 22:40:49 -0700
4Subject: [PATCH 2/2] makefile: build SHARED_MEMENVLIB
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 Makefile | 6 +++---
11 1 file changed, 3 insertions(+), 3 deletions(-)
12
13diff --git a/Makefile b/Makefile
14index f7cc7d7..cb42278 100644
15--- a/Makefile
16+++ b/Makefile
17@@ -126,12 +126,12 @@ SHARED_VERSION_MINOR = 20
18 SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
19 SHARED_LIB2 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR)
20 SHARED_LIB3 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
21-SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3)
22+SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3) $(SHARED_MEMENVLIB)
23 $(SHARED_OUTDIR)/$(SHARED_LIB1): $(SHARED_OUTDIR)/$(SHARED_LIB3)
24 ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB1)
25 $(SHARED_OUTDIR)/$(SHARED_LIB2): $(SHARED_OUTDIR)/$(SHARED_LIB3)
26 ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB2)
27-SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
28+SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.$(PLATFORM_SHARED_EXT).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
29 endif
30
31 $(SHARED_OUTDIR)/$(SHARED_LIB3): $(SHARED_LIBOBJECTS)
32@@ -294,7 +294,7 @@ endif
33
34 $(SHARED_MEMENVLIB):$(SHARED_MEMENVOBJECTS)
35 rm -f $@
36- $(AR) -rs $@ $(SHARED_MEMENVOBJECTS)
37+ $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(basename $(notdir $(SHARED_MEMENVLIB))) $(SHARED_MEMENVOBJECTS) -o $(SHARED_MEMENVLIB) $(LIBS)
38
39 $(STATIC_OUTDIR)/db_bench:db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL)
40 $(CXX) $(LDFLAGS) $(CXXFLAGS) db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
41--
422.14.1
43
diff --git a/meta-oe/recipes-extended/leveldb/leveldb_git.bb b/meta-oe/recipes-extended/leveldb/leveldb_git.bb
index d44aa14d2..dfe4b459a 100644
--- a/meta-oe/recipes-extended/leveldb/leveldb_git.bb
+++ b/meta-oe/recipes-extended/leveldb/leveldb_git.bb
@@ -8,7 +8,9 @@ SRCREV = "a53934a3ae1244679f812d998a4f16f2c7f309a6"
8PV = "1.20+git${SRCPV}" 8PV = "1.20+git${SRCPV}"
9 9
10SRC_URI = "git://github.com/google/${BPN}.git \ 10SRC_URI = "git://github.com/google/${BPN}.git \
11" 11 file://0001-build_detect_platform-Check-for-__SSE4_2__.patch \
12 file://0002-makefile-build-SHARED_MEMENVLIB.patch \
13 "
12 14
13S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
14 16