applied farnkerls patch to handle the jam commandline limitation problems
[supertux.git] / mk / jam / macosx.jam
index b5025eb..9979bbd 100644 (file)
@@ -1,18 +1,19 @@
 #============================================================================
 # Jam configuration and actions for MacOS/X
 # Copyright (C) 2003 by Eric Sunshine <sunshine@sunshineco.com>
+# Copyright (C) 2006 by Ondrej Hosek <ondra.hosek@gmail.com>
 #============================================================================
 SHELL ?= "/bin/sh" ;
 DEEPCOPY ?= "cp -R" ;
 
 # Experience seems to indicate that library scanning misbehaves on MacOS/X with
 # Jam 2.4, consequently we disable it.
-AR = "ar ru" ;
+MACLIBTOOL = "libtool" ;
 NOARUPDATE = true ;
 NOARSCAN = true ;
 actions Archive
 {
-  $(AR) $(<) $(>)
+  $(MACLIBTOOL) -static -o $(<) $(>)
 }
 
 #------------------------------------------------------------------------------
@@ -37,8 +38,20 @@ rule SystemLinkApplication
 {
   local target = $($(<)_TARGET) ;
   Depends $(target) : $(>) ;
-    
-  LinkApplication $(target) : $(>) ;
+
+  if [ IsElem linkerfile : $(3) ]
+  {
+    RemoveLinkerInputFile $(target) ;
+    local i ;
+    for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; }
+    LinkApplicationFromFile $(target) : $(target) ;
+    RemoveLinkerInputFile $(target) ;
+  }
+  else
+  {
+    LinkApplication $(target) : $(>) ;
+  }
+
   LIBS on $(target) = $(LIBS) ;
   Clean clean : $(target) ;
   Clean $(<)clean : $(target) ;
@@ -52,3 +65,20 @@ 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
+{
+  $(MACOSX.ENVIRON)
+  $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+#  $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+}
+