diff --git a/.gitmodules b/.gitmodules index 7d464bd..6ca8206 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "app/libcryfs"] path = app/libcryfs url = https://forge.chapril.org/hardcoresushi/libcryfs.git +[submodule "app/ffmpeg/ffmpeg"] + path = app/ffmpeg/ffmpeg + url = https://git.ffmpeg.org/ffmpeg.git diff --git a/BUILD.md b/BUILD.md index 2c65b92..b8974ac 100644 --- a/BUILD.md +++ b/BUILD.md @@ -38,31 +38,17 @@ __Don't continue if the verification fails!__ Initialize submodules: ``` -$ git submodule update --depth=1 --init +$ git submodule update --init ``` -[FFmpeg](https://ffmpeg.org) is needed to record encrypted video: +If you want Gocryptfs support, initliaze libgocryptfs submodules: ``` -$ cd app/ffmpeg -$ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git +$ cd app/libgocryptfs +$ git submodule update --init ``` -If you want Gocryptfs support, you need to download OpenSSL: -``` -$ cd ../libgocryptfs -$ wget https://openssl.org/source/openssl-3.3.1.tar.gz -``` -Verify OpenSSL signature: -``` -$ wget https://openssl.org/source/openssl-3.3.1.tar.gz.asc -$ gpg --verify openssl-3.3.1.tar.gz.asc openssl-3.3.1.tar.gz -``` -Continue **ONLY** if the signature is **VALID**. -``` -$ tar -xzf openssl-3.3.1.tar.gz -``` -If you want CryFS support, initialize libcryfs: +If you want CryFS support, initialize libcryfs submodules: ``` $ cd app/libcryfs -$ git submodule update --depth=1 --init +$ git submodule update --init ``` # Build @@ -70,31 +56,33 @@ Retrieve your Android NDK installation path, usually something like `/home/\] ``` ## libgocryptfs This step is only required if you want Gocryptfs support. ``` $ cd app/libgocryptfs -$ ANDROID_NDK_ROOT="$ANDROID_NDK_HOME" OPENSSL_PATH="./openssl-3.3.1" ./build.sh +$ ./build.sh [] ``` ## Compile APKs Gradle build libgocryptfs and libcryfs by default. To build DroidFS without Gocryptfs support, run: ``` -$ ./gradlew assembleRelease -PdisableGocryptfs=true +$ ./gradlew assembleRelease [-Pabi=] -PdisableGocryptfs=true ``` To build DroidFS without CryFS support, run: ``` -$ ./gradlew assembleRelease -PdisableCryFS=true +$ ./gradlew assembleRelease [-Pabi=] -PdisableCryFS=true ``` If you want to build DroidFS with support for both Gocryptfs and CryFS, just run: ``` -$ ./gradlew assembleRelease +$ ./gradlew assembleRelease [-Pabi=] ``` # Sign APKs diff --git a/app/build.gradle b/app/build.gradle index 9b1bffe..ece801d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,12 +13,6 @@ if (hasProperty("disableGocryptfs")) { ext.disableGocryptfs = false } -if (hasProperty("nosplits")) { - ext.splits = false -} else { - ext.splits = true -} - android { compileSdk 34 ndkVersion '25.2.9519653' @@ -33,6 +27,8 @@ android { jvmTarget = "17" } + def abiCodes = [ "arm64-v8a": 1, "armeabi-v7a": 2, "x86_64": 3, "x86": 4] + defaultConfig { applicationId "sushi.hardcore.droidfs" minSdkVersion 21 @@ -40,8 +36,17 @@ android { versionCode 36 versionName "2.1.3" - ndk { - abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a" + splits { + abi { + enable true + reset() // fix unknown bug (https://ru.stackoverflow.com/questions/1557805/abis-armeabi-mips-mips64-riscv64-are-not-supported-for-platform) + if (project.hasProperty("abi")) { + include project.getProperty("abi") + } else { + abiCodes.keySet().each { abi -> include abi } + universalApk !project.hasProperty("nouniversal") + } + } } externalNativeBuild.cmake { @@ -54,20 +59,20 @@ android { } } - if (project.ext.splits) { - splits { - abi { - enable true - reset() // fix unknown bug (https://ru.stackoverflow.com/questions/1557805/abis-armeabi-mips-mips64-riscv64-are-not-supported-for-platform) - universalApk true - } - } - } - applicationVariants.configureEach { variant -> variant.resValue "string", "versionName", variant.versionName buildConfigField "boolean", "CRYFS_DISABLED", "${project.ext.disableCryFS}" buildConfigField "boolean", "GOCRYPTFS_DISABLED", "${project.ext.disableGocryptfs}" + variant.outputs.each { output -> + def abi = output.getFilter(com.android.build.OutputFile.ABI) + if (abi == null) { // universal + output.versionCodeOverride = variant.versionCode*10 + output.outputFileName = "DroidFS-v${variant.versionName}-${variant.name}-universal.apk" + } else { + output.versionCodeOverride = variant.versionCode*10 + abiCodes[abi] + output.outputFileName = "DroidFS-v${variant.versionName}-${variant.name}-${abi}.apk" + } + } } buildFeatures { diff --git a/app/ffmpeg/.gitignore b/app/ffmpeg/.gitignore index e12f70e..378eac2 100644 --- a/app/ffmpeg/.gitignore +++ b/app/ffmpeg/.gitignore @@ -1,2 +1 @@ -ffmpeg build diff --git a/app/ffmpeg/build.sh b/app/ffmpeg/build.sh index e63ea62..06d439b 100755 --- a/app/ffmpeg/build.sh +++ b/app/ffmpeg/build.sh @@ -1,13 +1,13 @@ #!/bin/bash +set -e + if [ -z ${ANDROID_NDK_HOME+x} ]; then echo "Error: \$ANDROID_NDK_HOME is not defined." >&2 exit 1 -elif [ $# -lt 1 ]; then - echo "Usage: $0 []" >&2 - exit 1 else - FFMPEG_DIR=$1 + cd "$(dirname "$0")" + FFMPEG_DIR="ffmpeg" compile_for_arch() { echo "Compiling for $1..." case $1 in @@ -29,7 +29,8 @@ else ARCH="arm" ;; esac - (cd $FFMPEG_DIR && make clean; + (cd $FFMPEG_DIR + make clean || true ./configure \ --cc="$CFN" \ --cxx="$CFN++" \ @@ -73,22 +74,19 @@ else --disable-audiotoolbox \ --disable-appkit \ --disable-alsa \ - --disable-debug \ - && - make -j $(nproc --all) >/dev/null) && - mkdir -p build/$1/libavformat build/$1/libavcodec build/$1/libavutil && - cp $FFMPEG_DIR/libavformat/*.h $FFMPEG_DIR/libavformat/libavformat.so build/$1/libavformat && - cp $FFMPEG_DIR/libavcodec/*.h $FFMPEG_DIR/libavcodec/libavcodec.so build/$1/libavcodec && - cp $FFMPEG_DIR/libavutil/*.h $FFMPEG_DIR/libavutil/libavutil.so build/$1/libavutil || - exit 1 + --disable-debug + make -j "$(nproc --all)" >/dev/null) + mkdir -p "build/$1/libavformat" "build/$1/libavcodec" "build/$1/libavutil" + cp $FFMPEG_DIR/libavformat/*.h $FFMPEG_DIR/libavformat/libavformat.so "build/$1/libavformat" + cp $FFMPEG_DIR/libavcodec/*.h $FFMPEG_DIR/libavcodec/libavcodec.so "build/$1/libavcodec" + cp $FFMPEG_DIR/libavutil/*.h $FFMPEG_DIR/libavutil/libavutil.so "build/$1/libavutil" } export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH - if [ $# -eq 2 ]; then - compile_for_arch $2 + if [ $# -eq 1 ]; then + compile_for_arch "$1" else - declare -a ABIs=("x86_64" "x86" "arm64-v8a" "armeabi-v7a") - for abi in ${ABIs[@]}; do + for abi in "x86_64" "x86" "arm64-v8a" "armeabi-v7a"; do compile_for_arch $abi done fi diff --git a/app/ffmpeg/ffmpeg b/app/ffmpeg/ffmpeg new file mode 160000 index 0000000..af25a4b --- /dev/null +++ b/app/ffmpeg/ffmpeg @@ -0,0 +1 @@ +Subproject commit af25a4bfd2503caf3ee485b27b99b620302f5718 diff --git a/app/libgocryptfs b/app/libgocryptfs index 4f32853..b221d4c 160000 --- a/app/libgocryptfs +++ b/app/libgocryptfs @@ -1 +1 @@ -Subproject commit 4f32853ae5ac70811b451cac60ed36fd5b93cbc8 +Subproject commit b221d4cf3c70edc711169a769a476802d2577b2b diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index d41b985..67c4490 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -16,9 +16,3 @@ -keep class sushi.hardcore.droidfs.VolumeData$* { static public android.os.Parcelable$Creator CREATOR; } --keep class sushi.hardcore.droidfs.filesystems.EncryptedVolume { - public int describeContents(); -} --keep class sushi.hardcore.droidfs.filesystems.EncryptedVolume$* { - static public android.os.Parcelable$Creator CREATOR; -} \ No newline at end of file diff --git a/libpdfviewer b/libpdfviewer index 4863138..8df8522 160000 --- a/libpdfviewer +++ b/libpdfviewer @@ -1 +1 @@ -Subproject commit 48631380a7a8b5f0932078e2b643e06c3f433890 +Subproject commit 8df8522088b095de23d4de95c73320a91b111a8d