xbmc: add PR2712

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-05-09 14:56:47 +02:00
parent a62414cf62
commit fd66456d08

View File

@ -0,0 +1,77 @@
From 101fbc2d6869d6f02c4345a232854dbbb3f1a855 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Thu, 2 May 2013 16:45:41 -0400
Subject: [PATCH] build: stop using whole-archive for our final binary
This nasty hack has been around for ages. By changing, we get the following
benefits:
- We don't link in _every_ object in _every_ archive!
- Builds will no longer fail if a source file has been removed but its object
still exists in the archive
- Filesize reduction
- Ability to use lto, garbage collection, dead-code stripping, etc in a
useful manner
This is achieved by specifying a main object on the link line, and using
start-group/end-group to search through the archives multiple times until each
symbol is found.
---
Makefile.in | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 3cbe1a2..f0827f2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,6 +92,9 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \
xbmc/windows/windows.a \
xbmc/xbmc.a \
+ifneq (@USE_LIBXBMC@,1)
+DIRECTORY_ARCHIVES +=xbmc/main/main.a
+endif
NWAOBJSXBMC= xbmc/threads/threads.a \
xbmc/commons/commons.a
@@ -425,24 +428,29 @@ endif
OBJSXBMC:=$(filter-out $(DYNOBJSXBMC), $(OBJSXBMC))
-libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC)
+MAINOBJS=xbmc/xbmc.o
+ifeq (@USE_ANDROID@,1)
+MAINOBJS+=xbmc/android/activity/android_main.o
+endif
+ifneq (@USE_LIBXBMC@,1)
+MAINOBJS+=xbmc/main/main.o
+endif
+
+libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS)
ifeq ($(findstring osx,@ARCH@), osx)
$(SILENT_LD) $(CXX) $(LDFLAGS) -bundle -o $@ -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS)
else
- $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS)
+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS)
endif
-xbmc.bin: xbmc/main/main.a $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC)
+xbmc.bin: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS)
ifeq ($(findstring osx,@ARCH@), osx)
- $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a $(LIBS) -rdynamic
+ $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) -rdynamic
else
- $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a -Wl,--no-whole-archive $(NWAOBJSXBMC) $(LIBS) -rdynamic
+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group $(NWAOBJSXBMC) $(LIBS) -rdynamic
endif
-xbmc/main/main.a: force
- $(MAKE) -C xbmc/main
-
xbmc-xrandr: xbmc-xrandr.c
ifneq (1,@USE_XRANDR@)
# xbmc-xrandr.c gets picked up by the default make rules
--
1.8.1.6