Skip to content

Commit

Permalink
Add zstdcat to assets/bin, built with NDK
Browse files Browse the repository at this point in the history
Built zstdcat against the Android NDK for arm, arm_64, x86 and x86_64.
This binary is needed by debootstrap for newer versions of Ubuntu and
not present before Android 12.

Included build instructions used to build binaries.

Signed-off-by: Niel Fourie <[email protected]>
  • Loading branch information
Lusus authored and lateautumn233 committed Jan 14, 2023
1 parent ec0e7ac commit 1a8c6a9
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
Binary file added app/src/main/assets/bin/arm/zstdcat
Binary file not shown.
Binary file added app/src/main/assets/bin/arm_64/zstdcat
Binary file not shown.
Binary file added app/src/main/assets/bin/x86/zstdcat
Binary file not shown.
Binary file added app/src/main/assets/bin/x86_64/zstdcat
Binary file not shown.
1 change: 1 addition & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ QEMU: https://packages.debian.org/stretch/qemu-user-static

mke2fs (e2fsprogs): http://packages.debian.org/wheezy/e2fsprogs

zstdcat (zstd): https://github.com/facebook/zstd
84 changes: 84 additions & 0 deletions contrib/zstdcat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
zstdcat Build Guide
===================

Zstandard file compression utility. This is required for newer version of Ubuntu, and not included before Android 12.

## Build instructions

In a work directory of your choice...

### Download/Install Android SDK:

```
$ mkdir sdk/
$ cd sdk/
$ mkdir cmdline-tools/
$ cd cmdline-tools/
```

Go to https://developer.android.com/studio/
Download after agreeing to EULA: `commandlinetools-linux-xxx_latest.zip` into above path.
(In my case it was `commandlinetools-linux-8512546_latest.zip`.)

```
$ unzip commandlinetools-linux-8512546_latest.zip
```

Now install CMake and the NDK, I used the version below:

```
$ cmdline-tools/bin/sdkmanager --install "cmake;3.10.2.4988404"
$ cmdline-tools/bin/sdkmanager --install "ndk;24.0.8215888"
$ cd ../..
```

### Clone and build zstdcat

Preparation:

```
$ git clone https://github.com/facebook/zstd.git
$ cd zstd/build/cmake/
$ mkdir builddir/
$ cd builddir/
$ export ANDROID_SDK=../../../../sdk
```

#### Build for armeabi

```
$ $ANDROID_SDK/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a ..
$ make -j 8
```

Copy out (and rename) from zstd ``programs/zstd`` to linuxdeploy as ``app/src/main/assets/bin/arm/zstdcat``

#### Build for arm64-v8a

```
$ rm -rf *
$ $ANDROID_SDK/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..
$ make -j 8
```

Copy out (and rename) from zstd ``programs/zstd`` to linuxdeploy as ``app/src/main/assets/bin/arm_64/zstdcat``

#### Build for x86

```
$ rm -rf *
$ $ANDROID_SDK/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86 ..
$ make -j 8
```

Copy out (and rename) from zstd ``programs/zstd`` to linuxdeploy as ``app/src/main/assets/bin/x86/zstdcat``

#### Build for x86_64

```
$ rm -rf *
$ $ANDROID_SDK/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 ..
$ make -j 8
```

Copy out (and rename) from zstd ``programs/zstd`` to linuxdeploy as ``app/src/main/assets/bin/x86_64/zstdcat``

0 comments on commit 1a8c6a9

Please sign in to comment.