summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-07 00:24:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-07 00:24:05 +0900
commitb277f5ae6fe9b263410945796263aa52d95d4ab5 (patch)
tree589070ca8340c9dd2be7e8b0906d0a2ca178f991 /src
parent6109a0fe4442007cb3cd3df53730f74418ceaf37 (diff)
downloadfzf-b277f5ae6fe9b263410945796263aa52d95d4ab5.tar.gz
Fix i386 build
Diffstat (limited to 'src')
-rw-r--r--src/Dockerfile.arch6
-rw-r--r--src/Makefile2
-rw-r--r--src/README.md7
-rw-r--r--src/curses/curses.go23
4 files changed, 22 insertions, 16 deletions
diff --git a/src/Dockerfile.arch b/src/Dockerfile.arch
index 9fa4ea3c..8f942db2 100644
--- a/src/Dockerfile.arch
+++ b/src/Dockerfile.arch
@@ -13,6 +13,12 @@ ENV GOPATH /go
ENV GOROOT /go1.4
ENV PATH /go1.4/bin:$PATH
+# For i386 build
+RUN echo '[multilib]' >> /etc/pacman.conf && \
+ echo 'Include = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf && \
+ pacman-db-upgrade && yes | pacman -Sy gcc-multilib lib32-ncurses && \
+ cd $GOROOT/src && GOARCH=386 ./make.bash
+
# Symlink fzf directory
RUN mkdir -p /go/src/github.com/junegunn && \
ln -s /fzf /go/src/github.com/junegunn/fzf
diff --git a/src/Makefile b/src/Makefile
index 3e57a178..12767d3a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -45,7 +45,7 @@ clean:
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
# Linux distribution to build fzf on
-DISTRO := ubuntu
+DISTRO := arch
docker:
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)
diff --git a/src/README.md b/src/README.md
index 70b2c1d1..06b915a2 100644
--- a/src/README.md
+++ b/src/README.md
@@ -29,10 +29,9 @@ make linux
System requirements
-------------------
-Currently prebuilt binaries are provided only for 64 bit OS X and Linux.
-The install script will fall back to the legacy Ruby version on the other
-systems, but if you have Go installed, you can try building it yourself.
-(`make install`)
+Currently prebuilt binaries are provided only for OS X and Linux. The install
+script will fall back to the legacy Ruby version on the other systems, but if
+you have Go installed, you can try building it yourself. (`make install`)
However, as pointed out in [golang.org/doc/install][req], the Go version will
not run on CentOS/RHEL 5.x and thus the install script will choose the Ruby
diff --git a/src/curses/curses.go b/src/curses/curses.go
index 945a3ce4..e4a65756 100644
--- a/src/curses/curses.go
+++ b/src/curses/curses.go
@@ -1,8 +1,15 @@
package curses
-// #include <ncurses.h>
-// #include <locale.h>
-// #cgo LDFLAGS: -lncurses
+/*
+#include <ncurses.h>
+#include <locale.h>
+#cgo LDFLAGS: -lncurses
+void swapOutput() {
+ FILE* temp = stdout;
+ stdout = stderr;
+ stderr = temp;
+}
+*/
import "C"
import (
@@ -162,7 +169,7 @@ func Init(color bool, color256 bool, black bool, mouse bool) {
// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
}
- swapOutput()
+ C.swapOutput()
C.setlocale(C.LC_ALL, C.CString(""))
C.initscr()
@@ -218,13 +225,7 @@ func Init(color bool, color256 bool, black bool, mouse bool) {
func Close() {
C.endwin()
- swapOutput()
-}
-
-func swapOutput() {
- syscall.Dup2(2, 3)
- syscall.Dup2(1, 2)
- syscall.Dup2(3, 1)
+ C.swapOutput()
}
func GetBytes() []byte {