commit
4e162d1949
3 changed files with 72 additions and 0 deletions
17
.drone.yml
Normal file
17
.drone.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: Build cavif
|
||||
image: debian
|
||||
commands:
|
||||
- '/drone/src/compilation.sh'
|
||||
volumes:
|
||||
- name: program-archives
|
||||
path: /compiled
|
||||
|
||||
volumes:
|
||||
- name: program-archives
|
||||
host:
|
||||
path: /mnt/user/files/repos/archives
|
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Cavif build
|
||||
|
||||
- Builds [cavif](https://github.com/kornelski/cavif-rs) and places it in `$COMPILED_DIR/cavif/cavif.tar.zst`
|
||||
- Version file at `$COMPILED_DIR/cavif/version`
|
||||
|
||||
## Archive details
|
||||
|
||||
```
|
||||
.
|
||||
├── cavif
|
||||
```
|
||||
|
||||
Recommended:
|
||||
|
||||
| File | Location | Permissions |
|
||||
| --------------- | -------------------------------------- | ----------- |
|
||||
| `./cavif` | `/usr/bin/cavif` | 755 |
|
38
compilation.sh
Executable file
38
compilation.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
workdir=$(mktemp -d)
|
||||
built_dir=${COMPILED_DIR:-/compiled}/cavif
|
||||
mkdir -p $built_dir
|
||||
version_file=$built_dir/version
|
||||
touch $version_file
|
||||
|
||||
apt update
|
||||
apt install curl jq -y
|
||||
|
||||
# clone and check whether it's up-to-date
|
||||
mkdir -p $workdir/cavif/
|
||||
cd $workdir/cavif/
|
||||
# check version
|
||||
version=$(curl -L 'https://crates.io/api/v1/crates/cavif' | jq '.crate.default_version' -r)
|
||||
if grep -q $version $version_file; then
|
||||
echo "already up to date, exiting"
|
||||
exit
|
||||
fi
|
||||
# get build deps
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
. ~/.cargo/env
|
||||
apt install gcc nasm -y
|
||||
|
||||
# build cavif
|
||||
cargo install cavif
|
||||
cp ~/.cargo/bin/cavif $workdir/cavif/
|
||||
|
||||
# crate .tar.zst archive
|
||||
cd $workdir/cavif/
|
||||
mkdir -p ${COMPILED_DIR:-/compiled}/cavif/
|
||||
apt install zstd -y
|
||||
tar --zstd -cf $built_dir/cavif.tar.zst .
|
||||
echo $version >$version_file
|
||||
|
||||
echo "cavif updated to $version"
|
Loading…
Add table
Reference in a new issue