Better build explanation

This commit is contained in:
Matéo Duparc 2022-01-20 13:01:56 +01:00
parent 3007bf756c
commit 822aba9481
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
4 changed files with 38 additions and 26 deletions

View File

@ -8,7 +8,7 @@ It currently only works with [gocryptfs](https://github.com/rfjakob/gocryptfs) b
<img src="https://forge.chapril.org/hardcoresushi/DroidFS/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" height="500"> <img src="https://forge.chapril.org/hardcoresushi/DroidFS/raw/branch/master/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" height="500">
</p> </p>
# Disclamer # Disclaimer
DroidFS is provided "as is", without any warranty of any kind. DroidFS is provided "as is", without any warranty of any kind.
It shouldn't be considered as an absolute safe way to store files. It shouldn't be considered as an absolute safe way to store files.
DroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc. DroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc.
@ -48,7 +48,7 @@ It is strongly recommended to read the documentation of a feature before enablin
You can download DroidFS from [F-Droid](https://f-droid.org/packages/sushi.hardcore.droidfs) or from the "Releases" section in the repo. You can download DroidFS from [F-Droid](https://f-droid.org/packages/sushi.hardcore.droidfs) or from the "Releases" section in the repo.
APKs availables here are signed with my PGP key available on keyservers: APKs available here are signed with my PGP key available on keyservers:
`gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 007F84120107191E` \ `gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 007F84120107191E` \
Fingerprint: `BD5621479E7B74D36A405BE8007F84120107191E` \ Fingerprint: `BD5621479E7B74D36A405BE8007F84120107191E` \
@ -88,11 +88,16 @@ DroidFS use some parts of the original gocryptfs code, which is designed to run
# Build # Build
Most of the original gocryptfs code was used as is (written in Go) and compiled to native code. That's why you need [Go](https://golang.org) and the [Android Native Development Kit (NDK)](https://developer.android.com/ndk/) to build DroidFS from source. Most of the original gocryptfs code was used as is (written in Go) and compiled to native code. That's why you need [Go](https://golang.org) and the [Android Native Development Kit (NDK)](https://developer.android.com/ndk/) to build DroidFS from source.
#### Install dependencies
#### Install Requirements On debian:
- [Android Studio](https://developer.android.com/studio/) ```
- [Android NDK and CMake](https://developer.android.com/studio/projects/install-ndk) (OpenSSL build fails with NDK versions higher than v22. It should pass with NDK v21.4.7075529 and lower) $ sudo apt-get install build-essential pkg-config libssl-dev
- [Go](https://golang.org/doc/install) (on debian: `$ sudo apt-get install golang-go`) ```
Install [Go](https://golang.org/doc/install):
```
$ sudo apt-get install golang-go
```
You also need to install the Android SDK build tools and the [Android NDK](https://developer.android.com/studio/projects/install-ndk).
#### Download Sources #### Download Sources
``` ```
@ -123,28 +128,32 @@ $ cd app/ffmpeg
$ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git $ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git
``` ```
#### Generate a keystore
APKs must be signed to be installed on an Android device. If you don't already have a keystore, you can generate one by running:
```
$ keytool -genkey -keystore <output file> -alias <key alias> -keyalg EC -validity 10000
```
#### Build #### Build
First, we need to install some dependencies: Retrieve your Android NDK installation path, usually something like "/home/\<user\>/Android/SDK/ndk/\<NDK version\>". Now you can build libgocryptfs:
```
$ sudo apt-get install libcrypto++-dev libssl-dev pkg-config
```
And also Go dependencies:
```
$ go get golang.org/x/sys/unix golang.org/x/sys/cpu golang.org/x/crypto/hkdf github.com/jacobsa/crypto/siv github.com/rfjakob/eme
```
Then, retrieve your Android NDK installation path, usually someting like "/home/\<user\>/Android/SDK/ndk/\<NDK version\>". We can now build libgocryptfs:
``` ```
$ cd DroidFS/app/libgocryptfs $ cd DroidFS/app/libgocryptfs
$ env ANDROID_NDK_HOME="<your ndk path>" OPENSSL_PATH="./openssl-1.1.1m" ./build.sh $ env ANDROID_NDK_HOME="<your ndk path>" OPENSSL_PATH="./openssl-1.1.1m" ./build.sh
``` ```
And also FFmpeg: Then FFmpeg:
``` ```
$ cd app/ffmpeg $ cd app/ffmpeg
$ env ANDROID_NDK_HOME="<your ndk path>" ./build.sh ffmpeg $ env ANDROID_NDK_HOME="<your ndk path>" ./build.sh ffmpeg
``` ```
Then, open the DroidFS project with Android Studio. \ Finally, compile the app:
If a device (virtual or physical) is connected, just click on "Run". \ ```
If you want to generate a signed APK, you can follow this [post](https://stackoverflow.com/a/28938286). $ ./gradlew assembleRelease
```
If the build succeeds, you will find the unsigned APKs in `app/build/outputs/apk/release/`. You need to sign them in order to install the app:
```
$ apksigner sign --out droidfs.apk -v --ks <keystore> app/build/outputs/apk/release/<unsigned apk file>
```
Now you can install `droidfs.apk` on your device.
# Third party code # Third party code
Thanks to these open source projects that DroidFS uses: Thanks to these open source projects that DroidFS uses:

View File

@ -14,8 +14,8 @@ android {
applicationId "sushi.hardcore.droidfs" applicationId "sushi.hardcore.droidfs"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 21 versionCode 22
versionName "1.7.1" versionName "1.7.2"
ndk { ndk {
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a" abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

View File

@ -1,9 +1,11 @@
#!/bin/bash #!/bin/bash
if [ -z ${ANDROID_NDK_HOME+x} ]; then if [ -z ${ANDROID_NDK_HOME+x} ]; then
echo "Error: \$ANDROID_NDK_HOME is not defined." echo "Error: \$ANDROID_NDK_HOME is not defined." >&2
exit 1
elif [ $# -lt 1 ]; then elif [ $# -lt 1 ]; then
echo "Usage: $0 <FFmpeg source directory> [<ABI>]" echo "Usage: $0 <FFmpeg source directory> [<ABI>]" >&2
exit 1
else else
FFMPEG_DIR=$1 FFMPEG_DIR=$1
compile_for_arch() { compile_for_arch() {
@ -76,7 +78,8 @@ else
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 &&
cp $FFMPEG_DIR/libavcodec/*.h $FFMPEG_DIR/libavcodec/libavcodec.so build/$1/libavcodec && 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 cp $FFMPEG_DIR/libavutil/*.h $FFMPEG_DIR/libavutil/libavutil.so build/$1/libavutil ||
exit 1
} }
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH

@ -1 +1 @@
Subproject commit b232bb782605eb0c6b23aef5f7ea56fd5bd3b7fd Subproject commit 1da2407a614f17a3c64d14ee34fb41e081db9a71