Subversion Repositories eduke32

Rev

Rev 6055 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6004 hendricks2 1
#!/bin/bash
2
 
3
get_abs_path()
4
{
5
    echo "$(cd "$1" && pwd)"
6
}
7
 
6431 hendricks2 8
get_num_logical_cpus()
9
{
10
    getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1
11
}
12
 
6004 hendricks2 13
targets=( eduke32 mapster32 )
14
extensions=( ".dol" )
15
 
6431 hendricks2 16
 
17
# Change directory to the eduke32 root:
18
 
6004 hendricks2 19
sourcedir="$(dirname "${BASH_SOURCE[0]}")"
20
sourcedir="$(get_abs_path "$sourcedir/..")"
21
 
22
pushd "${sourcedir}" >/dev/null
23
 
6431 hendricks2 24
 
25
# Set up PATH
26
 
27
p=${DEVKITPPC}/bin:${PATH}
28
 
29
pathstoremove=( "/mingw64/bin" )
30
 
31
for i in "${pathstoremove[@]}"; do
32
    p=${p/:${i}/}
33
done
34
 
35
export PATH=${p}
36
 
37
 
6004 hendricks2 38
# Detect versioning systems and pull the revision number:
6431 hendricks2 39
 
6004 hendricks2 40
export VC_REV=$(svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
41
vc=svn
42
if [ -z "$VC_REV" ]; then
43
    vc=git
44
    export VC_REV=$(git svn info 2> /dev/null | grep Revision | awk '{ print $2 }')
45
fi
46
if [ -z "$VC_REV" ]; then
47
    export VC_REV=Unknown
48
    vc=none
49
fi
50
 
51
date=$(date +%Y%m%d)
52
 
53
 
6431 hendricks2 54
# Build:
55
 
56
make=( make PLATFORM=WII $* STRIP="" )
57
 
6004 hendricks2 58
echo "${make[@]}"
59
"${make[@]}"
60
 
61
for i in "${targets[@]}"; do
62
    for j in "${extensions[@]}"; do
63
        if [ ! -f "$i$j" ]; then
64
            exit 1
65
        fi
66
    done
67
done
68
 
6431 hendricks2 69
 
6004 hendricks2 70
# Package data:
6431 hendricks2 71
 
6004 hendricks2 72
mkdir -p apps
73
 
74
for i in "${targets[@]}"; do
75
    cp -R "platform/Wii/apps/$i" "apps/"
76
    for j in "${extensions[@]}"; do
77
        mv -f "$i$j" "apps/${i}/boot${j}"
78
    done
79
    for j in ".elf.map"; do
80
        rm -f "$i$j"
81
    done
82
    echo -e "    <version>r${VC_REV}</version>\n    <release_date>${date}</release_date>" | cat "platform/Wii/${i}_meta_1.xml" - "platform/Wii/${i}_meta_2.xml" >"apps/${i}/meta.xml"
83
done
84
 
85
if [ -d "apps/eduke32" ]; then
86
    cp -R package/common/* apps/eduke32/
87
    rm -f apps/eduke32/*.dll
88
fi
89
 
90
if [ -d "apps/mapster32" ]; then
91
    cp -R package/common/* apps/mapster32/
92
    cp -R package/sdk/* apps/mapster32/
93
    rm -f apps/mapster32/*.dll
94
fi
95
 
96
ls -l -R apps
97
 
6431 hendricks2 98
cpus=$(get_num_logical_cpus)
99
 
6004 hendricks2 100
rm -f "eduke32-wii-r${VC_REV}-debug-elf.7z"
101
rm -f "eduke32-wii-r${VC_REV}.7z"
6431 hendricks2 102
7zr a -mx9 -ms=on -t7z -m0=lzma2 -mmt${cpus} "eduke32-wii-r${VC_REV}-debug-elf.7z" *.elf -xr!*.svn*
103
7zr a -mx9 -ms=on -t7z -m0=lzma2 -mmt${cpus} "eduke32-wii-r${VC_REV}.7z" apps -xr!*.svn*
6004 hendricks2 104
 
6431 hendricks2 105
# Clean up:
106
 
6004 hendricks2 107
popd >/dev/null