-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (105 loc) · 3.55 KB
/
librav1e-xcode.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: SDWebImage/librav1e-Xcode
on:
push:
# Pattern matched against refs/tags
tags:
- '*'
env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8
jobs:
build:
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up cargo cache
uses: actions/[email protected]
with:
path: |
~/.cargo/registry
~/.cargo/git
rav1e/target
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
- name: Install Rust toolchain
uses: actions-rs/[email protected]
with:
toolchain: 1.51.0
override: true
- name: Set up cargo package
run: |
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-darwin x86_64-apple-darwin
cargo install cargo-lipo
cargo install cbindgen
cargo install cargo-crate-type
HOMEBREW_NO_AUTO_UPDATE=1 brew install nasm
- name: Clone rav1e
run: |
cd "${{ github.workspace }}"
mkdir include
rm -rf rav1e
git clone -b "v${{ github.ref_name }}" --depth 1 https://github.com/xiph/rav1e.git
- name: Configure rav1e
run: |
cd "${{ github.workspace }}/rav1e"
cbindgen -c cbindgen.toml -l C -o include/rav1e/rav1e.h --crate rav1e .
cargo crate-type static
# iOS
- name: Build iOS
run: |
cd "${{ github.workspace }}/rav1e"
rm -rf "${{ github.workspace }}/rav1e/target"
cargo lipo --release --no-default-features --features "asm capi" --targets=aarch64-apple-ios,x86_64-apple-ios
cd "${{ github.workspace }}"
mkdir -p Build
cd Build
mkdir iOS
cd iOS
mkdir librav1e.framework
cd librav1e.framework
mkdir Headers
mkdir Modules
cp "${{ github.workspace }}/rav1e/target/universal/release/librav1e.a" librav1e
cp "${{ github.workspace }}/rav1e/include/rav1e/rav1e.h" Headers/
cp "${{ github.workspace }}/module.modulemap" Modules/
# MacOS
- name: Build macOS
run: |
cd "${{ github.workspace }}/rav1e"
rm -rf "${{ github.workspace }}/rav1e/target"
cargo lipo --release --no-default-features --features "asm capi" --targets=aarch64-apple-darwin,x86_64-apple-darwin
cd "${{ github.workspace }}"
mkdir -p Build
cd Build
mkdir Mac
cd Mac
mkdir librav1e.framework
cd librav1e.framework
mkdir Versions
cd Versions
mkdir A
ln -s A Current
cd A
mkdir Headers
mkdir Modules
cp "${{ github.workspace }}/rav1e/target/universal/release/librav1e.a" librav1e
cp "${{ github.workspace }}/rav1e/include/rav1e/rav1e.h" Headers/
cp "${{ github.workspace }}/module.modulemap" Modules/
cd ../../
ln -s Versions/Current/librav1e librav1e
ln -s Versions/Current/Headers Headers
ln -s Versions/Current/Modules Modules
# Zip
- name: Archive
run: |
cd "${{ github.workspace }}"
cd Build
zip -y -r librav1e.zip Mac/ iOS/
- uses: softprops/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_REPOSITORY: "${{ github.repository }}"
with:
files: "${{ github.workspace }}/Build/librav1e.zip"