forked from face-hh/webx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-macos
executable file
·59 lines (42 loc) · 2 KB
/
install-macos
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
#!/usr/bin/env bash
echo "Building Napture..."
status=$(git status)
# Check if the status contains the phrase "Your branch is behind"
if [[ $status == *"Your branch is behind"* ]]; then
echo "Your branch is behind the remote repository."
echo "Pulling the latest changes..."
git pull origin $(git rev-parse --abbrev-ref HEAD)
elif [[ $status == *"Your branch is up to date"* ]]; then
echo "Your branch is up to date with the remote repository."
else
echo "Failed to determine the repository status."
fi
# Install deps using Homebrew
brew install gtk4 graphene glib libadwaita lua pkg-config || exit 1
# Assuming the script is in the same directory as "napture"
cd "$(dirname "$0")/napture" || exit 1
# Build the project
RUSTFLAGS="-L $HOMEBREW_CELLAR" cargo build --release || exit 1
# Make an app bundle
mkdir -p target/release/Napture.app/Contents/MacOS
cp target/release/webx target/release/Napture.app/Contents/MacOS
cp ./Info.plist target/release/Napture.app/Contents
# Thanks https://stackoverflow.com/a/31883126/9376340
mkdir -p target/release/Napture.app/Contents/Resources/AppIcon.iconset
# Normal screen icons
for SIZE in 16 32 64 128 256 512; do
sips -z $SIZE $SIZE ./file.png --out target/release/Napture.app/Contents/Resources/AppIcon.iconset/icon_${SIZE}x${SIZE}.png || exit 1
done
# Retina display icons
for SIZE in 32 64 256 512; do
sips -z $SIZE $SIZE ./file.png --out target/release/Napture.app/Contents/Resources/AppIcon.iconset/icon_$(expr $SIZE / 2)x$(expr $SIZE / 2)x2.png || exit 1
done
# Make a multi-resolution Icon
iconutil -c icns -o target/release/Napture.app/Contents/Resources/AppIcon.icns target/release/Napture.app/Contents/Resources/AppIcon.iconset || exit 1
rm -rf target/release/Napture.app/Contents/Resources/AppIcon.iconset
# Sign the app bundle
codesign --force --deep --sign - target/release/Napture.app || exit 1
# Move to Application folder
echo "Installing Napture..."
mv target/release/Napture.app /Applications || exit 1
echo "Napture installation completed."