From: Matthias Braun Date: Thu, 6 Jul 2006 21:59:52 +0000 (+0000) Subject: applied farnkerls patch to handle the jam commandline limitation problems X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=902c56177611c46af0dc44d946bc73a198a03c9d;p=supertux.git applied farnkerls patch to handle the jam commandline limitation problems SVN-Revision: 3923 --- diff --git a/mk/jam/application.jam b/mk/jam/application.jam index eea390757..e307bc9bd 100644 --- a/mk/jam/application.jam +++ b/mk/jam/application.jam @@ -22,10 +22,12 @@ ## noinstall: Don't setup a default installation target. ## independent: The target will not be made a dependency of the apps and ## all target. +## linkerfile: Store a list of objects in a file and link using that +## file. Use this to get around Jam's 10240 character argument limit. rule Application { # check options - CheckOptions noinstall console independent : $(3) : $(<) ; + CheckOptions noinstall console independent linkerfile : $(3) : $(<) ; local target = [ ConstructApplicationTarget $(<) : $(3) ] ; local sources = [ SearchSource $(>) ] ; diff --git a/mk/jam/flags.jam b/mk/jam/flags.jam index 5c9150c2e..13641364c 100644 --- a/mk/jam/flags.jam +++ b/mk/jam/flags.jam @@ -48,48 +48,6 @@ 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 5fcb299db..9979bbd37 100644 --- a/mk/jam/macosx.jam +++ b/mk/jam/macosx.jam @@ -38,14 +38,20 @@ rule SystemLinkApplication { local target = $($(<)_TARGET) ; Depends $(target) : $(>) ; - - if $(<)_WHOLE_ARCHIVE + + if [ IsElem linkerfile : $(3) ] + { + RemoveLinkerInputFile $(target) ; + local i ; + for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; } + LinkApplicationFromFile $(target) : $(target) ; + RemoveLinkerInputFile $(target) ; + } + else { - WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; - WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + LinkApplication $(target) : $(>) ; } - LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; Clean clean : $(target) ; Clean $(<)clean : $(target) ; @@ -53,10 +59,26 @@ rule SystemLinkApplication # LinkApplicationConsole exe : objects # Link a console (non-GUI) appliation from a set of object files. -actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +{ + $(MACOSX.ENVIRON) + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +} + +actions quietly RemoveLinkerInputFile +{ + $(RM) $(<).opt +} + +actions quietly together piecemeal AppendLinkerInputFile +{ + echo $(>) >> $(<).opt +} + +actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS { $(MACOSX.ENVIRON) - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ - $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) + $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) } diff --git a/mk/jam/unix.jam b/mk/jam/unix.jam index 281b738e2..5ee1aa946 100644 --- a/mk/jam/unix.jam +++ b/mk/jam/unix.jam @@ -30,26 +30,50 @@ rule ConstructPluginTarget # correct clean targets. rule SystemLinkApplication { + # check options + CheckOptions linkerfile : $(3) : $(<) ; + local target = $($(<)_TARGET) ; Depends $(target) : $(>) ; - if $(<)_WHOLE_ARCHIVE + if [ IsElem linkerfile : $(3) ] + { + RemoveLinkerInputFile $(target) ; + local i ; + for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; } + LinkApplicationFromFile $(target) : $(target) ; + RemoveLinkerInputFile $(target) ; + } + else { - WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; - WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + LinkApplication $(target) : $(>) ; } - LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; # setup clean rules Clean clean : $(target) ; Clean $(<)clean : $(target) ; } -actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +{ + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +} + +actions quietly RemoveLinkerInputFile +{ + $(RM) $(<).opt +} + +actions quietly together piecemeal AppendLinkerInputFile +{ + echo $(>) >> $(<).opt +} + +actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS { - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ - $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) + $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) } diff --git a/mk/jam/win32.jam b/mk/jam/win32.jam index fa97e52bd..a51400a05 100644 --- a/mk/jam/win32.jam +++ b/mk/jam/win32.jam @@ -59,22 +59,43 @@ rule SystemLinkApplication Depends $(target) : $(>) ; - if $(<)_WHOLE_ARCHIVE + if [ IsElem linkerfile : $(3) ] { - WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ; - WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ; + RemoveLinkerInputFile $(target) ; + local i ; + for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; } + LinkApplicationFromFile $(target) : $(target) ; + RemoveLinkerInputFile $(target) ; + } + else + { + LinkApplication $(target) : $(>) ; } - LinkApplication $(target) : $(>) ; LIBS on $(target) = $(LIBS) ; # setup clean rules Clean clean : $(target) ; Clean $(<)clean : $(target) ; } -actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS +actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS +{ + $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +} + +actions quietly RemoveLinkerInputFile +{ + $(RM) $(<).opt +} + +actions quietly together piecemeal AppendLinkerInputFile +{ + echo $(>) >> $(<).opt +} + +actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS { - $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \ - $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS) + $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) +# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS) } diff --git a/src/Jamfile b/src/Jamfile index 330588b8d..c401c98b5 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -3,39 +3,30 @@ SubDir TOP src ; SubInclude TOP src squirrel ; SubInclude TOP src scripting ; -#------------------------ -# 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 ] ; +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 ] +; TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ; -Application supertux : $(sources) $(wrapper_objects) ; +#Application supertux : $(sources) $(wrapper_objects) ; +Application supertux : $(sources) $(wrapper_objects) : linkerfile ; C++Flags supertux : -DAPPDATADIR='\"$(appdatadir)\"' ; LinkWith supertux : squirrel ; ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ; 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 ;