Skip to content

Commit 4cf31a6

Browse files
committed
feat: auto cursor build and packaging using build.sh
1 parent 3110e2f commit 4cf31a6

File tree

3 files changed

+94
-56
lines changed

3 files changed

+94
-56
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
### What's New?
2020

2121
- feat: Redesign all cursor to latest macOS (Related to #95)
22+
- Official Distributing `16` and `20` XCursors
2223
- README.md: AUR docs added #91
24+
- Attach version meta-data inside cursor packages
25+
- Using [cbmp v1.1.1](https://github.com/ful1e5/cbmp/tree/v1.1.1) for rendering cursor bitmaps.
2326

2427
### Changes
2528

29+
- Use 'xz' for better compression in `build.sh` script
30+
2631
### Issue Fixes
2732

2833
- Fixed wrong animation #94

build.sh

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
# A script for preparing binaries of Apple Cursors, created by Abdulkaiz Khatri.
3+
4+
version="v2.0.1"
5+
6+
error() (
7+
set -o pipefail
8+
"$@" 2> >(sed $'s,.*,\e[31m&\e[m,' >&2)
9+
)
10+
11+
get_config_file() {
12+
local key="${1}"
13+
local cfg_file="build.toml"
14+
15+
if [[ $key == *"Right"* ]]; then
16+
cfg_file="build.right.toml"
17+
fi
18+
19+
echo $cfg_file
20+
}
21+
22+
with_version() {
23+
local comment="${1}"
24+
echo "$comment ($version)."
25+
}
26+
27+
if ! type -p ctgen >/dev/null; then
28+
error ctgen
29+
exit 127 # exit program with "command not found" error code
30+
fi
31+
32+
declare -A names
33+
names["macOS"]=$(with_version "macOS cursors")
34+
names["macOS-White"]=$(with_version "White macOS cursors")
35+
36+
# Cleanup old builds
37+
rm -rf themes bin
38+
39+
# Building Apple XCursor binaries
40+
for key in "${!names[@]}"; do
41+
comment="${names[$key]}"
42+
cfg=$(get_config_file key)
43+
44+
ctgen "$cfg" -p x11 -d "bitmaps/$key" -n "$key" -c "$comment" &
45+
PID=$!
46+
wait $PID
47+
done
48+
49+
# Building Bibata Windows binaries
50+
for key in "${!names[@]}"; do
51+
comment="${names[$key]}"
52+
cfg=$(get_config_file key)
53+
54+
ctgen "$cfg" -p windows -s 16 -d "bitmaps/$key" -n "$key-Small" -c "$comment" &
55+
ctgen "$cfg" -p windows -s 24 -d "bitmaps/$key" -n "$key-Regular" -c "$comment" &
56+
ctgen "$cfg" -p windows -s 32 -d "bitmaps/$key" -n "$key-Large" -c "$comment" &
57+
ctgen "$cfg" -p windows -s 48 -d "bitmaps/$key" -n "$key-Extra-Large" -c "$comment" &
58+
PID=$!
59+
wait $PID
60+
done
61+
62+
# Compressing Binaries
63+
mkdir -p bin
64+
cd themes || exit
65+
66+
for key in "${!names[@]}"; do
67+
tar -cJvf "../bin/${key}.tar.xz" "${key}" &
68+
PID=$!
69+
wait $PID
70+
done
71+
72+
# Compressing Bibata.tar.xz
73+
cp ../LICENSE .
74+
tar -cJvf "../bin/macOS.tar.xz" --exclude="*-Windows" . &
75+
PID=$!
76+
wait $PID
77+
78+
# Compressing Bibata-*-Windows
79+
for key in "${!names[@]}"; do
80+
zip -rv "../bin/${key}-Windows.zip" "${key}-Small-Windows" "${key}-Regular-Windows" "${key}-Large-Windows" "${key}-Extra-Large-Windows" &
81+
PID=$!
82+
wait $PID
83+
done
84+
85+
cd ..
86+
87+
# Copying License File for 'bitmaps'
88+
cp LICENSE bitmaps/
89+
zip -rv bin/bitmaps.zip bitmaps

release.sh

-56
This file was deleted.

0 commit comments

Comments
 (0)