This repository has been archived by the owner on Aug 21, 2020. It is now read-only.
/
build_mxe.sh
136 lines (109 loc) · 2.73 KB
/
build_mxe.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh
# Exit when any command fails.
set -e
# Build a clean version of the given branch.
if [ $# -lt 2 ]; then
echo "ERROR (build_mxe.sh): Need to provide branch and MXE configuration."
exit -1
fi
BRANCH=$1
MXE_CONFIG=$2
#
# Update to certain changeset if 3rd parameter is given.
#
if [ $# -eq 3 ];
then
MXE_CHANGESET=$3
else
MXE_CHANGESET=
fi
#
# Update the MXE repository copy.
#
cd $OCD_REPO_DIR/mxe
hg clean --all
hg pull
hg update $MXE_CHANGESET
./bootstrap
#
# Identify the HD ID.
#
MXE_HG_ID=$(hg identify --id)
if [[ $BRANCH == "stable" ]];
then
HG_ID=$OCD_STABLE_HG_ID
elif [[ $BRANCH == "default" ]];
then
HG_ID=$OCD_DEFAULT_HG_ID
elif [[ $BRANCH == "release" ]];
then
HG_ID=
else
echo "ERROR (build_mxe.sh): Bad branch name \"${BRANCH}\" given."
exit -1
fi
read -d '' MXE_CONFIG_OPTS << EOF || :
--enable-devel-tools \
--enable-binary-packages \
--with-ccache \
--with-pkg-dir=${OCD_MXE_PKG_DIR} \
--enable-octave=${BRANCH}
EOF
if [[ ${MXE_CONFIG} == "w64" ]];
then
MXE_CONFIG_OPTS=${MXE_CONFIG_OPTS}
elif [[ ${MXE_CONFIG} == "w64-64" ]];
then
MXE_CONFIG_OPTS="${MXE_CONFIG_OPTS} --enable-fortran-int64"
elif [[ ${MXE_CONFIG} == "w32" ]];
then
MXE_CONFIG_OPTS="${MXE_CONFIG_OPTS} --disable-windows-64"
else
echo "ERROR (build_mxe.sh): Bad MXE configuration \"${MXE_CONFIG}\" given."
exit -1
fi
BUILD_DIR=$OCD_BUILD_DIR/mxe_${BRANCH}_${MXE_CONFIG}
EXPORT_DIR=$OCD_EXPORTS_DIR/mxe_${BRANCH}_${MXE_HG_ID}
LOG_FILE=$BUILD_DIR/build_mxe_${MXE_CONFIG}.log.html
#
# Build the branch.
#
TIME_START=$(date --utc +"%F %H-%M-%S (UTC)")
REPO_URL=https://hg.savannah.gnu.org/hgweb/octave/rev
MXE_URL=https://hg.octave.org/mxe-octave/rev
mkdir -p $BUILD_DIR
cd $BUILD_DIR
{
printf "<!DOCTYPE html>\n<html>\n<body>\n"
printf "<h1>Octave ${BRANCH} MXE (${MXE_CONFIG})</h1>\n"
if [[ $BRANCH == "stable" ]] || [[ $BRANCH == "default" ]];
then
printf "<ul>\n<li>Octave HG_ID: "
printf "<a href=\"${REPO_URL}/${HG_ID}\">${HG_ID}</a>"
fi
printf "<ul>\n<li>MXE HG_ID: "
printf "<a href=\"${MXE_URL}/${MXE_HG_ID}\">${MXE_HG_ID}</a>"
printf "</li>\n<li>Start: ${TIME_START}</li>\n</ul>\n"
printf "<details><summary>configure</summary>\n"
printf "<pre>\n"
${OCD_REPO_DIR}/mxe/configure ${MXE_CONFIG_OPTS}
printf "</pre>\n</details>\n"
printf "<details><summary>make</summary>\n"
printf "<pre>\n"
make JOBS=4 all nsis-installer 7z-dist zip-dist
printf "</pre>\n</details>\n"
TIME_END=$(date --utc +"%F %H-%M-%S (UTC)")
printf "<ul>\n<li>End: ${TIME_END}</li>\n</ul>\n"
printf "</body>\n</html>\n"
} 2>&1 | tee $LOG_FILE
#
# export relevant artifacts
#
mkdir -p $EXPORT_DIR
cd $BUILD_DIR/dist
cp -t $EXPORT_DIR \
$LOG_FILE \
octave-*.exe \
octave-*.7z \
octave-*.zip
cd $OCD_ROOT