Initial commit
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
34
.github/workflows/main.yml
vendored
Normal file
34
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Main
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ !startsWith(github.event.head_commit.message, '[skip ci]') }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: SetupNDK
|
||||||
|
uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r24
|
||||||
|
- name: Build
|
||||||
|
id: build
|
||||||
|
run: |
|
||||||
|
chmod 777 ./build.sh
|
||||||
|
./build.sh
|
||||||
|
- name: Upload release
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: magisk-module-release
|
||||||
|
path: out/magisk-module
|
||||||
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
.DS_Store
|
||||||
|
*.zip
|
||||||
|
*.so
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# VS Code Java Language Server
|
||||||
|
.settings/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
|
*.sha256
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "native/jni/libcxx"]
|
||||||
|
path = native/jni/libcxx
|
||||||
|
url = https://github.com/huskydg/libcxx.git
|
||||||
22
build.sh
Normal file
22
build.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
build_mode="${1:-release}"
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
pushd native
|
||||||
|
rm -fr libs obj
|
||||||
|
debug_mode=1
|
||||||
|
if [[ "$build_mode" == "release" ]]; then
|
||||||
|
debug_mode=0
|
||||||
|
fi
|
||||||
|
ndk-build -j4 NDK_DEBUG=$debug_mode
|
||||||
|
popd
|
||||||
|
|
||||||
|
rm -rf out
|
||||||
|
mkdir -p out
|
||||||
|
cp -af magisk-module out
|
||||||
|
mv -fT native/libs out/magisk-module/libs
|
||||||
|
zip -r9 out/magisk-module-release.zip out/magisk-module
|
||||||
33
magisk-module/META-INF/com/google/android/update-binary
Normal file
33
magisk-module/META-INF/com/google/android/update-binary
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Initialization
|
||||||
|
#################
|
||||||
|
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# echo before loading util_functions
|
||||||
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
|
require_new_magisk() {
|
||||||
|
ui_print "*******************************"
|
||||||
|
ui_print " Please install Magisk v20.4+! "
|
||||||
|
ui_print "*******************************"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Load util_functions.sh
|
||||||
|
#########################
|
||||||
|
|
||||||
|
OUTFD=$2
|
||||||
|
ZIPFILE=$3
|
||||||
|
|
||||||
|
mount /data 2>/dev/null
|
||||||
|
|
||||||
|
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||||
|
. /data/adb/magisk/util_functions.sh
|
||||||
|
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
||||||
|
|
||||||
|
install_module
|
||||||
|
exit 0
|
||||||
1
magisk-module/META-INF/com/google/android/updater-script
Normal file
1
magisk-module/META-INF/com/google/android/updater-script
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#MAGISK
|
||||||
7
magisk-module/customize.sh
Normal file
7
magisk-module/customize.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
mkdir -p "$MODPATH/system/bin"
|
||||||
|
api_level_arch_detect
|
||||||
|
[ ! -d "$MODPATH/libs/$ABI" ] && abort "! $ABI not supported"
|
||||||
|
cp -af "$MODPATH/libs/$ABI/"* "$MODPATH/system/bin"
|
||||||
|
rm -rf "$MODPATH/libs"
|
||||||
|
chcon -R u:object_r:system_file:s0 "$MODPATH/system"
|
||||||
|
chmod -R 755 "$MODPATH/system/bin"
|
||||||
6
magisk-module/module.prop
Normal file
6
magisk-module/module.prop
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
id=example_module
|
||||||
|
name=Example module
|
||||||
|
author=HuskyDG
|
||||||
|
version=1.0
|
||||||
|
versionCode=1
|
||||||
|
description=module that add some stuff
|
||||||
3
native/.gitignore
vendored
Normal file
3
native/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/build
|
||||||
|
/libs
|
||||||
|
/obj
|
||||||
11
native/build.gradle
Normal file
11
native/build.gradle
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
path("jni/Android.mk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
native/jni/Android.mk
Normal file
10
native/jni/Android.mk
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := example
|
||||||
|
LOCAL_SRC_FILES := example.cpp
|
||||||
|
LOCAL_STATIC_LIBRARIES := libcxx
|
||||||
|
LOCAL_LDLIBS := -llog
|
||||||
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
|
include jni/libcxx/Android.mk
|
||||||
4
native/jni/Application.mk
Normal file
4
native/jni/Application.mk
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
|
||||||
|
APP_CPPFLAGS := -std=c++17 -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
|
APP_STL := none
|
||||||
|
APP_PLATFORM := android-21
|
||||||
7
native/jni/example.cpp
Normal file
7
native/jni/example.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1
native/jni/libcxx
Submodule
1
native/jni/libcxx
Submodule
Submodule native/jni/libcxx added at 9b40e8b936
2
native/src/main/AndroidManifest.xml
Normal file
2
native/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="native" />
|
||||||
Reference in New Issue
Block a user