This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from vmarkovtsev/master
Add Windows installation instructions
- Loading branch information
Showing
8 changed files
with
146 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea | ||
|
||
# libuast source code | ||
*.c | ||
*.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Installing client-go on Windows | ||
|
||
There are two supported options how to build client-go on Windows: | ||
static linking using MinGW or dynamic linking with Visual Studio. | ||
The former does not require any external DLL files at runtime and is "Go style". | ||
|
||
## Prerequisites | ||
|
||
Same as for [libuast](https://github.com/src-d/libuast/blob/master/WINDOWS.md) | ||
and additionally: | ||
|
||
* MinGW is always required because CGo expects a GNU compiler under the hood. | ||
* MSVC++ option requires [pexports](https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.47/) | ||
|
||
The following options correspond to how `libuast` was built: CGo always | ||
uses MinGW internally. | ||
|
||
## MinGW static | ||
|
||
``` | ||
SET CGO_CFLAGS=-I%PREFIX%\include -DLIBUAST_STATIC | ||
SET CGO_LDFLAGS=-L%PREFIX%\lib -luast -lxml2 -static -lstdc++ -static-libgcc | ||
go get -v -tags custom_libuast gopkg.in/bblfsh/client-go.v2/... | ||
``` | ||
|
||
`-static-libstdc++` instead of `-static -lstdc++` may be used if works. | ||
|
||
## MSVC++ dynamic | ||
|
||
We use `dlltool` to build the interface static libraries to call the foreign DLLs. | ||
|
||
``` | ||
pexports %PREFIX%/bin/libxml2.dll > %PREFIX%/bin/libxml2.def | ||
dlltool -k --no-leading-underscore -d %PREFIX%/bin/libxml2.def -l %PREFIX%/lib/libxml2.a | ||
pexports %PREFIX%/bin/uast.dll > %PREFIX%/bin/uast.def | ||
dlltool -k --no-leading-underscore -d %PREFIX%/bin/libxml2.def -l %PREFIX%/lib/libuast.a | ||
SET CGO_CFLAGS=-I%PREFIX%\include | ||
SET CGO_LDFLAGS=-L%PREFIX%\lib -luast -lxml2 | ||
go get -v -tags custom_libuast gopkg.in/bblfsh/client-go.v2/... | ||
``` | ||
|
||
You have to carry `%PREFIX%\bin\libxml2.dll` and `%PREFIX%\bin\uast.dll` | ||
to the path where you call a Go binary which depends on client-go. | ||
You also need to install [Microsoft Visual C++ Redistributable](https://www.visualstudio.com/downloads/#title-39324) | ||
on clients. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: "{build}" | ||
platform: x64 | ||
image: Visual Studio 2017 | ||
|
||
matrix: | ||
allow_failures: | ||
- platform: x64 | ||
|
||
clone_folder: c:\gopath\src\gopkg.in\bblfsh\client-go.v2 | ||
|
||
environment: | ||
GOPATH: c:\gopath | ||
|
||
install: | ||
- choco install make | ||
- c:\msys64\usr\bin\pacman --noconfirm --needed -S mingw-w64-x86_64-toolchain | ||
|
||
build_script: | ||
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=% | ||
- set PATH=C:\msys64\mingw64\bin;%PATH% | ||
- make dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters