All Projects → lizhangqu → aapt-repo-manifest

lizhangqu / aapt-repo-manifest

Licence: other
aapt cmake 构建 核心repo manifest, 支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows的版本

Projects that are alternatives of or similar to aapt-repo-manifest

aapt-cmake-buildscript
aapt cmake构建系统,支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows版本,支持x86和x86_64构建
Stars: ✭ 28 (+55.56%)
Mutual labels:  repo, aosp, aapt, mingw-w64, aapt2
dotfiles
🏡 There's no place like ~/
Stars: ✭ 59 (+227.78%)
Mutual labels:  mac
Anytranslate
💭 Translate words from and to your language, anywhere.
Stars: ✭ 17 (-5.56%)
Mutual labels:  mac
Menu
The most customizable menu for macOS apps.
Stars: ✭ 84 (+366.67%)
Mutual labels:  mac
dotfiles
my personal dotfiles mac
Stars: ✭ 39 (+116.67%)
Mutual labels:  mac
ci playground
Playground for Cloud CI development for C++
Stars: ✭ 23 (+27.78%)
Mutual labels:  mingw-w64
Installer
A simple standalone program which automates the installation, removal and maintenance of BetterDiscord.
Stars: ✭ 1,391 (+7627.78%)
Mutual labels:  mac
disable sip
This script is used in the recovery partition to automatically disable SIP.
Stars: ✭ 26 (+44.44%)
Mutual labels:  mac
battery
Draw battery unicode art written by Go
Stars: ✭ 66 (+266.67%)
Mutual labels:  mac
manifest
This is where the magic begins
Stars: ✭ 29 (+61.11%)
Mutual labels:  aosp
mac
高效、好玩、有趣的 Mac 软件推荐
Stars: ✭ 15 (-16.67%)
Mutual labels:  mac
docker lnmp
一键部署基于docker的LAMP环境,并利用electron + vue 提供gui管理。+++ 可配置的多进程php扩展安装
Stars: ✭ 37 (+105.56%)
Mutual labels:  mac
nyson
The official home of the Nyson Programming Language, built off Rust.
Stars: ✭ 19 (+5.56%)
Mutual labels:  mac
mcfgthread
Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
Stars: ✭ 143 (+694.44%)
Mutual labels:  mingw-w64
timenaut
Desktop time tracking application for Windows, Mac and Linux that does not invade your privacy
Stars: ✭ 16 (-11.11%)
Mutual labels:  mac
addon-check
Automatic checks for new repository submissions
Stars: ✭ 45 (+150%)
Mutual labels:  repo
mbpfan
A simple daemon to control fan speed on all MacBook/MacBook Pros (probably all Apple computers) for Linux Kernel 3 and newer
Stars: ✭ 680 (+3677.78%)
Mutual labels:  mac
defi-app-old
DeFi Blockchain desktop app for Windows, Linux and Mac.
Stars: ✭ 12 (-33.33%)
Mutual labels:  mac
Silica
A static site generator for MobileAPT repos.
Stars: ✭ 129 (+616.67%)
Mutual labels:  repo
CocoaDownloader
An powerful download library for iOS, macOS.
Stars: ✭ 22 (+22.22%)
Mutual labels:  mac

aapt-repo-manifest

查看cmake构建脚本请转移至项目 https://github.com/lizhangqu/aapt-cmake-buildscript

for mac

创建大小写敏感磁盘

hdiutil create -volname "aapt" -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 10g aapt.dmg

挂载

hdiutil attach aapt.dmg.sparseimage -mountpoint /Volumes/aapt

卸载

hdiutil detach /Volumes/aapt

for linux(Ubuntu 16.0.4)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openjdk-8-jdk
sudo apt-get install cmake
sudo apt-get install clang
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

for windows(Ubuntu 16.0.4下使用MinGw进行交叉编译)

当前windows可执行文件和动态库的版本只能在linux(Ubuntu 16.0.4)上进行交叉编译产生,需要安装MinGw

sudo apt-get install mingw-w64

安装完成后,mingw-gcc和mingw-g++默认使用的线程模型是win32的,但是我们需要使用posix的线程模型,因此分别执行以下命令,将工具链指向带-posix后缀的工具链

sudo update-alternatives --config x86_64-w64-mingw32-gcc
sudo update-alternatives --config x86_64-w64-mingw32-g++
sudo update-alternatives --config x86_64-w64-mingw32-gfortran
sudo update-alternatives --config x86_64-w64-mingw32-gnat

sudo update-alternatives --config i686-w64-mingw32-gcc
sudo update-alternatives --config i686-w64-mingw32-g++
sudo update-alternatives --config i686-w64-mingw32-gfortran
sudo update-alternatives --config i686-w64-mingw32-gnat

如果交叉编译构建过程中发生了如下错误

error: ‘_Atomic’ does not name a type
 typedef _Atomic _Bool atomic_bool;

请将system/core/libcutils/include/cutils/atomic.h头文件中的#include <stdatomic.h>部分

改为

#if defined(_WIN32)
    #ifdef __cplusplus
    #include <atomic>
    using namespace std;
    #else
    #include <stdatomic.h>
    #endif
#else
    #include <stdatomic.h>
#endif

构建

安装repo

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

初始化repo项目

#进入工作目录
cd /Volumes/aapt
#如果存在repo bundle下载不下来的情况,请使用下面的命令进行手动clone
#git clone http://mirrors.ustc.edu.cn/aosp/git-repo.git/ .repo/repo
#初始化并同步源码树,约3G
repo init -u https://github.com/lizhangqu/aapt-repo-manifest.git -b android-9.0.0_r10
repo sync -j8

执行构建,构建过程中发生错误请自行根据提示安装对应的依赖库,下面是mac和linux的构建步骤

#进入工作目录
cd /Volumes/aapt
#使用cmake生成构建文件,并最小化编译产物,这一步的生成主要是为了生成protobuffer相关文件
cmake -H"./" -B"./build-cmake" -DCMAKE_BUILD_TYPE=MinSizeRel
#生成aapt2所需的protobuffer头文件和cpp文件
cmake --build "./build-cmake" --target protobuffer_h -- -j 8
#重新生成构建文件,因为之前生成的时候,protobuffer相关文件不存在,需要重新生成,如果可以直接编译通过,这一步可省略
cmake -H"./" -B"./build-cmake" -DCMAKE_BUILD_TYPE=MinSizeRel
#编译aapt
cmake --build "./build-cmake" --target aapt -- -j 8
#编译aapt2
cmake --build "./build-cmake" --target aapt2 -- -j 8
#编译aapt2_jni
cmake --build "./build-cmake" --target aapt2_jni -- -j 8

交叉编译时,如果需要指定交叉编译工具链的路径,则使用如下命令传递对应参数

cmake -H"./" -B"./build-cmake" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=windows.toolchain.cmake

windows可执行文件需要在Ubuntu 16.0.4下进行交叉编译,进行交叉编译前,需要将system/core/libcutils/include/cutils/atomic.h头文件中的#include <stdatomic.h>部分修改为

#if defined(_WIN32)
    #ifdef __cplusplus
    #include <atomic>
    using namespace std;
    #else
    #include <stdatomic.h>
    #endif
#else
    #include <stdatomic.h>
#endif

原因是引用的头文件stdatomic.h不是标准的c++部分,而clang可以支持兼容掉这部分,但是交叉编译工具链MinGW g++不支持,因此需要引用标准的C++中的atomic头文件。

并且交叉编译工具链不支持在linux下执行windows的可执行文件,因此aapt2需要的protobuffer头文件需要在linux用linux可执行文件生成,具体的完整流程如下

#进入工作目录
cd /Volumes/aapt
#使用cmake生成linux构建文件,并最小化编译产物
cmake -H"./" -B"./build-cmake-linux" -DCMAKE_BUILD_TYPE=MinSizeRel
#使用linux环境生成aapt2所需的头文件
cmake --build "./build-cmake-linux" --target protobuffer_h -- -j 8

#使用cmake生成windows交叉编译构建文件,并最小化编译产物
cmake -H"./" -B"./build-cmake-windows" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=windows.toolchain.cmake

#编译aapt
cmake --build "./build-cmake-windows" --target aapt -- -j 8
#编译aapt2
cmake --build "./build-cmake-windows" --target aapt2 -- -j 8
#编译aapt2_jni
cmake --build "./build-cmake-windows" --target aapt2_jni -- -j 8
#最终windows下的可执行文件和动态库生成都位于build-cmake-windows目录下

如果需要编译32位的可执行文件,在生产cmake文件的时候,添加-DUSE_32BITS=1参数,如

#linux或者mac
cmake -H"./" -B"./build-cmake-unix-x86" -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_32BITS=1
#windows交叉编译
cmake -H"./" -B"./build-cmake-windows-x86" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=windows.toolchain.cmake -DUSE_32BITS=1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].