Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new formula to install and compile the package IMG #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Formula/gap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def install
# This use of `libexec` seems to contradict Linux Filesystem Hierarchy
# Standard, but is recommended in Homebrew's "Formula Cookbook."

pkgshare.install Dir["pkg"]
libexec.install Dir["*"]

# GAP does not support "make install" so it has to be compiled in place
Expand All @@ -39,14 +40,19 @@ def install

# Create a symlink `bin/gap` from the `gap` binary
bin.install_symlink libexec/"gap" => "gap"
libexec.install_symlink pkgshare/"pkg" => "pkg"

ohai "Building included packages. Please be patient, it may take a while"
cd libexec/"pkg" do
cd pkgshare/"pkg" do
# NOTE: This script will build most of the packages that require
# compilation. It is known to produce a number of warnings and
# error messages, possibly failing to build several packages.
system "../bin/BuildPackages.sh", "--with-gaproot=#{libexec}"
system "../../../libexec/bin/BuildPackages.sh", "--with-gaproot=#{libexec}"
end

# Now remove the symlink to pkgshare/"pkg", and put one to HOMEBREW_PREFIX/share/gap/pkg, so we can access global packages too
rm libexec/"pkg"
ln_s "#{HOMEBREW_PREFIX}/share/gap/pkg", libexec/"pkg"
end

test do
Expand Down
29 changes: 29 additions & 0 deletions Formula/img.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Img < Formula
desc "Iterated monodromy groups in GAP"
homepage "https://gap-packages.github.io/img/"
url "https://github.com/gap-packages/img/releases/download/v0.3.0/IMG-0.3.0.tar.gz"
sha256 "41a59cf49be79b2f617e0e5d1f1e73838e6bd2f1d2ea3f234177a31c33c6826d"
license "GPL-3"

depends_on "gap-system/gap/gap"
depends_on "cmake" => :build
depends_on "openblas" => :build
depends_on "suite-sparse" => :build

bottle :unneeded

def install
system "./configure", "--with-gaproot=#{Formula["gap-system/gap/gap"].opt_prefix}/libexec"
system "make"
(share/"gap/pkg/img-0.3.0").install Dir["*"]
end

test do
(testpath/"test1.g").write <<~EOF
OnBreak:=function() Print("FATAL ERROR"); FORCE_QUIT_GAP(1); end;;
LoadPackage("img");
FORCE_QUIT_GAP(0);
EOF
system Formula["gap-system/gap/gap"].opt_prefix/"bin/gap", "test1.g"
end
end