Fix i386 build

This commit is contained in:
Junegunn Choi 2015-01-07 00:24:05 +09:00
parent 6109a0fe44
commit b277f5ae6f
5 changed files with 29 additions and 22 deletions

13
install
View File

@ -15,6 +15,7 @@ check_binary() {
echo "- Checking fzf executable" echo "- Checking fzf executable"
echo -n " - " echo -n " - "
if ! "$fzf_base"/bin/fzf --version; then if ! "$fzf_base"/bin/fzf --version; then
rm -v "$fzf_base"/bin/fzf
binary_error="Error occurred" binary_error="Error occurred"
fi fi
} }
@ -33,7 +34,7 @@ download() {
return return
fi fi
local url=https://github.com/junegunn/fzf-bin/releases/download/snapshot/${1}.tgz local url=https://github.com/junegunn/fzf-bin/releases/download/$version/${1}.tgz
if which curl > /dev/null; then if which curl > /dev/null; then
curl -fL $url | tar -xz curl -fL $url | tar -xz
elif which wget > /dev/null; then elif which wget > /dev/null; then
@ -56,11 +57,11 @@ archi=$(uname -sm)
binary_available=1 binary_available=1
binary_error="" binary_error=""
case "$archi" in case "$archi" in
"Darwin x86_64") download fzf-$version-darwin_amd64 ;; Darwin\ x86_64) download fzf-$version-darwin_amd64 ;;
# "Darwin i[36]86") download fzf-$version-darwin_386 ;; Darwin\ i*86) download fzf-$version-darwin_386 ;;
"Linux x86_64") download fzf-$version-linux_amd64 ;; Linux\ x86_64) download fzf-$version-linux_amd64 ;;
# "Linux i[36]86") download fzf-$version-linux_386 ;; Linux\ i*86) download fzf-$version-linux_386 ;;
*) binary_available=0 ;; *) binary_available=0 ;;
esac esac
cd "$fzf_base" cd "$fzf_base"

View File

@ -13,6 +13,12 @@ ENV GOPATH /go
ENV GOROOT /go1.4 ENV GOROOT /go1.4
ENV PATH /go1.4/bin:$PATH 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 # Symlink fzf directory
RUN mkdir -p /go/src/github.com/junegunn && \ RUN mkdir -p /go/src/github.com/junegunn && \
ln -s /fzf /go/src/github.com/junegunn/fzf ln -s /fzf /go/src/github.com/junegunn/fzf

View File

@ -45,7 +45,7 @@ clean:
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
# Linux distribution to build fzf on # Linux distribution to build fzf on
DISTRO := ubuntu DISTRO := arch
docker: docker:
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO) docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)

View File

@ -29,10 +29,9 @@ make linux
System requirements System requirements
------------------- -------------------
Currently prebuilt binaries are provided only for 64 bit OS X and Linux. Currently prebuilt binaries are provided only for OS X and Linux. The install
The install script will fall back to the legacy Ruby version on the other script will fall back to the legacy Ruby version on the other systems, but if
systems, but if you have Go installed, you can try building it yourself. you have Go installed, you can try building it yourself. (`make install`)
(`make install`)
However, as pointed out in [golang.org/doc/install][req], the Go version will 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 not run on CentOS/RHEL 5.x and thus the install script will choose the Ruby

View File

@ -1,8 +1,15 @@
package curses package curses
// #include <ncurses.h> /*
// #include <locale.h> #include <ncurses.h>
// #cgo LDFLAGS: -lncurses #include <locale.h>
#cgo LDFLAGS: -lncurses
void swapOutput() {
FILE* temp = stdout;
stdout = stderr;
stderr = temp;
}
*/
import "C" import "C"
import ( import (
@ -162,7 +169,7 @@ func Init(color bool, color256 bool, black bool, mouse bool) {
// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd())) // syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
} }
swapOutput() C.swapOutput()
C.setlocale(C.LC_ALL, C.CString("")) C.setlocale(C.LC_ALL, C.CString(""))
C.initscr() C.initscr()
@ -218,13 +225,7 @@ func Init(color bool, color256 bool, black bool, mouse bool) {
func Close() { func Close() {
C.endwin() C.endwin()
swapOutput() C.swapOutput()
}
func swapOutput() {
syscall.Dup2(2, 3)
syscall.Dup2(1, 2)
syscall.Dup2(3, 1)
} }
func GetBytes() []byte { func GetBytes() []byte {