Subversion Repositories eduke32

Rev

Rev 6055 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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