aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2009-07-28 11:02:35 +0800
committerMax Howell2009-07-28 18:47:45 +0800
commit053bb16fb0610afb39efdf7aa5a172c587325dbd (patch)
tree2b9b91c22c6ba088a9bd828582c4ed4739115ba3
parent5b5a3a182688c38511431349b3379010bd40fc3c (diff)
downloadbrew-053bb16fb0610afb39efdf7aa5a172c587325dbd.tar.bz2
Add --cmake option to brew mk to generate a CMAKE skeleton.
Signed-off-by: Max Howell <max@methylblue.com>
-rwxr-xr-xbin/brew32
1 files changed, 28 insertions, 4 deletions
diff --git a/bin/brew b/bin/brew
index 23a938123..3dca0496d 100755
--- a/bin/brew
+++ b/bin/brew
@@ -113,7 +113,7 @@ rescue Exception
raise
end
-def mk url
+def mk url, mode='make'
require 'formula'
path=Pathname.new(url)
@@ -131,9 +131,25 @@ def mk url
f.puts " @homepage=''" # second because you fill in these two first
f.puts " @md5=''"
f.puts
+
+ if mode == "cmake"
+ f.puts " def deps"
+ f.puts " BinaryDep.new 'cmake'"
+ f.puts " end"
+ f.puts
+ end
+
f.puts " def install"
- f.puts " system \"./configure --disable-debug --prefix='\#{prefix}'\""
- f.puts " system \"make install\""
+
+ if mode == "make"
+ f.puts " system \"./configure --disable-debug --prefix='\#{prefix}'\""
+ f.puts " system \"make install\""
+ elsif mode == "cmake"
+ f.puts " system \"cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX=\#{prefix}\""
+ f.puts " system \"make\""
+ f.puts " system \"make install\""
+ end
+
f.puts " end"
f.print "end"
f.close
@@ -218,7 +234,15 @@ begin
puts "Pruned #{prune} symbolic links"
when 'mk', 'make'
- paths=ARGV.collect {|arg| mk arg}
+ mode = "make"
+ if ARGV.length > 0
+ if ARGV[0] == '--cmake'
+ ARGV.shift
+ mode = "cmake"
+ end
+ end
+
+ paths=ARGV.collect {|arg| mk arg, mode}
if paths.empty?
raise "Invalid URL"
elsif Kernel.system "which mate > /dev/null" and $? == 0