Set up openssl on Android

This commit is contained in:
Manish Goregaokar 2014-12-03 13:41:49 -08:00
parent b7de46970f
commit 00a0f1527c
6 changed files with 296 additions and 25 deletions

View file

@ -1 +1 @@
2014-11-06
2014-12-02

View file

@ -90,9 +90,9 @@ dependencies = [
[[package]]
name = "cookie"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/cookie-rs#9b579dd9b8cf0624eee1d013e9b48577acd3c40e"
source = "git+https://github.com/servo/cookie-rs#30520767a95b92e39265aaf6822db515b2418f1d"
dependencies = [
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
]
@ -356,12 +356,12 @@ source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463
[[package]]
name = "hyper"
version = "0.0.1"
source = "git+https://github.com/servo/hyper?ref=servo#7edbbba41ecba6783a7bc130f2f1890793a20d51"
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
dependencies = [
"cookie 0.0.1 (git+https://github.com/alexcrichton/cookie-rs)",
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl)",
"typeable 0.0.1 (git+https://github.com/reem/rust-typeable)",
"unsafe-any 0.1.0 (git+https://github.com/reem/rust-unsafe-any)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@ -441,6 +441,14 @@ name = "lazy_static"
version = "0.1.0"
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
[[package]]
name = "libressl-pnacl-sys"
version = "2.0.2"
source = "git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git#8e9349e0280b069bfab247a2202cd10b8beae154"
dependencies = [
"pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mime"
version = "0.0.1"
@ -484,8 +492,20 @@ dependencies = [
[[package]]
name = "openssl"
version = "0.2.2"
source = "git+https://github.com/sfackler/rust-openssl.git#b91a267082d3066bb369d3aa5b572d48b9ed8ded"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
]
[[package]]
name = "openssl-sys"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
]
[[package]]
name = "phf"
@ -503,10 +523,20 @@ dependencies = [
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
]
[[package]]
name = "pkg-config"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/pkg-config-rs#9b3b44a2e1a8ccc70c3f701aeb5154ad79e665e9"
[[package]]
name = "plugins"
version = "0.0.1"
[[package]]
name = "pnacl-build-helper"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.1.0"
@ -620,7 +650,7 @@ dependencies = [
name = "task_info"
version = "0.0.1"
[[package]]
name = "typeable"
version = "0.0.1"
source = "git+https://github.com/reem/rust-typeable#55154e1809db8ceec8f8519bdbb638c2fbd712f5"

View file

@ -18,10 +18,21 @@ all: glut_app
ant debug
.PHONY: glut_app
glut_app:
glut_app: openssl
cd glut_app; \
../../../mach cargo build --target=arm-linux-androideabi $(CARGO_OPTS)
OPENSSL_PATH=`pwd`/../openssl-1.0.1j ../../../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

View file

@ -70,9 +70,9 @@ dependencies = [
[[package]]
name = "cookie"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/cookie-rs#9b579dd9b8cf0624eee1d013e9b48577acd3c40e"
source = "git+https://github.com/servo/cookie-rs#30520767a95b92e39265aaf6822db515b2418f1d"
dependencies = [
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
]
@ -289,12 +289,12 @@ source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463
[[package]]
name = "hyper"
version = "0.0.1"
source = "git+https://github.com/servo/hyper?ref=servo#e48f52793ccb5b046714bb1f7a21b7e57f87fd5f"
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
dependencies = [
"cookie 0.0.1 (git+https://github.com/alexcrichton/cookie-rs)",
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
"typeable 0.0.2 (git+https://github.com/reem/rust-typeable)",
"unsafe-any 0.1.1 (git+https://github.com/reem/rust-unsafe-any)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@ -374,6 +374,14 @@ name = "lazy_static"
version = "0.1.0"
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
[[package]]
name = "libressl-pnacl-sys"
version = "2.0.2"
source = "git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git#8e9349e0280b069bfab247a2202cd10b8beae154"
dependencies = [
"pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mime"
version = "0.0.1"
@ -422,8 +430,20 @@ source = "git+https://github.com/servo/rust-opengles#7f025f0069fbf6fefef4ed383b9
[[package]]
name = "openssl"
version = "0.2.2"
source = "git+https://github.com/sfackler/rust-openssl.git#b91a267082d3066bb369d3aa5b572d48b9ed8ded"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl.git#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
]
[[package]]
name = "openssl-sys"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
]
[[package]]
name = "phf"
@ -441,10 +461,20 @@ dependencies = [
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
]
[[package]]
name = "pkg-config"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/pkg-config-rs#9b3b44a2e1a8ccc70c3f701aeb5154ad79e665e9"
[[package]]
name = "plugins"
version = "0.0.1"
[[package]]
name = "pnacl-build-helper"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "png"
version = "0.1.0"

188
ports/android/openssl.sh Normal file
View file

@ -0,0 +1,188 @@
#!/bin/bash
# Cross-compile environment for Android on ARMv7 and x86
#
# Contents licensed under the terms of the OpenSSL license
# http://www.openssl.org/source/license.html
#
# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android
# and http://wiki.openssl.org/index.php/Android
#####################################################################
# Set ANDROID_NDK_ROOT to you NDK location. For example,
# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a
# login script. If ANDROID_NDK_ROOT is not specified, the script will
# try to pick it up with the value of _ANDROID_NDK_ROOT below. If
# ANDROID_NDK_ROOT is set, then the value is ignored.
# _ANDROID_NDK="android-ndk-r8e"
_ANDROID_NDK="android-ndk-r9"
# _ANDROID_NDK="android-ndk-r10"
# Set _ANDROID_EABI to the EABI you want to use. You can find the
# list in $ANDROID_NDK_ROOT/toolchains. This value is always used.
# _ANDROID_EABI="x86-4.6"
# _ANDROID_EABI="arm-linux-androideabi-4.6"
_ANDROID_EABI="arm-linux-androideabi-4.8"
# Set _ANDROID_ARCH to the architecture you are building for.
# This value is always used.
# _ANDROID_ARCH=arch-x86
_ANDROID_ARCH=arch-arm
# Set _ANDROID_API to the API you want to use. You should set it
# to one of: android-14, android-9, android-8, android-14, android-5
# android-4, or android-3. You can't set it to the latest (for
# example, API-17) because the NDK does not supply the platform. At
# Android 5.0, there will likely be another platform added (android-22?).
# This value is always used.
# _ANDROID_API="android-14"
_ANDROID_API="android-18"
# _ANDROID_API="android-19"
#####################################################################
# If the user did not specify the NDK location, try and pick it up.
# We expect something like ANDROID_NDK_ROOT=/opt/android-ndk-r8e
# or ANDROID_NDK_ROOT=/usr/local/android-ndk-r8e.
export ANDROID_NDK_ROOT=$1
echo $ANDROID_NDK_ROOT
# Error checking
# ANDROID_NDK_ROOT should always be set by the user (even when not running this script)
# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77
if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then
echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT"
# exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then
echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT/toolchains"
# exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then
echo "Error: ANDROID_EABI is not a valid path. Please edit this script."
# echo "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI"
# exit 1
fi
#####################################################################
# Based on ANDROID_NDK_ROOT, try and pick up the required toolchain. We expect something like:
# /opt/android-ndk-r83/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin
# Once we locate the toolchain, we add it to the PATH. Note: this is the 'hard way' of
# doing things according to the NDK documentation for Ice Cream Sandwich.
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
ANDROID_TOOLCHAIN=""
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
do
if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
break
fi
done
# Error checking
if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then
echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script."
# echo "$ANDROID_TOOLCHAIN"
# exit 1
fi
case $_ANDROID_ARCH in
arch-arm)
ANDROID_TOOLS="arm-linux-androideabi-gcc arm-linux-androideabi-ranlib arm-linux-androideabi-ld"
;;
arch-x86)
ANDROID_TOOLS="i686-linux-android-gcc i686-linux-android-ranlib i686-linux-android-ld"
;;
*)
echo "ERROR ERROR ERROR"
;;
esac
for tool in $ANDROID_TOOLS
do
# Error checking
if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then
echo "Error: Failed to find $tool. Please edit this script."
# echo "$ANDROID_TOOLCHAIN/$tool"
# exit 1
fi
done
# Only modify/export PATH if ANDROID_TOOLCHAIN good
if [ ! -z "$ANDROID_TOOLCHAIN" ]; then
export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN"
export PATH="$ANDROID_TOOLCHAIN":"$PATH"
fi
#####################################################################
# For the Android SYSROOT. Can be used on the command line with --sysroot
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
# Error checking
if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then
echo "Error: ANDROID_SYSROOT is not valid. Please edit this script."
# echo "$ANDROID_SYSROOT"
# exit 1
fi
#####################################################################
#####################################################################
# Most of these should be OK (MACHINE, SYSTEM, ARCH). RELEASE is ignored.
export MACHINE=armv7
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE="arm-linux-androideabi-"
if [ "$_ANDROID_ARCH" == "arch-x86" ]; then
export MACHINE=i686
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=x86
export CROSS_COMPILE="i686-linux-android-"
fi
# For the Android toolchain
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_API="$_ANDROID_API"
# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system.
# export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
export HOSTCC=gcc
VERBOSE=1
if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
echo "ANDROID_ARCH: $_ANDROID_ARCH"
echo "ANDROID_EABI: $_ANDROID_EABI"
echo "ANDROID_API: $ANDROID_API"
echo "ANDROID_SYSROOT: $ANDROID_SYSROOT"
echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN"
echo "FIPS_SIG: $FIPS_SIG"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "ANDROID_DEV: $ANDROID_DEV"
fi
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

26
ports/cef/Cargo.lock generated
View file

@ -81,9 +81,9 @@ dependencies = [
[[package]]
name = "cookie"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/cookie-rs#9b579dd9b8cf0624eee1d013e9b48577acd3c40e"
source = "git+https://github.com/servo/cookie-rs#9b579dd9b8cf0624eee1d013e9b48577acd3c40e"
dependencies = [
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
]
@ -320,12 +320,12 @@ source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463
[[package]]
name = "hyper"
version = "0.0.1"
source = "git+https://github.com/servo/hyper?ref=servo#7edbbba41ecba6783a7bc130f2f1890793a20d51"
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
dependencies = [
"cookie 0.0.1 (git+https://github.com/alexcrichton/cookie-rs)",
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
"openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
"typeable 0.0.2 (git+https://github.com/reem/rust-typeable)",
"unsafe-any 0.1.1 (git+https://github.com/reem/rust-unsafe-any)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
@ -448,8 +448,20 @@ dependencies = [
[[package]]
name = "openssl"
version = "0.2.2"
source = "git+https://github.com/sfackler/rust-openssl.git#b91a267082d3066bb369d3aa5b572d48b9ed8ded"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl.git#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
]
[[package]]
name = "openssl-sys"
version = "0.0.1"
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
dependencies = [
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
]
[[package]]
name = "phf"