feat: add build scripts for aapt2

This commit is contained in:
Lucaskyy 2022-04-22 23:06:37 +02:00
parent 07c1de614e
commit cca507661d
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89
36 changed files with 1554 additions and 0 deletions

42
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: build
on:
push:
branches:
- main
env:
NDK_VERSION: "23.1.7779620"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Setup Android NDK
run: sdkmanager "ndk;${{ env.NDK_VERSION }}"
- name: Build aapt2
env:
NDK_TOOLCHAIN: "${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION }}/toolchains/llvm/prebuilt/linux-x86_64"
run: |
chmod +x ./build.sh
./build.sh
- uses: actions/upload-artifact@v3
with:
name: dist
path: build-tools-android/dist/

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/contentModel.xml
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
.idea/**/gradle.xml
.idea/**/libraries
cmake-build-*/
.idea/**/mongoSettings.xml
*.iws
out/
.idea_modules/
atlassian-ide-plugin.xml
.idea/replstate.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
.idea/httpRequests
.idea/caches/build_file_checksums.ser

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

7
.idea/discord.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/revanced-aapt2.iml" filepath="$PROJECT_DIR$/.idea/revanced-aapt2.iml" />
</modules>
</component>
</project>

8
.idea/revanced-aapt2.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.14.2)
project(build-tools-android)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu++2a")
set(CMAKE_EXE_LINKER_FLAGS "-static")
set(SRC_PATH ${PROJECT_SOURCE_DIR}/src)
if(NOT DEFINED ARCH)
message(FATAL_ERROR "ARCH is not defined")
endif()
if(${ARCH} STREQUAL "arm64-v8a" OR ${ARCH} STREQUAL "armeabi-v7a")
enable_language(ASM)
elseif(${ARCH} STREQUAL "x86-64" OR ${ARCH} STREQUAL "x86")
enable_language(ASM_NASM)
else()
message(FATAL_ERROR "Unsupported architecture: ${ARCH}")
endif()
add_library(crypto STATIC IMPORTED)
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION ${SRC_PATH}/openssl/lib/${ARCH}/libcrypto.a)
add_library(ssl STATIC IMPORTED)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${SRC_PATH}/openssl/lib/${ARCH}/libssl.a)
# Required by aapt2
include(cmake/libandroidfw.cmake)
include(cmake/libincfs.cmake)
include(cmake/libselinux.cmake)
include(cmake/libsepol.cmake)
include(cmake/libpackagelistparser.cmake)
include(cmake/libutils.cmake)
include(cmake/libcutils.cmake)
include(cmake/libziparchive.cmake)
include(cmake/libbase.cmake)
include(cmake/libprotobuf.cmake)
include(cmake/liblog.cmake)
include(cmake/libpng.cmake)
include(cmake/libexpat.cmake)
include(cmake/libpcre.cmake)
# Others potentially required by dependencies of aapt2
include(cmake/libgtest.cmake)
include(cmake/libfmt.cmake)
include(cmake/libzopfli.cmake)
include(cmake/libprocessgroup.cmake)
include(cmake/libjson.cmake)
# aapt2 itself
include(cmake/aapt2.cmake)

201
build-tools-android/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,2 @@
# build-tools-android
Visit the original repository [here](https://github.com/RohitVermaOP/build-tools-android).

View File

@ -0,0 +1,60 @@
add_executable(aapt ${SRC_PATH}/aapt/Main.cpp
${SRC_PATH}/aapt/AaptAssets.cpp
${SRC_PATH}/aapt/AaptConfig.cpp
${SRC_PATH}/aapt/AaptUtil.cpp
${SRC_PATH}/aapt/AaptXml.cpp
${SRC_PATH}/aapt/ApkBuilder.cpp
${SRC_PATH}/aapt/Command.cpp
${SRC_PATH}/aapt/CrunchCache.cpp
${SRC_PATH}/aapt/FileFinder.cpp
${SRC_PATH}/aapt/Images.cpp
${SRC_PATH}/aapt/Package.cpp
${SRC_PATH}/aapt/pseudolocalize.cpp
${SRC_PATH}/aapt/Resource.cpp
${SRC_PATH}/aapt/ResourceFilter.cpp
${SRC_PATH}/aapt/ResourceIdCache.cpp
${SRC_PATH}/aapt/ResourceTable.cpp
${SRC_PATH}/aapt/SourcePos.cpp
${SRC_PATH}/aapt/StringPool.cpp
${SRC_PATH}/aapt/WorkQueue.cpp
${SRC_PATH}/aapt/XMLNode.cpp
${SRC_PATH}/aapt/ZipEntry.cpp
${SRC_PATH}/aapt/ZipFile.cpp
)
target_compile_definitions(aapt PRIVATE
-DSTATIC_ANDROIDFW_FOR_TOOLS
)
target_include_directories(aapt PUBLIC
${SRC_PATH}/androidfw/include
${SRC_PATH}/expat
${SRC_PATH}/fmtlib/include
${SRC_PATH}/libpng
${SRC_PATH}/libbase/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/liblog/include
${SRC_PATH}/incfs/util/include
${SRC_PATH}/incfs/kernel-headers
)
target_link_libraries(aapt
libandroidfw
libincfs
libutils
libcutils
libselinux
libziparchive
libbase
libprocessgroup
liblog
libexpat
crypto
libjson
libpng
c++_static
z
)

View File

@ -0,0 +1,188 @@
set(AAPT2_PROTO_SRC) # proto source files
set(AAPT2_PROTO_HDRS) # proto head files
set(AAPT2_PROTO_DIR ${SRC_PATH}/aapt2)
file(GLOB_RECURSE PROTO_FILES ${AAPT2_PROTO_DIR}/*.proto)
foreach(proto ${PROTO_FILES})
get_filename_component(FIL_WE ${proto} NAME_WE)
set(TARGET_CPP_FILE "${AAPT2_PROTO_DIR}/${FIL_WE}.pb.cc")
set(TARGET_HEAD_FILE "${AAPT2_PROTO_DIR}/${FIL_WE}.pb.h")
if(EXISTS ${TARGET_CPP_FILE} AND EXISTS ${TARGET_HEAD_FILE})
list(APPEND AAPT2_PROTO_SRC ${TARGET_CPP_FILE})
list(APPEND AAPT2_PROTO_HDRS ${TARGET_HEAD_FILE})
else()
# execute the protoc command to generate the proto targets
execute_process(
COMMAND ${CMAKE_BINARY_DIR}/bin/protoc ${proto}
--proto_path=${AAPT2_PROTO_DIR}
--cpp_out=${AAPT2_PROTO_DIR}
WORKING_DIRECTORY ${AAPT2_PROTO_DIR}
)
message(STATUS "generate cpp file ${TARGET_CPP_FILE}")
message(STATUS "generate head file ${TARGET_HEAD_FILE}")
endif()
endforeach()
set_source_files_properties(${AAPT2_PROTO_SRC} ${AAPT2_PROTO_HDRS} PROPERTIES GENERATED TRUE)
set(TOOL_SOURCE
${SRC_PATH}/aapt2/cmd/Command.cpp
${SRC_PATH}/aapt2/cmd/Compile.cpp
${SRC_PATH}/aapt2/cmd/Convert.cpp
${SRC_PATH}/aapt2/cmd/Diff.cpp
${SRC_PATH}/aapt2/cmd/Dump.cpp
${SRC_PATH}/aapt2/cmd/Link.cpp
${SRC_PATH}/aapt2/cmd/Optimize.cpp
${SRC_PATH}/aapt2/cmd/Util.cpp
)
set(LINK_LIB
libandroidfw
libincfs
libselinux
libsepol
libpackagelistparser
libutils
libcutils
libziparchive
libbase
libprotobuf
liblog
libpng
libexpat
libpcre
crypto
ssl
z
)
# build the host static library: aapt2
add_library(libaapt2 STATIC
${SRC_PATH}/aapt2/compile/IdAssigner.cpp
${SRC_PATH}/aapt2/compile/InlineXmlFormatParser.cpp
${SRC_PATH}/aapt2/compile/NinePatch.cpp
${SRC_PATH}/aapt2/compile/Png.cpp
${SRC_PATH}/aapt2/compile/PngChunkFilter.cpp
${SRC_PATH}/aapt2/compile/PngCrunch.cpp
${SRC_PATH}/aapt2/compile/PseudolocaleGenerator.cpp
${SRC_PATH}/aapt2/compile/Pseudolocalizer.cpp
${SRC_PATH}/aapt2/compile/XmlIdCollector.cpp
${SRC_PATH}/aapt2/configuration/ConfigurationParser.cpp
${SRC_PATH}/aapt2/dump/DumpManifest.cpp
${SRC_PATH}/aapt2/filter/AbiFilter.cpp
${SRC_PATH}/aapt2/filter/ConfigFilter.cpp
${SRC_PATH}/aapt2/format/Archive.cpp
${SRC_PATH}/aapt2/format/Container.cpp
${SRC_PATH}/aapt2/format/binary/BinaryResourceParser.cpp
${SRC_PATH}/aapt2/format/binary/ResChunkPullParser.cpp
${SRC_PATH}/aapt2/format/binary/TableFlattener.cpp
${SRC_PATH}/aapt2/format/binary/XmlFlattener.cpp
${SRC_PATH}/aapt2/format/proto/ProtoDeserialize.cpp
${SRC_PATH}/aapt2/format/proto/ProtoSerialize.cpp
${SRC_PATH}/aapt2/io/BigBufferStream.cpp
${SRC_PATH}/aapt2/io/File.cpp
${SRC_PATH}/aapt2/io/FileStream.cpp
${SRC_PATH}/aapt2/io/FileSystem.cpp
${SRC_PATH}/aapt2/io/StringStream.cpp
${SRC_PATH}/aapt2/io/Util.cpp
${SRC_PATH}/aapt2/io/ZipArchive.cpp
${SRC_PATH}/aapt2/link/AutoVersioner.cpp
${SRC_PATH}/aapt2/link/ManifestFixer.cpp
${SRC_PATH}/aapt2/link/NoDefaultResourceRemover.cpp
${SRC_PATH}/aapt2/link/ProductFilter.cpp
${SRC_PATH}/aapt2/link/PrivateAttributeMover.cpp
${SRC_PATH}/aapt2/link/ReferenceLinker.cpp
${SRC_PATH}/aapt2/link/ResourceExcluder.cpp
${SRC_PATH}/aapt2/link/TableMerger.cpp
${SRC_PATH}/aapt2/link/XmlCompatVersioner.cpp
${SRC_PATH}/aapt2/link/XmlNamespaceRemover.cpp
${SRC_PATH}/aapt2/link/XmlReferenceLinker.cpp
${SRC_PATH}/aapt2/optimize/MultiApkGenerator.cpp
${SRC_PATH}/aapt2/optimize/ResourceDeduper.cpp
${SRC_PATH}/aapt2/optimize/ResourceFilter.cpp
${SRC_PATH}/aapt2/optimize/ResourcePathShortener.cpp
${SRC_PATH}/aapt2/optimize/VersionCollapser.cpp
${SRC_PATH}/aapt2/process/SymbolTable.cpp
${SRC_PATH}/aapt2/split/TableSplitter.cpp
${SRC_PATH}/aapt2/text/Printer.cpp
${SRC_PATH}/aapt2/text/Unicode.cpp
${SRC_PATH}/aapt2/text/Utf8Iterator.cpp
${SRC_PATH}/aapt2/util/BigBuffer.cpp
${SRC_PATH}/aapt2/util/Files.cpp
${SRC_PATH}/aapt2/util/Util.cpp
${SRC_PATH}/aapt2/Debug.cpp
${SRC_PATH}/aapt2/DominatorTree.cpp
${SRC_PATH}/aapt2/java/AnnotationProcessor.cpp
${SRC_PATH}/aapt2/java/ClassDefinition.cpp
${SRC_PATH}/aapt2/java/JavaClassGenerator.cpp
${SRC_PATH}/aapt2/java/ManifestClassGenerator.cpp
${SRC_PATH}/aapt2/java/ProguardRules.cpp
${SRC_PATH}/aapt2/LoadedApk.cpp
${SRC_PATH}/aapt2/Resource.cpp
${SRC_PATH}/aapt2/ResourceParser.cpp
${SRC_PATH}/aapt2/ResourceTable.cpp
${SRC_PATH}/aapt2/ResourceUtils.cpp
${SRC_PATH}/aapt2/ResourceValues.cpp
${SRC_PATH}/aapt2/SdkConstants.cpp
${SRC_PATH}/aapt2/StringPool.cpp
${SRC_PATH}/aapt2/trace/TraceBuffer.cpp
${SRC_PATH}/aapt2/xml/XmlActionExecutor.cpp
${SRC_PATH}/aapt2/xml/XmlDom.cpp
${SRC_PATH}/aapt2/xml/XmlPullParser.cpp
${SRC_PATH}/aapt2/xml/XmlUtil.cpp
${SRC_PATH}/aapt2/Configuration.proto
${SRC_PATH}/aapt2/Resources.proto
${SRC_PATH}/aapt2/ResourcesInternal.proto
${AAPT2_PROTO_SRC} ${AAPT2_PROTO_HDRS}
)
set(INCLUDE_PATH
${SRC_PATH}/aapt2
${SRC_PATH}/protobuf/src
${SRC_PATH}/liblog/include
${SRC_PATH}/expat
${SRC_PATH}/fmtlib/include
${SRC_PATH}/libpng
${SRC_PATH}/libbase/include
${SRC_PATH}/androidfw/include
${SRC_PATH}/libidmap2_policies/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/libutils/include
${SRC_PATH}/googletest/include
${SRC_PATH}/libziparchive/include
${SRC_PATH}/incfs/util/include
${SRC_PATH}/incfs/kernel-headers
)
target_include_directories(libaapt2 PUBLIC ${INCLUDE_PATH})
# build the host shared library: aapt2_jni
add_library(aapt2_jni SHARED
${SRC_PATH}/aapt2/jni/aapt2_jni.cpp
${TOOL_SOURCE}
)
target_include_directories(aapt2_jni PUBLIC ${INCLUDE_PATH})
target_link_libraries(aapt2_jni
libaapt2
${LINK_LIB}
c++_shared
)
# build the executable file aapt2
add_executable(aapt2
${SRC_PATH}/aapt2/Main.cpp
${TOOL_SOURCE}
)
target_include_directories(aapt2 PUBLIC ${INCLUDE_PATH})
target_link_libraries(aapt2
libaapt2
${LINK_LIB}
c++_static
)

View File

@ -0,0 +1,90 @@
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
if(NOT BISON_FOUND)
message(FATAL_ERROR "can't find the bison")
endif()
if(NOT FLEX_FOUND)
message(FATAL_ERROR "can't find the flex")
endif()
# generate aidl_language_y.h and aidl_language_y.cpp
bison_target(
LangParser ${SRC_PATH}/aidl/aidl_language_y.yy ${SRC_PATH}/aidl/aidl_language_y.cpp
DEFINES_FILE ${SRC_PATH}/aidl/aidl_language_y.h
)
# generate aidl_language_l.h and aidl_language_l.cpp
flex_target(
LangScanner ${SRC_PATH}/aidl/aidl_language_l.ll ${SRC_PATH}/aidl/aidl_language_l.cpp
DEFINES_FILE ${SRC_PATH}/aidl/aidl_language_l.h
)
# add dependency
add_flex_bison_dependency(LangScanner LangParser)
message(STATUS ${FLEX_LangScanner_OUTPUTS})
message(STATUS ${BISON_LangParser_OUTPUTS})
set(GEN_PARSER_HEAD_FILE ${SRC_PATH}/aidl/aidl_language_y.h)
add_custom_target(patch
COMMAND echo 'typedef union yy::parser::value_type YYSTYPE\;' >> ${GEN_PARSER_HEAD_FILE}
COMMAND echo 'typedef yy::parser::location_type YYLTYPE\;' >> ${GEN_PARSER_HEAD_FILE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${FLEX_LangScanner_OUTPUTS} ${BISON_LangParser_OUTPUTS}
COMMENT "to patch for ${GEN_PARSER_HEAD_FILE}"
)
add_executable(aidl ${SRC_PATH}/aidl/main.cpp
${SRC_PATH}/aidl/aidl_checkapi.cpp
${SRC_PATH}/aidl/aidl_const_expressions.cpp
${SRC_PATH}/aidl/aidl_dumpapi.cpp
${SRC_PATH}/aidl/aidl_language.cpp
${SRC_PATH}/aidl/aidl_language_l.ll
${SRC_PATH}/aidl/aidl_language_y.yy
${SRC_PATH}/aidl/aidl_to_cpp_common.cpp
${SRC_PATH}/aidl/aidl_to_cpp.cpp
${SRC_PATH}/aidl/aidl_to_java.cpp
${SRC_PATH}/aidl/aidl_to_ndk.cpp
${SRC_PATH}/aidl/aidl_to_rust.cpp
${SRC_PATH}/aidl/aidl_typenames.cpp
${SRC_PATH}/aidl/aidl.cpp
${SRC_PATH}/aidl/ast_cpp.cpp
${SRC_PATH}/aidl/ast_java.cpp
${SRC_PATH}/aidl/code_writer.cpp
${SRC_PATH}/aidl/comments.cpp
${SRC_PATH}/aidl/diagnostics.cpp
${SRC_PATH}/aidl/generate_aidl_mappings.cpp
${SRC_PATH}/aidl/generate_cpp.cpp
${SRC_PATH}/aidl/generate_java_binder.cpp
${SRC_PATH}/aidl/generate_java.cpp
${SRC_PATH}/aidl/generate_ndk.cpp
${SRC_PATH}/aidl/generate_rust.cpp
${SRC_PATH}/aidl/import_resolver.cpp
${SRC_PATH}/aidl/io_delegate.cpp
${SRC_PATH}/aidl/location.cpp
${SRC_PATH}/aidl/logging.cpp
${SRC_PATH}/aidl/options.cpp
${SRC_PATH}/aidl/parser.cpp
${SRC_PATH}/aidl/preprocess.cpp
${FLEX_LangScanner_OUTPUTS}
)
target_compile_definitions(aidl PRIVATE
-DPLATFORM_SDK_VERSION="31.0.3"
)
target_include_directories(aidl PUBLIC
${SRC_PATH}/libbase/include
${SRC_PATH}/fmtlib/include
${SRC_PATH}/googletest/include
)
target_link_libraries(aidl
libbase
liblog
libgtest
libfmt
c++_static
)

View File

@ -0,0 +1,45 @@
add_library(libandroidfw STATIC
${SRC_PATH}/androidfw/ApkAssets.cpp
${SRC_PATH}/androidfw/Asset.cpp
${SRC_PATH}/androidfw/AssetDir.cpp
${SRC_PATH}/androidfw/AssetManager.cpp
${SRC_PATH}/androidfw/AssetManager2.cpp
${SRC_PATH}/androidfw/AttributeResolution.cpp
${SRC_PATH}/androidfw/ChunkIterator.cpp
${SRC_PATH}/androidfw/ConfigDescription.cpp
${SRC_PATH}/androidfw/Idmap.cpp
${SRC_PATH}/androidfw/LoadedArsc.cpp
${SRC_PATH}/androidfw/Locale.cpp
${SRC_PATH}/androidfw/LocaleData.cpp
${SRC_PATH}/androidfw/misc.cpp
${SRC_PATH}/androidfw/ObbFile.cpp
${SRC_PATH}/androidfw/PosixUtils.cpp
${SRC_PATH}/androidfw/ResourceTypes.cpp
${SRC_PATH}/androidfw/ResourceUtils.cpp
${SRC_PATH}/androidfw/StreamingZipInflater.cpp
${SRC_PATH}/androidfw/TypeWrappers.cpp
${SRC_PATH}/androidfw/Util.cpp
${SRC_PATH}/androidfw/ZipFileRO.cpp
${SRC_PATH}/androidfw/ZipUtils.cpp
)
target_compile_definitions(libandroidfw PUBLIC -DSTATIC_ANDROIDFW_FOR_TOOLS)
target_compile_definitions(libandroidfw PRIVATE -D_GNU_SOURCE -DNDEBUG)
target_include_directories(libandroidfw PUBLIC
${SRC_PATH}/androidfw/include
${SRC_PATH}/libcutils/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libbase/include
${SRC_PATH}/binder/include
${SRC_PATH}/libziparchive/include
${SRC_PATH}/incfs/util/include
${SRC_PATH}/incfs/kernel-headers
)
target_link_libraries(libandroidfw PUBLIC
libfmt
)

View File

@ -0,0 +1,29 @@
add_library(libbase STATIC
${SRC_PATH}/libbase/abi_compatibility.cpp
${SRC_PATH}/libbase/chrono_utils.cpp
${SRC_PATH}/libbase/cmsg.cpp
${SRC_PATH}/libbase/errors_unix.cpp
${SRC_PATH}/libbase/file.cpp
${SRC_PATH}/libbase/logging.cpp
${SRC_PATH}/libbase/mapped_file.cpp
${SRC_PATH}/libbase/parsebool.cpp
${SRC_PATH}/libbase/parsenetaddress.cpp
${SRC_PATH}/libbase/process.cpp
${SRC_PATH}/libbase/properties.cpp
${SRC_PATH}/libbase/stringprintf.cpp
${SRC_PATH}/libbase/strings.cpp
${SRC_PATH}/libbase/test_utils.cpp
${SRC_PATH}/libbase/threads.cpp
)
target_compile_definitions(libbase PUBLIC
-D_FILE_OFFSET_BITS=64
)
target_include_directories(libbase PUBLIC
${SRC_PATH}/libbase/include
${SRC_PATH}/libcutils/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/liblog/include
)

View File

@ -0,0 +1,34 @@
add_library(libcutils STATIC
${SRC_PATH}/libcutils/android_get_control_file.cpp
${SRC_PATH}/libcutils/ashmem-host.cpp
${SRC_PATH}/libcutils/canned_fs_config.cpp
${SRC_PATH}/libcutils/config_utils.cpp
${SRC_PATH}/libcutils/fs.cpp
${SRC_PATH}/libcutils/fs_config.cpp
${SRC_PATH}/libcutils/hashmap.cpp
${SRC_PATH}/libcutils/iosched_policy.cpp
${SRC_PATH}/libcutils/load_file.cpp
${SRC_PATH}/libcutils/multiuser.cpp
${SRC_PATH}/libcutils/native_handle.cpp
${SRC_PATH}/libcutils/properties.cpp
${SRC_PATH}/libcutils/record_stream.cpp
${SRC_PATH}/libcutils/socket_inaddr_any_server_unix.cpp
${SRC_PATH}/libcutils/socket_local_client_unix.cpp
${SRC_PATH}/libcutils/socket_local_server_unix.cpp
${SRC_PATH}/libcutils/socket_network_client_unix.cpp
${SRC_PATH}/libcutils/sockets_unix.cpp
${SRC_PATH}/libcutils/sockets.cpp
${SRC_PATH}/libcutils/str_parms.cpp
${SRC_PATH}/libcutils/strlcpy.c
${SRC_PATH}/libcutils/trace-host.cpp
${SRC_PATH}/libcutils/threads.cpp
)
target_compile_definitions(libcutils PRIVATE -D_GNU_SOURCE)
target_include_directories(libcutils PUBLIC
${SRC_PATH}/libutils/include
${SRC_PATH}/libcutils/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libbase/include
)

View File

@ -0,0 +1,13 @@
add_library(libexpat STATIC
${SRC_PATH}/expat/xmlparse.c
${SRC_PATH}/expat/xmlrole.c
${SRC_PATH}/expat/xmltok.c
)
target_compile_definitions(libexpat PRIVATE
-DHAVE_EXPAT_CONFIG_H
)
target_include_directories(libexpat PUBLIC
${SRC_PATH}/expat
)

View File

@ -0,0 +1,7 @@
add_library(libfmt STATIC
${SRC_PATH}/fmtlib/src/format.cc
)
target_include_directories(libfmt PUBLIC
${SRC_PATH}/fmtlib/include
)

View File

@ -0,0 +1,8 @@
add_library(libgtest STATIC
${SRC_PATH}/googletest/src/gtest-all.cc
)
target_include_directories(libgtest PUBLIC
${SRC_PATH}/googletest/include
${SRC_PATH}/googletest
)

View File

@ -0,0 +1,20 @@
add_library(libincfs STATIC
${SRC_PATH}/incfs/incfs_ndk.c
${SRC_PATH}/incfs/incfs.cpp
${SRC_PATH}/incfs/MountRegistry.cpp
${SRC_PATH}/incfs/path.cpp
${SRC_PATH}/incfs/util/map_ptr.cpp
${SRC_PATH}/sysprop/IncrementalProperties.sysprop.cpp
)
target_include_directories(libincfs PUBLIC
${SRC_PATH}/incfs/include
${SRC_PATH}/incfs/util/include
${SRC_PATH}/sysprop/include
${SRC_PATH}/incfs/kernel-headers
${SRC_PATH}/libbase/include
${SRC_PATH}/libutils/include
${SRC_PATH}/openssl/include
${SRC_PATH}/libselinux/include
${SRC_PATH}/liblog/include
)

View File

@ -0,0 +1,15 @@
add_library(libjson STATIC
${SRC_PATH}/jsoncpp/src/json_reader.cpp
${SRC_PATH}/jsoncpp/src/json_value.cpp
${SRC_PATH}/jsoncpp/src/json_writer.cpp
${SRC_PATH}/jsoncpp/src/json_valueiterator.inl
)
target_compile_definitions(libjson PRIVATE
-DJSON_USE_EXCEPTION=0
-DJSONCPP_NO_LOCALE_SUPPORT
)
target_include_directories(libjson PUBLIC
${SRC_PATH}/jsoncpp/include
)

View File

@ -0,0 +1,30 @@
add_library(liblog STATIC
${SRC_PATH}/liblog/log_event_list.cpp
${SRC_PATH}/liblog/log_event_write.cpp
${SRC_PATH}/liblog/logger_name.cpp
${SRC_PATH}/liblog/logger_read.cpp
${SRC_PATH}/liblog/logger_write.cpp
${SRC_PATH}/liblog/properties.cpp
${SRC_PATH}/liblog/logprint.cpp
${SRC_PATH}/liblog/event_tag_map.cpp
${SRC_PATH}/liblog/log_time.cpp
${SRC_PATH}/liblog/pmsg_reader.cpp
${SRC_PATH}/liblog/pmsg_writer.cpp
${SRC_PATH}/liblog/logd_reader.cpp
${SRC_PATH}/liblog/logd_writer.cpp
)
target_compile_definitions(liblog PRIVATE
-DLIBLOG_LOG_TAG=1006
-D_XOPEN_SOURCE=700
-DFAKE_LOG_DEVICE=1
-DSNET_EVENT_LOG_TAG=1397638686
)
target_include_directories(liblog PUBLIC
${SRC_PATH}/libcutils/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libbase/include
)

View File

@ -0,0 +1,8 @@
add_library(libpackagelistparser STATIC
${SRC_PATH}/libpackagelistparser/packagelistparser.cpp
)
target_include_directories(libpackagelistparser PUBLIC
${SRC_PATH}/libpackagelistparser/include
${SRC_PATH}/liblog/include
)

View File

@ -0,0 +1,39 @@
add_library(libpcre STATIC
${SRC_PATH}/pcre/dist2/src/pcre2_auto_possess.c
${SRC_PATH}/pcre/dist2/src/pcre2_compile.c
${SRC_PATH}/pcre/dist2/src/pcre2_config.c
${SRC_PATH}/pcre/dist2/src/pcre2_context.c
${SRC_PATH}/pcre/dist2/src/pcre2_convert.c
${SRC_PATH}/pcre/dist2/src/pcre2_dfa_match.c
${SRC_PATH}/pcre/dist2/src/pcre2_error.c
${SRC_PATH}/pcre/dist2/src/pcre2_extuni.c
${SRC_PATH}/pcre/dist2/src/pcre2_find_bracket.c
${SRC_PATH}/pcre/dist2/src/pcre2_maketables.c
${SRC_PATH}/pcre/dist2/src/pcre2_match.c
${SRC_PATH}/pcre/dist2/src/pcre2_match_data.c
${SRC_PATH}/pcre/dist2/src/pcre2_jit_compile.c
${SRC_PATH}/pcre/dist2/src/pcre2_newline.c
${SRC_PATH}/pcre/dist2/src/pcre2_ord2utf.c
${SRC_PATH}/pcre/dist2/src/pcre2_pattern_info.c
${SRC_PATH}/pcre/dist2/src/pcre2_script_run.c
${SRC_PATH}/pcre/dist2/src/pcre2_serialize.c
${SRC_PATH}/pcre/dist2/src/pcre2_string_utils.c
${SRC_PATH}/pcre/dist2/src/pcre2_study.c
${SRC_PATH}/pcre/dist2/src/pcre2_substitute.c
${SRC_PATH}/pcre/dist2/src/pcre2_substring.c
${SRC_PATH}/pcre/dist2/src/pcre2_tables.c
${SRC_PATH}/pcre/dist2/src/pcre2_ucd.c
${SRC_PATH}/pcre/dist2/src/pcre2_valid_utf.c
${SRC_PATH}/pcre/dist2/src/pcre2_xclass.c
${SRC_PATH}/pcre/dist2/src/pcre2_chartables.c
)
target_compile_definitions(libpcre PUBLIC
-DHAVE_CONFIG_H
)
target_include_directories(libpcre PUBLIC
${SRC_PATH}/pcre/dist2/src
${SRC_PATH}/pcre/include_internal
${SRC_PATH}/pcre/include
)

View File

@ -0,0 +1,45 @@
add_library(libpng STATIC
${SRC_PATH}/libpng/png.c
${SRC_PATH}/libpng/pngerror.c
${SRC_PATH}/libpng/pngget.c
${SRC_PATH}/libpng/pngmem.c
${SRC_PATH}/libpng/pngpread.c
${SRC_PATH}/libpng/pngread.c
${SRC_PATH}/libpng/pngrio.c
${SRC_PATH}/libpng/pngrtran.c
${SRC_PATH}/libpng/pngrutil.c
${SRC_PATH}/libpng/pngset.c
${SRC_PATH}/libpng/pngtrans.c
${SRC_PATH}/libpng/pngwio.c
${SRC_PATH}/libpng/pngwrite.c
${SRC_PATH}/libpng/pngwtran.c
${SRC_PATH}/libpng/pngwutil.c
)
if(${ARCH} STREQUAL "arm64-v8a" OR ${ARCH} STREQUAL "armeabi-v7a")
target_sources(libpng PUBLIC
${SRC_PATH}/libpng/arm/arm_init.c
${SRC_PATH}/libpng/arm/filter_neon_intrinsics.c
${SRC_PATH}/libpng/arm/palette_neon_intrinsics.c
)
if(${ARCH} STREQUAL "armeabi-v7a")
target_sources(libpng PUBLIC
${SRC_PATH}/libpng/arm/filter_neon.S
)
endif()
elseif(${ARCH} STREQUAL "x86-64" OR ${ARCH} STREQUAL "x86")
target_sources(libpng PUBLIC
${SRC_PATH}/libpng/intel/intel_init.c
${SRC_PATH}/libpng/intel/filter_sse2_intrinsics.c
)
target_compile_definitions(libpng PRIVATE
-DPNG_INTEL_SSE_OPT=1
)
endif()
target_include_directories(libpng PRIVATE
${SRC_PATH}/libpng
)

View File

@ -0,0 +1,22 @@
add_library(libprocessgroup STATIC
${SRC_PATH}/libprocessgroup/cgroup_map.cpp
${SRC_PATH}/libprocessgroup/processgroup.cpp
${SRC_PATH}/libprocessgroup/sched_policy.cpp
${SRC_PATH}/libprocessgroup/task_profiles.cpp
${SRC_PATH}/libprocessgroup/cgrouprc_format/cgroup_controller.cpp
${SRC_PATH}/libprocessgroup/cgrouprc/cgroup_controller.cpp
${SRC_PATH}/libprocessgroup/cgrouprc/cgroup_file.cpp
)
target_include_directories(libprocessgroup PUBLIC
${SRC_PATH}/libprocessgroup/include
${SRC_PATH}/libprocessgroup/cgrouprc/include
${SRC_PATH}/libprocessgroup/cgrouprc_format/include
${SRC_PATH}/libbase/include
${SRC_PATH}/libcutils/include
${SRC_PATH}/jsoncpp/include
)
target_include_directories(libprocessgroup PRIVATE
${SRC_PATH}/libprocessgroup
)

View File

@ -0,0 +1,91 @@
add_library(libprotobuf STATIC
${SRC_PATH}/protobuf/src/google/protobuf/any_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/arena.cc
${SRC_PATH}/protobuf/src/google/protobuf/extension_set.cc
${SRC_PATH}/protobuf/src/google/protobuf/generated_enum_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/generated_message_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/implicit_weak_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/coded_stream.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/io_win32.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/strtod.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/zero_copy_stream.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/message_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/parse_context.cc
${SRC_PATH}/protobuf/src/google/protobuf/repeated_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/bytestream.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/common.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/int128.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/status.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/statusor.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/stringpiece.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/stringprintf.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/structurally_valid.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/strutil.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/time.cc
${SRC_PATH}/protobuf/src/google/protobuf/wire_format_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/any.cc
${SRC_PATH}/protobuf/src/google/protobuf/any.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/api.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/importer.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/parser.cc
${SRC_PATH}/protobuf/src/google/protobuf/descriptor.cc
${SRC_PATH}/protobuf/src/google/protobuf/descriptor.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/descriptor_database.cc
${SRC_PATH}/protobuf/src/google/protobuf/duration.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/dynamic_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/empty.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/extension_set_heavy.cc
${SRC_PATH}/protobuf/src/google/protobuf/field_mask.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/generated_message_reflection.cc
${SRC_PATH}/protobuf/src/google/protobuf/generated_message_table_driven.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/gzip_stream.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/printer.cc
${SRC_PATH}/protobuf/src/google/protobuf/io/tokenizer.cc
${SRC_PATH}/protobuf/src/google/protobuf/map_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/message.cc
${SRC_PATH}/protobuf/src/google/protobuf/reflection_ops.cc
${SRC_PATH}/protobuf/src/google/protobuf/service.cc
${SRC_PATH}/protobuf/src/google/protobuf/source_context.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/struct.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/mathlimits.cc
${SRC_PATH}/protobuf/src/google/protobuf/stubs/substitute.cc
${SRC_PATH}/protobuf/src/google/protobuf/text_format.cc
${SRC_PATH}/protobuf/src/google/protobuf/timestamp.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/type.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/unknown_field_set.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/delimited_message_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/field_comparator.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/field_mask_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/datapiece.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/error_listener.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/json_escaping.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/object_writer.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/proto_writer.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/type_info.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/internal/utility.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/json_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/message_differencer.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/time_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/util/type_resolver_util.cc
${SRC_PATH}/protobuf/src/google/protobuf/wire_format.cc
${SRC_PATH}/protobuf/src/google/protobuf/wrappers.pb.cc
)
target_compile_definitions(libprotobuf PRIVATE
-DHAVE_ZLIB=1
)
target_include_directories(libprotobuf PUBLIC
${SRC_PATH}/protobuf/android
${SRC_PATH}/protobuf/src
)

View File

@ -0,0 +1,75 @@
add_library(libselinux STATIC
${SRC_PATH}/libselinux/src/booleans.c
${SRC_PATH}/libselinux/src/callbacks.c
${SRC_PATH}/libselinux/src/freecon.c
${SRC_PATH}/libselinux/src/label_backends_android.c
${SRC_PATH}/libselinux/src/label.c
${SRC_PATH}/libselinux/src/label_support.c
${SRC_PATH}/libselinux/src/matchpathcon.c
${SRC_PATH}/libselinux/src/setrans_client.c
${SRC_PATH}/libselinux/src/sha1.c
${SRC_PATH}/libselinux/src/android/android.c
${SRC_PATH}/libselinux/src/avc.c
${SRC_PATH}/libselinux/src/avc_internal.c
${SRC_PATH}/libselinux/src/avc_sidtab.c
${SRC_PATH}/libselinux/src/canonicalize_context.c
${SRC_PATH}/libselinux/src/checkAccess.c
${SRC_PATH}/libselinux/src/check_context.c
${SRC_PATH}/libselinux/src/compute_av.c
${SRC_PATH}/libselinux/src/compute_create.c
${SRC_PATH}/libselinux/src/compute_member.c
${SRC_PATH}/libselinux/src/context.c
${SRC_PATH}/libselinux/src/deny_unknown.c
${SRC_PATH}/libselinux/src/disable.c
${SRC_PATH}/libselinux/src/enabled.c
${SRC_PATH}/libselinux/src/fgetfilecon.c
${SRC_PATH}/libselinux/src/fsetfilecon.c
${SRC_PATH}/libselinux/src/getenforce.c
${SRC_PATH}/libselinux/src/getfilecon.c
${SRC_PATH}/libselinux/src/get_initial_context.c
${SRC_PATH}/libselinux/src/getpeercon.c
${SRC_PATH}/libselinux/src/init.c
${SRC_PATH}/libselinux/src/lgetfilecon.c
${SRC_PATH}/libselinux/src/load_policy.c
${SRC_PATH}/libselinux/src/lsetfilecon.c
${SRC_PATH}/libselinux/src/mapping.c
${SRC_PATH}/libselinux/src/policyvers.c
${SRC_PATH}/libselinux/src/procattr.c
${SRC_PATH}/libselinux/src/reject_unknown.c
${SRC_PATH}/libselinux/src/sestatus.c
${SRC_PATH}/libselinux/src/setenforce.c
${SRC_PATH}/libselinux/src/setfilecon.c
${SRC_PATH}/libselinux/src/stringrep.c
${SRC_PATH}/libselinux/src/label_file.c
${SRC_PATH}/libselinux/src/regex.c
${SRC_PATH}/libselinux/src/selinux_config.c
${SRC_PATH}/libselinux/src/seusers.c
${SRC_PATH}/libselinux/src/android/android_vendor.c
)
target_compile_definitions(libselinux PRIVATE
-DAUDITD_LOG_TAG=1003
-D_GNU_SOURCE
-DHOST
-DUSE_PCRE2
-DNO_PERSISTENTLY_STORED_PATTERNS
-DDISABLE_SETRANS
-DDISABLE_BOOL
-DNO_MEDIA_BACKEND
-DNO_X_BACKEND
-DNO_DB_BACKEND
-DPCRE2_CODE_UNIT_WIDTH=8
)
target_include_directories(libselinux PUBLIC
${SRC_PATH}/libselinux/include
${SRC_PATH}/libsepol/include
${SRC_PATH}/libcutils/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libpackagelistparser/include
${SRC_PATH}/pcre/include
)
target_include_directories(libselinux PRIVATE
${SRC_PATH}/libselinux/src
)

View File

@ -0,0 +1,79 @@
add_library(libsepol STATIC
${SRC_PATH}/libsepol/src/assertion.c
${SRC_PATH}/libsepol/src/avrule_block.c
${SRC_PATH}/libsepol/src/avtab.c
${SRC_PATH}/libsepol/src/boolean_record.c
${SRC_PATH}/libsepol/src/booleans.c
${SRC_PATH}/libsepol/src/conditional.c
${SRC_PATH}/libsepol/src/constraint.c
${SRC_PATH}/libsepol/src/context.c
${SRC_PATH}/libsepol/src/context_record.c
${SRC_PATH}/libsepol/src/debug.c
${SRC_PATH}/libsepol/src/ebitmap.c
${SRC_PATH}/libsepol/src/expand.c
${SRC_PATH}/libsepol/src/handle.c
${SRC_PATH}/libsepol/src/hashtab.c
${SRC_PATH}/libsepol/src/hierarchy.c
${SRC_PATH}/libsepol/src/iface_record.c
${SRC_PATH}/libsepol/src/interfaces.c
${SRC_PATH}/libsepol/src/kernel_to_cil.c
${SRC_PATH}/libsepol/src/kernel_to_common.c
${SRC_PATH}/libsepol/src/kernel_to_conf.c
${SRC_PATH}/libsepol/src/link.c
${SRC_PATH}/libsepol/src/mls.c
${SRC_PATH}/libsepol/src/module.c
${SRC_PATH}/libsepol/src/module_to_cil.c
${SRC_PATH}/libsepol/src/node_record.c
${SRC_PATH}/libsepol/src/nodes.c
${SRC_PATH}/libsepol/src/optimize.c
${SRC_PATH}/libsepol/src/polcaps.c
${SRC_PATH}/libsepol/src/policydb.c
${SRC_PATH}/libsepol/src/policydb_convert.c
${SRC_PATH}/libsepol/src/policydb_public.c
${SRC_PATH}/libsepol/src/port_record.c
${SRC_PATH}/libsepol/src/ports.c
${SRC_PATH}/libsepol/src/roles.c
${SRC_PATH}/libsepol/src/services.c
${SRC_PATH}/libsepol/src/sidtab.c
${SRC_PATH}/libsepol/src/symtab.c
${SRC_PATH}/libsepol/src/user_record.c
${SRC_PATH}/libsepol/src/users.c
${SRC_PATH}/libsepol/src/util.c
${SRC_PATH}/libsepol/src/write.c
${SRC_PATH}/libsepol/cil/src/android.c
${SRC_PATH}/libsepol/cil/src/cil_binary.c
${SRC_PATH}/libsepol/cil/src/cil_build_ast.c
${SRC_PATH}/libsepol/cil/src/cil.c
${SRC_PATH}/libsepol/cil/src/cil_copy_ast.c
${SRC_PATH}/libsepol/cil/src/cil_find.c
${SRC_PATH}/libsepol/cil/src/cil_fqn.c
${SRC_PATH}/libsepol/cil/src/cil_lexer.l
${SRC_PATH}/libsepol/cil/src/cil_list.c
${SRC_PATH}/libsepol/cil/src/cil_log.c
${SRC_PATH}/libsepol/cil/src/cil_mem.c
${SRC_PATH}/libsepol/cil/src/cil_parser.c
${SRC_PATH}/libsepol/cil/src/cil_policy.c
${SRC_PATH}/libsepol/cil/src/cil_post.c
${SRC_PATH}/libsepol/cil/src/cil_reset_ast.c
${SRC_PATH}/libsepol/cil/src/cil_resolve_ast.c
${SRC_PATH}/libsepol/cil/src/cil_stack.c
${SRC_PATH}/libsepol/cil/src/cil_strpool.c
${SRC_PATH}/libsepol/cil/src/cil_symtab.c
${SRC_PATH}/libsepol/cil/src/cil_tree.c
${SRC_PATH}/libsepol/cil/src/cil_verify.c
${SRC_PATH}/libsepol/cil/src/cil_write_ast.c
)
target_compile_definitions(libsepol
PRIVATE -D_GNU_SOURCE
)
target_include_directories(libsepol PUBLIC
${SRC_PATH}/libselinux/include
${SRC_PATH}/libsepol/include
)
target_include_directories(libsepol PRIVATE
${SRC_PATH}/libsepol/src
${SRC_PATH}/libsepol/cil/include
)

View File

@ -0,0 +1,35 @@
add_library(libutils STATIC
${SRC_PATH}/libutils/Errors.cpp
${SRC_PATH}/libutils/FileMap.cpp
${SRC_PATH}/libutils/JenkinsHash.cpp
${SRC_PATH}/libutils/LightRefBase.cpp
${SRC_PATH}/libutils/NativeHandle.cpp
${SRC_PATH}/libutils/Printer.cpp
${SRC_PATH}/libutils/RefBase.cpp
${SRC_PATH}/libutils/SharedBuffer.cpp
${SRC_PATH}/libutils/StopWatch.cpp
${SRC_PATH}/libutils/String8.cpp
${SRC_PATH}/libutils/String16.cpp
${SRC_PATH}/libutils/StrongPointer.cpp
${SRC_PATH}/libutils/SystemClock.cpp
${SRC_PATH}/libutils/Threads.cpp
${SRC_PATH}/libutils/Timers.cpp
${SRC_PATH}/libutils/Tokenizer.cpp
${SRC_PATH}/libutils/Unicode.cpp
${SRC_PATH}/libutils/VectorImpl.cpp
${SRC_PATH}/libutils/misc.cpp
${SRC_PATH}/libutils/Trace.cpp
${SRC_PATH}/libutils/Looper.cpp
)
target_include_directories(libutils PUBLIC
${SRC_PATH}/libcutils/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libsystem/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libprocessgroup/include
${SRC_PATH}/libvndksupport/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libbase/include
${SRC_PATH}/libbacktrace/include
)

View File

@ -0,0 +1,19 @@
add_library(libziparchive STATIC
${SRC_PATH}/libziparchive/zip_archive.cc
${SRC_PATH}/libziparchive/zip_archive_stream_entry.cc
${SRC_PATH}/libziparchive/zip_cd_entry_map.cc
${SRC_PATH}/libziparchive/zip_writer.cc
${SRC_PATH}/libziparchive/zip_error.cpp
)
target_compile_definitions(libziparchive PRIVATE
-DZLIB_CONST
-D_FILE_OFFSET_BITS=64
)
target_include_directories(libziparchive PUBLIC
${SRC_PATH}/libziparchive/include
${SRC_PATH}/libbase/include
${SRC_PATH}/liblog/include
${SRC_PATH}/googletest/include
)

View File

@ -0,0 +1,18 @@
add_library(libzopfli STATIC
${SRC_PATH}/zopfli/src/zopfli/blocksplitter.c
${SRC_PATH}/zopfli/src/zopfli/cache.c
${SRC_PATH}/zopfli/src/zopfli/deflate.c
${SRC_PATH}/zopfli/src/zopfli/gzip_container.c
${SRC_PATH}/zopfli/src/zopfli/hash.c
${SRC_PATH}/zopfli/src/zopfli/katajainen.c
${SRC_PATH}/zopfli/src/zopfli/lz77.c
${SRC_PATH}/zopfli/src/zopfli/squeeze.c
${SRC_PATH}/zopfli/src/zopfli/tree.c
${SRC_PATH}/zopfli/src/zopfli/util.c
${SRC_PATH}/zopfli/src/zopfli/zlib_container.c
${SRC_PATH}/zopfli/src/zopfli/zopfli_lib.c
)
target_include_directories(libzopfli PRIVATE
${SRC_PATH}/zopfli/src
)

View File

@ -0,0 +1,99 @@
add_executable(protoc ${SRC_PATH}/protobuf/src/google/protobuf/compiler/main.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/code_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/command_line_interface.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_context.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_enum.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_extension.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_file.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_helpers.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_map_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message_builder.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_message_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_service.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_string_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/js/js_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/php/php_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/plugin.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/plugin.pb.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/python/python_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/subprocess.cc
${SRC_PATH}/protobuf/src/google/protobuf/compiler/zip_writer.cc
)
target_compile_definitions(protoc PRIVATE
-DHAVE_ZLIB=1
)
target_include_directories(protoc PUBLIC
${SRC_PATH}/protobuf/src
${SRC_PATH}/protobuf/android
)
target_link_libraries(protoc
libprotobuf
liblog
z
c++_static
)

View File

@ -0,0 +1,27 @@
add_executable(zipalign ${SRC_PATH}/zipalign/ZipAlignMain.cpp
${SRC_PATH}/zipalign/ZipAlign.cpp
${SRC_PATH}/zipalign/ZipEntry.cpp
${SRC_PATH}/zipalign/ZipFile.cpp
)
target_include_directories(zipalign PUBLIC
${SRC_PATH}/libbase/include
${SRC_PATH}/liblog/include
${SRC_PATH}/libutils/include
${SRC_PATH}/libziparchive/include
)
target_include_directories(zipalign PRIVATE
${SRC_PATH}/zipalign/include
${SRC_PATH}/zopfli/src
)
target_link_libraries(zipalign
libutils
libbase
libziparchive
libzopfli
liblog
c++_static
z
)

BIN
build-tools-android/src.zip Normal file

Binary file not shown.

96
build.sh Executable file
View File

@ -0,0 +1,96 @@
#!/bin/bash
installDeps() {
echo "Installing dependencies..."
sudo apt-get update
sudo apt-get upgrade git -y
sudo apt-get install build-essential unzip nasm cmake ninja-build -y || exit 1
}
compileAapt2() {
arch="$1"
c_compiler=""
cxx_compiler=""
case $arch in
"arm64-v8a")
c_compiler="aarch64-linux-android30-clang"
cxx_compiler="aarch64-linux-android30-clang++"
;;
"armeabi-v7a")
c_compiler="armv7a-linux-androideabi30-clang"
cxx_compiler="armv7a-linux-androideabi30-clang++"
;;
"x86")
c_compiler="i686-linux-android30-clang"
cxx_compiler="i686-linux-android30-clang++"
;;
"x86-64")
c_compiler="x86_64-linux-android30-clang"
cxx_compiler="x86_64-linux-android30-clang++"
;;
*)
echo "Unknown architecture: $arch"
exit 1
;;
esac
currentdir="$(pwd)"
outdir="$currentdir/dist/$arch"
if [ -d "$outdir" ]; then
echo "Skipping compilation against target $arch because it already exists."
echo "Please delete $outdir and re-run this script to recompile against target $arch."
return 0
fi
echo "Compiling against target: $arch"
echo "NDK toolchain: ${NDK_TOOLCHAIN}"
echo "Output will be saved in: $outdir"
echo "Compiling..."
rm -rf "build"
mkdir "build" && cd "build" || exit 1
cmake -G 'Ninja' \
-DCMAKE_C_COMPILER="$NDK_TOOLCHAIN/bin/$c_compiler" \
-DCMAKE_CXX_COMPILER="$NDK_TOOLCHAIN/bin/$cxx_compiler" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=True \
-DCMAKE_SYSROOT="$NDK_TOOLCHAIN/sysroot" \
-DCMAKE_BUILD_TYPE=Release \
-DARCH="$arch" \
.. || exit 1
ninja -j16 || exit 1
mkdir -p "$outdir"
mv "aapt2" "$outdir"
mv "libaapt2_jni.so" "$outdir"
cd "$currentdir" || exit 1
}
buildAapt2() {
echo "Building aapt2, this may take a while..."
cd build-tools-android || exit 1
echo "Unzipping sources..."
unzip -q -o src.zip
mkdir -p "dist"
for arch in "arm64-v8a" \
"armeabi-v7a" \
"x86" \
"x86-64"; do
compileAapt2 $arch
done
}
main() {
if [[ -z "${NDK_TOOLCHAIN}" ]]; then
echo "Please specify the Android NDK you want to use in environment variable \"NDK_TOOLCHAIN\"."
exit 1
fi
echo "Building aapt2 libraries..."
installDeps
buildAapt2
echo "All done!"
}
main