forked from hexops/mach-objc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·70 lines (59 loc) · 2.17 KB
/
update.sh
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
#!/usr/bin/env bash
set -euo pipefail
# TODO: delete this shell script and move all this logic into generator.zig
# `git clone --depth 1` but at a specific revision
git_clone_rev() {
repo=$1
rev=$2
dir=$3
rm -rf "$dir"
mkdir "$dir"
pushd "$dir"
git init -q
git fetch "$repo" "$rev" --depth 1
git checkout -q FETCH_HEAD
popd
}
git_clone_rev https://github.com/hexops/xcode-frameworks 3d1d9613c39bfc2ebfa2551626e87b7f38e0a29f xcode-frameworks
zig build -Doptimize=ReleaseFast
rm -rf src/metal/mtl.zig
echo "Generating Metal"
echo "
#include <Metal/Metal.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/metal/
cat mtl_manual.zig > src/metal/mtl.zig
./zig-out/bin/generator --framework Metal >> src/metal/mtl.zig
rm headers.json headers.m
rm -rf src/avf_audio/avaudio.zig
echo "Generating AVFAudio"
cp avf_audio_headers.m headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/avf_audio/
cat avf_audio_manual.zig > src/avf_audio/avaudio.zig
./zig-out/bin/generator --framework AVFAudio >> src/avf_audio/avaudio.zig
rm headers.json headers.m
rm -rf src/core_midi/coremidi.zig
echo "Generating CoreMIDI"
echo "
#include <CoreMIDI/MidiServices.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/core_midi/
cat core_midi_manual.zig > src/core_midi/coremidi.zig
./zig-out/bin/generator --framework CoreMIDI >> src/core_midi/coremidi.zig
rm headers.json headers.m
rm -rf src/appkit/appkit.zig
echo "Generating AppKit"
echo "
#include <AppKit/AppKit.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations -Wno-availability > headers.json
mkdir -p src/appkit/
cat appkit_manual.zig > src/appkit/appkit.zig
./zig-out/bin/generator --framework AppKit >> src/appkit/appkit.zig
rm headers.json headers.m
zig fmt .
# TODO: generate src/foundation/ns.zig
# TODO: generate src/quartz_core/ca.zig