Skip to content

Commit

Permalink
Merge branch 'fix/issue-2385' into fix/android-new-masquerades
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed Apr 16, 2015
2 parents 312a14b + 09137b9 commit a431c87
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 94 deletions.
33 changes: 32 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ LDFLAGS := -w -X main.version $(GIT_REVISION) -X main.buildDate $(BUILD_DATE) -X
LANTERN_DESCRIPTION := Censorship circumvention tool
LANTERN_EXTENDED_DESCRIPTION := Lantern allows you to access sites blocked by internet censorship.\nWhen you run it, Lantern reroutes traffic to selected domains through servers located where such domains aren't censored.

LANTERN_ANDROID_DIR := src/github.com/getlantern/lantern-android

PACKAGE_VENDOR := Brave New Software Project, Inc
PACKAGE_MAINTAINER := Lantern Team <team@getlantern.org>
PACKAGE_URL := https://www.getlantern.org
Expand Down Expand Up @@ -177,6 +179,14 @@ docker: system-checks
cp Dockerfile $$DOCKER_CONTEXT && \
docker build -t $(DOCKER_IMAGE_TAG) $$DOCKER_CONTEXT;

docker-golang-android: require-mercurial
@$(call docker-up) && \
if [ -z "$$(docker images | grep golang/mobile)" ]; then \
docker pull golang/mobile && \
$(GO) get -d golang.org/x/mobile/example/... && \
$(GO) get golang.org/x/mobile/cmd/gobind; \
fi

linux: genassets linux-386 linux-amd64

windows: genassets windows-386
Expand All @@ -190,6 +200,9 @@ system-checks:
require-s3cmd:
@if [[ -z "$(S3CMD)" ]]; then echo 'Missing "s3cmd" command.. See https://github.com/s3tools/s3cmd/blob/master/INSTALL'; exit 1; fi

require-mercurial:
@if [[ -z "$$(which hg 2> /dev/null)" ]]; then echo 'Missing "hg" command.'; exit 1; fi

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

Expand Down Expand Up @@ -348,6 +361,17 @@ test-and-cover:
tail -n +2 profile_tmp.cov >> profile.cov; \
done

android-lib: docker-golang-android
@source setenv.bash && \
cd $(LANTERN_ANDROID_DIR) && \
mkdir -p app && \
cd libflashlight && \
mkdir -p bindings/go_bindings && \
gobind -lang=go github.com/getlantern/lantern-android/libflashlight/bindings > bindings/go_bindings/go_bindings.go && \
gobind -lang=java github.com/getlantern/lantern-android/libflashlight/bindings > bindings/Flashlight.java || exit 1;
@$(DOCKER) run -v $$PWD/src:/src golang/mobile /bin/bash -c \ "cd /src/github.com/getlantern/lantern-android/libflashlight && ./make.bash" && \
ls -l src/github.com/getlantern/lantern-android/app/libs/armeabi-v7a/libgojni.so

clean:
@rm -f lantern_linux* && \
rm -f lantern_darwin* && \
Expand All @@ -359,4 +383,11 @@ clean:
rm -rf *.app && \
git checkout ./src/github.com/getlantern/flashlight/ui/resources.go && \
rm -f src/github.com/getlantern/flashlight/*.syso && \
rm -f *.dmg
rm -f *.dmg && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/bin && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/bindings/go_bindings && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/gen && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/libs && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/res && \
rm -rf $(LANTERN_ANDROID_DIR)/libflashlight/src && \
rm -rf $(LANTERN_ANDROID_DIR)/app
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ make release-beta

## Other tasks

### Creating libgojni.so

The `libgojni.so` is the Lantern library for Android. This is a work in
progress but if you're feeling adventurous you can build it by using the
`android` target:

```
make android-lib
```

### Generating assets

```sh
Expand Down
Empty file.
40 changes: 0 additions & 40 deletions src/github.com/getlantern/lantern-android/Makefile

This file was deleted.

40 changes: 11 additions & 29 deletions src/github.com/getlantern/lantern-android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,23 @@ cd $GOPATH/src/github.com/getlantern
git clone https://github.com/getlantern/flashlight-build.git
```

After cloning the repository use the `setenv.bash` script to export development
enviromental variables to the current terminal session.

```
cd flashlight-build
source setenv.bash
```

## Building the Android library

`flashlight-build` will provide you with a copy of `lantern-android`, change
directory into `lantern-android` and execute `make` to start compiling our
shared library:

```
cd $GOPATH/src/github.com/getlantern/lantern-android
After cloning the repository use `make android` to build the Android library,
this library is going to be built at
`src/github.com/getlantern/lantern-android/app/libs/armeabi-v7a/libgojni.so`:

make
# ...
# BUILD SUCCESSFUL
# Total time: 7 seconds
```

The `make` command will create a new `app` subdirectory that will contain an
Android example project. You may import the contents of the `app` subdirectory
into Android Studio to see libflashlight working.

If you're on a Mac, be sure to export docker's enviromental variables before
running `make`:

make android-lib
...
BUILD SUCCESSFUL
Total time: 4 seconds
```
$(boot2docker shellinit)

make
```
The `make` command will create a new
`src/github.com/getlantern/lantern-android/app` subdirectory that will contain
an Android example project. You may import the contents of the `app`
subdirectory into Android Studio to see libflashlight working.

## Testing the example project

Expand Down
24 changes: 0 additions & 24 deletions src/github.com/getlantern/lantern-android/app/AndroidManifest.xml

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit a431c87

Please sign in to comment.