87 lines
3.2 KiB
Ruby
87 lines
3.2 KiB
Ruby
class Gjs < Formula
|
|
desc "JavaScript Bindings for GNOME"
|
|
homepage "https://gitlab.gnome.org/GNOME/gjs/wikis/Home"
|
|
url "https://download.gnome.org/sources/gjs/1.58/gjs-1.58.3.tar.xz"
|
|
sha256 "ca9fcd47b95ab0fc445301b2595e51fcea24d6f3cd87c190fe07006146d773ae"
|
|
|
|
bottle do
|
|
sha256 "12a95c5f332a4a62928149c7c3d6015ff8e584f4a81acce29dfb81a51ead93ab" => :catalina
|
|
sha256 "2092fc20257e9ca5428605387f959cabe30d60f1b6734de3081b2cea5b7feceb" => :mojave
|
|
sha256 "500bc3eba446b44a10b6debe5d49e44de7567adcbb3e89d066e49a674a212141" => :high_sierra
|
|
end
|
|
|
|
depends_on "autoconf@2.13" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "gobject-introspection"
|
|
depends_on "gtk+3"
|
|
depends_on "nspr"
|
|
depends_on "readline"
|
|
|
|
resource "mozjs60" do
|
|
url "https://archive.mozilla.org/pub/firefox/releases/60.1.0esr/source/firefox-60.1.0esr.source.tar.xz"
|
|
sha256 "a4e7bb80e7ebab19769b2b8940966349136a99aabd497034662cffa54ea30e40"
|
|
end
|
|
|
|
def install
|
|
ENV.cxx11
|
|
ENV["_MACOSX_DEPLOYMENT_TARGET"] = ENV["MACOSX_DEPLOYMENT_TARGET"]
|
|
|
|
resource("mozjs60").stage do
|
|
inreplace "config/rules.mk",
|
|
"-install_name $(_LOADER_PATH)/$(SHARED_LIBRARY) ",
|
|
"-install_name #{lib}/$(SHARED_LIBRARY) "
|
|
inreplace "old-configure", "-Wl,-executable_path,${DIST}/bin", ""
|
|
mkdir("build") do
|
|
ENV["PYTHON"] = "python"
|
|
system "../js/src/configure", "--prefix=#{prefix}",
|
|
"--with-system-nspr",
|
|
"--with-system-zlib",
|
|
"--with-system-icu",
|
|
"--enable-readline",
|
|
"--enable-shared-js",
|
|
"--with-pthreads",
|
|
"--enable-optimize",
|
|
"--enable-pie",
|
|
"--enable-release",
|
|
"--with-intl-api",
|
|
"--disable-jemalloc"
|
|
system "make"
|
|
system "make", "install"
|
|
rm Dir["#{bin}/*"]
|
|
end
|
|
# headers were installed as softlinks, which is not acceptable
|
|
cd(include.to_s) do
|
|
`find . -type l`.chomp.split.each do |link|
|
|
header = File.readlink(link)
|
|
rm link
|
|
cp header, link
|
|
end
|
|
end
|
|
ENV.append_path "PKG_CONFIG_PATH", "#{lib}/pkgconfig"
|
|
rm "#{lib}/libjs_static.ajs"
|
|
end
|
|
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--without-dbus-tests",
|
|
"--disable-profiler",
|
|
"--disable-schemas-compile",
|
|
"--prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.js").write <<~EOS
|
|
#!/usr/bin/env gjs
|
|
const GLib = imports.gi.GLib;
|
|
if (31 != GLib.Date.get_days_in_month(GLib.DateMonth.JANUARY, 2000))
|
|
imports.system.exit(1)
|
|
EOS
|
|
system "#{bin}/gjs", "test.js"
|
|
end
|
|
end
|