class Io < Formula desc "Small prototype-based programming language" homepage "http://iolanguage.com/" url "https://github.com/stevedekorte/io/archive/2017.09.06.tar.gz" sha256 "9ac5cd94bbca65c989cd254be58a3a716f4e4f16480f0dc81070457aa353c217" head "https://github.com/stevedekorte/io.git" bottle do sha256 "686d5d23790b53c27765d49da0a74ec96ee949353b31646a0a92ee931270a23d" => :high_sierra sha256 "2d0e05344917ad3a1d322f2860030013315ceb7e8ae962cf6070d1ee8cc395d4" => :sierra sha256 "3a5a0e9a1ec0ce7f4bc6bcfc5fb8c782f0b1ba0451251aaab51a796452b59e67" => :el_capitan sha256 "16d31a7062e2c7ebab815bcd48b03aab9597a6c40071cb407e2bc6dec91fef0b" => :yosemite end option "without-addons", "Build without addons" depends_on "cmake" => :build depends_on "pkg-config" => :build if build.with? "addons" depends_on "glib" depends_on "cairo" depends_on "gmp" depends_on "jpeg" depends_on "libevent" depends_on "libffi" depends_on "libogg" depends_on "libpng" depends_on "libsndfile" depends_on "libtiff" depends_on "libvorbis" depends_on "ossp-uuid" depends_on "pcre" depends_on "yajl" depends_on "xz" depends_on :python => :optional end def install ENV.deparallelize # FSF GCC needs this to build the ObjC bridge ENV.append_to_cflags "-fobjc-exceptions" if build.without? "addons" # Turn off all add-ons in main cmake file inreplace "CMakeLists.txt", "add_subdirectory(addons)", "#add_subdirectory(addons)" else inreplace "addons/CMakeLists.txt" do |s| if build.without? "python" s.gsub! "add_subdirectory(Python)", "#add_subdirectory(Python)" end # Turn off specific add-ons that are not currently working # Looks for deprecated Freetype header s.gsub!(/(add_subdirectory\(Font\))/, '#\1') # Builds against older version of memcached library s.gsub!(/(add_subdirectory\(Memcached\))/, '#\1') end end mkdir "buildroot" do system "cmake", "..", *std_cmake_args system "make" output = `./_build/binaries/io ../libs/iovm/tests/correctness/run.io` if $CHILD_STATUS.exitstatus.nonzero? opoo "Test suite not 100% successful:\n#{output}" else ohai "Test suite ran successfully:\n#{output}" end system "make", "install" end end test do (testpath/"test.io").write <<~EOS "it works!" println EOS assert_equal "it works!\n", shell_output("#{bin}/io test.io") end end