Skip to content

Commit

Permalink
guile-mqtt: new package 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Nov 17, 2024
1 parent c4ffd96 commit a4c3df2
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Formula/guile-mqtt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
class GuileMqtt < Formula
desc "Guile bindings for libmosquitto MQTT client library"
homepage "https://github.com/mdjurfeldt/guile-mqtt"
url "https://github.com/mdjurfeldt/guile-mqtt/releases/download/v0.2.1/guile-mqtt-0.2.1.tar.gz"
sha256 "faa7eb530f32218f2239b1152db83a6ce7e240d4792e4c369fda0732bdc94399"

depends_on "nyacc" => :build
depends_on "pkg-config" => :build
depends_on "guile"
depends_on "mosquitto"

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 "./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
mqtt = testpath/"mqtt.scm"
mqtt.write <<~EOS
(use-modules (mosquitto client))
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", mqtt
end
end

0 comments on commit a4c3df2

Please sign in to comment.