From cc45a8ccbeb146fdfc4461519e33e7b797604615 Mon Sep 17 00:00:00 2001 From: Diego Jahn Date: Mon, 15 Apr 2024 19:44:18 +0200 Subject: [PATCH] morpheus-develop: Refactor `install` method according to Homebrew-Core See https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/morpheus.rb. --- Formula/morpheus-develop.rb | 51 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/Formula/morpheus-develop.rb b/Formula/morpheus-develop.rb index c8d090a..63d703e 100644 --- a/Formula/morpheus-develop.rb +++ b/Formula/morpheus-develop.rb @@ -1,58 +1,53 @@ class MorpheusDevelop < Formula - desc "Modelling environment for multi-cellular systems biology" + desc "Modeling environment for multi-cellular systems biology" homepage "https://morpheus.gitlab.io/" license "BSD-3-Clause" head "https://gitlab.com/morpheus.lab/morpheus.git", branch: "develop" + option "with-sbml", "Enable SBML import via the internal libSBML build" + depends_on "boost" => :build depends_on "cmake" => :build depends_on "doxygen" => :build - depends_on "ffmpeg" # Runtime dependencies + depends_on "ninja" => :build depends_on "gnuplot" depends_on "graphviz" depends_on "libomp" depends_on "libtiff" depends_on "qt@5" + depends_on "ffmpeg" => :recommended # Runtime dependencies uses_from_macos "bzip2" uses_from_macos "libxml2" uses_from_macos "zlib" def install - args = std_cmake_args - args << "-DMORPHEUS_RELEASE_BUNDLE=ON" if OS.mac? - - system "cmake", ".", *args - system "make", "install" + # has to build with Ninja until: https://gitlab.kitware.com/cmake/cmake/-/issues/25142 + args = ["-G Ninja"] if OS.mac? - bin.write_exec_script "#{prefix}/Morpheus.app/Contents/MacOS/morpheus" + args << "-DMORPHEUS_RELEASE_BUNDLE=ON" + args << "-DBREW_FORMULA_DEPLOYMENT=ON" - (bin/"morpheus-gui").write <<~EOS - #!/bin/bash - open #{prefix}/Morpheus.app - EOS - (bin/"morpheus-gui").chmod 0555 + # SBML import currently disabled by default due to libSBML build errors with some macOS SDKs + args << "-DMORPHEUS_SBML=OFF" if build.without? "sbml" end - end - def post_install - if OS.mac? - # Set PATH environment variable including Homebrew prefix in macOS app bundle - inreplace "#{prefix}/Morpheus.app/Contents/Info.plist", "CFBundleExecutable", - <<~EOS.chomp - LSEnvironment - - PATH - #{ENV["PATH"]} - - CFBundleExecutable - EOS - end + system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + + return unless OS.mac? + + bin.write_exec_script "#{prefix}/Morpheus.app/Contents/MacOS/morpheus" + bin.write_exec_script "#{prefix}/Morpheus.app/Contents/MacOS/morpheus-gui" + + # Set PATH environment variable including Homebrew prefix in macOS app bundle + inreplace "#{prefix}/Morpheus.app/Contents/Info.plist", "HOMEBREW_BIN_PATH", "#{HOMEBREW_PREFIX}/bin" end def caveats - if OS.mac? + on_macos do <<~EOS To start the Morpheus GUI, type the following command: