Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions AppDir/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

set -e

CURRENTDIR="$(cd "${0%/*}" && echo "$PWD")"
BIN="${ARGV0:-$0}"
BIN="${BIN##*/}"
DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}"
unset ARGV0

export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share"
export PATH="$CURRENTDIR/bin:$PATH"

if [ ! -d "$DATADIR"/rofi/themes ]; then
mkdir -p "$DATADIR"/rofi
cp -r "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes
fi

# additional scripts can be placed in the top level bin dir
# those with a name that ends up .hook will be executed in teh current shell
# while those that end with bg.hook will be executed in the background
for hook in "$CURRENTDIR"/bin/*.hook; do
[ -x "$hook" ] || continue
case "$hook" in
*.bg.hook) >&2 echo "exec bg hook: $hook"; "$hook" &;;
*.hook) >&2 echo "exec hook: $hook"; "$hook" ;;
esac
done

# Check if ARGV0 matches any bundled binary, fallback to $1, then main bin
if [ -f "$CURRENTDIR"/bin/"$1" ]; then
BIN="$1"
shift
exec "$CURRENTDIR"/bin/"$BIN" "$@"
elif [ -f "$CURRENTDIR"/bin/"$BIN" ]; then
exec "$CURRENTDIR"/bin/"$BIN" "$@"
else
exec "$CURRENTDIR"/bin/rofi "$@"
fi
12 changes: 12 additions & 0 deletions get-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

echo "Installing build dependencies..."
echo "---------------------------------------------------------------"
Expand Down Expand Up @@ -37,3 +38,14 @@ echo "---------------------------------------------------------------"
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
chmod +x ./get-debloated-pkgs.sh
./get-debloated-pkgs.sh libxml2-mini gtk3-mini

echo "Building rofi..."
echo "---------------------------------------------------------------"
git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && (
cd ./rofi
patch -p1 -i "$PATCH"
meson --prefix /usr . build
meson compile -C build
meson install -C build
)
/usr/bin/rofi -v | awk -F'[- ]' '{print $2; exit}' > ~/version
51 changes: 0 additions & 51 deletions hack.patch

This file was deleted.

22 changes: 22 additions & 0 deletions locale-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/source/rofi.c b/source/rofi.c
index 4355374..2937eda 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -1083,10 +1083,14 @@ int main(int argc, char *argv[]) {

display_init(proxy);

+ /** Fallback to C locale instead of outright failing */
if (setlocale(LC_ALL, "") == NULL) {
- g_warning("Failed to set locale.");
- cleanup();
- return EXIT_FAILURE;
+ g_warning("Failed to set locale, falling back to C locale.");
+ if (setlocale(LC_ALL, "C") == NULL) {
+ g_warning("Failed to set C locale – aborting.");
+ cleanup();
+ return EXIT_FAILURE;
+ }
}

TICK_N("Setup Locale");
114 changes: 24 additions & 90 deletions rofi-appimage.sh
Original file line number Diff line number Diff line change
@@ -1,95 +1,30 @@
#!/bin/sh

set -ex
set -eux

ARCH="$(uname -m)"
SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-$ARCH-aio"
URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH"
URUNTIME_LITE="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-lite-$ARCH"
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
PATCH="$PWD"/hack.patch

# CREATE DIRECTORIES
mkdir ./AppDir && (
cd ./AppDir
# DOWNLOAD AND BUILD ROFI
git clone --depth 1 "https://github.com/davatorium/rofi.git" ./rofi && (
cd ./rofi
patch -p1 -i "$PATCH"
meson --prefix /usr . build
meson compile -C build
meson install -C build --destdir "$(realpath ../)"
)
mv -v ./usr/* ./
cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./
cp -v ./share/icons/hicolor/scalable/apps/rofi.svg ./.DirIcon
cp -v ./share/applications/rofi.desktop ./
echo "Categories=Utility;" >> ./rofi.desktop

# ADD LIBRARIES
wget --retry-connrefused --tries=30 "$SHARUN" -O ./sharun-aio
chmod +x ./sharun-aio
./sharun-aio l -p -v -k -s \
./bin/* \
/usr/lib/gdk-pixbuf-*/*/*/* \
/usr/lib/gio/modules/libgvfsdbus.so
rm -rf ./sharun-aio ./rofi ./usr

# AppRun
cat > ./AppRun <<-'EOF'
#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"

BIN="${ARGV0#./}"
unset ARGV0
DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}"

export XDG_DATA_DIRS="$DATADIR:$XDG_DATA_DIRS:/usr/local/share:/usr/share"
export PATH="$CURRENTDIR/bin:$PATH"

if [ ! -d "$DATADIR"/rofi/themes ]; then
mkdir -p "$DATADIR"/rofi || exit 1
cp -rn "$CURRENTDIR"/share/rofi/themes "$DATADIR"/rofi/themes || exit 1
fi

if [ "$1" = "rofi-theme-selector" ]; then
shift
exec "$CURRENTDIR/bin/rofi-theme-selector" "$@"
elif [ -f "$CURRENTDIR/bin/$BIN" ]; then
exec "$CURRENTDIR/bin/$BIN" "$@"
else
exec "$CURRENTDIR/bin/rofi" "$@"
fi
EOF

chmod a+x ./AppRun
./sharun -g
)

export VERSION="$(./AppDir/AppRun -v | awk -F'[- ]' '{print $2; exit}')"
echo "$VERSION" > ~/version

# turn appdir into appimage
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime
wget --retry-connrefused --tries=30 "$URUNTIME_LITE" -O ./uruntime-lite
chmod +x ./uruntime*

# Keep the mount point (speeds up launch time)
sed -i 's|URUNTIME_MOUNT=[0-9]|URUNTIME_MOUNT=0|' ./uruntime-lite

# Add udpate info to runtime
echo "Adding update information \"$UPINFO\" to runtime..."
./uruntime-lite --appimage-addupdinfo "$UPINFO"

echo "Generating AppImage..."
./uruntime \
--appimage-mkdwarfs -f \
--set-owner 0 --set-group 0 \
--no-history --no-create-timestamp \
--compression zstd:level=22 -S26 -B8 \
--header uruntime-lite \
-i ./AppDir \
-o ./rofi-"$VERSION"-anylinux-"$ARCH".AppImage
VERSION="$(cat ~/version)"
SHARUN="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/execv-hook/useful-tools/quick-sharun.sh"
URUNTIME="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/uruntime2appimage.sh"
UPDATER="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/self-updater.bg.hook"

export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync"
export OUTNAME=rofi-"$VERSION"-anylinux-"$ARCH".AppImage
export DESKTOP=/usr/share/applications/rofi.desktop
export ICON=/usr/share/icons/hicolor/scalable/apps/rofi.svg
export URUNTIME_PRELOAD=1 # really needed here
export EXEC_WRAPPER=1 # needed here since this will launch other processes

# ADD LIBRARIES
wget --retry-connrefused --tries=30 "$SHARUN" -O ./quick-sharun
chmod +x ./quick-sharun
./quick-sharun /usr/bin/rofi*
echo 'unset ARGV0' > ./AppDir/.env

# MAKE APPIMAGE WITH URUNTIME
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime2appimage
chmod +x ./uruntime2appimage
./uruntime2appimage

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

echo "Generating zsync file..."
zsyncmake ./*.AppImage -u ./*.AppImage
zsyncmake ./*.AppBundle -u ./*.AppBundle

mkdir -p ./dist
mv -v ./*.AppImage* ./dist
mv -v ./*.AppImage* ./dist
mv -v ./*.AppBundle* ./dist

echo "All Done!"