Skip to content

Commit 434d291

Browse files
authored
Add files via upload
1 parent 704f013 commit 434d291

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

azahar-appimage.sh

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
export ARCH="$(uname -m)"
6+
7+
REPO="https://github.com/azahar-emu/azahar.git"
8+
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
9+
GRON="https://raw.githubusercontent.com/xonixx/gron.awk/refs/heads/main/gron.awk"
10+
URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH"
11+
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
12+
13+
if [ "$ARCH" = 'x86_64' ]; then
14+
if [ "$1" = 'v3' ]; then
15+
echo "Making x86-64-v3 optimized build of azahar..."
16+
ARCH="${ARCH}_v3"
17+
ARCH_FLAGS="-march=x86-64-v3 -O3 -flto=thin -DNDEBUG"
18+
else
19+
echo "Making x86-64 generic build of azahar..."
20+
ARCH_FLAGS="-march=x86-64 -mtune=generic -O3 -flto=thin -DNDEBUG"
21+
fi
22+
else
23+
echo "Making aarch64 build of azahar..."
24+
ARCH_FLAGS="-march=armv8-a -mtune=generic -O3 -flto=thin -DNDEBUG"
25+
fi
26+
27+
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
28+
29+
# Determine to build nightly or stable
30+
if [ "DEVEL" = 'true' ]; then
31+
echo "Making nightly build of azahar..."
32+
VERSION="$(git ls-remote "$REPO" HEAD | cut -c 1-9)"
33+
git clone "$REPO" ./azahar
34+
else
35+
echo "Making stable build of azahar..."
36+
wget "$GRON" -O ./gron.awk
37+
chmod +x ./gron.awk
38+
VERSION=$(wget https://api.github.com/repos/azahar-emu/azahar/tags -O - \
39+
| ./gron.awk | awk -F'=|"' '/name/ {print $3; exit}')
40+
git clone --branch "$VERSION" --single-branch "$REPO" ./azahar
41+
fi
42+
echo "$VERSION" > ~/version
43+
44+
# BUILD AZAAHR
45+
(
46+
cd ./azahar
47+
git submodule update --init --recursive -j$(nproc)
48+
49+
mkdir ./build
50+
cd ./build
51+
cmake .. -DCMAKE_CXX_COMPILER=clang++ \
52+
-DCMAKE_C_COMPILER=clang \
53+
-DCMAKE_INSTALL_PREFIX=/usr \
54+
-DENABLE_QT_TRANSLATION=ON \
55+
-DUSE_SYSTEM_BOOST=OFF \
56+
-DCMAKE_BUILD_TYPE=Release \
57+
-DUSE_DISCORD_PRESENCE=OFF \
58+
-DCMAKE_C_FLAGS="$ARCH_FLAGS" \
59+
-DUSE_SYSTEM_VULKAN_HEADERS=ON \
60+
-DENABLE_LTO=OFF \
61+
-DUSE_SYSTEM_GLSLANG=ON \
62+
-DSIRIT_USE_SYSTEM_SPIRV_HEADERS=ON \
63+
-DCITRA_USE_PRECOMPILED_HEADERS=OFF \
64+
-DCMAKE_C_FLAGS="$ARCH_FLAGS" \
65+
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS" \
66+
-Wno-dev
67+
cmake --build . -- -j"$(nproc)"
68+
sudo make install
69+
)
70+
rm -rf ./azahar
71+
72+
# NOW MAKE APPIMAGE
73+
mkdir ./AppDir
74+
cd ./AppDir
75+
76+
cp -v /usr/share/applications/org.azahar_emu.Azahar.desktop ./azahar.desktop
77+
cp -v /usr/share/icons/hicolor/512x512/apps/org.azahar_emu.Azahar.png ./azahar.png
78+
cp -v /usr/share/icons/hicolor/512x512/apps/org.azahar_emu.Azahar.png ./.DirIcon
79+
80+
if [ "$DEVEL" = 'true' ]; then
81+
sed -i 's|Name=Azahar|Name=Azahar nightly|' ./azahar.desktop
82+
UPINFO="$(echo "$UPINFO" | sed 's|latest|nightly|')"
83+
fi
84+
85+
# Bundle all libs
86+
wget --retry-connrefused --tries=30 "$LIB4BN" -O ./lib4bin
87+
chmod +x ./lib4bin
88+
xvfb-run -a -- ./lib4bin -p -v -e -s -k \
89+
/usr/bin/azahar* \
90+
/usr/lib/libGLX* \
91+
/usr/lib/libGL.so* \
92+
/usr/lib/libEGL* \
93+
/usr/lib/dri/* \
94+
/usr/lib/vdpau/* \
95+
/usr/lib/libvulkan* \
96+
/usr/lib/libVkLayer* \
97+
/usr/lib/libXss.so* \
98+
/usr/lib/libdecor-0.so* \
99+
/usr/lib/libgamemode.so* \
100+
/usr/lib/qt6/plugins/audio/* \
101+
/usr/lib/qt6/plugins/bearer/* \
102+
/usr/lib/qt6/plugins/imageformats/* \
103+
/usr/lib/qt6/plugins/iconengines/* \
104+
/usr/lib/qt6/plugins/platforms/* \
105+
/usr/lib/qt6/plugins/platformthemes/* \
106+
/usr/lib/qt6/plugins/platforminputcontexts/* \
107+
/usr/lib/qt6/plugins/styles/* \
108+
/usr/lib/qt6/plugins/xcbglintegrations/* \
109+
/usr/lib/qt6/plugins/wayland-*/* \
110+
/usr/lib/pulseaudio/* \
111+
/usr/lib/pipewire-*/* \
112+
/usr/lib/spa-*/*/* \
113+
/usr/lib/alsa-lib/*
114+
115+
# Prepare sharun
116+
if [ "$ARCH" = 'aarch64' ]; then
117+
# allow the host vulkan to be used for aarch64 given the sed situation
118+
echo 'SHARUN_ALLOW_SYS_VKICD=1' > ./.env
119+
fi
120+
ln ./sharun ./AppRun
121+
./sharun -g
122+
123+
# turn appdir into appimage
124+
cd ..
125+
wget -q "$URUNTIME" -O ./uruntime
126+
chmod +x ./uruntime
127+
128+
#Add udpate info to runtime
129+
echo "Adding update information \"$UPINFO\" to runtime..."
130+
./uruntime --appimage-addupdinfo "$UPINFO"
131+
132+
echo "Generating AppImage..."
133+
./uruntime --appimage-mkdwarfs -f \
134+
--set-owner 0 --set-group 0 \
135+
--no-history --no-create-timestamp \
136+
--compression zstd:level=22 -S26 -B8 \
137+
--header uruntime \
138+
-i ./AppDir -o Azahar-Enhanced-"$VERSION"-anylinux-"$ARCH".AppImage
139+
140+
echo "Generating zsync file..."
141+
zsyncmake *.AppImage -u *.AppImage
142+
echo "All Done!"

0 commit comments

Comments
 (0)