Skip to content

Commit

Permalink
feat: auto cursor build and packaging using build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Mar 29, 2024
1 parent 3110e2f commit 4cf31a6
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 56 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### What's New?

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

### Changes

- Use 'xz' for better compression in `build.sh` script

### Issue Fixes

- Fixed wrong animation #94
Expand Down
89 changes: 89 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash
# A script for preparing binaries of Apple Cursors, created by Abdulkaiz Khatri.

version="v2.0.1"

error() (
set -o pipefail
"$@" 2> >(sed $'s,.*,\e[31m&\e[m,' >&2)
)

get_config_file() {
local key="${1}"
local cfg_file="build.toml"

if [[ $key == *"Right"* ]]; then
cfg_file="build.right.toml"
fi

echo $cfg_file
}

with_version() {
local comment="${1}"
echo "$comment ($version)."
}

if ! type -p ctgen >/dev/null; then
error ctgen
exit 127 # exit program with "command not found" error code
fi

declare -A names
names["macOS"]=$(with_version "macOS cursors")
names["macOS-White"]=$(with_version "White macOS cursors")

# Cleanup old builds
rm -rf themes bin

# Building Apple XCursor binaries
for key in "${!names[@]}"; do
comment="${names[$key]}"
cfg=$(get_config_file key)

ctgen "$cfg" -p x11 -d "bitmaps/$key" -n "$key" -c "$comment" &
PID=$!
wait $PID
done

# Building Bibata Windows binaries
for key in "${!names[@]}"; do
comment="${names[$key]}"
cfg=$(get_config_file key)

ctgen "$cfg" -p windows -s 16 -d "bitmaps/$key" -n "$key-Small" -c "$comment" &
ctgen "$cfg" -p windows -s 24 -d "bitmaps/$key" -n "$key-Regular" -c "$comment" &
ctgen "$cfg" -p windows -s 32 -d "bitmaps/$key" -n "$key-Large" -c "$comment" &
ctgen "$cfg" -p windows -s 48 -d "bitmaps/$key" -n "$key-Extra-Large" -c "$comment" &
PID=$!
wait $PID
done

# Compressing Binaries
mkdir -p bin
cd themes || exit

for key in "${!names[@]}"; do
tar -cJvf "../bin/${key}.tar.xz" "${key}" &
PID=$!
wait $PID
done

# Compressing Bibata.tar.xz
cp ../LICENSE .
tar -cJvf "../bin/macOS.tar.xz" --exclude="*-Windows" . &
PID=$!
wait $PID

# Compressing Bibata-*-Windows
for key in "${!names[@]}"; do
zip -rv "../bin/${key}-Windows.zip" "${key}-Small-Windows" "${key}-Regular-Windows" "${key}-Large-Windows" "${key}-Extra-Large-Windows" &
PID=$!
wait $PID
done

cd ..

# Copying License File for 'bitmaps'
cp LICENSE bitmaps/
zip -rv bin/bitmaps.zip bitmaps
56 changes: 0 additions & 56 deletions release.sh

This file was deleted.

0 comments on commit 4cf31a6

Please sign in to comment.