Skip to content

Commit 3427c74

Browse files
committed
Removed prebuilt builds from directory (look at releases). Description added. Added arguments.
1 parent a6d6476 commit 3427c74

File tree

199 files changed

+106
-54857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+106
-54857
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*build*/*
2+
*ssl*/*
3+
*out*/*

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
11
# Build openssl for Adroid
22
These builds are good for building projects for Android that require openssl. For example, tdlib.
33
You can also create your own assemblies from under Unix system. You can also use WSL on Windows.
4+
5+
## Dependencies
6+
You need to have your android ndk kit in order to complete the build. You can download this set [here](https://developer.android.com/ndk/downloads). You can also use the NDK that is installed on your system from Android Studio.
7+
You need build tools. On Ubuntu you can call:
8+
```
9+
sudo apt-get update
10+
sudo apt-get install build-essential
11+
```
12+
You can also download and put the OpenSSL source files in any place convenient for you, but you don't have to do it - in this case the script will do everything for you (you need `git` installed in the system).
13+
14+
## Build for one architecture
15+
Run the script to do the default build:
16+
```
17+
./launcher.sh path/to/your/ndk
18+
```
19+
In this case, the script will use the default parameters.
20+
You can change the default options by specifying them on the command line in order:
21+
-1 - path/to/your/ndk (no def)
22+
-2 - architecture (def: android-arm) Can be android-arm, android-arm64, android-x86, android-x86 etc
23+
-3 - ANDROID_API (def: 28)
24+
-4 - dir with ready lib and headers (def: SCRIPTPATH/output)
25+
-5 - OPENSSL_DIR or where you want to place it (def: SCRIPTPATH/openssl)
26+
You can specify both absolute and relative paths. If the script does not find the specified OPENSSL_DIR, then it will automatically download the [sources](https://github.com/openssl/openssl.git) for the `openssl-3.0.0` tag.
27+
You will get the assembly in the form of this tree:
28+
```
29+
Your output dir
30+
include
31+
*include files*
32+
lib
33+
Your ANDROID_API
34+
$architecture (in android documentation view)
35+
*lib files*
36+
```
37+
## Build for all architectures of the specified api
38+
To do this, you need to run another script:
39+
```
40+
./lazzy.sh path/to/your/ndk
41+
```
42+
The parameters of this script are similar to the parameters of the previous one:
43+
-1 - path/to/your/ndk (no def)
44+
-2 - ANDROID_API (def: 28)
45+
-3 - dir with ready lib and headers (def: SCRIPTPATH/output)
46+
-4 - OPENSSL_DIR or where you want to place it (def: SCRIPTPATH/openssl)
47+
You will get the assembly in the form of this tree:
48+
```
49+
Your output dir
50+
include
51+
*include files*
52+
lib
53+
Your ANDROID_API
54+
armeabi-v7a
55+
*lib files*
56+
arm64-v8a
57+
*lib files*
58+
x86
59+
*lib files*
60+
x86_64
61+
*lib files*
62+
```

launcher.sh

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,36 @@
22
set -e
33
set -x
44

5-
# Set the Android API levels
6-
ANDROID_API=$1
5+
# Set directory
6+
SCRIPTPATH=`realpath .`
7+
8+
export ANDROID_NDK_ROOT=`readlink -m $1`
79

810
# Set the target architecture
911
# Can be android-arm, android-arm64, android-x86, android-x86 etc
10-
architecture=$2
12+
architecture=${2:-android-arm}
1113

12-
# Set directory
13-
SCRIPTPATH=`realpath .`
14-
export ANDROID_NDK_ROOT=$SCRIPTPATH/android-ndk-r23
15-
OPENSSL_DIR=$SCRIPTPATH/openssl
14+
# Set the Android API levels
15+
ANDROID_API=${3:-28}
16+
17+
TARGET_DIR=${4:-$SCRIPTPATH/output}
18+
if [[ "$TARGET_DIR" != $SCRIPTPATH/output ]]
19+
then TARGET_DIR=`readlink -m $TARGET_DIR`
20+
fi
21+
22+
OPENSSL_DIR=${5:-$SCRIPTPATH/openssl}
23+
if [[ "$OPENSSL_DIR" != $SCRIPTPATH/openssl ]]
24+
then OPENSSL_DIR=`readlink -m $OPENSSL_DIR`
25+
fi
1626

1727
if ! [ -d $OPENSSL_DIR ]; then
18-
git clone https://github.com/openssl/openssl.git -b openssl-3.0.0
28+
git clone https://github.com/openssl/openssl.git -b openssl-3.0.0 ${OPENSSL_DIR}
1929
else
2030
cd ${OPENSSL_DIR}
2131
git clean -fdx
2232
cd ${SCRIPTPATH}
2333
fi
2434

25-
# Get opessl from git
26-
# git clone https://github.com/openssl/openssl.git -b openssl-3.0.0
27-
2835
# Find the toolchain for your build machine
2936
toolchains_path=$(python3 toolchains_path.py --ndk ${ANDROID_NDK_ROOT})
3037

@@ -42,16 +49,6 @@ cd ${OPENSSL_DIR}
4249
# Build
4350
make -j8
4451

45-
if ("${ANDROID_ABI}" STREQUAL "x86")
46-
set(arcName i686-linux-android)
47-
elseif("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
48-
set(arcName arm-linux-androideabi)
49-
elseif("${ANDROID_ABI}" STREQUAL "arm64-v8a")
50-
set(arcName aarch64-linux-android)
51-
elseif("${ANDROID_ABI}" STREQUAL "x86_64")
52-
set(arcName x86_64-linux-android)
53-
endif()
54-
5552
if [[ "$architecture" == android-arm ]]
5653
then arcName=armeabi-v7a
5754
elif [[ "$architecture" == android-arm64 ]]
@@ -65,12 +62,15 @@ arcName="$architecture"
6562
fi
6663

6764
# Copy the outputs
68-
OUTPUT_INCLUDE=$SCRIPTPATH/outputStatic/include
69-
OUTPUT_LIB=$SCRIPTPATH/outputStatic/lib/${ANDROID_API}/${arcName}
65+
OUTPUT_INCLUDE=$TARGET_DIR/include
66+
OUTPUT_LIB=$TARGET_DIR/lib/${ANDROID_API}/${arcName}
7067
mkdir -p $OUTPUT_INCLUDE
7168
mkdir -p $OUTPUT_LIB
72-
cp -RL include/openssl $OUTPUT_INCLUDE
73-
cp libcrypto.so $OUTPUT_LIB
74-
cp libcrypto.a $OUTPUT_LIB
75-
cp libssl.so $OUTPUT_LIB
76-
cp libssl.a $OUTPUT_LIB
69+
cp -RL ${OPENSSL_DIR}/include/openssl $OUTPUT_INCLUDE
70+
cp ${OPENSSL_DIR}/libcrypto.so $OUTPUT_LIB
71+
cp ${OPENSSL_DIR}/libcrypto.a $OUTPUT_LIB
72+
cp ${OPENSSL_DIR}/libssl.so $OUTPUT_LIB
73+
cp ${OPENSSL_DIR}/libssl.a $OUTPUT_LIB
74+
75+
# Clen openssl dir from build files
76+
git clean -fdx

lazzy.sh

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,26 @@
22
set -e
33
set -x
44

5-
# Set the Android API levels
6-
ANDROID_API=28
7-
8-
# Set the target architecture
9-
# Can be android-arm, android-arm64, android-x86, android-x86_64 etc
10-
architecture=android-arm64
11-
./launcher.sh $ANDROID_API $architecture
5+
ANDROID_NDK_ROOT=$1
126

13-
architecture=android-arm
14-
./launcher.sh $ANDROID_API $architecture
7+
SCRIPTPATH=`realpath .`
158

16-
architecture=android-x86
17-
./launcher.sh $ANDROID_API $architecture
9+
# Set the Android API levels
10+
ANDROID_API=${2:-28}
1811

19-
architecture=android-x86_64
20-
./launcher.sh $ANDROID_API $architecture
12+
TARGET_DIR=${3:-$SCRIPTPATH/output}
2113

22-
ANDROID_API=26
14+
OPENSSL_DIR=${4:-$SCRIPTPATH/openssl}
2315

24-
architecture=android-arm
25-
./launcher.sh $ANDROID_API $architecture
16+
# Can be android-arm, android-arm64, android-x86, android-x86_64 etc
17+
#architecture=android-arm64
18+
./launcher.sh $ANDROID_NDK_ROOT android-arm $ANDROID_API $TARGET_DIR $OPENSSL_DIR
2619

27-
architecture=android-x86
28-
./launcher.sh $ANDROID_API $architecture
20+
#architecture=android-arm
21+
./launcher.sh $ANDROID_NDK_ROOT android-arm64 $ANDROID_API $TARGET_DIR $OPENSSL_DIR
2922

30-
architecture=android-x86_64
31-
./launcher.sh $ANDROID_API $architecture
23+
#architecture=android-x86
24+
./launcher.sh $ANDROID_NDK_ROOT android-x86 $ANDROID_API $TARGET_DIR $OPENSSL_DIR
3225

33-
architecture=android-arm64
34-
./launcher.sh $ANDROID_API $architecture
26+
#architecture=android-x86_64
27+
./launcher.sh $ANDROID_NDK_ROOT android-x86_64 $ANDROID_API $TARGET_DIR $OPENSSL_DIR

openssl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 89cd17a031e022211684eb7eb41190cf1910f9fa

prebuild-openssl/include/openssl/__DECC_INCLUDE_EPILOGUE.H

Lines changed: 0 additions & 22 deletions
This file was deleted.

prebuild-openssl/include/openssl/__DECC_INCLUDE_PROLOGUE.H

Lines changed: 0 additions & 26 deletions
This file was deleted.

prebuild-openssl/include/openssl/aes.h

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)