init-msleep.sh (1048B)
1 #!/bin/bash 2 3 function ble/util/msleep/.load-compiled-builtin/compile { 4 local builtin_path=$1 5 [[ -x $builtin_path && -s $builtin_path && $builtin_path -nt $_ble_base/lib/init-msleep.sh ]] && return 0 6 7 local CC=cc 8 ble/bin#has gcc && CC=gcc 9 10 local include='#include' # '#' で始まる行はインストール時に消される 11 "$CC" -O2 -s -shared -o "$builtin_path" -xc - << EOF || return 1 12 #%$ sed 's/^#include/$include/' lib/init-msleep.c 13 EOF 14 [[ -x $builtin_path ]] 15 } &>/dev/null 16 17 function ble/util/msleep/.load-compiled-builtin { 18 local basename=$_ble_edit_io_fname2 19 local fname_buff=$basename.buff 20 21 local hostname=${HOSTNAME:-$_ble_base_env_HOSTNAME} 22 local builtin_path=$_ble_base_cache/init-msleep.$_ble_bash.$hostname.so 23 local builtin_runpath=$_ble_base_run/$$.init-msleep.so 24 ble/util/msleep/.load-compiled-builtin/compile "$builtin_path" && 25 ble/bin/cp "$builtin_path" "$builtin_runpath" || return 1 26 27 enable -f "$builtin_runpath" msleep || return 1 28 blehook unload!='enable -d ble/builtin/msleep &>/dev/null' 29 }