Skip to content

支持MAUI.Android #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 60 additions & 0 deletions Build-Android.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Ubuntu子系统
$ sudo passwd
$ su
$ sudo apt-get install git-core build-essential cmake

一. 编译OpenSSL
1. 安装NDK
# wget -c https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
# apt install unzip
# unzip android-ndk-r25c-linux.zip

配置PATH路径
# sudo vim /etc/profile

输入命令字母“o”,切换为插入模式(--INSERT--),可以在光标末尾插入新行对文件进行修改。
在文件末尾加入相应的路径:
export NDK_PATH=/home/book/android-ndk-r25c
export PATH=$PATH:$NDK_PATH
按 esc 键,退出插入模式即可进入命令模式。在末尾输入 :wq ,即可写入保存并离开
# source /etc/profile
# ​​​​​​​ndk-build


2. 编译OpenSSL
# git clone --recursive https://gitee.com/Git-Fork/openssl.git
# cd openssl
每次进入命令提示符均需要设置. Tell configure what flags Android requires.
# export CFLAGS="-fPIE -fPIC"
# export LDFLAGS="-pie"
# PATH=$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
# ./Configure android-arm64
# make

# find . -type f -name "*.o" -exec rm -v {} \;
# find . -type f -name "*.S" -exec rm -v {} \;
# ./Configure android-arm -fPIC
# make

二. 如果CMAKE版本过低需要升级
wget https://cmake.org/files/v3.26/cmake-3.26.3.tar.gz
tar -xvzf cmake-3.26.3.tar.gz
cd cmake-3.26.3
chmod 777 ./configure
./configure
make
sudo make install
sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force


三. 编译LibGit2
# git clone --recursive https://gitee.com/Git-Fork/libgit2sharp.nativebinaries
# cd libgit2sharp.nativebinaries/
## export SSL_PATH=/home/book/openssl/
# export RID=android-arm
# ./build.libgit2.sh
# export RID=android-arm64
# ./build.libgit2.sh

Windows下调用
nuget.exe Pack nuget.package/NativeBinaries.nuspec -Version <version> -NoPackageAnalysis
16 changes: 16 additions & 0 deletions OpenSSL/arm64-v8a/include/crypto/__DECC_INCLUDE_EPILOGUE.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/

/* restore state. Must correspond to the save in __decc_include_prologue.h */
#pragma names restore
20 changes: 20 additions & 0 deletions OpenSSL/arm64-v8a/include/crypto/__DECC_INCLUDE_PROLOGUE.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

/*
* This file is only used by HP C on VMS, and is included automatically
* after each header file from this directory
*/

/* save state */
#pragma names save
/* have the compiler shorten symbols larger than 31 chars to 23 chars
* followed by a 8 hex char CRC
*/
#pragma names as_is,shortened
Loading