-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192461 from Homebrew/polkit
polkit 125 (new formula)
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
class Polkit < Formula | ||
desc "Toolkit for defining and handling authorizations" | ||
homepage "https://github.com/polkit-org/polkit" | ||
url "https://github.com/polkit-org/polkit/archive/refs/tags/125.tar.gz" | ||
sha256 "ea5cd6e6e2afa6bad938ee770bf0c2cd9317910f37956faeba2869adcf3747d1" | ||
license "LGPL-2.0-or-later" | ||
|
||
bottle do | ||
sha256 x86_64_linux: "812f69589b874c7617c40900b75cc00724f442f009a6537d2185b30b7e8fa141" | ||
end | ||
|
||
depends_on "gettext" => :build | ||
depends_on "gobject-introspection" => :build | ||
depends_on "meson" => :build | ||
depends_on "ninja" => :build | ||
depends_on "pkg-config" => [:build, :test] | ||
depends_on "duktape" | ||
depends_on "expat" | ||
depends_on "glib" | ||
depends_on :linux # macOS requires some patches to build due to installing into /usr/lib | ||
depends_on "linux-pam" | ||
depends_on "systemd" | ||
|
||
def install | ||
args = ["-Dsystemdsystemunitdir=#{lib}/systemd/system"] | ||
|
||
system "meson", "setup", "build", *args, *std_meson_args | ||
system "meson", "compile", "-C", "build", "--verbose" | ||
system "meson", "install", "-C", "build" | ||
end | ||
|
||
test do | ||
(testpath/"test.c").write <<~EOS | ||
#include <glib.h> | ||
#include <polkit/polkit.h> | ||
int main() { | ||
PolkitUnixGroup *group = POLKIT_UNIX_GROUP(polkit_unix_group_new(0)); | ||
g_assert(group); | ||
gint group_gid = polkit_unix_group_get_gid(group); | ||
g_assert_cmpint(group_gid, ==, 0); | ||
g_object_unref(group); | ||
return 0; | ||
} | ||
EOS | ||
|
||
flags = shell_output("pkg-config --cflags --libs polkit-gobject-1").strip.split | ||
system ENV.cc, "test.c", "-o", "test", *flags | ||
system "./test" | ||
end | ||
end |