From 030dab553e6ae37e2ef2cda8c897b9555d967d5d Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Mon, 8 Dec 2014 13:40:23 +1000 Subject: [PATCH] Use mach to build openssl on android instead of glut makefile. The glut makefile will be removed shortly after glutin lands for android, so we need to build openssl for android elsewhere in the build process. --- ports/android/Makefile | 15 ++------------- python/servo/build_commands.py | 12 ++++++++++-- python/servo/command_base.py | 3 +++ support/android/.gitignore | 3 +++ support/android/openssl.makefile | 13 +++++++++++++ {ports => support}/android/openssl.sh | 2 +- 6 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 support/android/.gitignore create mode 100644 support/android/openssl.makefile rename {ports => support}/android/openssl.sh (99%) mode change 100644 => 100755 diff --git a/ports/android/Makefile b/ports/android/Makefile index 98d4c3528f1..b99354e98cb 100644 --- a/ports/android/Makefile +++ b/ports/android/Makefile @@ -18,21 +18,10 @@ all: glut_app ant debug .PHONY: glut_app -glut_app: openssl +glut_app: cd glut_app; \ - OPENSSL_PATH=`pwd`/../openssl-1.0.1j ../../../mach cargo build --target=arm-linux-androideabi $(CARGO_OPTS) + ../../../mach cargo build --target=arm-linux-androideabi $(CARGO_OPTS) .PHONY: install install: $(ANDROID_SDK)/platform-tools/adb install -r bin/ServoAndroid-debug.apk - -# From http://wiki.openssl.org/index.php/Android -.PHONY: openssl -openssl: openssl-1.0.1j/libssl.so - -openssl-1.0.1j/libssl.so: openssl-1.0.1j/Configure - bash openssl.sh ${ANDROID_NDK} - -openssl-1.0.1j/Configure: - wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz - tar -zxvf openssl-1.0.1j.tar.gz diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 11b2fdd08e5..e3e41ca38e2 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -63,17 +63,25 @@ class MachCommands(CommandBase): opts += ["--features", "%s" % ' '.join(features)] build_start = time() + env = self.build_env() if android: + # Build OpenSSL for android + with cd(self.android_support_dir()): + status = subprocess.call( + ["make", "-j4", "-f", "openssl.makefile"], + env=self.build_env()) + env['OPENSSL_PATH'] = path.join(self.android_support_dir(), "openssl-1.0.1j") + make_opts = [] if opts: make_opts += ["CARGO_OPTS=" + " ".join(opts)] status = subprocess.call( ["make", "-C", "ports/android"] + make_opts, - env=self.build_env()) + env=env) else: status = subprocess.call( ["cargo", "build"] + opts, - env=self.build_env(), cwd=self.servo_crate()) + env=env, cwd=self.servo_crate()) elapsed = time() - build_start print("Build completed in %0.2fs" % elapsed) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index a34104b734e..2af5fcd63c1 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -145,6 +145,9 @@ class CommandBase(object): def servo_crate(self): return path.join(self.context.topdir, "components", "servo") + def android_support_dir(self): + return path.join(self.context.topdir, "support", "android") + def ensure_bootstrapped(self): if self.context.bootstrapped: return diff --git a/support/android/.gitignore b/support/android/.gitignore new file mode 100644 index 00000000000..1d0971b22e9 --- /dev/null +++ b/support/android/.gitignore @@ -0,0 +1,3 @@ +openssl-1.0.1j/ +openssl-1.0.1j.tar.gz + diff --git a/support/android/openssl.makefile b/support/android/openssl.makefile new file mode 100644 index 00000000000..081bafb1afb --- /dev/null +++ b/support/android/openssl.makefile @@ -0,0 +1,13 @@ +.PHONY: all +all: openssl + +# From http://wiki.openssl.org/index.php/Android +.PHONY: openssl +openssl: openssl-1.0.1j/libssl.so + +openssl-1.0.1j/libssl.so: openssl-1.0.1j/Configure + ./openssl.sh ${ANDROID_NDK} + +openssl-1.0.1j/Configure: + wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz + tar -zxf openssl-1.0.1j.tar.gz diff --git a/ports/android/openssl.sh b/support/android/openssl.sh old mode 100644 new mode 100755 similarity index 99% rename from ports/android/openssl.sh rename to support/android/openssl.sh index 154a7dcf75d..201503ea451 --- a/ports/android/openssl.sh +++ b/support/android/openssl.sh @@ -185,4 +185,4 @@ cd openssl-1.0.1j perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org ./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/$ANDROID_API make depend -make all \ No newline at end of file +make all