libslirp 4.3.1 (new formula)

* libslirp 4.3.1 (new formula)
* Add pkg-config as dependency
* Place pkg-config after other dependencies
* Make glib not just for build
* Place glib after other dependencies
* Use inreplace instead of sed
* Build static library as well

Closes #63412.

Signed-off-by: Sean Molenaar <1484494+SMillerDev@users.noreply.github.com>
master
WaluigiWare64 2020-10-24 07:42:54 -07:00 committed by Sean Molenaar
parent c3f9b20738
commit 98b5ed3be5
1 changed files with 38 additions and 0 deletions

38
Formula/libslirp.rb Normal file
View File

@ -0,0 +1,38 @@
class Libslirp < Formula
desc "General purpose TCP-IP emulator"
homepage "https://gitlab.freedesktop.org/slirp/libslirp"
url "https://elmarco.fedorapeople.org/libslirp-4.3.1.tar.xz"
sha256 "388b4b08a8cc0996cc5155cb027a097dc1a7f2cfe84b1121496608ab5366cc48"
license "BSD-3-Clause"
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "glib"
def install
inreplace "meson.build", ",--version-script", ""
system "meson", "build", "-Ddefault_library=both", *std_meson_args
system "ninja", "-C", "build", "install", "all"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <slirp/libslirp.h>
int main() {
SlirpConfig cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.version = 1;
cfg.in_enabled = true;
cfg.vhostname = "testServer";
Slirp* ctx = slirp_new(&cfg, NULL, NULL);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lslirp", "-o", "test"
system "./test"
end
end