diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Casks/msg-desktop.rb b/Casks/msg-desktop.rb new file mode 100644 index 0000000..f8fd53c --- /dev/null +++ b/Casks/msg-desktop.rb @@ -0,0 +1,14 @@ +cask "msg-desktop" do + arch arm: "aarch64" + version "0.1.0" + sha256 arm: "2888260f69bb00a7fe14b07e5a311cb69eb31cb40f4e6f3e414c75c6d07d08a7" + + url "https://forge.superkamiguru.org/MSG/msg-desktop/releases/download/msg-desktop_v0.1.0/MSG%20Desktop.dmg.zip" + name "MSG Desktop" + desc "MSG Frontend app" + homepage "https://forge.superkamiguru.org/MSG/msg-desktop" + + depends_on formula: "msg-cli" + + app "MSG Desktop.app" +end diff --git a/Formula/guile-config.rb b/Formula/guile-config.rb new file mode 100644 index 0000000..c447500 --- /dev/null +++ b/Formula/guile-config.rb @@ -0,0 +1,53 @@ +class GuileConfig < Formula + desc "Module for handling application configuration in a declarative way" + homepage "https://gitlab.com/a-sassmannshausen/guile-config/" + url "https://gitlab.com/api/v4/projects/7016362/repository/archive?sha=8a4f6442ac42084b00713dde3181c3538d52edbf" + sha256 "6e5099475e23dcab4253f8c59b113c1cf0cb250fb9709582af7a5b2902999698" + version "main" + + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "pkg-config" => :build + depends_on "texinfo" => :build + depends_on "msg/apps/guile-next" + + bottle do + root_url "https://forge.superkamiguru.org/MSG/homebrew-apps/releases/download/guile-config_main" + sha256 arm64_sequoia: "8c54a47417b8b0f6553928c0363564fa2b38d8bf90bdf60c5b98c1059dc2995e" + end + + def install + ENV["GUILE_AUTO_COMPILE"] = "0" + # We need this so we can find other modules. + ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0" + ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" + ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" + + system "autoreconf", "-vif" + system "./configure", "--prefix=#{prefix}" + system "make", "install" + end + + def caveats + <<~EOS + Remember to add the following to your .bashrc or equivalent in order to use this module: + export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0" + export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache" + export GUILE_SYSTEM_EXTENSIONS_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/extensions" + EOS + end + + test do + config = testpath/"config.scm" + config.write <<~EOS + (use-modules (config)) + EOS + + ENV["GUILE_AUTO_COMPILE"] = "0" + ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0" + ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" + ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" + + system "guile", config + end +end diff --git a/Formula/guile-hall.rb b/Formula/guile-hall.rb new file mode 100644 index 0000000..39e8a48 --- /dev/null +++ b/Formula/guile-hall.rb @@ -0,0 +1,50 @@ +class GuileHall < Formula + desc "Hall is a project manager for Guile modules and applications" + homepage "https://gitlab.com/a-sassmannshausen/guile-hall/" + url "https://gitlab.com/api/v4/projects/7016408/repository/archive?sha=cc0c9016220de42084f9b61f7353edeb62dbff82" + sha256 "997331e60cd009be93fd7d6d3dacaa4eec87499cd6345ee14602ae323318ae62" + + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "pkg-config" => :build + depends_on "texinfo" => :build + depends_on "msg/apps/guile-next" + depends_on "guile-lib" + depends_on "msg/apps/guile-config" + + bottle do + root_url "https://forge.superkamiguru.org/MSG/homebrew-apps/releases/download/guile-hall_main" + sha256 arm64_sequoia: "59a2f2434d8c3563abaaf3d88bfc9f17753e4fe095dcfddc4247081a1fd828d6" + end + + def install + ENV["GUILE_AUTO_COMPILE"] = "0" + + # We need this so we can find other modules. + ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0" + ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" + ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" + + system "autoreconf", "-vif" + system "./configure", "--prefix=#{prefix}" + system "make", "install" + end + + def caveats + <<~EOS + Remember to add the following to your .bashrc or equivalent in order to use this module: + export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0" + export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache" + export GUILE_SYSTEM_EXTENSIONS_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/extensions" + EOS + end + + test do + ENV["GUILE_AUTO_COMPILE"] = "0" + ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0" + ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" + ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" + + system "#{bin}/hall" + end +end diff --git a/Formula/guile-next.rb b/Formula/guile-next.rb new file mode 100644 index 0000000..0924285 --- /dev/null +++ b/Formula/guile-next.rb @@ -0,0 +1,101 @@ +class GuileNext < Formula + desc "GNU Ubiquitous Intelligent Language for Extensions" + homepage "https://www.gnu.org/software/guile/" + url "https://git.savannah.gnu.org/git/guile.git", revision: "bce91cebedda016b479972655c680acc6706e539" + version "3.0.10" + license "LGPL-3.0-or-later" + # Credit goes to aconchillo + + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "gettext" => :build + depends_on "gnu-sed" => :build + depends_on "bdw-gc" + depends_on "gmp" + depends_on "libtool" + depends_on "libunistring" + depends_on "pkg-config" # guile-config is a wrapper around pkg-config. + depends_on "readline" + + uses_from_macos "flex" => :build + uses_from_macos "gperf" + uses_from_macos "libffi", since: :catalina + uses_from_macos "libxcrypt" + + on_system :linux, macos: :ventura_or_newer do + depends_on "texinfo" => :build + end + + bottle do + root_url "https://forge.superkamiguru.org/MSG/homebrew-apps/releases/download/guile-next_v3.0.10" + sha256 arm64_sequoia: "c903805af62c14273d16246aac455a6e24abe5c2c35e9fd8933aa5ca263f7d59" + end + + def install + # Avoid superenv shim + inreplace "meta/guile-config.in", "@PKG_CONFIG@", Formula["pkg-config"].opt_bin/"pkg-config" + + system "./autogen.sh" + + system "./configure", *std_configure_args, + "--with-libreadline-prefix=#{Formula["readline"].opt_prefix}", + "--with-libgmp-prefix=#{Formula["gmp"].opt_prefix}", + "--disable-nls" + system "make", "install" + + # A really messed up workaround required on macOS --mkhl + Pathname.glob("#{lib}/*.dylib") do |dylib| + lib.install_symlink dylib.basename => "#{dylib.basename(".dylib")}.so" + end + + # This is either a solid argument for guile including options for + # --with-xyz-prefix= for libffi and bdw-gc or a solid argument for + # Homebrew automatically removing Cellar paths from .pc files in favour + # of opt_prefix usage everywhere. + inreplace lib/"pkgconfig/guile-3.0.pc" do |s| + s.gsub! Formula["bdw-gc"].prefix.realpath, Formula["bdw-gc"].opt_prefix + s.gsub! Formula["libffi"].prefix.realpath, Formula["libffi"].opt_prefix if !OS.mac? || MacOS.version < :catalina + end + + (share/"gdb/auto-load").install Dir["#{lib}/*-gdb.scm"] + end + + def post_install + # Create directories so installed modules can create links inside. + (HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache").mkpath + (HOMEBREW_PREFIX/"lib/guile/3.0/extensions").mkpath + (HOMEBREW_PREFIX/"share/guile/site/3.0").mkpath + end + + def caveats + <<~EOS + **** Credit goes to aconchillo **** + + To use `guile-next` you need to unlink `guile` and then link `guile-next`: + brew unlink guile + brew link guile-next + + Guile libraries can now be installed here: + Source files: #{HOMEBREW_PREFIX}/share/guile/site/3.0 + Compiled files: #{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache + Extensions: #{HOMEBREW_PREFIX}/lib/guile/3.0/extensions + + Add the following to your .bashrc or equivalent: + export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0" + export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache" + export GUILE_SYSTEM_EXTENSIONS_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/extensions" + EOS + end + + test do + hello = testpath/"hello.scm" + hello.write <<~EOS + (display "Hello World") + (newline) + EOS + + ENV["GUILE_AUTO_COMPILE"] = "0" + + system bin/"guile", hello + end +end diff --git a/Formula/msg-cli.rb b/Formula/msg-cli.rb index dccd291..2530e62 100644 --- a/Formula/msg-cli.rb +++ b/Formula/msg-cli.rb @@ -4,13 +4,13 @@ class MsgCli < Formula desc "MacOS Subsystem for Guix - Creates a virtual machine for running a local guix environment on your mac" homepage "https://superkamiguru.org/projects/msg.html" - url "https://forge.superkamiguru.org/MSG/msg-cli/archive/v0.1.0.tar.gz" - sha256 "8092e3e240dd79e8254158b6b73a401845b84268a2c6fa80f6a5e9ced51e52f4" + url "https://forge.superkamiguru.org/MSG/msg-cli/archive/v0.1.1.tar.gz" + sha256 "5c543e46e3ac9c0c387fc70dbe660f6ea4318ecf187ae8ff573b8da5bfd0ff11" license "AGPL-3.0-or-later" bottle do - root_url "https://forge.superkamiguru.org/MSG/homebrew-msg/releases/tag/msg-cli_v0.1.0" - sha256 arm64_sequoia: "e840f2176ffabecb65b0c3e1cbd9c9509ae2d1f33007197681bac0dad0f9e513" + root_url "https://forge.superkamiguru.org/MSG/homebrew-apps/releases/download/msg-cli_v0.1.1" + sha256 arm64_sequoia: "11a205b49daf8660ffa3dc8a01271f9d3b0708692140fa586cd5ad306c6f7e0c" end # depends_on "cmake" => :build @@ -19,7 +19,7 @@ class MsgCli < Formula depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build - depends_on "guile-next" + depends_on "msg/apps/guile-next" depends_on "texinfo" # Additional dependency # resource "" do @@ -37,22 +37,35 @@ class MsgCli < Formula ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" system "autoreconf", "-vif" - system "./configure", "--prefix=#{prefix}" + system "./configure", "--prefix=#{prefix}", "--libdir=#{prefix}/lib" system "make" system "make", "install" # system "cmake", "-S", ".", "-B", "build", *std_cmake_args end + def post_install + ENV["GUILE_AUTO_COMPILE"] = "0" + + # We need this so we can find other modules. + ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0" + ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache" + ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions" + system "guild", "compile", "-o", "#{prefix}/lib/guile/3.0/site-ccache/msg/machine.go", "#{prefix}/share/guile/site/3.0/msg/machine.scm" + end + + def caveats + <<~EOS + Add the following to your .bashrc or equivalent: + export GUILE_LOAD_PATH="#{HOMEBREW_PREFIX}/share/guile/site/3.0" + export GUILE_LOAD_COMPILED_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/site-ccache" + export GUILE_SYSTEM_EXTENSIONS_PATH="#{HOMEBREW_PREFIX}/lib/guile/3.0/extensions" + + Then run the following to initialize msg: + msg machine init + EOS + end + test do - # `test do` will create, run in and delete a temporary directory. - # - # This test will fail and we won't accept that! For Homebrew/homebrew-core - # this will need to be a test that verifies the functionality of the - # software. Run the test with `brew test msg-cli`. Options passed - # to `brew install` such as `--HEAD` also need to be provided to `brew test`. - # - # The installed folder is not in the path, so use the entire path to any - # executables being tested: `system bin/"program", "do", "something"`. - system "false" + system "/opt/homebrew/bin/msg" end end diff --git a/README.org b/README.org index 60b52b8..c33ae03 100644 --- a/README.org +++ b/README.org @@ -1,5 +1,12 @@ * How to install formula ** Install by adding tap + +*** Add Tap #+begin_src sh brew tap MSG/apps https://forge.superkamiguru.org/MSG/homebrew-apps #+end_src + +*** Install Formula +#+begin_src sh +brew install +#+end_src