Use build tags to enable static linking

This commit is contained in:
Junegunn Choi 2015-09-22 13:16:10 +09:00
parent 5a60aa5050
commit ad7e433a7d
2 changed files with 5 additions and 6 deletions

View File

@ -44,10 +44,10 @@ clean:
cd fzf && rm -f fzf-* cd fzf && rm -f fzf-*
fzf/$(BINARY32): $(SOURCES) fzf/$(BINARY32): $(SOURCES)
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32) cd fzf && GOARCH=386 CGO_ENABLED=1 go build -a -o $(BINARY32)
fzf/$(BINARY64): $(SOURCES) fzf/$(BINARY64): $(SOURCES)
cd fzf && go build $(LDFLAGS) -o $(BINARY64) cd fzf && go build -a -tags "$(TAGS)" -o $(BINARY64)
$(BINDIR)/fzf: fzf/$(BINARY64) | $(BINDIR) $(BINDIR)/fzf: fzf/$(BINARY64) | $(BINDIR)
cp -f fzf/$(BINARY64) $(BINDIR) cp -f fzf/$(BINARY64) $(BINDIR)
@ -79,7 +79,7 @@ centos: docker-centos
linux: docker-centos linux: docker-centos
docker run -i -t -v $(GOPATH):/go junegunn/centos-sandbox \ docker run -i -t -v $(GOPATH):/go junegunn/centos-sandbox \
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make' /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make TAGS=static'
.PHONY: all build release test install uninstall clean docker \ .PHONY: all build release test install uninstall clean docker \
linux arch ubuntu centos docker-arch docker-ubuntu docker-centos linux arch ubuntu centos docker-arch docker-ubuntu docker-centos

View File

@ -3,9 +3,8 @@ package curses
/* /*
#include <ncurses.h> #include <ncurses.h>
#include <locale.h> #include <locale.h>
#cgo darwin LDFLAGS: -lncurses #cgo !static LDFLAGS: -lncurses
#cgo linux,386 LDFLAGS: -lncurses #cgo static LDFLAGS: -l:libncurses.a -l:libtinfo.a -l:libgpm.a -ldl
#cgo linux,amd64 LDFLAGS: -l:libncurses.a -l:libtinfo.a -l:libgpm.a -ldl
*/ */
import "C" import "C"