Skip to content

Commit

Permalink
Few fixes for building on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed May 4, 2016
1 parent 7166a54 commit f421603
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
37 changes: 21 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ SHELL := /bin/bash

OSX_MIN_VERSION := 10.9

DOCKER := $(shell which docker 2> /dev/null)
GO := $(shell which go 2> /dev/null)
NODE := $(shell which node 2> /dev/null)
NPM := $(shell which npm 2> /dev/null)
S3CMD := $(shell which s3cmd 2> /dev/null)
WGET := $(shell which wget 2> /dev/null)
RUBY := $(shell which ruby 2> /dev/null)
get-command = $(shell which="$$(which $(1) 2> /dev/null)" && if [[ ! -z "$$which" ]]; then printf %q "$$which"; fi)

APPDMG := $(shell which appdmg 2> /dev/null)
SVGEXPORT := $(shell which svgexport 2> /dev/null)
DOCKER := $(call get-command,docker)
GO := $(call get-command,go)
NODE := $(call get-command,node)
NPM := $(call get-command,npm)
GULP := $(call get-command,gulp)
S3CMD := $(call get-command,s3cmd)
WGET := $(call get-command,wget)
RUBY := $(call get-command,ruby)

DOCKERMACHINE := $(shell which docker-machine 2> /dev/null)
BOOT2DOCKER := $(shell which boot2docker 2> /dev/null)
APPDMG := $(call get-command,appdmg)
SVGEXPORT := $(call get-command,svgexport)

DOCKERMACHINE := $(call get-command,docker-machine)
BOOT2DOCKER := $(call get-command,boot2docker)

GIT_REVISION_SHORTCODE := $(shell git rev-parse --short HEAD)
GIT_REVISION := $(shell git describe --abbrev=0 --tags --exact-match 2> /dev/null || git rev-parse --short HEAD)
Expand Down Expand Up @@ -187,7 +190,7 @@ docker-%: system-checks
all: binaries
android-dist: genconfig android

$(RESOURCES_DOT_GO): $(NPM)
$(RESOURCES_DOT_GO): require-npm require-gulp
@source setenv.bash && \
LANTERN_UI="lantern-ui" && \
APP="$$LANTERN_UI/app" && \
Expand All @@ -196,13 +199,12 @@ $(RESOURCES_DOT_GO): $(NPM)
git update-index --assume-unchanged $$APP/js/revision.js && \
DEST="$@" && \
cd $$LANTERN_UI && \
npm install && \
$(NPM) install && \
rm -Rf dist && \
gulp build && \
$(GULP) build && \
cd - && \
rm -f bin/tarfs && \
go install github.com/getlantern/tarfs/tarfs && \
mv bin/tarfs.exe bin/tarfs ; \
go build -o bin/tarfs github.com/getlantern/tarfs/tarfs && \
echo "// +build !stub" > $$DEST && \
echo " " >> $$DEST && \
bin/tarfs -pkg ui $$DIST >> $$DEST
Expand Down Expand Up @@ -309,6 +311,9 @@ require-mercurial:
require-node:
@if [[ -z "$(NODE)" ]]; then echo 'Missing "node" command.'; exit 1; fi

require-gulp: require-node
@if [[ -z "$(GULP)" ]]; then echo 'Missing "gulp" command. Try "npm install -g gulp-cli"'; exit 1; fi

require-npm: require-node
@if [[ -z "$(NPM)" ]]; then echo 'Missing "npm" command.'; exit 1; fi

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

### Prerequisites

* An OSX or Linux host. Building on Windows is only partially supported with
the help of [Cygwin](https://www.cygwin.com/).
* [Git](https://git-scm.com/downloads) - `brew install git`, `apt-get install git`, etc
* [Go 1.6 or higher](https://golang.org/dl/).
* [GNU Make](https://www.gnu.org/software/make/)
* [Nodejs & NPM](https://nodejs.org/en/download/package-manager/)
* GNU C Library (linux only) - `apt-get install libc6-dev-i386`, etc
* [Gulp](http://gulpjs.com/) - `npm i gulp -g`
* [Gulp](http://gulpjs.com/) - `npm i gulp-cli -g`

To build and run Lantern desktop, just do:

Expand Down
2 changes: 1 addition & 1 deletion setenv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

if [[ "$OSTYPE" == "cygwin" ]];
then
go env | grep GOARCH | cut -d = -f 2 | grep 386 || die "Lantern on Windows requires Go for 386. Please reinstall from an installer at https://golang.org/dl/ or build from source"
export GOPATH=386 # Requires go1.5+
export GOPATH=`cygpath --windows "$DIR"`
else
export GOPATH=$DIR
Expand Down

0 comments on commit f421603

Please sign in to comment.