|
1 | 1 | # simple-build-ios-and-android-script |
2 | | -Build iOS and Android C&&C++ library cross compile shell script on MacOS. |
3 | | -## Use build script |
4 | | -- ios.sh is main build script on iOS platform. |
5 | | -- android.sh is main build script on Android platform. |
6 | | -- Other scripts do not need to be used directly. |
7 | | -## Support library list |
8 | | -- Only items in the list are supported to be built. |
9 | | -- See the currently supported build items in _common.sh (${COMMON_LIBRARY_NAME_LIST}). |
10 | | -## Add subscript considerations |
11 | | -### The project architecture supports extended subscripts. |
12 | | -### The specific parameters involved in adding the subscript are as follows: |
13 | | - - COMMON_LIBRARY_ID_LIST |
14 | | - - COMMON_LIBRARY_NAME_LIST |
15 | | - - COMMON_LIBRARY_VERSION_LIST |
16 | | - - COMMON_LIBRARY_URL_LIST |
17 | | - - common_get_library_id_from_name |
18 | | -### The following rules apply to adding subscripts: |
19 | | - - Implement the following methods: |
20 | | - 1. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_printf_variable : (optional) |
21 | | - 2. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_pre_tool_check : (must) |
22 | | - 3. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_pre_download_zip : (must) |
23 | | - 4. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_build_unzip : (must) |
24 | | - 5. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_build_config_make : (must) |
25 | | - 6. ${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_archive : (must) |
26 | | - - Please follow the naming conventions and rules. |
27 | | - 1. Use the keyword function for the method. |
28 | | - 2. Use the keyword local for local variable. |
29 | | - 3. Use common_ prefix in _common.sh script. |
30 | | - 4. Use ios_ prefix in ios-*.sh script. |
31 | | - 5. Use android_ prefix in android-*.sh script. |
32 | | - 6. Use util_ prefix in __util.sh script. |
33 | | - 7. Use ${COMMON_LIBRARY_NAME}_ prefix in subscript. |
34 | | -## Contributor |
35 | | - - asteriskzuo, zuoyuhsywn@hotmail.com |
| 2 | +## Documentation |
| 3 | +### Introduction |
| 4 | +> #### A common build project for building mobile platform native libraries. |
| 5 | +### Target users |
| 6 | +> #### Mobile platform C&&C++ native library. |
| 7 | +### Extended instructions |
| 8 | +> #### Use the entry script to build the target library. |
| 9 | +> #### ios.sh is the ios platform entry script. |
| 10 | +> #### android.sh is the android platform entry script. |
| 11 | +> #### Advanced use: |
| 12 | +> | target version | test result | |
| 13 | +> | :---- | :---- | |
| 14 | +> | default | pass | |
| 15 | +> | higher | generally pass | |
| 16 | +> | low | maybe not pass | |
| 17 | +### Contribution notes |
| 18 | +> #### Adding subscripts requires some experience in scripting and project building. |
| 19 | +> #### Adding subscripts can generally be a contributor to the project. |
| 20 | +> #### Adding subscript details: |
| 21 | +> * Update parameters: |
| 22 | +> + `COMMON_LIBRARY_ID_LIST` |
| 23 | +> + `COMMON_LIBRARY_NAME_LIST` |
| 24 | +> + `COMMON_LIBRARY_VERSION_LIST` |
| 25 | +> + `COMMON_LIBRARY_URL_LIST` |
| 26 | +> * Update method: |
| 27 | +> + `common_get_library_id_from_name` |
| 28 | +> * script: |
| 29 | +> + Usage agreement: |
| 30 | +> - A script method or function needs to use the keyword `function`. |
| 31 | +> - Global variables need to use the keyword `export` and are combined with uppercase alphanumeric and underlined characters. |
| 32 | +> - Script methods or local variables within functions use the keyword `local`. |
| 33 | +> - Methods within the common.sh script need to use the prefix `common_`. |
| 34 | +> - ios-*.sh script methods need to use the prefix `ios_`. |
| 35 | +> - android-*.sh script methods need to use the prefix `android_`. |
| 36 | +> - Methods in the util. Sh script require the prefix `util_`. |
| 37 | +> - Methods within the subscript need to use the prefix `xxx_`. |
| 38 | +> - Composite scripts require the use of composite prefixes. |
| 39 | +> + Method implementation: |
| 40 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_printf_variable`: (optional) |
| 41 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_pre_tool_check`: (must) |
| 42 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_pre_download_zip`: (must) |
| 43 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_build_unzip`: (must) |
| 44 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_build_config_make`: (must) |
| 45 | +> - `${COMMON_PLATFORM_TYPE}_${COMMON_LIBRARY_NAME}_archive`: (must) |
| 46 | +> * Contribution notes: |
| 47 | +> + asteriskzuo: Create the project and complete the main frame design. |
| 48 | +## Architecture design |
| 49 | +### Programming language |
| 50 | +> #### bash shell script |
| 51 | +### Build platform: |
| 52 | +> #### MaoOS |
| 53 | +> #### Linux: **`TODO`** |
| 54 | +### Target platform: |
| 55 | +> #### iOS |
| 56 | +> #### Android |
| 57 | +### Core ideas: |
| 58 | +> * Plug-in programming: |
| 59 | +> + You can build the target library by writing a corresponding subscript and adding parameters. |
| 60 | +> * Dynamic call: |
| 61 | +> + Similar to C++ polymorphism. |
| 62 | +> * High reusability: |
| 63 | +> + All code blocks are encapsulated using methods (functions). |
| 64 | +> * Dependent detection: |
| 65 | +> + Build target library dependency detection: |
| 66 | +> - manual build |
| 67 | +> - auto build all dependency target library: **`TODO`** |
| 68 | +> * To reconstruct the configure: **`TODO`** |
| 69 | +### Project structure: |
| 70 | +> * Input: |
| 71 | +> + Source directory: |
| 72 | +> - GNU make project: |
| 73 | +> - cmake project: No build script is required. The iOS platform has a better way, and the Android platform directly introduces cmakelist files. |
| 74 | +> + Build tools: |
| 75 | +> - iOS independent compiler tool chain |
| 76 | +> - Android independent compiler tool chain. |
| 77 | +> - More ... |
| 78 | +> * Output: |
| 79 | +> + Interim interim documents: |
| 80 | +> - Temporary intermediate file. |
| 81 | +> - Build the library product. |
| 82 | +> + Build library products: |
| 83 | +> * Script: |
| 84 | +> + Entry script: |
| 85 | +> - ios.sh: iOS platform entry script. |
| 86 | +> - android.sh: Android platform entry script. |
| 87 | +> + Tool script: |
| 88 | +> - util.sh: Provide various basic functions. |
| 89 | +> - log.sh: Provide various basic functions. |
| 90 | +> - common.sh: Provide common functions for iOS and Android platforms. |
| 91 | +> - ios-common.sh: Provide common functions for iOS platform. |
| 92 | +> - android-common.sh: Provide common functions of Android platform. |
| 93 | +> + Subscript(plug-in script): |
| 94 | +> - ios-openssl.sh: |
| 95 | +> - android-openssl.sh: |
| 96 | +> - ios-curl.sh: |
| 97 | +> - android-curl.sh: |
| 98 | +> - More ... |
| 99 | +## Problems to be solved |
| 100 | +### Only current list item builds are supported. |
| 101 | +### Project-made versions can be built, but may not be built properly for lower versions. |
| 102 | +### Building the dependencies of the target project requires manual construction. |
| 103 | +## Reference |
| 104 | +> [openssl_for_ios_and_android](https://github.com/AsteriskZuo/openssl_for_ios_and_android) |
| 105 | +## Document |
| 106 | +> [simple-build-ios-and-android-script](./document/simple-build-ios-and-android-script.html) |
0 commit comments