Update dependencies & Fix build

This commit is contained in:
Matéo Duparc 2024-06-06 21:08:11 +02:00
parent bd60e62635
commit 7c72c4e829
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
8 changed files with 32 additions and 37 deletions

View File

@ -1,18 +1,21 @@
# Introduction # Introduction
DroidFS relies on modified versions of the original encrypted filesystems programs to open volumes. [CryFS](https://github.com/cryfs/cryfs) is written in C++ while [gocryptfs](https://github.com/rfjakob/gocryptfs) is written in [Go](https://golang.org). Thus, building DroidFS requires the compilation of native code. However, for the sake of simplicity, the application has been designed in a modular way: you can build a version of DroidFS that supports both Gocryptfs and CryFS, or only one of the two. DroidFS relies on modified versions of the original encrypted filesystems programs to open volumes. [CryFS](https://github.com/cryfs/cryfs) is written in C++ while [gocryptfs](https://github.com/rfjakob/gocryptfs) is written in [Go](https://golang.org). Thus, building DroidFS requires the compilation of native code. However, for the sake of simplicity, the application has been designed in a modular way: you can build a version of DroidFS that supports both Gocryptfs and CryFS, or only one of the two.
Moreover, DroidFS aims to be accessible to as many people as possible. If you encounter any problems or need help with the build, feel free to open an issue, a discussion, or contact me by [email](mailto:hardcore.sushi@disroot.org) or on [Matrix](https://matrix.org): @hardcoresushi:matrix.underworld.fr Moreover, DroidFS aims to be accessible to as many people as possible. If you encounter any problems or need help with the build, feel free to open an issue, a discussion, or contact me (currently the main developer) by [email](mailto:gh@arkensys.dedyn.io) or on [Matrix](https://matrix.org): @hardcoresushi:matrix.underworld.fr
# Setup # Setup
The following two steps assume you're using a Debian-based Linux distribution. Package names might be similar for other distributions. Don't hesitate to ask if you're having trouble with this.
Install required packages: Install required packages:
``` ```
$ sudo apt-get install openjdk-11-jdk-headless build-essential pkg-config git gnupg2 wget apksigner $ sudo apt-get install openjdk-17-jdk-headless build-essential pkg-config git gnupg2 wget apksigner npm
``` ```
You also need to manually install the [Android SDK](https://developer.android.com/studio/index.html#command-tools) and the [Android Native Development Kit (NDK)](https://developer.android.com/ndk/downloads) (r23 versions are recommended). You also need to manually install the [Android SDK](https://developer.android.com/studio/index.html#command-tools) and the [Android Native Development Kit (NDK)](https://github.com/android/ndk/wiki/Unsupported-Downloads#r25c) version `25.2.9519653` (r25c). libcryfs cannot be built with newer NDK versions at the moment due to compatibility issues with [boost](https://www.boost.org). If you succeed in building it with a more recent version of NDK, please report it.
If you want a support for Gocryptfs volumes, you must install [Go](https://golang.org/doc/install) and libssl: If you want a support for Gocryptfs volumes, you need to install [Go](https://golang.org/doc/install):
``` ```
$ sudo apt-get install golang-go libssl-dev $ sudo apt-get install golang-go
``` ```
The code should be authenticated before being built. To verify the signatures, you will need my PGP key: The code should be authenticated before being built. To verify the signatures, you will need my PGP key:
``` ```
@ -45,16 +48,16 @@ $ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git
If you want Gocryptfs support, you need to download OpenSSL: If you want Gocryptfs support, you need to download OpenSSL:
``` ```
$ cd ../libgocryptfs $ cd ../libgocryptfs
$ wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz $ wget https://openssl.org/source/openssl-3.3.1.tar.gz
``` ```
Verify OpenSSL signature: Verify OpenSSL signature:
``` ```
$ wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz.asc $ https://openssl.org/source/openssl-3.3.1.tar.gz.asc
$ gpg --verify openssl-1.1.1w.tar.gz.asc openssl-1.1.1w.tar.gz $ gpg --verify openssl-3.3.1.tar.gz.asc openssl-3.3.1.tar.gz
``` ```
Continue **ONLY** if the signature is **VALID**. Continue **ONLY** if the signature is **VALID**.
``` ```
$ tar -xzf openssl-1.1.1w.tar.gz $ tar -xzf openssl-3.3.1.tar.gz
``` ```
If you want CryFS support, initialize libcryfs: If you want CryFS support, initialize libcryfs:
``` ```
@ -62,14 +65,6 @@ $ cd app/libcryfs
$ git submodule update --depth=1 --init $ git submodule update --depth=1 --init
``` ```
To be able to open PDF files internally, [pdf.js](https://github.com/mozilla/pdf.js) must be downloaded:
```
$ mkdir libpdfviewer/app/pdfjs-dist && cd libpdfviewer/app/pdfjs-dist
$ wget https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.8.162.tgz
$ tar xf pdfjs-dist-3.8.162.tgz package/build/pdf.min.js package/build/pdf.worker.min.js
$ mv package/build . && rm pdfjs-dist-3.8.162.tgz
```
# Build # Build
Retrieve your Android NDK installation path, usually something like `/home/\<user\>/Android/SDK/ndk/\<NDK version\>`. Then, make it available in your shell: Retrieve your Android NDK installation path, usually something like `/home/\<user\>/Android/SDK/ndk/\<NDK version\>`. Then, make it available in your shell:
``` ```
@ -84,8 +79,8 @@ $ ./build.sh ffmpeg
This step is only required if you want Gocryptfs support. This step is only required if you want Gocryptfs support.
``` ```
$ cd app/libgocryptfs $ cd app/libgocryptfs
$ OPENSSL_PATH="./openssl-1.1.1w" ./build.sh $ ANDROID_NDK_ROOT="$ANDROID_NDK_HOME" OPENSSL_PATH="./openssl-3.3.1" ./build.sh
``` ```
## Compile APKs ## Compile APKs
Gradle build libgocryptfs and libcryfs by default. Gradle build libgocryptfs and libcryfs by default.

View File

@ -21,7 +21,7 @@ if (hasProperty("nosplits")) {
android { android {
compileSdk 34 compileSdk 34
ndkVersion "26.1.10909125" ndkVersion '25.2.9519653'
namespace "sushi.hardcore.droidfs" namespace "sushi.hardcore.droidfs"
compileOptions { compileOptions {

View File

@ -74,7 +74,7 @@ else
--disable-appkit \ --disable-appkit \
--disable-alsa \ --disable-alsa \
--disable-debug \ --disable-debug \
>/dev/null && &&
make -j $(nproc --all) >/dev/null) && make -j $(nproc --all) >/dev/null) &&
mkdir -p build/$1/libavformat build/$1/libavcodec build/$1/libavutil && 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/libavformat/*.h $FFMPEG_DIR/libavformat/libavformat.so build/$1/libavformat &&

View File

@ -40,7 +40,7 @@ struct Muxer {
jmethodID seek_method_id; jmethodID seek_method_id;
}; };
int write_packet(void* opaque, uint8_t* buff, int buff_size) { int write_packet(void* opaque, const uint8_t* buff, int buff_size) {
struct Muxer* muxer = opaque; struct Muxer* muxer = opaque;
JNIEnv *env; JNIEnv *env;
(*muxer->jvm)->GetEnv(muxer->jvm, (void **) &env, JNI_VERSION_1_6); (*muxer->jvm)->GetEnv(muxer->jvm, (void **) &env, JNI_VERSION_1_6);
@ -108,8 +108,8 @@ Java_sushi_hardcore_droidfs_video_1recording_FFmpegMuxer_addVideoTrack(JNIEnv *e
stream->codecpar->height = height; stream->codecpar->height = height;
stream->codecpar->format = AV_PIX_FMT_YUVJ420P; stream->codecpar->format = AV_PIX_FMT_YUVJ420P;
stream->time_base = (AVRational) {1, frame_rate}; stream->time_base = (AVRational) {1, frame_rate};
uint8_t* matrix = av_stream_new_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9); AVPacketSideData *side_data_packet = av_packet_side_data_new(&stream->codecpar->coded_side_data, &stream->codecpar->nb_coded_side_data, AV_PKT_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, 0);
av_display_rotation_set((int32_t *) matrix, orientation_hint); av_display_rotation_set((int32_t *) side_data_packet->data, orientation_hint);
return stream->index; return stream->index;
} }

View File

@ -1,13 +1,6 @@
buildscript { plugins {
ext.kotlin_version = '1.9.22' id("com.android.application") version '8.4.0' apply false
repositories { id("org.jetbrains.kotlin.android") version "1.9.24" apply false
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
} }
allprojects { allprojects {

View File

@ -1,7 +1,8 @@
#Sun Jun 02 15:50:33 UTC 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionSha256Sum=591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225 distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

@ -1 +1 @@
Subproject commit 22965932759f232328810eadf3f02671b5c6ff99 Subproject commit 48631380a7a8b5f0932078e2b643e06c3f433890

View File

@ -1,2 +1,8 @@
pluginManagement {
repositories {
google()
mavenCentral()
}
}
include ':app', ':libpdfviewer:app' include ':app', ':libpdfviewer:app'
rootProject.name = "DroidFS" rootProject.name = "DroidFS"