summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-09-19 18:33:25 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-09-19 18:33:25 +0900
commit6bc3fe6e67e1a9f6d80d47c03dc6f4f3f4453380 (patch)
tree945db90ae0efc8d42ef47c0bfc2ce1a51e256c07 /src
parent93988780484c9e77dc468ed7e1b9be05c7335f7d (diff)
downloadfzf-6bc3fe6e67e1a9f6d80d47c03dc6f4f3f4453380.tar.gz
Build partially-static binary for linux (#350)
Instead of building a separate statically-linked binary, build partially-static binary that only contains ncurses to avoid compatibility issues in libc.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile33
-rw-r--r--src/curses/curses.go4
2 files changed, 10 insertions, 27 deletions
diff --git a/src/Makefile b/src/Makefile
index 3304f57d..dee7e805 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,19 +5,8 @@ endif
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GOOS := darwin
- LDFLAGS :=
-ifdef STATIC
-$(error Static linking not possible on OS X)
-endif
else ifeq ($(UNAME_S),Linux)
GOOS := linux
-ifdef STATIC
- SUFFIX := -static
- LDFLAGS := --ldflags '-extldflags "-static -ltinfo -lgpm"'
-else
- SUFFIX :=
- LDFLAGS :=
-endif
endif
ifneq ($(shell uname -m),x86_64)
@@ -27,11 +16,11 @@ endif
SOURCES := $(wildcard *.go */*.go)
BINDIR := ../bin
-BINARY32 := fzf-$(GOOS)_386$(SUFFIX)
-BINARY64 := fzf-$(GOOS)_amd64$(SUFFIX)
+BINARY32 := fzf-$(GOOS)_386
+BINARY64 := fzf-$(GOOS)_amd64
VERSION = $(shell fzf/$(BINARY64) --version)
-RELEASE32 = fzf-$(VERSION)-$(GOOS)_386$(SUFFIX)
-RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64$(SUFFIX)
+RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
+RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
all: release
@@ -40,11 +29,7 @@ release: build
cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \
rm -f $(RELEASE32) $(RELEASE64)
-ifndef STATIC
build: test fzf/$(BINARY32) fzf/$(BINARY64)
-else
-build: test fzf/$(BINARY64)
-endif
test:
go get
@@ -85,13 +70,9 @@ ubuntu: docker-ubuntu
docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
-linux: docker-arch
- docker run -i -t -v $(GOPATH):/go junegunn/arch-sandbox \
- /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
-
-linux-static: docker-ubuntu
+linux: docker-ubuntu
docker run -i -t -v $(GOPATH):/go junegunn/ubuntu-sandbox \
- /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make STATIC=1'
+ /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
.PHONY: all build release test install uninstall clean docker \
- linux linux-static arch ubuntu docker-arch docker-ubuntu
+ linux arch ubuntu docker-arch docker-ubuntu
diff --git a/src/curses/curses.go b/src/curses/curses.go
index 59cea3b0..2c4cb0d4 100644
--- a/src/curses/curses.go
+++ b/src/curses/curses.go
@@ -3,7 +3,9 @@ package curses
/*
#include <ncurses.h>
#include <locale.h>
-#cgo LDFLAGS: -lncurses
+#cgo darwin LDFLAGS: -lncurses
+#cgo linux,386 LDFLAGS: -lncurses
+#cgo linux,amd64 LDFLAGS: -l:libncurses.a -l:libtinfo.a -l:libgpm.a
*/
import "C"