Skip to content

Commit

Permalink
+dropbear/build.sh: init cp clear
Browse files Browse the repository at this point in the history
  • Loading branch information
sam#gemmi-win10 committed Nov 4, 2023
1 parent e0b1233 commit fe697cf
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions compile/src/x-dropbear/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/sh

set -e # Exit immediately if a command exits with a non-zero status.
# set -u # Treat unset variables as an error.


gh=https://ghps.cc/
# https://gitee.com/g-system/fk-suckless-st #git clone;
ST_VER=0.8.4
ST_URL=${gh}https://github.com/neutrinolabs/xrdp/releases/download/v${XRDP_VER}/xrdp-${XRDP_VER}.tar.gz

# Set same default compilation flags as abuild.
export CFLAGS="-Os -fomit-frame-pointer"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="$CFLAGS"
export LDFLAGS="-Wl,--as-needed --static -static -Wl,--strip-all"
#
export CC=xx-clang

# set -u; err if not exist
test -z "$TARGETPATH" && export TARGETPATH=/opt/base
test -z "$CONSOLE_LOG" && export CONSOLE_LOG=yes
# rm -rf $LOGS; #avoid deleted @batch-mode
CACHE=$TARGETPATH/../.cache; LOGS=$TARGETPATH/../.logs; mkdir -p $CACHE $LOGS
function down_catfile(){
url=$1
file=${url##*/}
#curl -# -L -f
test -f $CACHE/$file || curl -# -k -fSL $url > $CACHE/$file
cat $CACHE/$file
}
function print_time_cost(){
local begin_time=$1
gawk 'BEGIN{
print "本操作从" strftime("%Y年%m月%d日%H:%M:%S",'$begin_time'),"开始 ,",
strftime("到%Y年%m月%d日%H:%M:%S",systime()) ,"结束,",
" 共历时" systime()-'$begin_time' "秒";
}' 2>&1 | tee -a $logfile
}
function log {
echo -e "\n\n>>> $*"
}


# export CC=clang
# export CXX=clang++

#
# Build st
#
function st(){
log "Downloading ST..."
rm -rf /tmp/st; # mkdir -p /tmp/st
# down_catfile ${ST_URL} | tar -zx --strip 1 -C /tmp/st
# https://dl.suckless.org/st/st-0.8.4.tar.gz
git clone --depth=1 --branch=$ST_VER git://git.suckless.org/st /tmp/st #;
log "Configuring ST..."
cd /tmp/st #&& ./bootstrap;


log "Install ST..."
# make;
make install;

# view
ls -lh /tmp/st/
xx-verify --static /tmp/st/st
}


case "$1" in
cache)
# down_catfile ${XRDP_URL} > /dev/null
# down_catfile ${FDKAAC_URL} > /dev/null
;;
full)
st
;;
*) #compile
# $1 |tee $LOGS/$1.log
env #view
set +e
echo -e "\n$1, start building.."
begin_time="`gawk 'BEGIN{print systime()}'`"; export logfile=$LOGS/xrdp-$1.log
test "yes" == "$CONSOLE_LOG" && echo yes || echo no
test "yes" == "$CONSOLE_LOG" && $1 |tee $logfile || $1 > $logfile 2>&1;
# $1 > $logfile 2>&1;

test "0" != "$?" && tail -200 $logfile || echo "err 0, pass"
print_time_cost $begin_time; echo "$1, finished."
;;
esac
exit 0

0 comments on commit fe697cf

Please sign in to comment.