Update build script
Before adoption: this commit came in with the history the project adopted, so no landing records it.
- GOPATH is no longer required - fzf repository does not have to be in GOPATH - Build Linux binary with Go 1.5.3
authored by Junegunn Choi · committed by Junegunn Choi · parent e72a360 · Browse files · 6 files·+46 added−54 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+46 added−54 removed
- other:+46 added−54 removed
Provenance
- Commit
1b9ca31- Tree
5226b70- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
e72a360
6 files changed+46 added−54 removed
modified:src/Dockerfile.android+1 added-5 removed
9 unmodified lines10 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 /go14 ENV GOROOT /go1.415 ENV PATH /go1.4/bin:$PATH16 17 RUN cd / && \17 unmodified lines35 sed -i '0,/echo.*/{s/echo.*/exit 0/}' misc/run_tic.sh && \36 make install && \37 mv /ndk/sysroot/usr/lib/libncursesw.a /ndk/sysroot/usr/lib/libncurses.a38 40-# Volume41-VOLUME /go42-39 # Default CMD44-CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash40+CMD cd /fzf/src && /bin/bashmodified:src/Dockerfile.arch+1 added-5 removed
8 unmodified lines9 RUN cd / && curl \10 https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \11 tar -xz && mv go go1.412 13-ENV GOPATH /go13 ENV GOROOT /go1.414 ENV PATH /go1.4/bin:$PATH15 16 # For i386 build1 unmodified line18 echo 'Include = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf && \19 pacman-db-upgrade && yes | pacman -Sy gcc-multilib lib32-ncurses && \20 cd $GOROOT/src && GOARCH=386 ./make.bash21 23-# Volume24-VOLUME /go25-22 # Default CMD27-CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash23+CMD cd /fzf/src && /bin/bash24 modified:src/Dockerfile.centos+2 added-6 removed
11 unmodified lines12 tar -xz && mv go go1.413 14 # Install Go 1.515 RUN cd / && curl \16- https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz | \16+ https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz | \17 tar -xz && mv go go1.518 19 ENV GOROOT_BOOTSTRAP /go1.420 ENV GOROOT /go1.521-ENV GOPATH /go21 ENV PATH /go1.5/bin:$PATH22 23 # For i386 build24 RUN cd $GOROOT/src && GOARCH=386 ./make.bash25 27-# Volume28-VOLUME /go29-26 # Default CMD31-CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash27+CMD cd /fzf/src && /bin/bash28 modified:src/Dockerfile.ubuntu+1 added-5 removed
8 unmodified lines9 RUN cd / && curl \10 https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | \11 tar -xz && mv go go1.412 13-ENV GOPATH /go13 ENV GOROOT /go1.414 ENV PATH /go1.4/bin:$PATH15 16 # For i386 build17 RUN apt-get install -y lib32ncurses5-dev && \18 cd $GOROOT/src && GOARCH=386 ./make.bash19 21-# Volume22-VOLUME /go23-20 # Default CMD25-CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash21+CMD cd /fzf/src && /bin/bash22 modified:src/Makefile+39 added-32 removed
1-ifndef GOPATH2-$(error GOPATH is undefined)3-endif4-1 ifndef GOOS2 UNAME_S := $(shell uname -s)3 ifeq ($(UNAME_S),Darwin)4 GOOS := darwin5 unmodified lines10 ifneq ($(shell uname -m),x86_64)11 $(error "Build on $(UNAME_M) is not supported, yet.")12 endif13 18-SOURCES := $(wildcard *.go */*.go)19-BINDIR := ../bin20-14+SOURCES := $(wildcard *.go */*.go)15+ROOTDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))16+BINDIR := $(shell dirname $(ROOTDIR))/bin17+GOPATH := $(shell dirname $(ROOTDIR))/gopath18+SRCDIR := $(GOPATH)/src/github.com/junegunn/fzf/src19+DOCKEROPTS := -i -t -v $(ROOTDIR):/fzf/src20 BINARY32 := fzf-$(GOOS)_38621 BINARY64 := fzf-$(GOOS)_amd6422 BINARYARM7 := fzf-$(GOOS)_arm723 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)_arm724+RELEASE32 := fzf-$(VERSION)-$(GOOS)_38625+RELEASE64 := fzf-$(VERSION)-$(GOOS)_amd6426+RELEASEARM7 := fzf-$(VERSION)-$(GOOS)_arm727+export GOPATH28 29 all: release30 31-release: build31+release: test build32 -cd fzf && cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32)33 cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \34 rm -f $(RELEASE32) $(RELEASE64)35 36-build: test fzf/$(BINARY32) fzf/$(BINARY64)36+build: fzf/$(BINARY32) fzf/$(BINARY64)37 38+$(SRCDIR):39+ mkdir -p $(shell dirname $(SRCDIR))40+ ln -s $(ROOTDIR) $(SRCDIR)41+42+deps: $(SRCDIR) $(SOURCES)43+ cd $(SRCDIR) && go get44+45+android-build: $(SRCDIR)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) && \46+ cd $(SRCDIR) && GOARCH=arm GOARM=7 CGO_ENABLED=1 go get47+ cd $(SRCDIR)/fzf && GOARCH=arm GOARM=7 CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $(BINARYARM7)48+ cd $(SRCDIR)/fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7) && \49 rm -f $(RELEASEARM7)50 43-test:44- go get51+test: deps52 SHELL=/bin/sh go test -v ./...53 54 install: $(BINDIR)/fzf55 2 unmodified lines58 59 clean:60 cd fzf && rm -f fzf-*61 55-fzf/$(BINARY32): $(SOURCES)62+fzf/$(BINARY32): deps63 cd fzf && GOARCH=386 CGO_ENABLED=1 go build -a -o $(BINARY32)64 58-fzf/$(BINARY64): $(SOURCES)65+fzf/$(BINARY64): deps66 cd fzf && go build -a -tags "$(TAGS)" -o $(BINARY64)67 68 $(BINDIR)/fzf: fzf/$(BINARY64) | $(BINDIR)69 cp -f fzf/$(BINARY64) $(BINDIR)14 unmodified lines84 docker-android:85 docker build -t junegunn/android-sandbox - < Dockerfile.android86 87 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'88+ docker run $(DOCKEROPTS) junegunn/$@-sandbox \89+ sh -c 'cd /fzf/src; /bin/bash'90 91 ubuntu: docker-ubuntu85- docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \86- sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'92+ docker run $(DOCKEROPTS) junegunn/$@-sandbox \93+ sh -c 'cd /fzf/src; /bin/bash'94 95 centos: docker-centos89- docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \90- sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'96+ docker run $(DOCKEROPTS) junegunn/$@-sandbox \97+ sh -c 'cd /fzf/src; /bin/bash'98 99 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'100+ docker run $(DOCKEROPTS) junegunn/centos-sandbox \101+ /bin/bash -ci 'cd /fzf/src; make TAGS=static'102 103 ubuntu-android: docker-android97- docker run -i -t -v $(GOPATH):/go junegunn/android-sandbox \98- sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'104+ docker run $(DOCKEROPTS) junegunn/android-sandbox \105+ sh -c 'cd /fzf/src; /bin/bash'106 107 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'108+ docker run $(DOCKEROPTS) junegunn/android-sandbox \109+ /bin/bash -ci 'cd /fzf/src; GOOS=android make android-build'110 104-.PHONY: all build release test install uninstall clean docker \111+.PHONY: all build deps release test install uninstall clean \112 linux arch ubuntu centos docker-arch docker-ubuntu docker-centos \113 android-build docker-android ubuntu-android androidmodified:.gitignore+2 added-1 removed
1 bin2-src/fzf/fzf_*2+src/fzf/fzf-*3+gopath4 pkg5 Gemfile.lock6 .DS_Store