From: Matthias Braun Date: Fri, 30 Jun 2006 20:48:03 +0000 (+0000) Subject: applied Daniel Hedlunds patch that works around jam commandline limit X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4cff34ef66c22342718c0b6ff59677a11cc6492b;p=supertux.git applied Daniel Hedlunds patch that works around jam commandline limit SVN-Revision: 3813 --- diff --git a/mk/jam/flags.jam b/mk/jam/flags.jam index 13641364c..5c9150c2e 100644 --- a/mk/jam/flags.jam +++ b/mk/jam/flags.jam @@ -48,6 +48,48 @@ rule LinkWith } } +rule LinkWithWholeArchive +{ + local i libs sharedlib ; + + for i in $(>) { + if $($(i)_TYPE) = "library" { + if [ IsElem shared : $($(i)_OPTIONS) ] { + libs += $(i) ; + sharedlib = true ; + } else { + # for non shared libs add inherit the compile flags and libs + libs += $(i) $($(i)_LIBRARIES) ; + # inherit the exported flags + CppFlags $(<) : $($(i)_CPPFLAGS) : $(3) ; + CFlags $(<) : $($(i)_CFLAGS) : $(3) ; + C++Flags $(<) : $($(i)_CXXFLAGS) : $(3) ; + LFlags $(<) : $($(i)_LIBS) : $(3) ; + } + } else { + echo "WARNING: Trying to link" $(i) + "with" $(<) "which is not a library." ; + } + } + # resolve library dependencies + libs = [ RemoveDups $(libs) ] ; + $(<)_LIBRARIES = $(libs) ; + + local libfiles ; + for i in $(libs) { + libfiles += $($(i)_TARGET) ; + } + + DEPENDS $($(<)_TARGET) : $(libfiles) ; + NEEDLIBS_WHOLE on $($(<)_TARGET) += $(libfiles) ; + $(<)_WHOLE_ARCHIVE = true ; + # the usual libtool hack... + if $(sharedlib) { + LINK on $($(<)_TARGET) = "$(LIBTOOL) $(LINK)" ; + INSTALL on $($(<)_INSTALLTARGET) = "$(LIBTOOL) --mode=install $(INSTALL)" ; + } +} + rule CppFlags { CPPFLAGS on $($(<)_OBJECTS) += $(>) ; diff --git a/mk/jam/macosx.jam b/mk/jam/macosx.jam index d865ecae4..5fcb299db 100644 --- a/mk/jam/macosx.jam +++ b/mk/jam/macosx.jam @@ -39,6 +39,12 @@ rule SystemLinkApplication local target = $($(<)_TARGET) ; Depends $(target) : $(>) ; + if $(<)_WHOLE_ARCHIVE + { + WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; + WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + } + LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; Clean clean : $(target) ; @@ -47,9 +53,10 @@ rule SystemLinkApplication # LinkApplicationConsole exe : objects # Link a console (non-GUI) appliation from a set of object files. -actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS { $(MACOSX.ENVIRON) - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ + $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) } diff --git a/mk/jam/unix.jam b/mk/jam/unix.jam index 6a2842359..281b738e2 100644 --- a/mk/jam/unix.jam +++ b/mk/jam/unix.jam @@ -33,6 +33,13 @@ rule SystemLinkApplication local target = $($(<)_TARGET) ; Depends $(target) : $(>) ; + + if $(<)_WHOLE_ARCHIVE + { + WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; + WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + } + LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; # setup clean rules @@ -40,9 +47,9 @@ rule SystemLinkApplication Clean $(<)clean : $(target) ; } -actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS { - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ + $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) } - diff --git a/mk/jam/win32.jam b/mk/jam/win32.jam index 90f69c2f6..fa97e52bd 100644 --- a/mk/jam/win32.jam +++ b/mk/jam/win32.jam @@ -58,6 +58,13 @@ rule SystemLinkApplication local target = $($(<)_TARGET) ; Depends $(target) : $(>) ; + + if $(<)_WHOLE_ARCHIVE + { + WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; + WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + } + LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; # setup clean rules @@ -65,8 +72,9 @@ rule SystemLinkApplication Clean $(<)clean : $(target) ; } -actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS { - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ + $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) } diff --git a/src/Jamfile b/src/Jamfile index 69f7b2621..330588b8d 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -3,23 +3,31 @@ SubDir TOP src ; SubInclude TOP src squirrel ; SubInclude TOP src scripting ; -sources = - [ Wildcard *.cpp *.hpp ] - [ Wildcard audio : *.cpp *.hpp ] - [ Wildcard audio/newapi : *.cpp *.hpp ] - [ Wildcard badguy : *.cpp *.hpp ] - [ Wildcard control : *.cpp *.hpp ] - [ Wildcard gui : *.cpp *.hpp ] - [ Wildcard lisp : *.cpp *.hpp ] - [ Wildcard math : *.cpp *.hpp ] - [ Wildcard object : *.cpp *.hpp ] - [ Wildcard physfs : *.cpp *.hpp ] - [ Wildcard sprite : *.cpp *.hpp ] - [ Wildcard tinygettext : *.cpp *.hpp ] - [ Wildcard trigger : *.cpp *.hpp ] - [ Wildcard video : *.cpp *.hpp ] - [ Wildcard worldmap : *.cpp *.hpp ] -; +#------------------------ +# SuperTux ARCHIVE FILES: +#------------------------ +# the following keeps the .o files after an archive file (.a) is created +NOARUPDATE = true ; + +for i in audio badguy control gui lisp math object physfs sprite + tinygettext trigger video worldmap +{ + sources = [ Wildcard $(i) : *.cpp *.hpp ] ; + Library $(i) : $(sources) : noinstall ; + TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ; +} + +ExternalLibs audio badguy control gui lisp math object physfs sprite + tinygettext trigger video worldmap + : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ; +IncludeDir audio badguy control gui lisp math object physfs sprite + tinygettext trigger video worldmap + : squirrel/include squirrel ; + +#---------------------- +# SuperTux Application: +#---------------------- +sources = [ Wildcard *.cpp *.hpp ] ; TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ; Application supertux : $(sources) $(wrapper_objects) ; @@ -29,3 +37,5 @@ ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSF Help supertux : "Build the supertux executable" ; IncludeDir supertux : squirrel/include squirrel ; +LinkWithWholeArchive supertux : audio badguy control gui lisp math object physfs sprite + tinygettext trigger video worldmap ;