homebrew-core/Formula/libxlsxwriter.rb
2019-04-08 12:03:23 +02:00

38 lines
1.3 KiB
Ruby

class Libxlsxwriter < Formula
desc "C library for creating Excel XLSX files"
homepage "https://libxlsxwriter.github.io/"
url "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_0.8.6.tar.gz"
sha256 "76cd0d10dbb4e0f38814c89bbdabd49b329a84eb5b4b12135c0550b633c09d51"
bottle do
cellar :any
sha256 "58c96659bf6494f763de22ae71987eceae4ffaee435c0a2b1abf650e344f2c30" => :mojave
sha256 "782a11914d19ded90406f33afc652da077589b83c0b06a87674c060c7c2a8ee3" => :high_sierra
sha256 "01237e26925d66577f5aae0941a6160a3be059f70ca32adbfa13bcfdccd8ffe9" => :sierra
end
def install
system "make", "install", "INSTALL_DIR=#{prefix}", "V=1"
end
test do
(testpath/"test.c").write <<~EOS
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("myexcel.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
int row = 0;
int col = 0;
worksheet_write_string(worksheet, row, col, "Hello me!", NULL);
return workbook_close(workbook);
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-I#{include}", "-lxlsxwriter", "-o", "test"
system "./test"
assert_predicate testpath/"myexcel.xlsx", :exist?, "Failed to create xlsx file"
end
end