···4848make zig
4949```
50505151+## ๐ Installation
5252+5353+with `curl` (Ubuntu/Debian):
5454+5555+```sh
5656+curl -fsSL https://raw.githubusercontent.com/tsirysndr/rockbox-zig/HEAD/install.sh | bash
5757+```
5858+5959+MacOS, currently not supported, but you can run in a docker container.
6060+6161+6262+## ๐ฆ Downloads
6363+6464+- `Linux`: intel: [rockbox_2024.10.30_x86_64-linux.tar.gz](https://github.com/tsirysndr/rockbox-zig/releases/download/2024.10.30/rockbox_2024.10.30_x86_64-linux.tar.gz) arm64: [rockbox_2024.10.30_aarch64-linux.tar.gz](https://github.com/tsirysndr/rockbox-zig/releases/download/2024.10.30/rockbox_2024.10.30_aarch64-linux.tar.gz)
6565+6666+5167## โจ Features
52685369- [x] Zig Build System
+246
install.sh
···11+#!/bin/bash
22+33+set -e -o pipefail
44+55+readonly MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
66+readonly GREEN="$(tput setaf 2 2>/dev/null || echo '')"
77+readonly CYAN="$(tput setaf 6 2>/dev/null || echo '')"
88+readonly ORANGE="$(tput setaf 3 2>/dev/null || echo '')"
99+readonly NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
1010+1111+if ! command -v curl >/dev/null 2>&1; then
1212+ echo "Error: curl is required to install Rockbox."
1313+ exit 1
1414+fi
1515+1616+if ! command -v tar >/dev/null 2>&1; then
1717+ echo "Error: tar is required to install Rockbox."
1818+ exit 1
1919+fi
2020+2121+export PATH="$HOME/.local/bin:$PATH"
2222+2323+# Define the release information
2424+RELEASE_URL="https://api.github.com/repos/tsirysndr/rockbox-zig/releases/latest"
2525+2626+ASSET_NAME=""
2727+2828+function detect_os() {
2929+ # Determine the operating system
3030+ OS=$(uname -s)
3131+ if [ "$OS" = "Linux" ]; then
3232+ # Determine the CPU architecture
3333+ ARCH=$(uname -m)
3434+ if [ "$ARCH" = "aarch64" ]; then
3535+ ASSET_NAME="_aarch64-linux.tar.gz"
3636+ elif [ "$ARCH" = "x86_64" ]; then
3737+ ASSET_NAME="_x86_64-linux.tar.gz"
3838+ else
3939+ echo "Unsupported architecture: $ARCH"
4040+ exit 1
4141+ fi
4242+ else
4343+ echo "Unsupported operating system: $OS"
4444+ exit 1
4545+ fi;
4646+}
4747+4848+# Install Rockbox CLI
4949+5050+detect_os
5151+5252+# Retrieve the download URL for the desired asset
5353+DOWNLOAD_URL=$(curl -sSL "$RELEASE_URL" | grep -o "browser_download_url.*rockbox_.*$ASSET_NAME\"" | cut -d ' ' -f 2)
5454+5555+ASSET_NAME=$(basename $DOWNLOAD_URL)
5656+5757+INSTALL_DIR="$HOME/.local/bin"
5858+5959+DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`
6060+6161+# Download the asset
6262+curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
6363+6464+# Extract the asset
6565+tar -xzf /tmp/$ASSET_NAME -C /tmp
6666+6767+# Set the correct permissions for the binary
6868+chmod +x /tmp/rockbox
6969+7070+mv /tmp/rockbox $INSTALL_DIR
7171+7272+if command -v apt-get >/dev/null 2>&1; then
7373+ if command -v sudo >/dev/null 2>&1; then
7474+ sudo apt-get install -y libusb-dev \
7575+ libsdl1.2-dev \
7676+ libfreetype6 \
7777+ libunwind-dev \
7878+ alsa-utils \
7979+ libasound2
8080+ else
8181+ apt-get install -y libusb-dev \
8282+ libsdl1.2-dev \
8383+ libfreetype6 \
8484+ libunwind-dev \
8585+ alsa-utils \
8686+ libasound2
8787+ fi
8888+elif command -v pacman >/dev/null 2>&1; then
8989+ if command -v sudo >/dev/null 2>&1; then
9090+ sudo pacman -S --noconfirm libusb \
9191+ sdl \
9292+ freetype2 \
9393+ libunwind \
9494+ alsa-lib
9595+ else
9696+ pacman -S --noconfirm libusb \
9797+ sdl \
9898+ freetype2 \
9999+ libunwind \
100100+ alsa-lib
101101+ fi
102102+elif command -v dnf >/dev/null 2>&1; then
103103+ if command -v sudo >/dev/null 2>&1; then
104104+ sudo dnf install -y libusb \
105105+ SDL \
106106+ freetype \
107107+ libunwind \
108108+ alsa-lib
109109+ else
110110+ dnf install -y libusb \
111111+ SDL \
112112+ freetype \
113113+ libunwind \
114114+ alsa-lib
115115+ fi
116116+elif command -v zypper >/dev/null 2>&1; then
117117+ if command -v sudo >/dev/null 2>&1; then
118118+ sudo zypper install -y libusb-1_0-0 \
119119+ libSDL-1_2-0 \
120120+ freetype2 \
121121+ libunwind \
122122+ alsa
123123+ else
124124+ zypper install -y libusb-1_0-0 \
125125+ libSDL-1_2-0 \
126126+ freetype2 \
127127+ libunwind \
128128+ alsa
129129+ fi
130130+elif command -v apk >/dev/null 2>&1; then
131131+ if command -v sudo >/dev/null 2>&1; then
132132+ sudo apk add libusb \
133133+ sdl \
134134+ freetype \
135135+ libunwind \
136136+ alsa-lib
137137+ else
138138+ apk add libusb \
139139+ sdl \
140140+ freetype \
141141+ libunwind \
142142+ alsa-lib
143143+ fi
144144+fi
145145+146146+# Install Rockbox daemon
147147+148148+detect_os
149149+150150+DOWNLOAD_URL=$(curl -sSL $RELEASE_URL | grep -o "browser_download_url.*rockboxd_.*$ASSET_NAME\"" | cut -d ' ' -f 2)
151151+152152+ASSET_NAME=$(basename $DOWNLOAD_URL)
153153+154154+DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`
155155+156156+# Download the asset
157157+curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
158158+159159+# Extract the asset
160160+tar -xzf /tmp/$ASSET_NAME -C /tmp
161161+162162+# Set the correct permissions for the binary
163163+chmod +x /tmp/rockboxd
164164+165165+mv /tmp/rockboxd $INSTALL_DIR
166166+167167+# Install Rockbox assets
168168+169169+detect_os
170170+171171+ASSET_NAME=$(echo $ASSET_NAME | sed 's/_x86_64/-x86_64/')
172172+ASSET_NAME=$(echo $ASSET_NAME | sed 's/_aarch64/-aarch64/')
173173+174174+DOWNLOAD_URL=$(curl -sSL $RELEASE_URL | grep -o "browser_download_url.*rockbox-assets.*$ASSET_NAME\"" | cut -d ' ' -f 2)
175175+176176+ASSET_NAME=$(basename $DOWNLOAD_URL)
177177+178178+DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`
179179+180180+# Download the asset
181181+curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
182182+183183+184184+# Extract the asset
185185+mkdir -p /tmp/rockbox-assets
186186+tar -xzf /tmp/$ASSET_NAME -C /tmp/rockbox-assets
187187+188188+mkdir -p $INSTALL_DIR/../share/rockbox
189189+cp -r /tmp/rockbox-assets/* $INSTALL_DIR/../share/rockbox
190190+191191+# Install Rockbox Codecs
192192+193193+detect_os
194194+195195+ASSET_NAME=$(echo $ASSET_NAME | sed 's/_x86_64/-x86_64/')
196196+ASSET_NAME=$(echo $ASSET_NAME | sed 's/_aarch64/-aarch64/')
197197+198198+DOWNLOAD_URL=$(curl -sSL $RELEASE_URL | grep -o "browser_download_url.*rockbox-codecs.*$ASSET_NAME\"" | cut -d ' ' -f 2)
199199+200200+ASSET_NAME=$(basename $DOWNLOAD_URL)
201201+202202+DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`
203203+204204+# Download the asset
205205+curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
206206+207207+# Extract the asset
208208+tar -xzf /tmp/$ASSET_NAME -C /tmp
209209+210210+mkdir -p $INSTALL_DIR/../lib/rockbox
211211+cp -r /tmp/codecs $INSTALL_DIR/../lib/rockbox
212212+cp -r /tmp/rocks $INSTALL_DIR/../lib/rockbox
213213+214214+# detect if user can run rockboxd, if not add $HOME/.local/bin to PATH
215215+if ! command -v rockboxd >/dev/null 2>&1; then
216216+ echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> $HOME/.bashrc
217217+ export PATH="$HOME/.local/bin:$PATH"
218218+fi
219219+220220+cat <<EOF
221221+${ORANGE}
222222+ __________ __ ___.
223223+ Open \______ \ ____ ____ | | _\_ |__ _______ ___
224224+ Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
225225+ Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
226226+ Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \\
227227+ \/ \/ \/ \/ \/
228228+${NO_COLOR}
229229+Welcome to Rockbox Zig! ๐
230230+A fork of the original Rockbox project, with a focus on modernization and more features.
231231+232232+${GREEN}https://github.com/tsirysndr/rockbox-zig${NO_COLOR}
233233+234234+Please file an issue if you encounter any problems!
235235+236236+===============================================================================
237237+238238+Installation completed! ๐
239239+240240+To get started, run:
241241+242242+${CYAN}rockbox start${NO_COLOR}
243243+244244+Stuck? Join our Discord ${MAGENTA}https://discord.gg/tXPrgcPKSt${NO_COLOR}
245245+246246+EOF