From e573315322f9eb383d2b1d636a3aa6f70c8a2d7e Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Mon, 6 Feb 2023 23:20:16 -0700 Subject: [PATCH 1/5] Add support for --head option --- Formula/gap.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Formula/gap.rb b/Formula/gap.rb index 5c7621a..f3fb9c2 100644 --- a/Formula/gap.rb +++ b/Formula/gap.rb @@ -3,6 +3,10 @@ class Gap < Formula homepage "https://www.gap-system.org/" url "https://github.com/gap-system/gap/releases/download/v4.12.2/gap-4.12.2.tar.gz" sha256 "672308745eb78a222494ee8dd6786edd5bc331456fcc6456ac064bdb28d587a8" + head do + url "https://github.com/gap-system/gap.git", branch: "master" + depends_on "autoconf" => :build + end depends_on "gmp" # GAP cannot be built against the native macOS version of readline @@ -33,8 +37,14 @@ def install # GAP does not support "make install" so it has to be compiled in place cd libexec do + if build.head? + system "./autogen.sh" + end system "./configure", "--with-readline=#{Formula["readline"].opt_prefix}" system "make" + if build.head? # option for minimal packages? bootstrap-pkg-minimal + system "make", "bootstrap-pkg-full" + end end # Create a symlink `bin/gap` from the `gap` binary From 8afa4f7fca2221ccc5e4ca1044e35e7b377a7caf Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Thu, 23 Feb 2023 21:23:10 -0700 Subject: [PATCH 2/5] Use make install to install This is a first step towards getting the formula approved for use in homebrew proper --- Formula/gap.rb | 163 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 128 insertions(+), 35 deletions(-) diff --git a/Formula/gap.rb b/Formula/gap.rb index f3fb9c2..3c37dd0 100644 --- a/Formula/gap.rb +++ b/Formula/gap.rb @@ -3,11 +3,15 @@ class Gap < Formula homepage "https://www.gap-system.org/" url "https://github.com/gap-system/gap/releases/download/v4.12.2/gap-4.12.2.tar.gz" sha256 "672308745eb78a222494ee8dd6786edd5bc331456fcc6456ac064bdb28d587a8" + license "GPL-2.0-or-later" + + head do url "https://github.com/gap-system/gap.git", branch: "master" - depends_on "autoconf" => :build + depends_on "autoconf" => :build # required by packages below end + depends_on "gmp" # GAP cannot be built against the native macOS version of readline # it requires either GNU readline, or no readline at all; but @@ -15,47 +19,135 @@ class Gap < Formula # So we depend on GNU readline here. depends_on "readline" + # for zeromqinterface package + depends_on "zeromq" + + def install - # XXX: Currently there is no `install` target in `Makefile`. - # According to the manual installation instructions in - # - # https://github.com/gap-system/gap/blob/master/INSTALL.md - # - # the compiled "bundle" is intended to be used "as is," and there is - # no instructions for how to remove the source and other unnecessary - # files after compilation. Moreover, the content of the - # subdirectories with special names, such as `bin` and `lib`, is not - # suitable for merging with the content of the corresponding - # subdirectories of `/usr/local`. The easiest temporary solution seems - # to be to drop the compiled bundle into `/libexec` and to - # create a symlink `/bin/gap` to the startup script. - # This use of `libexec` seems to contradict Linux Filesystem Hierarchy - # Standard, but is recommended in Homebrew's "Formula Cookbook." - - libexec.install Dir["*"] - - # GAP does not support "make install" so it has to be compiled in place - - cd libexec do - if build.head? - system "./autogen.sh" - end - system "./configure", "--with-readline=#{Formula["readline"].opt_prefix}" - system "make" - if build.head? # option for minimal packages? bootstrap-pkg-minimal - system "make", "bootstrap-pkg-full" - end + + prerequisites_packages = [ + "atlasrep", + "normalizinterface", + "semigroups", + ] + + no_compilation_packages = [ + "atlasrep", "aclib", "agt", "alnuth", "automata", "automgrp", + "autpgrp", "circle", "classicpres", "congruence", "corelg", + "crime", "crisp", "cryst", "crystcat", "ctbllib", "cubefree", + "design", "difsets", "factint", "fga", "fining", "format", + "forms", "fr", "francy", "fwtree", "gapdoc", "gbnp", "genss", + "groupoids", "grpconst", "guarana", "hap", "hapcryst", "hecke", + "help", "idrel", "images", "intpic", "irredsol", "itc", + "jupyterkernel", "jupyterviz", "kan", "laguna", "liealgdb", + "liepring", "liering", "loops", "lpres", "majoranaalgebras", + "mapclass", "matgrp", "modisom", "nilmat", "nock", + "numericalsgps", "openmath", "packagemanager", "patternclass", + "permut", "polenta", "polycyclic", "polymaking", "primgrp", + "qpa", "quagroup", "radiroot", "rcwa", "rds", "recog", + "repndecomp", "repsn", "resclasses", "scscp", "sglppow", + "sgpviz", "singular", "sl2reps", "sla", "smallgrp", "smallsemi", + "sonata", "sophus", "spinsym", "standardff", "symbcompcc", + "thelma", "tomlib", "toric", "transgrp", "ugaly", "unipot", + "unitlib", "utils", "uuid", "walrus", "wedderga", "xmod", + "xmodalg", "yangbaxter", + ] + + # make doc and test targets, I don't actually call them + makefile_packages = [ + "4ti2interface", "autodoc", "cap", "examplesforhomalg", + "gaussforhomalg", "generalizedmorphismsforcap", "gradedmodules", + "gradedringforhomalg", "homalg", "homalgtocas", "io_forhomalg", + "linearalgebraforcap", "localizeringforhomalg", + "matricesforhomalg", "modulepresentationsforcap", "modules", + "monoidalcategories", "nconvex", "ringsforhomalg", "sco", + "toolsforhomalg", "toricvarieties", + ] + + # These two packages either don't build or don't work + # "cddinterface", "xgap", + configure_packages = [ + "anupq", "caratinterface", "crypting", "curlinterface", "cvec", + "datastructures", "deepthought", "digraphs", "ferret", "float", + "gauss", "grape", "io", "json", "normalizinterface", "nq", + "orb", "profiling", "semigroups", "simpcomp", "zeromqinterface", + ] + + old_configure_packages = [ + "ace", "browse", "cohomolo", "edim", "example", "fplsa", + "guava", "kbmag", + ] + + # These package have autogen.sh available + # I don't think there is a need to run it, but we could if we wanted + autogen_packages = [ + "anupq", "cddinterface", "curlinterface", "digraphs", "ferret", + "float", "guava", "io", "normalizinterface", "nq", "semigroups", + "simpcomp", "xgap", "zeromqinterface", + ] + + # Run special commands after installation + special_packages = { + # Even with x11 installed, it doesn't seem to work + # "xgap" => "cp bin/xgap.sh $GAPROOT/bin/xgap.sh", + } + + + # Start actually building GAP + if build.head? + system "./autogen.sh" + end + + libexec.install Dir["pkg"] + + system "./configure", "--prefix", libexec/"gap", "--with-readline=#{Formula["readline"].opt_prefix}" + if build.head? + system "make", "bootstrap-pkg-full" + # system "make", "doc" # Do we need this? end + system "make", "install" # Create a symlink `bin/gap` from the `gap` binary - bin.install_symlink libexec/"gap" => "gap" + bin.install_symlink libexec/"gap/bin/gap" => "gap" ohai "Building included packages. Please be patient, it may take a while" + pkg_dir = "#{libexec}/pkg" + cd libexec/"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 "mkdir", "#{libexec}/gap/lib/gap/pkg/" + + # The makefiles appear to only be used for docs... + # The BuildPackages.sh script didn't call them + no_compilation_packages.concat(makefile_packages).each do |pkg| + system "cp", "-R", pkg, "#{libexec}/gap/lib/gap/pkg/" + end + + prerequisites_packages.each do |pkg| + cd pkg do + system "./prerequisites.sh", "#{libexec}/gap/lib/gap" + end + end + + # autogen_packages.each do |pkg| + # cd pkg do + # system "./autogen.sh" + # end + # end + configure_packages.each do |pkg| + cd pkg do + system "./configure", "--with-gaproot=#{libexec}/gap/lib/gap" + system "make" + system "/usr/bin/rsync", "-aEvL", "bin/", "#{libexec}/gap/lib/gap/pkg/" + end + end + old_configure_packages.each do |pkg| + cd pkg do + system "./configure", "#{libexec}/gap/lib/gap" + system "make" + system "/usr/bin/rsync", "-aEvL", "bin/", "#{libexec}/gap/lib/gap/pkg/" + end + end end end @@ -63,4 +155,5 @@ def install ENV["LC_CTYPE"] = "en_GB.UTF-8" system bin/"gap", "-r", "-A", "#{libexec}/tst/testinstall.g" end + end From 0581dd827f12f84adbe52cb9f57fff286d5d7130 Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Wed, 26 Apr 2023 21:56:19 -0600 Subject: [PATCH 3/5] Add package dependencies Co-authored-by: Max Horn --- Formula/gap.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Formula/gap.rb b/Formula/gap.rb index 3c37dd0..e1ee2e2 100644 --- a/Formula/gap.rb +++ b/Formula/gap.rb @@ -19,8 +19,15 @@ class Gap < Formula # So we depend on GNU readline here. depends_on "readline" - # for zeromqinterface package - depends_on "zeromq" + # for packages + depends_on "cddlib" # CddInterface + depends_on "curl" # curlInterface + depends_on "fplll" # float + depends_on "libmpc" # float + depends_on "mpfi" # float + depends_on "mpfr" # float, normalizinterface + depends_on "ncurses" # browse + depends_on "zeromq" # ZeroMQInterface def install From 2390876101b912b06f21c2d2b3d43c92dcc82ee6 Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Sat, 29 Apr 2023 23:06:03 -0600 Subject: [PATCH 4/5] Simplify --- Formula/gap.rb | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/Formula/gap.rb b/Formula/gap.rb index e1ee2e2..4c7754f 100644 --- a/Formula/gap.rb +++ b/Formula/gap.rb @@ -28,15 +28,11 @@ class Gap < Formula depends_on "mpfr" # float, normalizinterface depends_on "ncurses" # browse depends_on "zeromq" # ZeroMQInterface - + depends_on "singular" # many packages + depends_on "pari" # many packages def install - prerequisites_packages = [ - "atlasrep", - "normalizinterface", - "semigroups", - ] no_compilation_packages = [ "atlasrep", "aclib", "agt", "alnuth", "automata", "automgrp", @@ -58,10 +54,8 @@ def install "thelma", "tomlib", "toric", "transgrp", "ugaly", "unipot", "unitlib", "utils", "uuid", "walrus", "wedderga", "xmod", "xmodalg", "yangbaxter", - ] - - # make doc and test targets, I don't actually call them - makefile_packages = [ + # These packages have `doc` and `test` make targets, but we + # don't actually call them "4ti2interface", "autodoc", "cap", "examplesforhomalg", "gaussforhomalg", "generalizedmorphismsforcap", "gradedmodules", "gradedringforhomalg", "homalg", "homalgtocas", "io_forhomalg", @@ -85,20 +79,11 @@ def install "guava", "kbmag", ] - # These package have autogen.sh available - # I don't think there is a need to run it, but we could if we wanted - autogen_packages = [ - "anupq", "cddinterface", "curlinterface", "digraphs", "ferret", - "float", "guava", "io", "normalizinterface", "nq", "semigroups", - "simpcomp", "xgap", "zeromqinterface", - ] - # Run special commands after installation - special_packages = { - # Even with x11 installed, it doesn't seem to work - # "xgap" => "cp bin/xgap.sh $GAPROOT/bin/xgap.sh", - } + all_packages = no_compilation_packages + .concat(configure_packages) + .concat(configure_packages) # Start actually building GAP if build.head? @@ -126,21 +111,15 @@ def install # The makefiles appear to only be used for docs... # The BuildPackages.sh script didn't call them - no_compilation_packages.concat(makefile_packages).each do |pkg| + all_packages.each do |pkg| system "cp", "-R", pkg, "#{libexec}/gap/lib/gap/pkg/" - end - - prerequisites_packages.each do |pkg| cd pkg do - system "./prerequisites.sh", "#{libexec}/gap/lib/gap" + if File.exist?("./prerequisites.sh") + system "./prerequisites.sh", "#{libexec}/gap/lib/gap" + end end end - # autogen_packages.each do |pkg| - # cd pkg do - # system "./autogen.sh" - # end - # end configure_packages.each do |pkg| cd pkg do system "./configure", "--with-gaproot=#{libexec}/gap/lib/gap" From d447c2aea54bb7689215e3083eae6e180a49d539 Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Mon, 1 May 2023 22:05:18 -0600 Subject: [PATCH 5/5] Install package binaries to the correct location --- Formula/gap.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/gap.rb b/Formula/gap.rb index 4c7754f..b46c196 100644 --- a/Formula/gap.rb +++ b/Formula/gap.rb @@ -124,14 +124,14 @@ def install cd pkg do system "./configure", "--with-gaproot=#{libexec}/gap/lib/gap" system "make" - system "/usr/bin/rsync", "-aEvL", "bin/", "#{libexec}/gap/lib/gap/pkg/" + system "cp", "-R", "bin/", "#{libexec}/gap/lib/gap/pkg/#{pkg}" end end old_configure_packages.each do |pkg| cd pkg do system "./configure", "#{libexec}/gap/lib/gap" system "make" - system "/usr/bin/rsync", "-aEvL", "bin/", "#{libexec}/gap/lib/gap/pkg/" + system "cp", "-R", "bin/", "#{libexec}/gap/lib/gap/pkg/#{pkg}" end end end