[Barrelfish-users] Patch to create libraries from other libraries

Zeus Gómez Marmolejo zeus.gomez at bsc.es
Mon Nov 7 14:30:05 CET 2011


Hi all,

I learned a bit of Haskell and extended hake to be able to create libraries
out of other libraries by extracting all object files of them and archive
them on the new one. This is useful for newlib.

I basically changed the ArchDefault rule for archiving a library. You can
see here the main change I did.


zeus.

--- a/hake/ArchDefaults.hs
+++ b/hake/ArchDefaults.hs
@@ -250,14 +250,29 @@ assembler arch compiler opts src obj =
 --
 -- Create a library from a set of object files
 --
-archive :: String -> Options -> [String] -> String -> [ RuleToken ]
-archive arch opts objs libname =
+archive :: String -> Options -> [String] -> [String] -> String -> [
RuleToken ]
+archive arch opts objs libs libname =
     [ Str "rm -f ", Out arch libname ]
     ++
     [ NL, Str "ar cr ", Out arch libname ]
     ++
     [ In BuildTree arch o | o <- objs ]
-    ++
+    ++
+    if libs == [] then []
+                  else (
+      [ NL, Str "rm -fr tmp; mkdir tmp" ]
+      ++
+      [ NL, Str "cd tmp; for i in " ]
+      ++
+      [ In BuildTree arch a | a <- libs ]
+      ++
+      [ Str "; do ar x ../$$i; done" ]
+      ++
+      [ NL, Str "ar q ", Out arch libname, Str " tmp/*.o" ]
+      ++
+      [ NL, Str "rm -fr tmp" ]
+    )
+    ++
     [ NL, Str "ranlib ", Out arch libname ]

 --

-- 
Zeus Gómez Marmolejo
Barcelona Supercomputing Center
PhD student
http://www.bsc.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20111107/5dab6782/attachment.html 


More information about the Barrelfish-users mailing list