Last active
May 14, 2019 05:31
-
-
Save KatagiriSo/3b8c519e95f2f8a2336e120607914a77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export OPENSSL_VER=openssl-1.0.2r | |
# arch-arm, arch-arm64, arch-mips, arch-mips64, arch-x86, arch-x86_64 | |
# export _ARCH=arch-x86 | |
# export _DO_FOLDER_PROC=0 | |
export _DO_GET_SOURCE_PROC=0 | |
export _DO_BUILD=0 | |
export _OUT_PUT_DIR=libs | |
# OPTARG | |
function do_SetDefault() { | |
echo "do_SetDefault" | |
_DO_FOLDER_PROC=1 | |
_DO_GET_SOURCE_PROC=1 | |
_DO_BUILD=1 | |
} | |
# 引数処理 -------- | |
echo "do_getOpts" | |
while getopts wf name | |
do | |
case $name in | |
w) _DO_GET_SOURCE_PROC=1;; | |
# f) _DO_FOLDER_PROC=1;; | |
?) echo "invalid flag"; | |
exit 0;; | |
esac | |
done | |
echo ${OPTIND} | |
if [ ${OPTIND} -eq 1 ]; then | |
do_SetDefault | |
fi | |
shift `expr ${OPTIND} - 1` | |
# ----------------------------------- | |
function do_Process () { | |
echo "do_Process" | |
if [ $_DO_GET_SOURCE_PROC -eq 1 ]; then | |
do_GetSoourceFromWeb | |
fi | |
if [ $_DO_BUILD -eq 1 ]; then | |
# do_Build arch-x86_64 | |
# do_FolderMovingProcess arch-x86_64 x86_64 | |
do_Build arch-x86_64 | |
do_FolderMovingProcess arch-x86_64 x86_64 | |
fi | |
# if [ $_DO_FOLDER_PROC -eq 1 ]; then | |
# do_FolderMovingProcess | |
# fi | |
} | |
# $1 Arch | |
function do_Build () { | |
export _ARCH=$1 | |
echo "do_Build $1" | |
# From the 'root' directory | |
cp ./setenv-android.sh ./${OPENSSL_VER} | |
pushd ${OPENSSL_VER} | |
. ./setenv-android.sh $_ARCH | |
# Perl is optional, and may fail in OpenSSL 1.1.0 | |
# $perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org | |
# Tune to suit your taste, visit http://wiki.openssl.org/index.php/Compilation_and_Installation | |
# ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine \ | |
# --openssldir=/usr/local/ssl/$ANDROID_API --prefix=/usr/local/ssl/$ANDROID_API | |
echo "hoge" | |
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org | |
./config shared \ | |
--openssldir=/usr/local/ssl/$ANDROID_API --prefix=/usr/local/ssl/$ANDROID_API | |
perl -pi -w -e 's/\-mandroid//g;' ./Makefile | |
# ./Configure darwin64-x86_64-cc | |
make clean | |
make depend | |
make all | |
popd | |
} | |
function do_GetSoourceFromWeb () { | |
echo "do_GetSoourceFromWeb" | |
curl https://www.openssl.org/source/${OPENSSL_VER}.tar.gz -o ${OPENSSL_VER}.tar.gz | |
tar -xf ./${OPENSSL_VER}.tar.gz | |
} | |
# $1 Arch $2 FolderName | |
function do_FolderMovingProcess () { | |
export _ARCH=$1 | |
export _FOLDER_NAME=$2 | |
echo "do_FolderMovingProcess" | |
# rm -rf ${_OUT_PUT_DIR} | |
mkdir ${_OUT_PUT_DIR}/${_FOLDER_NAME} | |
mkdir ${_OUT_PUT_DIR}/${_FOLDER_NAME}/lib | |
cp -r ${OPENSSL_VER}/include ${_OUT_PUT_DIR}/include | |
cp ${OPENSSL_VER}/libcrypto.a ${_OUT_PUT_DIR}/${_FOLDER_NAME}/lib/libcrypto.a | |
cp ${OPENSSL_VER}/libssl.a ${_OUT_PUT_DIR}/${_FOLDER_NAME}/lib/libssl.a | |
} | |
# main process | |
do_Process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment