Skip to content

Commit 80c58f8

Browse files
authored
Add Windows MinGW Static Library (@neptoess, #564)
Co-authored-by: neptoess <[email protected]>
1 parent 1d8e14f commit 80c58f8

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: go
22
osx_image: xcode9.2
3+
go_import_path: github.com/confluentinc/confluent-kafka-go
34
env:
45
global:
56
- PATH="$PATH:$GOPATH/bin"
@@ -46,6 +47,16 @@ jobs:
4647
- LD_LIBRARY_PATH="$HOME/gopath/src/github.com/confluentinc/confluent-kafka-go/tmp-build/lib"
4748
- DYLD_LIBRARY_PATH="$HOME/gopath/src/github.com/confluentinc/confluent-kafka-go/tmp-build/lib"
4849
- LIBRDKAFKA_VERSION=master
50+
- name: "Go 1.16 Windows bundled librdkafka"
51+
go: "1.16"
52+
os: windows
53+
env:
54+
- EXPECT_LINK_INFO="static"
55+
- name: "Go 1.14 Windows bundled librdkafka"
56+
go: "1.14"
57+
os: windows
58+
env:
59+
- EXPECT_LINK_INFO="static"
4960

5061
before_install:
5162
- if [[ $TRAVIS_OS_NAME == linux ]]; then wget -qO - https://packages.confluent.io/deb/5.4/archive.key | sudo apt-key add - ; fi
@@ -55,6 +66,13 @@ before_install:
5566
- rm -rf tmp-build
5667
- if [[ -n $BUILD_TYPE ]]; then bash mk/bootstrap-librdkafka.sh ${LIBRDKAFKA_VERSION} tmp-build ; fi
5768
- go get -u golang.org/x/lint/golint && touch .do_lint
69+
- |-
70+
case $TRAVIS_OS_NAME in
71+
windows)
72+
./mk/setup-msys2-mingw64.sh
73+
export PATH=/C/tools/msys64/mingw64/bin:$PATH
74+
export MAKE=mingw32-make # so that Autotools can find it
75+
esac
5876
5977
install:
6078
- for dir in kafka examples ; do (cd $dir && go get ${BUILD_TYPE} ./...) ; done

kafka/librdkafka_vendor/bundle-import.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $build_tag
6969
7070
package kafka
7171
72-
// #cgo CFLAGS: -DUSE_VENDORED_LIBRDKAFKA
72+
// #cgo CFLAGS: -DUSE_VENDORED_LIBRDKAFKA -DLIBRDKAFKA_STATICLIB
7373
// #cgo LDFLAGS: \${SRCDIR}/librdkafka_vendor/${dpath} $dynlibs
7474
import "C"
7575
@@ -99,7 +99,7 @@ for f in rdkafka.h LICENSES.txt ; do
9999
done
100100

101101

102-
for btype in glibc_linux musl_linux darwin ; do
102+
for btype in glibc_linux musl_linux darwin windows ; do
103103
lib=$bdir/librdkafka_${btype}.a
104104
pc=${lib/%.a/.pc}
105105
[[ -f $lib ]] || (echo "Expected file $lib missing" ; exit 1)

mk/setup-msys2-mingw64.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# From https://docs.travis-ci.com/user/reference/windows/#how-do-i-use-msys2
3+
4+
set -e
5+
6+
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
7+
choco uninstall -y mingw
8+
choco upgrade --no-progress -y msys2
9+
export msys2='cmd //C RefreshEnv.cmd '
10+
export msys2+='& set MSYS=winsymlinks:nativestrict '
11+
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
12+
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
13+
export msys2+=" -msys2 -c "\"\$@"\" --"
14+
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain
15+
## Install more MSYS2 packages from https://packages.msys2.org/base here
16+
taskkill //IM gpg-agent.exe //F || true # https://travis-ci.community/t/4967

0 commit comments

Comments
 (0)