Skip to content

Commit d5d4e9f

Browse files
CGO: FreeBSD support
unixODBC libs/includes are installed under /usr/local via ports/pkg on a FreeBSD system. Also perl is unstalled under /usr/local/bin: Use "env" to launch the correct interpreter.
1 parent dcf9c6f commit d5d4e9f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

api/api_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin linux
5+
// +build darwin linux freebsd
66
// +build cgo
77

88
package api
99

1010
// #cgo darwin LDFLAGS: -lodbc
1111
// #cgo linux LDFLAGS: -lodbc
12+
// #cgo freebsd LDFLAGS: -L /usr/local/lib -lodbc
13+
// #cgo freebsd CFLAGS: -I/usr/local/include
1214
// #include <sql.h>
1315
// #include <sqlext.h>
1416
// #include <stdint.h>

api/mksyscall_unix.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/perl
1+
#!/usr/bin/env perl
22
# Copyright 2012 The Go Authors. All rights reserved.
33
# Use of this source code is governed by a BSD-style
44
# license that can be found in the LICENSE file.
@@ -114,7 +114,7 @@ ($)
114114
// Use of this source code is governed by a BSD-style
115115
// license that can be found in the LICENSE file.
116116
117-
// +build darwin linux
117+
// +build darwin linux freebsd
118118
// +build cgo
119119
120120
package $package
@@ -123,6 +123,8 @@ package $package
123123
124124
// #cgo darwin LDFLAGS: -lodbc
125125
// #cgo linux LDFLAGS: -lodbc
126+
// #cgo freebsd LDFLAGS: -L /usr/local/lib -lodbc
127+
// #cgo freebsd CFLAGS: -I/usr/local/include
126128
// #include <sql.h>
127129
// #include <sqlext.h>
128130
import "C"

api/zapi_unix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Use of this source code is governed by a BSD-style
66
// license that can be found in the LICENSE file.
77

8-
// +build darwin linux
8+
// +build darwin linux freebsd
99
// +build cgo
1010

1111
package api
@@ -14,6 +14,8 @@ import "unsafe"
1414

1515
// #cgo darwin LDFLAGS: -lodbc
1616
// #cgo linux LDFLAGS: -lodbc
17+
// #cgo freebsd LDFLAGS: -L /usr/local/lib -lodbc
18+
// #cgo freebsd CFLAGS: -I/usr/local/include
1719
// #include <sql.h>
1820
// #include <sqlext.h>
1921
import "C"

0 commit comments

Comments
 (0)