aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/cweb.rb
diff options
context:
space:
mode:
authorHannu Hartikainen2014-03-25 22:11:22 +0200
committerMike McQuaid2014-03-26 16:33:37 +0000
commitfd8a1bee26fbb5157f179837eaceba57427b1014 (patch)
tree0a6fa588af952cd8231349e95c3419a9b7e6b103 /Library/Formula/cweb.rb
parentc6ff077882767ed07db9ff035df1dd604be7e252 (diff)
downloadhomebrew-fd8a1bee26fbb5157f179837eaceba57427b1014.tar.bz2
cweb 3.64ad (new formula)
Diffstat (limited to 'Library/Formula/cweb.rb')
-rw-r--r--Library/Formula/cweb.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/Library/Formula/cweb.rb b/Library/Formula/cweb.rb
new file mode 100644
index 000000000..0c50cb353
--- /dev/null
+++ b/Library/Formula/cweb.rb
@@ -0,0 +1,44 @@
+require "formula"
+
+class Cweb < Formula
+ homepage "http://www-cs-faculty.stanford.edu/~uno/cweb.html"
+ url "ftp://ftp.cs.stanford.edu/pub/cweb/cweb-3.64ad.tar.gz"
+ sha1 "a9828b66b525d7cf91c57b3c4891168caa4af10a"
+
+ def install
+ ENV.deparallelize
+
+ macrosdir = (share/"texmf/tex/generic")
+ emacsdir = (share/"emacs/site-lisp")
+ cwebinputs = (lib/"cweb")
+
+ # make install doesn't use `mkdir -p` so this is needed
+ [bin, man1, macrosdir, emacsdir, cwebinputs].each do |path|
+ path.mkpath
+ end
+
+ system "make", "install",
+ "DESTDIR=#{bin}/",
+ "MANDIR=#{man1}",
+ "MANEXT=1",
+ "MACROSDIR=#{macrosdir}",
+ "EMACSDIR=#{emacsdir}",
+ "CWEBINPUTS=#{cwebinputs}"
+ end
+
+ test do
+ (testpath/"test.w").write <<-EOS.undent
+ @* Hello World
+ This is a minimal program written in CWEB.
+
+ @c
+ #include <stdio.h>
+ void main() {
+ printf("Hello world!");
+ }
+ EOS
+ system "ctangle", "test.w"
+ system ENV.cc, "test.c", "-o", "hello"
+ assert_equal "Hello world!", `./hello`
+ end
+end