Skip to content
Myr

Merge pull request #380 from acornejo/android

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add android build: `make android`

authored by Junegunn Choi · committed by Junegunn Choi · parents 1c20255, 28ffb96 · Browse files · 3 files+78 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+78 added−7 removed

  • other:+78 added−7 removed

3 files+78 added−7 removed

modified:src/curses/curses.go+7 added-1 removed
3 unmodified lines
4#include <ncurses.h>5#include <locale.h>6#cgo !static LDFLAGS: -lncurses7#cgo static LDFLAGS: -l:libncursesw.a -l:libtinfo.a -l:libgpm.a -ldl8#cgo android static LDFLAGS: -l:libncurses.a -fPIE -march=armv7-a -mfpu=neon -mhard-float -Wl,--no-warn-mismatch910SCREEN *c_newterm () {11 return newterm(NULL, stderr, stdin);12}1314*/15import "C"1617import (
247 unmodified lines
265 // syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))266 }267268 C.setlocale(C.LC_ALL, C.CString(""))263 _screen = C.newterm(nil, C.stderr, C.stdin)269 _screen = C.c_newterm()270 if _screen == nil {271 fmt.Println("Invalid $TERM: " + os.Getenv("TERM"))272 os.Exit(2)273 }
288 unmodified lines
added:src/Dockerfile.android+44 added
1FROM ubuntu:14.042MAINTAINER Junegunn Choi <junegunn.c@gmail.com>34# apt-get5RUN apt-get update && apt-get -y upgrade && \6 apt-get install -y --force-yes git curl build-essential78# Install Go 1.49RUN cd / && curl \10 https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \11 tar -xz && mv go go1.4 && \12 sed -i 's@#define PTHREAD_KEYS_MAX 128@@' /go1.4/src/runtime/cgo/gcc_android_arm.c1314ENV GOPATH /go15ENV GOROOT /go1.416ENV PATH /go1.4/bin:$PATH1718RUN cd / && \19 curl -O http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin && \20 chmod 755 /android-ndk* && /android-ndk-r10e-linux-x86_64.bin && \21 mv android-ndk-r10e /android-ndk2223RUN cd /android-ndk && bash ./build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=/ndk --arch=arm2425ENV NDK_CC /ndk/bin/arm-linux-androideabi-gcc2627RUN cd $GOROOT/src && \28 CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash2930RUN cd / && curl \31 http://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz | \32 tar -xz && cd /ncurses-5.9 && \33 ./configure CC=$NDK_CC CFLAGS="-fPIE -march=armv7-a -mfpu=neon -mhard-float -Wl,--no-warn-mismatch" LDFLAGS="-march=armv7-a -Wl,--no-warn-mismatch" --host=arm-linux --enable-overwrite --enable-const --without-cxx-binding --without-shared --without-debug --enable-widec --enable-ext-colors --enable-ext-mouse --enable-pc-files --with-pkg-config-libdir=$PKG_CONFIG_LIBDIR --without-manpages --without-ada --disable-shared --without-tests --prefix=/ndk/sysroot/usr --with-default-terminfo-dirs=/usr/share/terminfo --with-terminfo-dirs=/usr/share/terminfo ac_cv_header_locale_h=n ac_cv_func_getpwent=no ac_cv_func_getpwnam=no ac_cv_func_getpwuid=no && \34 sed -i 's@#define HAVE_LOCALE_H 1@/* #undef HAVE_LOCALE_H */@' include/ncurses_cfg.h && \35 make && \36 sed -i '0,/echo.*/{s/echo.*/exit 0/}' misc/run_tic.sh && \37 make install && \38 mv /ndk/sysroot/usr/lib/libncursesw.a /ndk/sysroot/usr/lib/libncurses.a3940# Volume41VOLUME /go4243# Default CMD44CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
modified:src/Makefile+27 added-6 removed
1ifndef GOPATH2$(error GOPATH is undefined)3endif45ifndef GOOS6UNAME_S := $(shell uname -s)7ifeq ($(UNAME_S),Darwin)8 GOOS := darwin9else ifeq ($(UNAME_S),Linux)10 GOOS := linux11endif12endif1314ifneq ($(shell uname -m),x86_64)15$(error "Build on $(UNAME_M) is not supported, yet.")16endif1718SOURCES := $(wildcard *.go */*.go)19BINDIR := ../bin2019BINARY32 := fzf-$(GOOS)_38620BINARY64 := fzf-$(GOOS)_amd6421VERSION = $(shell fzf/$(BINARY64) --version)22RELEASE32 = fzf-$(VERSION)-$(GOOS)_38623RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd6421BINARY32 := fzf-$(GOOS)_38622BINARY64 := fzf-$(GOOS)_amd6423BINARYARM7 := fzf-$(GOOS)_arm724VERSION := $(shell awk -F= '/version =/ {print $$2}' constants.go | tr -d "\" ")25RELEASE32 = fzf-$(VERSION)-$(GOOS)_38626RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd6427RELEASEARM7 = fzf-$(VERSION)-$(GOOS)_arm72829all: release3031release: build
2 unmodified lines
34 rm -f $(RELEASE32) $(RELEASE64)3536build: test fzf/$(BINARY32) fzf/$(BINARY64)3738android-build:39 cd fzf && GOARCH=arm GOARM=7 CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $(BINARYARM7)40 cd fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7) && \41 rm -f $(RELEASEARM7)4243test:44 go get45 go test -v ./...46
26 unmodified lines
7374docker-centos:75 docker build -t junegunn/centos-sandbox - < Dockerfile.centos7677docker-android:78 docker build -t junegunn/android-sandbox - < Dockerfile.android7980arch: docker-arch81 docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \82 sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'83
8 unmodified lines
92linux: docker-centos93 docker run -i -t -v $(GOPATH):/go junegunn/centos-sandbox \94 /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make TAGS=static'9596ubuntu-android: docker-android97 docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \98 sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'99100android: docker-android101 docker run -i -t -v $(GOPATH):/go junegunn/android-sandbox \102 /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; GOOS=android make android-build'103104.PHONY: all build release test install uninstall clean docker \85 linux arch ubuntu centos docker-arch docker-ubuntu docker-centos105 linux arch ubuntu centos docker-arch docker-ubuntu docker-centos \106 android-build docker-android ubuntu-android android