-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
270 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,85 @@ | ||
class BerkeleyDb < Formula | ||
desc "High performance key/value database" | ||
homepage "https://www.oracle.com/database/technologies/related/berkeleydb.html" | ||
# Requires registration to download so we mirror it | ||
url "https://dl.bintray.com/homebrew/mirror/berkeley-db-18.1.40.tar.gz" | ||
mirror "https://fossies.org/linux/misc/db-18.1.40.tar.gz" | ||
sha256 "0cecb2ef0c67b166de93732769abdeba0555086d51de1090df325e18ee8da9c8" | ||
license "AGPL-3.0-only" | ||
|
||
livecheck do | ||
url "https://www.oracle.com/database/technologies/related/berkeleydb-downloads.html" | ||
regex(%r{href=.*?/berkeley-db/db[._-]v?(\d+(?:\.\d+)+)\.t}i) | ||
end | ||
|
||
bottle do | ||
sha256 cellar: :any, arm64_big_sur: "fb300ebe3dcc5b308c6fbc383856545a6b35e883889c95f0bfeee40d6d07b02d" | ||
sha256 cellar: :any, big_sur: "dc8c2c76f315ea02737e9277f74cc9f8faba1733c10c20e2ef62d50b4abce4b7" | ||
sha256 cellar: :any, catalina: "f4d82916099a1023af6a72675dce0a445000efd2286866d1f36bf0b1063b24aa" | ||
sha256 cellar: :any, mojave: "ef85a6b6fb93f8dcee4144acf22665a331c5b2398822a5f183aed0fb863718f5" | ||
end | ||
|
||
depends_on "[email protected]" | ||
|
||
def install | ||
# BerkeleyDB dislikes parallel builds | ||
ENV.deparallelize | ||
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.12" | ||
|
||
# --enable-compat185 is necessary because our build shadows | ||
# the system berkeley db 1.x | ||
args = %W[ | ||
--disable-debug | ||
--disable-static | ||
--prefix=#{prefix} | ||
--mandir=#{man} | ||
--enable-cxx | ||
--enable-compat185 | ||
--enable-sql | ||
--enable-sql_codegen | ||
--enable-dbm | ||
--enable-stl | ||
] | ||
|
||
# BerkeleyDB requires you to build everything from the build_unix subdirectory | ||
cd "build_unix" do | ||
system "../dist/configure", *args | ||
system "make", "install", "DOCLIST=license" | ||
|
||
# delete docs dir because it is huge | ||
rm_rf prefix/"docs" | ||
end | ||
end | ||
|
||
test do | ||
(testpath/"test.cpp").write <<~EOS | ||
#include <assert.h> | ||
#include <string.h> | ||
#include <db_cxx.h> | ||
int main() { | ||
Db db(NULL, 0); | ||
assert(db.open(NULL, "test.db", NULL, DB_BTREE, DB_CREATE, 0) == 0); | ||
const char *project = "Homebrew"; | ||
const char *stored_description = "The missing package manager for macOS"; | ||
Dbt key(const_cast<char *>(project), strlen(project) + 1); | ||
Dbt stored_data(const_cast<char *>(stored_description), strlen(stored_description) + 1); | ||
assert(db.put(NULL, &key, &stored_data, DB_NOOVERWRITE) == 0); | ||
Dbt returned_data; | ||
assert(db.get(NULL, &key, &returned_data, 0) == 0); | ||
assert(strcmp(stored_description, (const char *)(returned_data.get_data())) == 0); | ||
assert(db.close(0) == 0); | ||
} | ||
EOS | ||
flags = %W[ | ||
-I#{include} | ||
-L#{lib} | ||
-ldb_cxx | ||
] | ||
system ENV.cxx, "test.cpp", "-o", "test", *flags | ||
system "./test" | ||
assert_predicate testpath/"test.db", :exist? | ||
end | ||
end |
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,85 @@ | ||
class Libogg < Formula | ||
desc "Ogg Bitstream Library" | ||
homepage "https://www.xiph.org/ogg/" | ||
license "BSD-3-Clause" | ||
|
||
stable do | ||
url "https://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.gz" | ||
sha256 "fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e" | ||
|
||
# os_types: fix unsigned typedefs for MacOS. This is already merged upstream; remove on next version | ||
patch do | ||
url "https://github.com/xiph/ogg/commit/c8fca6b4a02d695b1ceea39b330d4406001c03ed.patch?full_index=1" | ||
sha256 "0f4d289aecb3d5f7329d51f1a72ab10c04c336b25481a40d6d841120721be485" | ||
end | ||
end | ||
|
||
bottle do | ||
rebuild 1 | ||
sha256 cellar: :any, arm64_big_sur: "9c217f3aa8ea00c0536a8b90df566aeb32fb4ffee56f85b94d9eb6f6ae68f21b" | ||
sha256 cellar: :any, big_sur: "47c3224ac25b17a201e234f8fabcb9249b7d1587e69c63e025578c5a6d448ab3" | ||
sha256 cellar: :any, catalina: "b95bbf935f48878bd96d1c0e6557a017aa18cb17a080bc3ef9308b6415c278ef" | ||
sha256 cellar: :any, mojave: "3cc7656859154f6eb98d3ddbe4b74c810b505e2162af1357b3ed6b70cad35125" | ||
sha256 cellar: :any, high_sierra: "95f271ec181f6b999674636272a3414db4242eabd0a0b0572cfa0f1f324f5ef8" | ||
end | ||
|
||
head do | ||
url "https://gitlab.xiph.org/xiph/ogg.git" | ||
|
||
depends_on "autoconf" => :build | ||
depends_on "automake" => :build | ||
depends_on "libtool" => :build | ||
end | ||
|
||
resource("oggfile") do | ||
url "https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" | ||
sha256 "379071af4fa77bc7dacf892ad81d3f92040a628367d34a451a2cdcc997ef27b0" | ||
end | ||
|
||
def install | ||
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.12" | ||
system "./autogen.sh" if build.head? | ||
system "./configure", "--disable-dependency-tracking", | ||
"--prefix=#{prefix}" | ||
system "make" | ||
ENV.deparallelize | ||
system "make", "install" | ||
end | ||
|
||
test do | ||
(testpath/"test.c").write <<~EOS | ||
#include <ogg/ogg.h> | ||
#include <stdio.h> | ||
int main (void) { | ||
ogg_sync_state oy; | ||
ogg_stream_state os; | ||
ogg_page og; | ||
ogg_packet op; | ||
char *buffer; | ||
int bytes; | ||
ogg_sync_init (&oy); | ||
buffer = ogg_sync_buffer (&oy, 4096); | ||
bytes = fread(buffer, 1, 4096, stdin); | ||
ogg_sync_wrote (&oy, bytes); | ||
if (ogg_sync_pageout (&oy, &og) != 1) | ||
return 1; | ||
ogg_stream_init (&os, ogg_page_serialno (&og)); | ||
if (ogg_stream_pagein (&os, &og) < 0) | ||
return 1; | ||
if (ogg_stream_packetout (&os, &op) != 1) | ||
return 1; | ||
return 0; | ||
} | ||
EOS | ||
testpath.install resource("oggfile") | ||
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-logg", | ||
"-o", "test" | ||
# Should work on an OGG file | ||
shell_output("./test < Example.ogg") | ||
# Expected to fail on a non-OGG file | ||
shell_output("./test < #{test_fixtures("test.wav")}", 1) | ||
end | ||
end |
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,40 @@ | ||
class Libsndfile < Formula | ||
desc "C library for files containing sampled sound" | ||
homepage "https://libsndfile.github.io/libsndfile/" | ||
url "https://github.com/libsndfile/libsndfile/releases/download/1.0.31/libsndfile-1.0.31.tar.bz2" | ||
sha256 "a8cfb1c09ea6e90eff4ca87322d4168cdbe5035cb48717b40bf77e751cc02163" | ||
license "LGPL-2.1-or-later" | ||
|
||
livecheck do | ||
url :stable | ||
strategy :github_latest | ||
end | ||
|
||
bottle do | ||
sha256 cellar: :any, arm64_big_sur: "8e2fc3b0df09a21840f8643f644bd3a0bb3c3551d21f600b344f6b316d3ef44d" | ||
sha256 cellar: :any, big_sur: "a4a734e58220fc8615d86e4563e9a874447d568151b366aa94391dfe07c4e0fb" | ||
sha256 cellar: :any, catalina: "671a3cc9c7dafd89cbaffeccf4de826262c144184bf5779320c236e87e7636cc" | ||
sha256 cellar: :any, mojave: "8b2876610f9188e8125f636e85bcbd525343b216c6d0787954e78b88dfe8f101" | ||
end | ||
|
||
depends_on "autoconf" => :build | ||
depends_on "automake" => :build | ||
depends_on "libtool" => :build | ||
depends_on "pkg-config" => :build | ||
depends_on "flac" | ||
depends_on "libogg" | ||
depends_on "libvorbis" | ||
depends_on "opus" | ||
|
||
def install | ||
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.12" | ||
system "autoreconf", "-fvi" | ||
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" | ||
system "make", "install" | ||
end | ||
|
||
test do | ||
output = shell_output("#{bin}/sndfile-info #{test_fixtures("test.wav")}") | ||
assert_match "Duration : 00:00:00.064", output | ||
end | ||
end |
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,60 @@ | ||
class Libvorbis < Formula | ||
desc "Vorbis General Audio Compression Codec" | ||
homepage "https://xiph.org/vorbis/" | ||
url "https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz" | ||
sha256 "b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b" | ||
license "BSD-3-Clause" | ||
|
||
bottle do | ||
sha256 cellar: :any, arm64_big_sur: "07ab1118fc6d389a8b0506d0b74a3cfc12026a837c8f2609b2133318c8818c81" | ||
sha256 cellar: :any, big_sur: "05e639c274f52924cbf31fb4337888ab51554a66597486aeed8e5942d267c586" | ||
sha256 cellar: :any, catalina: "432eb21045d9dfac3ef879648d845d894cc828862f5498448fe98c0141ef5cd0" | ||
sha256 cellar: :any, mojave: "59509a351e88352f01512b54cc5cb849c2551623f7d6dcd6679d38b5e96032ed" | ||
sha256 cellar: :any, high_sierra: "3e6609520d0ffd7179f721c23c1291f2735b70384d56d1c1dd10185ae355c4b2" | ||
end | ||
|
||
head do | ||
url "https://gitlab.xiph.org/xiph/vorbis.git" | ||
|
||
depends_on "autoconf" => :build | ||
depends_on "automake" => :build | ||
depends_on "libtool" => :build | ||
end | ||
|
||
depends_on "pkg-config" => :build | ||
depends_on "libogg" | ||
|
||
resource("oggfile") do | ||
url "https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg" | ||
sha256 "379071af4fa77bc7dacf892ad81d3f92040a628367d34a451a2cdcc997ef27b0" | ||
end | ||
|
||
def install | ||
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.12" | ||
system "./autogen.sh" if build.head? | ||
system "./configure", "--disable-dependency-tracking", | ||
"--prefix=#{prefix}" | ||
system "make", "install" | ||
end | ||
|
||
test do | ||
(testpath/"test.c").write <<~EOS | ||
#include <stdio.h> | ||
#include <assert.h> | ||
#include "vorbis/vorbisfile.h" | ||
int main (void) { | ||
OggVorbis_File vf; | ||
assert (ov_open_callbacks (stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) >= 0); | ||
vorbis_info *vi = ov_info (&vf, -1); | ||
printf("Bitstream is %d channel, %ldHz\\n", vi->channels, vi->rate); | ||
printf("Encoded by: %s\\n", ov_comment(&vf,-1)->vendor); | ||
return 0; | ||
} | ||
EOS | ||
testpath.install resource("oggfile") | ||
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lvorbisfile", | ||
"-o", "test" | ||
assert_match "2 channel, 44100Hz\nEncoded by: Xiph.Org libVorbis", | ||
shell_output("./test < Example.ogg") | ||
end | ||
end |