Skip to content

Commit ad41265

Browse files
authored
refactor and use lib4bin hooks (#7)
1 parent 8576e15 commit ad41265

File tree

2 files changed

+52
-87
lines changed

2 files changed

+52
-87
lines changed

.github/workflows/blank.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
sed -i 's/DownloadUser/#DownloadUser/g' /etc/pacman.conf
2222
pacman -Syu --noconfirm base-devel curl desktop-file-utils git wget \
23-
base-devel patchelf gtk3 strace gimp ffmpeg ghostscript llvm
23+
base-devel patchelf gtk3 strace gimp ffmpeg ghostscript llvm xorg-server-xvfb librsvg
2424
2525
# Artix repos don't have zsyc
2626
wget https://london.mirror.pkgbuild.com/extra/os/x86_64/zsync-0.6.2-5-x86_64.pkg.tar.zst

gimp-appimage.sh

Lines changed: 51 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -9,99 +9,60 @@ ICON=gimp.png
99
export ARCH="$(uname -m)"
1010
export APPIMAGE_EXTRACT_AND_RUN=1
1111
export VERSION="$(pacman -Q $PACKAGE | awk 'NR==1 {print $2; exit}')"
12+
export STRACE_TIME=15
1213

1314
UPINFO="gh-releases-zsync|$(echo $GITHUB_REPOSITORY | tr '/' '|')|continuous|*$ARCH.AppImage.zsync"
1415
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
15-
URUNTIME="$(wget -q https://api.github.com/repos/VHSgunzo/uruntime/releases -O - \
16-
| sed 's/[()",{} ]/\n/g' | grep -oi "https.*appimage.*dwarfs.*$ARCH$" | head -1)"
16+
URUNTIME=$(wget -q https://api.github.com/repos/VHSgunzo/uruntime/releases -O - \
17+
| sed 's/[()",{} ]/\n/g' | grep -oi "https.*appimage.*dwarfs.*$ARCH$" | head -1)
1718

1819
# Prepare AppDir
19-
mkdir -p ./"$PACKAGE"/AppDir/shared/lib \
20-
./"$PACKAGE"/AppDir/usr/share/applications \
21-
./"$PACKAGE"/AppDir/etc
22-
cd ./"$PACKAGE"/AppDir
23-
24-
cp -r /usr/share/gimp ./usr/share
25-
cp -r /usr/share/locale ./usr/share
26-
cp -r /usr/lib/locale ./shared/lib
27-
cp -r /usr/share/pixmaps ./usr/share
28-
cp -r /etc/gimp ./etc
29-
30-
cp /usr/share/applications/$DESKTOP ./usr/share/applications
31-
cp /usr/share/applications/$DESKTOP ./
32-
cp /usr/share/icons/hicolor/256x256/apps/"$ICON" ./
33-
34-
ln -s ./usr/share ./share
20+
mkdir -p ./AppDir/shared/lib ./AppDir/share ./AppDir/etc
21+
cd ./AppDir
22+
23+
cp -vr /usr/share/gimp ./share
24+
cp -vr /usr/share/locale ./share
25+
cp -vr /usr/lib/locale ./shared/lib
26+
cp -vr /usr/share/pixmaps ./share
27+
cp -vr /etc/gimp ./etc
28+
29+
cp /usr/share/applications/"$DESKTOP" ./
30+
cp /usr/share/icons/hicolor/256x256/apps/"$ICON" ./
31+
32+
ln -s ./ ./usr
3533
ln -s ./shared/lib ./lib
3634
ln -s ./"$ICON" ./.DirIcon
3735

3836
# ADD LIBRARIES
3937
wget "$LIB4BN" -O ./lib4bin
4038
chmod +x ./lib4bin
41-
./lib4bin -p -v -r -s /usr/bin/gimp*
42-
rm -f ./lib4bin
43-
44-
cp -nv /usr/lib/libgimp* ./shared/lib
45-
cp -nv /usr/lib/libaa* ./shared/lib
46-
cp -nv /usr/lib/libmng* ./shared/lib
47-
cp -nv /usr/lib/libgs* ./shared/lib
48-
cp -nv /usr/lib/libslang* ./shared/lib
49-
cp -nv /usr/lib/libijs* ./shared/lib
50-
cp -nv /usr/lib/libijs* ./shared/lib
51-
cp -nv /usr/lib/libjbig2dec* ./shared/lib
52-
cp -nv /usr/lib/libgpm* ./shared/lib
53-
cp -nv /usr/lib/libidn* ./shared/lib
54-
cp -nv /usr/lib/libpaper* ./shared/lib
55-
56-
# CREATE APPRUN
57-
echo '#!/bin/sh
58-
CURRENTDIR="$(dirname "$(readlink -f "${0}")")"
59-
60-
# set gimp variables
61-
export GIMP2_DATADIR="$CURRENTDIR"/share/gimp/2.0
62-
export GIMP2_SYSCONFDIR="$CURRENTDIR"/etc/gimp/2.0
63-
export GIMP2_LOCALEDIR="$CURRENTDIR"/share/locale
64-
export GIMP2_PLUGINDIR="$CURRENTDIR"/shared/lib/gimp/2.0
65-
66-
"$CURRENTDIR"/bin/gimp "$@"' > ./AppRun
67-
chmod +x ./AppRun
68-
69-
# DEPLOY GIMP PLUGINS DEPENDENCIES
70-
echo "Deploying gimp plugins..."
71-
cp -rv /usr/lib/gimp ./shared/lib
72-
find ./shared/lib/gimp -type f -exec ldd {} \; \
73-
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./shared/lib || true
74-
75-
# DEPLOY GDK
76-
echo "Deploying gdk..."
77-
GDK_PATH="$(find /usr/lib -type d -regex ".*/gdk-pixbuf-2.0" -print -quit)"
78-
cp -rv "$GDK_PATH" ./shared/lib
79-
80-
echo "Deploying gdk deps..."
81-
find ./shared/lib/gdk-pixbuf-2.0 -type f -name '*.so*' -exec ldd {} \; \
82-
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./shared/lib || true
83-
84-
find ./shared/lib -type f -regex '.*gdk.*loaders.cache' \
85-
-exec sed -i 's|/.*lib.*/gdk-pixbuf.*/.*/loaders/||g' {} \;
86-
87-
# DEPLOY GTK
88-
echo "Deploying gtk..."
89-
cp -rv /usr/lib/gtk* ./shared/lib
90-
91-
echo "Deploying gdk deps..."
92-
find ./shared/lib/gtk* -type f -name '*.so*' -exec ldd {} \; \
93-
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./shared/lib || true
94-
95-
find ./shared/lib -type f -regex '.*gdk.*immodules.cache' \
96-
-exec sed -i 's|/.*lib.*/gtk.*/.*/3.0.0/||g' {} \;
97-
98-
# DEPLOY WHATEVER THESE ARE
99-
echo "Deploying the rest of stuff..."
100-
cp -rv /usr/lib/gio ./shared/lib
101-
cp -rv /usr/lib/babl-0.1 ./shared/lib
102-
cp -rv /usr/lib/gegl-0.4 ./shared/lib
103-
find ./shared/lib/*/* -type f -name '*.so*' -exec ldd {} \; \
104-
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -vn {} ./shared/lib || true
39+
xvfb-run -a -- ./lib4bin -p -v -s -k \
40+
/usr/bin/gimp* \
41+
/usr/lib/libgimp* \
42+
/usr/lib/gdk-pixbuf-*/*/*/* \
43+
/usr/lib/gtk-*/*/*/* \
44+
/usr/lib/gio/*/* \
45+
/usr/lib/babl-*/* \
46+
/usr/lib/gegl-*/* \
47+
/usr/lib/libaa* \
48+
/usr/lib/libmng* \
49+
/usr/lib/libgs* \
50+
/usr/lib/libslang* \
51+
/usr/lib/libijs* \
52+
/usr/lib/libijs* \
53+
/usr/lib/libjbig2dec* \
54+
/usr/lib/libgpm* \
55+
/usr/lib/libidn* \
56+
/usr/lib/libpaper* \
57+
/usr/lib/libSDL* \
58+
/usr/lib/libXpm.so* \
59+
/usr/lib/libheif.so* \
60+
/usr/lib/libwmf* \
61+
/usr/lib/libudev.so* \
62+
/usr/lib/libdl.so.2
63+
64+
cp -vn /usr/lib/gegl-*/* ./shared/lib/gegl-*
65+
cp -rvn /usr/lib/gimp ./shared/lib
10566

10667
# sharun the gimp plugins
10768
echo "Sharunning the gimp plugins..."
@@ -118,6 +79,14 @@ cp ./sharun ./shared/lib/gimp/2.0
11879
done
11980
)
12081
ln -s ../../../ ./shared/lib/gimp/2.0/shared/lib
82+
83+
# PREPARE SHARUN
84+
echo 'GIMP2_DATADIR=${SHARUN_DIR}/share/gimp/2.0
85+
GIMP2_SYSCONFDIR=${SHARUN_DIR}/etc/gimp/2.0
86+
GIMP2_LOCALEDIR=${SHARUN_DIR}/share/locale
87+
GIMP2_PLUGINDIR=${SHARUN_DIR}/shared/lib/gimp/2.0' > ./.env
88+
89+
ln ./sharun ./AppRun
12190
./sharun -g
12291

12392
# MAKE APPIMAGE WITH URUNTIME
@@ -142,8 +111,4 @@ echo "Generating AppImage..."
142111

143112
echo "Generating zsync file..."
144113
zsyncmake *.AppImage -u *.AppImage
145-
146-
mv ./*.AppImage* ../
147-
cd ..
148-
rm -rf ./"$PACKAGE"
149114
echo "All Done!"

0 commit comments

Comments
 (0)