From: Hraban Luyat Date: Thu, 19 Feb 2015 12:38:49 +0000 (+0000) Subject: Change build parameters X-Git-Tag: v2.0.0~125 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3d85edebb38bc7b90dd4bad892ca08b11e6ab3e1;p=go-opus.git Change build parameters --- diff --git a/.gitignore b/.gitignore index 5672336..a044066 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ _testmain.go # Just noise *~ *.orig + +libopus.a diff --git a/Makefile b/Makefile index 6911bde..62fc862 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,5 @@ BUILDDIR := libopusbuild -export CGO_LDFLAGS := -L$(BUILDDIR)/lib -export CGO_CFLAGS := -I$(BUILDDIR)/include - .PHONY: libopus clean default test build default: libopus @@ -24,7 +21,8 @@ libopus/autogen.sh: libopus: libopus/config.h $(MAKE) -C libopus $(MAKE) -C libopus install + cp $(BUILDDIR)/lib/libopus.a . -clean: - $(MAKE) -C libopus clean - rm -rf $(BUILDDIR) libopus/configure.h +%clean: + $(MAKE) -C libopus $@ + rm -rf $(BUILDDIR) libopus/configure.h diff --git a/api.go b/api.go index 24f76db..9cd149b 100644 --- a/api.go +++ b/api.go @@ -1,3 +1,5 @@ +// Copyright © 2015 Hraban Luyat + package opus import ( @@ -6,9 +8,17 @@ import ( ) /* -#cgo CFLAGS: -std=c99 -Wall -Werror -pedantic -// Statically link libopus -#cgo LDFLAGS: libopusbuild/lib/libopus.a -lm +// Statically link libopus. Requires a libopus.a in every directory you use this +// as a dependency in. Not great, but CGO doesn't offer anything better, right +// now. Unless you require everyone who USES this package to instal have libopus +// installed system-wide, which is more of a chore because it's so new. Everyone +// will end up having to build it from source anyway, might as well just dump +// the pre-built lib in here. At least it will be up to the package maintainer, +// not the user. +// +// If I missed something, and somebody knows a better way: please let me know. +#cgo LDFLAGS: libopus.a -lm +#cgo CFLAGS: -std=c99 -Wall -Werror -pedantic -Ilibopusbuild/include #include */ import "C" diff --git a/opus_test.go b/opus_test.go index 5109668..74affc6 100644 --- a/opus_test.go +++ b/opus_test.go @@ -40,4 +40,5 @@ func Test_loop(t *testing.T) { const FRAME_SIZE = SAMPLE_RATE * FRAME_SIZE_MS / 1000 pcm := make([]float32, FRAME_SIZE) //you know what I'll finish this later + _ = pcm }