]> Sergey Matveev's repositories - go-opus.git/commitdiff
Change build parameters
authorHraban Luyat <hraban@0brg.net>
Thu, 19 Feb 2015 12:38:49 +0000 (12:38 +0000)
committerHraban Luyat <hraban@0brg.net>
Thu, 19 Feb 2015 12:38:49 +0000 (12:38 +0000)
.gitignore
Makefile
api.go
opus_test.go

index 5672336ec8649dd3662737ccb250df02cc65e34d..a04406672e63014369b8e4bb49a8efd02bddfcc6 100644 (file)
@@ -17,3 +17,5 @@ _testmain.go
 # Just noise
 *~
 *.orig
+
+libopus.a
index 6911bde4d079adf1381c8a86e10ffef8c578b841..62fc8626788a11a2b70d5ade696f42ae8b2dbd86 100644 (file)
--- 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 24f76dbceb71fb0b6d371c4200491bea845c5ccd..9cd149bac911c37bd947273913a54cf78e1c4b8d 100644 (file)
--- a/api.go
+++ b/api.go
@@ -1,3 +1,5 @@
+// Copyright © 2015 Hraban Luyat <hraban@0brg.net>
+
 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 <opus/opus.h>
 */
 import "C"
index 5109668583d135c3dc3aa0dbf974c83153d04f5d..74affc69c17c8c587b7f00cf0dad67acb3e448e4 100644 (file)
@@ -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
 }