From acaa305dfaa75fb95ddf614ebb5c05ecb2387fb6 Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Wed, 17 May 2017 00:32:19 -0400 Subject: [PATCH] adds linux build of pa_shim, removes Suppressor dependency --- .gitignore | 1 - LICENSE | 6 ++++++ REQUIRE | 1 - deps/src/Makefile | 4 ++-- deps/usr/lib/pa_shim.so | Bin 0 -> 8536 bytes src/PortAudio.jl | 3 ++- src/pa_shim.jl | 7 +++---- src/suppressor.jl | 20 ++++++++++++++++++++ test/runtests.jl | 3 +-- 9 files changed, 34 insertions(+), 11 deletions(-) create mode 100755 deps/usr/lib/pa_shim.so create mode 100644 src/suppressor.jl diff --git a/.gitignore b/.gitignore index d86d68c..d7bc517 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ *.swp -*.so *.o deps/deps.jl *.wav diff --git a/LICENSE b/LICENSE index 0f797a9..04c37c2 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +suppressor.jl includes code from the Suppressor.jl package, licensed under the +MIT "Expat" License: + +Copyright (c) 2016: Ismael Venegas Castelló. diff --git a/REQUIRE b/REQUIRE index 297f03f..3a091fe 100644 --- a/REQUIRE +++ b/REQUIRE @@ -2,6 +2,5 @@ julia 0.6- BinDeps SampledSignals 0.3.0 RingBuffers 1.0.0 -Suppressor @osx Homebrew @windows WinRPM diff --git a/deps/src/Makefile b/deps/src/Makefile index 160c4bd..7c87b0a 100644 --- a/deps/src/Makefile +++ b/deps/src/Makefile @@ -17,7 +17,7 @@ endif # file extensions and platform-specific libs ifeq ($(OS), WINNT) LIBS += - LDFLAGS += -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer + LDFLAGS += -shared -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer INC += SHACMD = sha256sum SHLIB_EXT = dll @@ -32,7 +32,7 @@ else ifeq ($(OS), Darwin) else LIBS += INC += - LDFLAGS += -L../../../RingBuffers/deps/usr/lib -lpa_ringbuffer + LDFLAGS += -shared SHLIB_EXT = so SHACMD = sha256sum endif diff --git a/deps/usr/lib/pa_shim.so b/deps/usr/lib/pa_shim.so new file mode 100755 index 0000000000000000000000000000000000000000..228a44d1f3a98412d8a8a3c3238139445d4e1b11 GIT binary patch literal 8536 zcmd^EZE##w89tkBnv|y5w1C7GWyMws!pj z0OLNo#rG_OZ$bm9J>Ej?4tqiHAqf2ZKLME^ZU7JC@s=|H{Ni>34||otC-7YDgZ~!T zS|7Yaw(|;cpebA-ErMGou*g=~a8^loOZ{eX(4+rTrGHfEuUG5hy9&=LoaU8ExANnS zOJlPRK@ZePHRtC85?>=8UhP13Mc0S3xiP(98F@?Bg`OG9SVB*O2z~edem!O8&EZVJ zGV}ZUdq;C)=6+*n)U;*(5D5~!t&w(TnAJprr&x*&bXG3A>kM=UB8Oncg%&mUlq-Tt5;5X(U0s-w{88em ziwn<7K2JP#ZQ%*Y-$6W0$-=bchlr=HEF6>kKkC9FJq=zKZL0egC}>l)L7K<>@tigpU(_aJ zU{B58d9hr^NCfV!I~6}i6W|D^`p>;cGo+P%Mv4!RqHP$a(Za|{FJWzR0NxUvTItv2 z+3D9#%3xEqo8fHGW+vW_A@aOdDxTI#19Mubf3~j_f3>gFKLaN-S}A@O6iv|9pwIc*=aZJ~Q={;L3oWc<9AoCQ9ob)C>c zJ5K;p5$dV!*EkGpbZN6lz46$fThuBU<>QVC>_1G*WULw0OJUa)KOfo?KVOQI6DO23 zyWMGubTrwIQINygg{aCUby^N5R4@XQ1E7h`ayZHQQSGMqTwyIKzl@=f{e1JhV@(|j zeeUZJI6WXgcrW`;t5`2BY5T^Cs#uFE)}V}K&;6;jx^RNslLo!kI#N&p=!$uf;UCc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7lSixd9KipZ9Ni izqsvg`)S&&P$oUjIj$|W&!&F%8`RbEJyulIYyVHmTFGeu literal 0 HcmV?d00001 diff --git a/src/PortAudio.jl b/src/PortAudio.jl index 46d3daf..61841e6 100644 --- a/src/PortAudio.jl +++ b/src/PortAudio.jl @@ -4,7 +4,7 @@ module PortAudio using SampledSignals using RingBuffers -using Suppressor +#using Suppressor using Base: AsyncCondition @@ -14,6 +14,7 @@ import Base: read, read!, write, flush # Get binary dependencies loaded from BinDeps include("../deps/deps.jl") +include("suppressor.jl") include("pa_shim.jl") include("libportaudio.jl") diff --git a/src/pa_shim.jl b/src/pa_shim.jl index 040b896..acd81fa 100644 --- a/src/pa_shim.jl +++ b/src/pa_shim.jl @@ -1,8 +1,7 @@ -const libpa_shim = Libdl.find_library( - ["pa_shim"], - [joinpath(dirname(@__FILE__), "..", "deps", "usr", "lib")]) - function init_pa_shim() + global const libpa_shim = Libdl.find_library( + ["pa_shim"], + [joinpath(dirname(@__FILE__), "..", "deps", "usr", "lib")]) shim_dlib = Libdl.dlopen(libpa_shim) # pointer to the shim's process callback global const shim_processcb_c = Libdl.dlsym(shim_dlib, :pa_shim_processcb) diff --git a/src/suppressor.jl b/src/suppressor.jl new file mode 100644 index 0000000..ab297bc --- /dev/null +++ b/src/suppressor.jl @@ -0,0 +1,20 @@ +# while waiting for this PR to get merged: https://github.com/Ismael-VC/Suppressor.jl/pull/12 +# we'll just include the relevant code here + +macro suppress_err(block) + quote + if ccall(:jl_generating_output, Cint, ()) == 0 + ORIGINAL_STDERR = STDERR + err_rd, err_wr = redirect_stderr() + err_reader = @async readstring(err_rd) + end + + value = $(esc(block)) + + if ccall(:jl_generating_output, Cint, ()) == 0 + redirect_stderr(ORIGINAL_STDERR) + close(err_wr) + end + value + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 5cade49..f6df19d 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -201,8 +201,7 @@ end PortAudio.versioninfo(io) result = split(String(take!((io))), "\n") # make sure this is the same version I tested with - @test startswith(result[1], "PortAudio V19-devel") - @test result[2] == "Version: 1899" + @test startswith(result[1], "PortAudio V19") @test result[3] == "Shim Source Hash: 4ea2a8526b" end