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
Provenance
- Commit
e1df876- Tree
9779d56- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent 1
1c20255- Parent 2
28ffb96
3 files changed+78 added−7 removed
modified:src/curses/curses.go+7 added-1 removed
3 unmodified lines4 #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-mismatch9+10+SCREEN *c_newterm () {11+ return newterm(NULL, stderr, stdin);12+}13+14 */15 import "C"16 17 import (247 unmodified lines265 // syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))266 }267 268 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 linesadded:src/Dockerfile.android+44 added
1+FROM ubuntu:14.042+MAINTAINER Junegunn Choi <junegunn.c@gmail.com>3+4+# apt-get5+RUN apt-get update && apt-get -y upgrade && \6+ apt-get install -y --force-yes git curl build-essential7+8+# Install Go 1.49+RUN 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.c13+14+ENV GOPATH /go15+ENV GOROOT /go1.416+ENV PATH /go1.4/bin:$PATH17+18+RUN 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-ndk22+23+RUN cd /android-ndk && bash ./build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=/ndk --arch=arm24+25+ENV NDK_CC /ndk/bin/arm-linux-androideabi-gcc26+27+RUN cd $GOROOT/src && \28+ CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash29+30+RUN 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.a39+40+# Volume41+VOLUME /go42+43+# Default CMD44+CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bashmodified:src/Makefile+27 added-6 removed
1 ifndef GOPATH2 $(error GOPATH is undefined)3 endif4 5+ifndef GOOS6 UNAME_S := $(shell uname -s)7 ifeq ($(UNAME_S),Darwin)8 GOOS := darwin9 else ifeq ($(UNAME_S),Linux)10 GOOS := linux11 endif12+endif13 14 ifneq ($(shell uname -m),x86_64)15 $(error "Build on $(UNAME_M) is not supported, yet.")16 endif17 18 SOURCES := $(wildcard *.go */*.go)19 BINDIR := ../bin20 19-BINARY32 := fzf-$(GOOS)_38620-BINARY64 := fzf-$(GOOS)_amd6421-VERSION = $(shell fzf/$(BINARY64) --version)22-RELEASE32 = fzf-$(VERSION)-$(GOOS)_38623-RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd6421+BINARY32 := fzf-$(GOOS)_38622+BINARY64 := fzf-$(GOOS)_amd6423+BINARYARM7 := fzf-$(GOOS)_arm724+VERSION := $(shell awk -F= '/version =/ {print $$2}' constants.go | tr -d "\" ")25+RELEASE32 = fzf-$(VERSION)-$(GOOS)_38626+RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd6427+RELEASEARM7 = fzf-$(VERSION)-$(GOOS)_arm728 29 all: release30 31 release: build2 unmodified lines34 rm -f $(RELEASE32) $(RELEASE64)35 36 build: test fzf/$(BINARY32) fzf/$(BINARY64)37 38+android-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)42+43 test:44 go get45 go test -v ./...46 26 unmodified lines73 74 docker-centos:75 docker build -t junegunn/centos-sandbox - < Dockerfile.centos76 77+docker-android:78+ docker build -t junegunn/android-sandbox - < Dockerfile.android79+80 arch: 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 lines92 linux: 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'95 96+ubuntu-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'99+100+android: 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'103+104 .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