]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo: re-enable testso
authorFrancisco Souza <franciscossouza@gmail.com>
Thu, 8 Mar 2012 17:13:41 +0000 (12:13 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 8 Mar 2012 17:13:41 +0000 (12:13 -0500)
The test.bash file generates .so file using gcc, builds the executable
using the go tool and then run it with the $LD_LIBRARY_PATH variable
pointing to the directory where the .so file lives.

Fixes #2982.

R=rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/5788043

.hgignore
misc/cgo/testso/Makefile [deleted file]
misc/cgo/testso/cgoso.go
misc/cgo/testso/cgoso_c.c
misc/cgo/testso/main.go
misc/cgo/testso/test.bash
src/run.bash

index 2a84753035a7ff63723f1781d5d0ba31aeb3eeb3..d6ba72c6bc1be956223c27116a899409995afc8f 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -27,6 +27,7 @@ doc/tmpltohtml
 doc/articles/wiki/*.bin
 misc/cgo/life/run.out
 misc/cgo/stdio/run.out
+misc/cgo/testso/testso
 misc/dashboard/builder/builder
 misc/goplay/goplay
 misc/osx/*.pkg
diff --git a/misc/cgo/testso/Makefile b/misc/cgo/testso/Makefile
deleted file mode 100644 (file)
index e472cf2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2011 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../../src/Make.inc
-
-TARG=cgosotest
-
-CGO_DEPS+=libcgoso.so
-CGO_LDFLAGS+=-lcgoso -L.
-CLEANFILES+=out libcgoso.so
-CGOFILES=\
-       cgoso.go\
-
-include ../../../src/Make.pkg
-
-libcgoso.so: cgoso_c.c
-       gcc cgoso_c.c -fPIC -o $@ $(_CGO_CFLAGS_$(GOARCH)) $(_CGO_LDFLAGS_$(GOOS))
-
-out: install main.go
-       $(GC) $(GCFLAGS) $(GCIMPORTS) main.go
-       $(LD) -o $@ main.$O
index 6eb9f40e38a89e1d8766b793d2b2ee8d0edda287..44fb616c11821fd15d3da2710b3f6b2ea694f7bd 100644 (file)
@@ -4,7 +4,10 @@
 
 package cgosotest
 
-//void sofunc(void);
+/*
+#cgo LDFLAGS: -L. -lcgosotest
+void sofunc(void);
+*/
 import "C"
 
 func Test() {
index e29f7e8071c4daef6f6dab3eb7dd23fa1c45f237..8c15a6b9ff2003e54a0ca91fd551afb7285fb0c1 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 void sofunc(void)
 {
        extern void goCallback(void);
index 672ab262be52a5513511408e0789c50f09bcd9b2..88aa4322d242cf7adc33c0d57b4aa727166f6640 100644 (file)
@@ -2,9 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build ignore
+
 package main
 
-import "cgosotest"
+import "."
 
 func main() {
        cgosotest.Test()
index f275eb5723c46fdb943952dd85e7234b506b4f94..119fd64827281e9eda35a4d6782a828054fa54d0 100755 (executable)
@@ -4,6 +4,7 @@
 # license that can be found in the LICENSE file.
 
 set -e
-gomake out
-LD_LIBRARY_PATH=. ./out
-gomake clean
+gcc -fPIC -g -shared -o libcgosotest.so cgoso_c.c
+go build main.go
+LD_LIBRARY_PATH=. ./main
+rm -f libcgosotest.so main
index e97f55a0ba92d73a57ba36ba0b629e3600c06e04..0e4600b0adb5b829408a66daafd38b8ee516608f 100755 (executable)
@@ -55,12 +55,10 @@ xcd() {
 go test
 ) || exit $?
 
-$BROKEN ||
 [ "$CGO_ENABLED" != 1 ] ||
 [ "$GOHOSTOS" == windows ] ||
 [ "$GOHOSTOS" == darwin ] ||
 (xcd ../misc/cgo/testso
-"$GOMAKE" clean
 ./test.bash
 ) || exit $?