BUILDDIR := libopusbuild
-export CGO_LDFLAGS := -L$(BUILDDIR)/lib
-export CGO_CFLAGS := -I$(BUILDDIR)/include
-
.PHONY: libopus clean default test build
default: libopus
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
+// Copyright © 2015 Hraban Luyat <hraban@0brg.net>
+
package opus
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"
const FRAME_SIZE = SAMPLE_RATE * FRAME_SIZE_MS / 1000
pcm := make([]float32, FRAME_SIZE)
//you know what I'll finish this later
+ _ = pcm
}