libserdes: fix dependencies, add head

libserdes depends on jansson directly for its schema registry support;
i.e., it is not just a transitive dependency via avro-c. List it
explicitly, in case avro-c one day stops depending on jansson.

Also mark that libserdes requires "curl" from macOS.

Finally, libserdes does not actually depend on librdkafka, except for
some examples that use librdkafka. Exclude it, because we don't install
those examples anyway, and then adjust the test to test libserdes
directly.
This commit is contained in:
Nikhil Benesch 2019-12-28 11:27:42 -05:00 committed by FX Coudert
parent 695b679fc8
commit 03d0c13ba8

View file

@ -2,8 +2,9 @@ class Libserdes < Formula
desc "Schema ser/deserializer lib for Avro + Confluent Schema Registry"
homepage "https://github.com/confluentinc/libserdes"
url "https://github.com/confluentinc/libserdes.git",
:tag => "v5.3.1",
:revision => "b259d15f68dce65591700b0ccccb73311db1de3d"
:tag => "v5.3.1",
:revision => "b259d15f68dce65591700b0ccccb73311db1de3d"
head "https://github.com/confluentinc/libserdes.git"
bottle do
cellar :any
@ -13,7 +14,8 @@ class Libserdes < Formula
end
depends_on "avro-c"
depends_on "librdkafka"
depends_on "jansson"
uses_from_macos "curl"
def install
system "./configure", "--prefix=#{prefix}"
@ -23,22 +25,24 @@ class Libserdes < Formula
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <librdkafka/rdkafka.h>
#include <serdes-avro.h>
#include <serdes.h>
#include <err.h>
#include <stddef.h>
#include <sys/types.h>
#include <libserdes/serdes.h>
int main()
{
rd_kafka_conf_t *rk_conf;
rk_conf = rd_kafka_conf_new();
char errstr[512];
serdes_conf_t *sconf = serdes_conf_new(NULL, 0, NULL);
serdes_t *serdes = serdes_new(sconf, errstr, sizeof(errstr));
if (serdes == NULL) {
errx(1, "constructing serdes: %s", errstr);
}
serdes_destroy(serdes);
return 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}/libserdes", "-L/usr/local/lib/", "-L#{lib}", "-lrdkafka", "-lserdes", "-o", "test"
system ENV.cc, "test.c", "-L#{lib}", "-lserdes", "-o", "test"
system "./test"
end
end