Skip to content

Commit f72c6b2

Browse files
authored
move to quick-sharun (#18)
1 parent b753ae1 commit f72c6b2

File tree

5 files changed

+97
-141
lines changed

5 files changed

+97
-141
lines changed

AppDir/AppRun

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
CURRENTDIR="$(cd "${0%/*}" && echo "$PWD")"
6+
BIN="${ARGV0:-$0}"
7+
BIN="${BIN##*/}"
8+
DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}"
9+
unset ARGV0
10+
11+
export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share"
12+
export PATH="$CURRENTDIR/bin:$PATH"
13+
14+
if [ ! -d "$DATADIR"/rofi/themes ]; then
15+
mkdir -p "$DATADIR"/rofi
16+
cp -r "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes
17+
fi
18+
19+
# additional scripts can be placed in the top level bin dir
20+
# those with a name that ends up .hook will be executed in teh current shell
21+
# while those that end with bg.hook will be executed in the background
22+
for hook in "$CURRENTDIR"/bin/*.hook; do
23+
[ -x "$hook" ] || continue
24+
case "$hook" in
25+
*.bg.hook) >&2 echo "exec bg hook: $hook"; "$hook" &;;
26+
*.hook) >&2 echo "exec hook: $hook"; "$hook" ;;
27+
esac
28+
done
29+
30+
# Check if ARGV0 matches any bundled binary, fallback to $1, then main bin
31+
if [ -f "$CURRENTDIR"/bin/"$1" ]; then
32+
BIN="$1"
33+
shift
34+
exec "$CURRENTDIR"/bin/"$BIN" "$@"
35+
elif [ -f "$CURRENTDIR"/bin/"$BIN" ]; then
36+
exec "$CURRENTDIR"/bin/"$BIN" "$@"
37+
else
38+
exec "$CURRENTDIR"/bin/rofi "$@"
39+
fi

get-dependencies.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -ex
44
EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"
5+
PATCH="$PWD"/locale-fix.patch
56

67
echo "Installing build dependencies..."
78
echo "---------------------------------------------------------------"
@@ -37,3 +38,14 @@ echo "---------------------------------------------------------------"
3738
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
3839
chmod +x ./get-debloated-pkgs.sh
3940
./get-debloated-pkgs.sh libxml2-mini gtk3-mini
41+
42+
echo "Building rofi..."
43+
echo "---------------------------------------------------------------"
44+
git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && (
45+
cd ./rofi
46+
patch -p1 -i "$PATCH"
47+
meson --prefix /usr . build
48+
meson compile -C build
49+
meson install -C build
50+
)
51+
/usr/bin/rofi -v | awk -F'[- ]' '{print $2; exit}' > ~/version

hack.patch

Lines changed: 0 additions & 51 deletions
This file was deleted.

locale-fix.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/source/rofi.c b/source/rofi.c
2+
index 4355374..2937eda 100644
3+
--- a/source/rofi.c
4+
+++ b/source/rofi.c
5+
@@ -1083,10 +1083,14 @@ int main(int argc, char *argv[]) {
6+
7+
display_init(proxy);
8+
9+
+ /** Fallback to C locale instead of outright failing */
10+
if (setlocale(LC_ALL, "") == NULL) {
11+
- g_warning("Failed to set locale.");
12+
- cleanup();
13+
- return EXIT_FAILURE;
14+
+ g_warning("Failed to set locale, falling back to C locale.");
15+
+ if (setlocale(LC_ALL, "C") == NULL) {
16+
+ g_warning("Failed to set C locale – aborting.");
17+
+ cleanup();
18+
+ return EXIT_FAILURE;
19+
+ }
20+
}
21+
22+
TICK_N("Setup Locale");

rofi-appimage.sh

Lines changed: 24 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,30 @@
11
#!/bin/sh
22

3-
set -ex
3+
set -eux
44

55
ARCH="$(uname -m)"
6-
SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-$ARCH-aio"
7-
URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH"
8-
URUNTIME_LITE="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-lite-$ARCH"
9-
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
10-
PATCH="$PWD"/hack.patch
11-
12-
# CREATE DIRECTORIES
13-
mkdir ./AppDir && (
14-
cd ./AppDir
15-
# DOWNLOAD AND BUILD ROFI
16-
git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && (
17-
cd ./rofi
18-
patch -p1 -i "$PATCH"
19-
meson --prefix /usr . build
20-
meson compile -C build
21-
meson install -C build --destdir "$(realpath ../)"
22-
)
23-
mv -v ./usr/* ./
24-
cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./
25-
cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./.DirIcon
26-
cp -v ./share/applications/rofi.desktop ./
27-
echo "Categories=Utility;" >> ./rofi.desktop
28-
29-
# ADD LIBRARIES
30-
wget --retry-connrefused --tries=30 "$SHARUN" -O ./sharun-aio
31-
chmod +x ./sharun-aio
32-
./sharun-aio l -p -v -k -s \
33-
./bin/* \
34-
/usr/lib/gdk-pixbuf-*/*/*/* \
35-
/usr/lib/gio/modules/libgvfsdbus.so
36-
rm -rf ./sharun-aio ./rofi ./usr
37-
38-
# AppRun
39-
cat > ./AppRun <<-'EOF'
40-
#!/bin/sh
41-
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
42-
43-
BIN="${ARGV0#./}"
44-
unset ARGV0
45-
DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}"
46-
47-
export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share"
48-
export PATH="$CURRENTDIR/bin:$PATH"
49-
50-
if [ ! -d "$DATADIR"/rofi/themes ]; then
51-
mkdir -p "$DATADIR"/rofi || exit 1
52-
cp -rn "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes || exit 1
53-
fi
54-
55-
if [ "$1" = "rofi-theme-selector" ]; then
56-
shift
57-
exec "$CURRENTDIR/bin/rofi-theme-selector" "$@"
58-
elif [ -f "$CURRENTDIR/bin/$BIN" ]; then
59-
exec "$CURRENTDIR/bin/$BIN" "$@"
60-
else
61-
exec "$CURRENTDIR/bin/rofi" "$@"
62-
fi
63-
EOF
64-
65-
chmod a+x ./AppRun
66-
./sharun -g
67-
)
68-
69-
export VERSION="$(./AppDir/AppRun -v | awk -F'[- ]' '{print $2; exit}')"
70-
echo "$VERSION" > ~/version
71-
72-
# turn appdir into appimage
73-
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime
74-
wget --retry-connrefused --tries=30 "$URUNTIME_LITE" -O ./uruntime-lite
75-
chmod +x ./uruntime*
76-
77-
# Keep the mount point (speeds up launch time)
78-
sed -i 's|URUNTIME_MOUNT=[0-9]|URUNTIME_MOUNT=0|' ./uruntime-lite
79-
80-
# Add udpate info to runtime
81-
echo "Adding update information \"$UPINFO\" to runtime..."
82-
./uruntime-lite --appimage-addupdinfo "$UPINFO"
83-
84-
echo "Generating AppImage..."
85-
./uruntime \
86-
--appimage-mkdwarfs -f \
87-
--set-owner 0 --set-group 0 \
88-
--no-history --no-create-timestamp \
89-
--compression zstd:level=22 -S26 -B8 \
90-
--header uruntime-lite \
91-
-i ./AppDir \
92-
-o ./rofi-"$VERSION"-anylinux-"$ARCH".AppImage
6+
VERSION="$(cat ~/version)"
7+
SHARUN="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/execv-hook/useful-tools/quick-sharun.sh"
8+
URUNTIME="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/uruntime2appimage.sh"
9+
UPDATER="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/self-updater.bg.hook"
10+
11+
export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync"
12+
export OUTNAME=rofi-"$VERSION"-anylinux-"$ARCH".AppImage
13+
export DESKTOP=/usr/share/applications/rofi.desktop
14+
export ICON=/usr/share/icons/hicolor/scalable/apps/rofi.svg
15+
export URUNTIME_PRELOAD=1 # really needed here
16+
export EXEC_WRAPPER=1 # needed here since this will launch other processes
17+
18+
# ADD LIBRARIES
19+
wget --retry-connrefused --tries=30 "$SHARUN" -O ./quick-sharun
20+
chmod +x ./quick-sharun
21+
./quick-sharun /usr/bin/rofi*
22+
echo 'unset ARGV0' > ./AppDir/.env
23+
24+
# MAKE APPIMAGE WITH URUNTIME
25+
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime2appimage
26+
chmod +x ./uruntime2appimage
27+
./uruntime2appimage
9328

9429
# make appbundle
9530
UPINFO="$(echo "$UPINFO" | sed 's#.AppImage.zsync#*.AppBundle.zsync#g')"
@@ -106,11 +41,10 @@ echo "Generating [dwfs]AppBundle..."
10641
--output-to ./rofi-"$VERSION"-anylinux-"$ARCH".dwfs.AppBundle
10742

10843
echo "Generating zsync file..."
109-
zsyncmake ./*.AppImage -u ./*.AppImage
11044
zsyncmake ./*.AppBundle -u ./*.AppBundle
11145

11246
mkdir -p ./dist
113-
mv -v ./*.AppImage* ./dist
47+
mv -v ./*.AppImage* ./dist
11448
mv -v ./*.AppBundle* ./dist
11549

11650
echo "All Done!"

0 commit comments

Comments
 (0)