]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: support building on debian/kFreeBSD
authorDave Cheney <dave@cheney.net>
Mon, 3 Dec 2012 21:27:30 +0000 (08:27 +1100)
committerDave Cheney <dave@cheney.net>
Mon, 3 Dec 2012 21:27:30 +0000 (08:27 +1100)
The debian/kFreeBSD project uses the FreeBSD kernel and the debian userspace. From our point of view, this is freebsd not linux as GOOS talks about the kernel syscall interface, not the userspace (although cgo alters that). As debian/kFreeBSD is experimental at this time, I do not think it is worth the effort of duplicating all the freebsd specific code so this is proposal represents a reasonable workaround.

Currently cgo is not supported, make.bash will detect this and disable cgo automatically during the build.

dfc@debian:~/go/src$ uname -a
GNU/kFreeBSD debian 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386 Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz GNU/kFreeBSD
dfc@debian:~/go/src$ ../bin/go version
go version devel +d05272f402ec Sat Dec 01 15:15:14 2012 -0800

Tested with GOOS=freebsd GOARCH=386

R=golang-dev
CC=golang-dev
https://golang.org/cl/6868046

src/cmd/dist/unix.c
src/make.bash

index 607f904acbd260d13a669903eb7620ffee5e74e6..b82bf1ddbd9bca9fd769fd8b4b493388c25b4be3 100644 (file)
@@ -670,6 +670,10 @@ main(int argc, char **argv)
        gohostos = "linux";
 #elif defined(__FreeBSD__)
        gohostos = "freebsd";
+#elif defined(__FreeBSD_kernel__)
+       // detect debian/kFreeBSD. 
+       // http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ#Q._How_do_I_detect_kfreebsd_with_preprocessor_directives_in_a_C_program.3F
+       gohostos = "freebsd";   
 #elif defined(__OpenBSD__)
        gohostos = "openbsd";
 #elif defined(__NetBSD__)
index b2de37b7245f0aaf3729a41130af66b0c7a4d9dd..1190b93ffaee03acf7cf9f653232f8996027f651 100755 (executable)
@@ -77,6 +77,13 @@ do
        fi
 done
 
+# Test for debian/kFreeBSD.
+# cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to
+# disable cgo manually.
+if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then
+        export CGO_ENABLED=0
+fi
+
 # Clean old generated file that will cause problems in the build.
 rm -f ./pkg/runtime/runtime_defs.go