@@ -21,10 +21,8 @@ SHARUN_LINK=${SHARUN_LINK:-https://github.com/VHSgunzo/sharun/releases/latest/do
2121HOOKSRC=${HOOKSRC:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ hooks}
2222LD_PRELOAD_OPEN=${LD_PRELOAD_OPEN:- https:// github.com/ VHSgunzo/ pathmap.git}
2323
24- EXEC_WRAPPER=${EXEC_WRAPPER:- 0}
25- EXEC_WRAPPER_SOURCE=${EXEC_WRAPPER_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ lib/ exec.c}
26- LOCALE_FIX=${LOCALE_FIX:- 0}
27- LOCALE_FIX_SOURCE=${LOCALE_FIX_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ lib/ localefix.c}
24+ ANYLINUX_LIB=${ANYLINUX_LIB:- 0}
25+ ANYLINUX_LIB_SOURCE=${ANYLINUX_LIB_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ lib/ anylinux.c}
2826NOTIFY_SOURCE=${NOTIFY_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ bin/ notify}
2927APPRUN_SOURCE=${APPRUN_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ bin/ AppRun-generic}
3028URUNTIME2APPIMAGE_SOURCE=${URUNTIME2APPIMAGE_SOURCE:- https:// raw.githubusercontent.com/ pkgforge-dev/ Anylinux-AppImages/ refs/ heads/ main/ useful-tools/ uruntime2appimage.sh}
@@ -49,6 +47,11 @@ DEPENDENCIES="
4947 tr
5048"
5149
50+ # keep this for backwards compat until all existing scripts have been updated
51+ if [ " $EXEC_WRAPPER " = 1 ] || [ " $LOCALE_FIX " = 1 ]; then
52+ ANYLINUX_LIB=1
53+ fi
54+
5255# check if the _tmp_* vars have not be declared already
5356# likely to happen if this script run more than once
5457PATH_MAPPING_SCRIPT=" $APPDIR " /bin/path-mapping-hardcoded.src.hook
@@ -165,10 +168,8 @@ _help_msg() {
165168 LIB_DIR Set source library directory if autodetection fails.
166169 NO_STRIP Disable stripping binaries and libraries if set.
167170 APPDIR Destination AppDir (default: ./AppDir).
168- EXEC_WRAPPER Preloads a library that unsets environment variables known to cause
169- problems to child processes. Not needed if the app will just use
170- xdg-open to spawn child proceeses since in that case sharun has
171- a wrapper for xdg-open that handles that.
171+ ANYLINUX_LIB Preloads a library that unsets environment variables known to cause
172+ problems to child processes. Set to 0 to disable.
172173
173174 PATH_MAPPING Configures and preloads pathmap.
174175 Set this variable if the application is hardcoded to look
@@ -202,11 +203,8 @@ _sanity_check() {
202203 fi
203204 done
204205
205- if [ " $EXEC_WRAPPER " = 1 ] && ! command -v cc 1> /dev/null; then
206- _err_msg " ERROR: Using EXEC_WRAPPER requires cc"
207- exit 1
208- elif [ " $LOCALE_FIX " = 1 ] && ! command -v cc 1> /dev/null; then
209- _err_msg " ERROR: Using LOCALE_FIX requires cc"
206+ if [ " $ANYLINUX_LIB " = 1 ] && ! command -v cc 1> /dev/null; then
207+ _err_msg " ERROR: Using ANYLINUX_LIB requires cc"
210208 exit 1
211209 elif [ " $DEPLOY_PYTHON " = 1 ] && [ " $DEPLOY_SYS_PYTHON " = 1 ]; then
212210 _err_msg " ERROR: DEPLOY_PYTHON and DEPLOY_SYS_PYTHON cannot be both enabled!"
@@ -796,17 +794,18 @@ _handle_bins_scripts() {
796794
797795}
798796
799- _add_exec_wrapper () {
800- if [ " $EXEC_WRAPPER " != 1 ]; then
797+ _add_anylinux_lib () {
798+ if [ " $ANYLINUX_LIB " != 1 ]; then
801799 return 0
802800 fi
803801
804- _echo " * Building exec .so..."
805- _download " $TMPDIR " /exec. c " $EXEC_WRAPPER_SOURCE "
806- cc -shared -fPIC " $TMPDIR " /exec. c -o " $APPDIR " /lib/exec .so
807- echo " exec .so" >> " $APPDIR " /.preload
802+ _echo " * Building anylinux .so..."
803+ _download " $APPDIR " /.anylinux. c " $ANYLINUX_LIB_SOURCE "
804+ cc -shared -fPIC " $APPDIR " /.anylinux. c -o " $APPDIR " /lib/anylinux .so
805+ echo " anylinux .so" >> " $APPDIR " /.preload
808806
809- # remove xdg-open wrapper not needed when exec.so is in use
807+ # remove xdg-open wrapper not needed when the lib is in use
808+ # we still need to have a wrapper for gio-launch-desktop though
810809 if [ -f " $APPDIR " /bin/gio-launch-desktop ]; then
811810 rm -f " $APPDIR " /bin/gio-launch-desktop
812811 cat << -'EOF ' > "$APPDIR"/bin/gio-launch-desktop
@@ -817,17 +816,7 @@ _add_exec_wrapper() {
817816 chmod +x " $APPDIR " /bin/gio-launch-desktop
818817 fi
819818 rm -f " $APPDIR " /bin/xdg-open
820- _echo " * EXEC_WRAPPER successfully added!"
821- }
822-
823- _add_locale_fix () {
824- if [ " $LOCALE_FIX " = 1 ] && [ ! -f " $APPDIR " /lib/localefix.so ]; then
825- _echo " * Building localefix.so..."
826- _download " $TMPDIR " /localefix.c " $LOCALE_FIX_SOURCE "
827- cc -shared -fPIC " $TMPDIR " /localefix.c -o " $APPDIR " /lib/localefix.so
828- echo " localefix.so" >> " $APPDIR " /.preload
829- _echo " * LOCALE_FIX successfully added!"
830- fi
819+ _echo " * anylinux.so successfully added!"
831820}
832821
833822_map_paths_ld_preload_open () {
@@ -1295,8 +1284,7 @@ echo ""
12951284_deploy_icon_and_desktop
12961285_map_paths_ld_preload_open
12971286_map_paths_binary_patch
1298- _add_exec_wrapper
1299- _add_locale_fix
1287+ _add_anylinux_lib
13001288_deploy_datadir
13011289_deploy_locale
13021290_check_window_class
0 commit comments