Skip to content

Commit 9ffc2db

Browse files
authored
add option to make static binaries with wrappe (#134)
1 parent 8be967c commit 9ffc2db

File tree

1 file changed

+60
-17
lines changed

1 file changed

+60
-17
lines changed

useful-tools/quick-sharun.sh

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export DST_DIR="$APPDIR"
7777
export GEN_LIB_PATH=1
7878
export HARD_LINKS=1
7979
export WITH_HOOKS=1
80-
export STRACE_MODE="${STRACE_MODE:-1}"
80+
export STRACE_MODE=${STRACE_MODE:-1}
81+
export WRAPPE_CLVL=${WRAPPE_CLVL:-15}
8182
export VERBOSE=1
8283

8384
if [ -z "$NO_STRIP" ]; then
@@ -258,22 +259,6 @@ _make_appimage() {
258259
exec "$TMPDIR"/uruntime2appimage.sh
259260
}
260261

261-
case "$1" in
262-
--help)
263-
_help_msg
264-
;;
265-
--make-appimage)
266-
_make_appimage
267-
;;
268-
'')
269-
if [ -z "$PYTHON_PACKAGES" ]; then
270-
_help_msg
271-
fi
272-
;;
273-
esac
274-
275-
_sanity_check
276-
277262
# POSIX shell doesn't support arrays we use awk to save it into a variable
278263
# then with 'eval set -- $var' we add it to the positional array
279264
# see https://unix.stackexchange.com/questions/421158/how-to-use-pseudo-arrays-in-posix-shell-script
@@ -1193,6 +1178,64 @@ _patch_away_usr_share_dir() {
11931178
ADD_HOOKS="${ADD_HOOKS:+$ADD_HOOKS:}path-mapping-hardcoded.hook"
11941179
}
11951180

1181+
_make_static_bin() (
1182+
while :; do case "$1" in
1183+
--dst-dir)
1184+
export DST_DIR="$2"
1185+
shift
1186+
;;
1187+
-*)
1188+
_err_msg "ERROR: Unknown option: '$1'"
1189+
exit 1
1190+
;;
1191+
'')
1192+
break
1193+
;;
1194+
*)
1195+
BIN_TO_DEPLOY="${BIN_TO_DEPLOY:+$BIN_TO_DEPLOY:}$1"
1196+
shift
1197+
;;
1198+
esac
1199+
done
1200+
_IFS=$IFS
1201+
IFS=:
1202+
set -- $BIN_TO_DEPLOY
1203+
IFS=$_IFS
1204+
_echo "------------------------------------------------------------"
1205+
mkdir -p "$DST_DIR"
1206+
for b do
1207+
_echo "Packing $b as a static binary..."
1208+
$XVFB_CMD "$TMPDIR"/sharun-aio l \
1209+
--with-wrappe \
1210+
--wrappe-exec "${b##*/}" \
1211+
"$b" || :
1212+
done
1213+
_echo "------------------------------------------------------------"
1214+
)
1215+
1216+
1217+
case "$1" in
1218+
--help)
1219+
_help_msg
1220+
;;
1221+
--make-appimage)
1222+
_make_appimage
1223+
;;
1224+
--make-static-bin)
1225+
shift
1226+
_get_sharun
1227+
_make_static_bin "$@"
1228+
exit 0
1229+
;;
1230+
'')
1231+
if [ -z "$PYTHON_PACKAGES" ]; then
1232+
_help_msg
1233+
fi
1234+
;;
1235+
esac
1236+
1237+
_sanity_check
1238+
11961239
_echo "------------------------------------------------------------"
11971240
_echo "Starting deployment, checking if extra libraries need to be added..."
11981241
echo ""

0 commit comments

Comments
 (0)