libebml: don't rely on make -e, obey LDFLAGS

We need to obey LDFLAGS to get the correct hash style for external toolchains,
and passing vars explicitly is better than relying on implicitly overriding
everything blindly from the environment.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
(cherry picked from commit 64d874f768)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Christopher Larson 2016-06-17 13:34:49 -07:00 committed by Armin Kuster
parent 2be8e0fe2f
commit 9ecd1e0e13
3 changed files with 138 additions and 5 deletions

View File

@ -0,0 +1,57 @@
Use LD and obey LDFLAGS
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Upstream-Status: Pending
diff --git a/make/linux/Makefile b/make/linux/Makefile
index 391b6e3..a2ac13e 100644
--- a/make/linux/Makefile
+++ b/make/linux/Makefile
@@ -64,6 +64,7 @@ objects_so:=$(patsubst %$(EXTENSION),%.lo,$(sources))
WARNINGFLAGS=-Wall -Wextra -Wno-unknown-pragmas -ansi -fno-gnu-keywords -Wshadow
COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
DEPENDFLAGS = $(CXXFLAGS) $(INCLUDE)
+LINKFLAGS=$(LDFLAGS)
ifeq (Darwin,$(shell uname -s))
all: staticlib
@@ -91,7 +92,7 @@ $(LIBRARY): $(objects)
$(RANLIB) $@
$(LIBRARY_SO): $(objects_so)
- $(CXX) -shared -Wl,-soname,$(LIBRARY_SO_VER) -o $(LIBRARY_SO_VER) $(objects_so)
+ $(LD) $(LINKFLAGS) -shared -Wl,-soname,$(LIBRARY_SO_VER) -o $(LIBRARY_SO_VER) $(objects_so)
rm -f $(LIBRARY_SO)
ln -s $(LIBRARY_SO_VER) $(LIBRARY_SO)
diff --git a/make/mingw32/Makefile b/make/mingw32/Makefile
index e5986ef..6ca16aa 100644
--- a/make/mingw32/Makefile
+++ b/make/mingw32/Makefile
@@ -18,6 +18,7 @@ DEBUGFLAGS=-g -DDEBUG
endif
CROSS =
CXX = $(CROSS)g++
+LD = $(CXX)
CC = $(CROSS)gcc
WINDRES = $(CROSS)windres
RANLIB = $(CROSS)ranlib
@@ -33,6 +34,7 @@ LIBS = libebml.a
endif
INCS = -I"$(shell pwd)/../.."
COMPILEFLAGS = $(DEBUGFLAGS) $(INCS) $(DLLFLAGS) $(CXXFLAGS)
+LINKFLAGS = $(LDFLAGS)
.PHONY: all all-before all-after clean clean-custom
@@ -54,7 +56,7 @@ libebml.a: $(OBJ)
$(RANLIB) $@
libebml.dll: $(OBJ)
- $(CXX) -shared -Wl,--export-all -Wl,--out-implib=$@.a -o $@ $(OBJ)
+ $(LD) $(LINKFLAGS) -shared -Wl,--export-all -Wl,--out-implib=$@.a -o $@ $(OBJ)
depend:
@echo Calculating dependecies:
--
2.8.0

View File

@ -0,0 +1,42 @@
Allow override of the 'uname -s' for cross-compilation
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Upstream-Status: Pending
diff --git a/make/linux/Makefile b/make/linux/Makefile
index a2ac13e..4188bee 100644
--- a/make/linux/Makefile
+++ b/make/linux/Makefile
@@ -9,9 +9,11 @@
# 'make DEBUG=yes'.
#
+TARGET_OS ?= $(shell uname -s)
+
# Paths
# BeOS wants the libs and headers in /boot/home/config
-ifeq (BeOS,$(shell uname -s))
+ifeq (BeOS,$(TARGET_OS))
prefix=/boot/home/config
else
prefix=/usr/local
@@ -66,7 +68,7 @@ COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
DEPENDFLAGS = $(CXXFLAGS) $(INCLUDE)
LINKFLAGS=$(LDFLAGS)
-ifeq (Darwin,$(shell uname -s))
+ifeq (Darwin,$(TARGET_OS))
all: staticlib
else
all: staticlib sharedlib
@@ -116,7 +118,7 @@ depend:
$(CXX) $(DEPENDFLAGS) -MM -MT $$o $$i >> .depend ; \
done
-ifeq (Darwin,$(shell uname -s))
+ifeq (Darwin,$(TARGET_OS))
install: install_staticlib install_headers
else
install: install_staticlib install_sharedlib install_headers
--
2.8.0

View File

@ -2,15 +2,49 @@ SUMMARY = "libebml is a C++ libary to parse EBML files"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=f14599a2f089f6ff8c97e2baa4e3d575"
SRC_URI = "http://dl.matroska.org/downloads/libebml/libebml-${PV}.tar.bz2"
SRC_URI = "\
http://dl.matroska.org/downloads/libebml/libebml-${PV}.tar.bz2 \
file://ldflags.patch \
file://override-uname.patch \
"
SRC_URI[md5sum] = "efec729bf5a51e649e1d9d1f61c0ae7a"
SRC_URI[sha256sum] = "83b074d6b62715aa0080406ea84d33df2e44b5d874096640233a4db49b8096de"
EXTRA_OEMAKE = "-e MAKEFLAGS="
do_unpack[postfuncs] += "dos2unix"
do_compile() {
cd ${S}/make/linux
oe_runmake CROSS="${TARGET_PREFIX}"
dos2unix () {
cr="$(printf '\r')"
for f in make/*/Makefile; do
tr -d "$cr" <"$f" >"$f.new" && \
mv "$f.new" "$f"
done
}
LIBEBML_OS = "Unknown"
LIBEBML_OS_linux = "Linux"
LIBEBML_OS_darwin = "Darwin"
LIBEBML_OS_mingw32 = "Windows"
EXTRA_OEMAKE = "\
'TARGET_OS=${LIBEBML_OS}' \
\
'CXX=${CXX}' \
'LD=${CXX}' \
'AR=${AR}' \
'RANLIB=${RANLIB}' \
\
'DEBUGFLAGS=' \
'CPPFLAGS=${CPPFLAGS}' \
'CXXFLAGS=${CXXFLAGS}' \
'LDFLAGS=${LDFLAGS}' \
\
'prefix=${prefix}' \
'libdir=${libdir}' \
'includedir=${includedir}/ebml' \
"
do_compile () {
oe_runmake -C make/linux
}
do_install() {