#!/usr/bin/env bash # compress algorithm: gzip, bzip2, xz algo=$1 if [ -z $algo ]; then algo="gzip" fi suffix=$algo if [ $algo = "gzip" ]; then suffix="gz" elif [ $algo = "bzip2" ]; then suffix="bz2" fi # path constants cd "$(dirname "$0")/../.." xmakeroot=`pwd` buildroot=$xmakeroot/scripts/makeself temproot=/tmp/xmake-makeself # prepare files to pack # clean up temproot if [ -d $temproot ]; then rm -rf $temproot fi mkdir -p $temproot # copy xmake repo to temproot/xmake-repo, remove git ignored files cp -r $xmakeroot $temproot/xmake-repo cd $temproot/xmake-repo git clean -dfX git submodule foreach git clean -dfX # copy files to temproot/xmake mkdir -p $temproot/xmake/scripts cd $temproot/xmake-repo cp -r ./core $temproot/xmake cp -r ./xmake $temproot/xmake cp ./scripts/get.sh $temproot/xmake/scripts cp ./*.md $temproot/xmake cp makefile $temproot/xmake cd $temproot/xmake rm -rf ./core/src/tbox/tbox/src/demo rm -rf ./core/src/tbox/tbox/src/tbox/platform/windows rm -rf ./core/src/pdcurses # prepare info texts cd $temproot cp $buildroot/* . version=`cat ./xmake/core/xmake.lua | grep -E "^set_version" | grep -oE "[0-9]*\.[0-9]*\.[0-9]*"` perl -pi -e "s/#xmake-version#/$version/g" ./header perl -pi -e "s/#xmake-version#/$version/g" ./lsm # make run file cd $temproot wget https://github.com/megastep/makeself/releases/download/release-2.4.0/makeself-2.4.0.run -O ./makeself-2.4.0.run sh ./makeself-2.4.0.run ./makeself-2.4.0/makeself.sh \ --$algo \ --sha256 \ --lsm ./lsm \ --help-header ./header \ ./xmake \ $buildroot/xmake.$suffix.run \ xmake-v$version-runfile \ ./scripts/get.sh __local__