2012-10-04 12:38:33 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Libsass < Formula
|
|
|
|
homepage 'https://github.com/hcatlin/libsass'
|
2013-12-20 20:07:10 +00:00
|
|
|
url 'https://github.com/hcatlin/libsass/archive/v1.0.1.tar.gz'
|
|
|
|
sha1 '9524e028bc8ebe84e36895269d07ecc7db496c7c'
|
|
|
|
|
|
|
|
depends_on :autoconf
|
|
|
|
depends_on :automake
|
|
|
|
depends_on :libtool
|
2012-10-04 12:38:33 +00:00
|
|
|
|
|
|
|
def install
|
2013-12-20 20:07:10 +00:00
|
|
|
system "autoreconf -i"
|
2012-10-04 12:38:33 +00:00
|
|
|
system "./configure", "--prefix=#{prefix}"
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
2013-02-02 05:12:42 +00:00
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
|
|
#include <sass_interface.h>
|
|
|
|
#include <string.h>
|
2012-10-04 12:38:33 +00:00
|
|
|
|
2013-02-02 05:12:42 +00:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
struct sass_context* sass_ctx = sass_new_context();
|
2013-12-20 20:07:10 +00:00
|
|
|
struct sass_options options;
|
|
|
|
options.output_style = SASS_STYLE_NESTED;
|
|
|
|
options.source_comments = 0;
|
|
|
|
options.image_path = "images";
|
|
|
|
options.include_paths = "";
|
2013-02-02 05:12:42 +00:00
|
|
|
sass_ctx->source_string = "a { color:blue; &:hover { color:red; } }";
|
2013-12-20 20:07:10 +00:00
|
|
|
sass_ctx->options = options;
|
2013-02-02 05:12:42 +00:00
|
|
|
sass_compile(sass_ctx);
|
|
|
|
if(sass_ctx->error_status) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return strcmp(sass_ctx->output_string, "a {\\n color: blue; }\\n a:hover {\\n color: red; }\\n") != 0;
|
2012-10-04 12:38:33 +00:00
|
|
|
}
|
2013-02-02 05:12:42 +00:00
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "-o", "test", "test.c", "-lsass"
|
|
|
|
system "./test"
|
2012-10-04 12:38:33 +00:00
|
|
|
end
|
|
|
|
end
|