summaryrefslogtreecommitdiff
path: root/scripts/archive-all
blob: 9770664b8209611965f33dae7a24d59613e6f3c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash

# ./scripts/archive-all
tmpdir=/tmp/.xmake_archive
xmakeroot=`pwd`
artifactsdir=$xmakeroot/artifacts
if [ ! -d $artifactsdir ]; then
    mkdir $artifactsdir
fi
if [ -d $tmpdir ]; then
    rm -rf $tmpdir
fi
mkdir $tmpdir

# clone xmake repo
cp -r $xmakeroot $tmpdir/repo
cd $tmpdir/repo
git reset --hard HEAD
git clean -dfX
git submodule foreach git clean -dfX

# copy files to tmpdir/xmake
version=`cat ./core/xmake.lua | grep -E "^set_version" | grep -oE "[0-9]*\.[0-9]*\.[0-9]*"`
srcdir=$tmpdir/xmake
topdir=$srcdir/xmake-$version
mkdir -p $topdir/scripts
cd $tmpdir/repo || exit
cp -r ./core $topdir
cp -r ./xmake $topdir/xmake
cp ./scripts/*.sh $topdir/scripts
cp -r ./scripts/man $topdir/scripts
cp -r ./scripts/debian $topdir/scripts
cp -r ./scripts/msys $topdir/scripts
cp ./*.md $topdir
cp configure $topdir
rm -rf $topdir/core/src/tbox/tbox/src/demo
rm -rf $topdir/core/src/luajit
rm -rf $topdir/core/src/pdcurses
cd $srcdir || exit

# archive files
outputfile=$artifactsdir/"xmake"
if [ -f "$outputfile.zip" ]; then
    rm "$outputfile.zip"
fi
if [ -f "$outputfile.7z" ]; then
    rm "$outputfile.7z"
fi
if [ -f "$outputfile.tar.gz" ]; then
    rm "$outputfile.tar.gz"
fi
zip -qr -9 "$outputfile.zip" .
7z a "$outputfile.7z" .
#tar -czf "$outputfile.tar.gz" *
tar -cvf - * | gzip -9 - > "$outputfile.tar.gz"
shasum -a 256 "$outputfile.zip"
shasum -a 256 "$outputfile.7z"
shasum -a 256 "$outputfile.tar.gz"
ls -l "$outputfile.zip"
ls -l "$outputfile.7z"
ls -l "$outputfile.tar.gz"