-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.buildenv
121 lines (117 loc) · 5.37 KB
/
Dockerfile.buildenv
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
FROM debian:12-slim
ARG FPC_STABLE_VER
ARG FPC_OLDSTABLE_VER
ARG FPC_FIXES_VER
ARG FPC_MAIN_VER
RUN dpkg --add-architecture i386 && apt-get update && apt-get -y install \
build-essential \
git \
libc6-dev-i386 \
libgtk2.0-dev \
libgtk-3-dev \
libqt5x11extras5-dev \
qtbase5-dev \
qt6-base-dev \
unzip \
wget
SHELL ["/bin/bash", "-c"]
# install compilers, but first save (to root directory for simplicity) docs archive for stable FPC (needed to build Lazarus docs)
RUN docarchive=doc-chm.zip; \
wget --no-verbose --output-document=/$docarchive https://downloads.freepascal.org/fpc/dist/$FPC_STABLE_VER/docs/$docarchive; \
if [ ! -f /$docarchive ]; then \
exit 1; \
fi; \
tarballs=( \
"$FPC_OLDSTABLE_VER https://sourceforge.net/projects/freepascal/files/Linux/$FPC_OLDSTABLE_VER/fpc-$FPC_OLDSTABLE_VER-x86_64-linux.tar fpc-$FPC_OLDSTABLE_VER-x86_64-linux" \
"$FPC_STABLE_VER https://sourceforge.net/projects/freepascal/files/Linux/$FPC_STABLE_VER/fpc-$FPC_STABLE_VER.x86_64-linux.tar fpc-$FPC_STABLE_VER.x86_64-linux" \
"$FPC_FIXES_VER https://gitlab.com/freepascal.org/fpc/build/-/jobs/artifacts/fixes_3_2/raw/fpc-$FPC_FIXES_VER.x86_64-linux.tar?job=build-job fpc-$FPC_FIXES_VER.x86_64-linux" \
"$FPC_MAIN_VER https://gitlab.com/freepascal.org/fpc/build/-/jobs/artifacts/main/raw/fpc-$FPC_MAIN_VER.x86_64-linux.tar?job=build-job fpc-$FPC_MAIN_VER.x86_64-linux" \
); \
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
wget --no-verbose --output-document=${tarball[2]}.tar ${tarball[1]}; \
tar xf ${tarball[2]}.tar; \
cd ${tarball[2]}; \
# install only compiler and RTL, do not install documentation and demos
echo -e "\nn\nn\n" | ./install.sh; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd ..; \
# store fpdoc binaries separately for each FPC version (needed to build Lazarus docs)
cp -v /usr/bin/fpdoc /usr/bin/fpdoc-${tarball[0]}; \
rm -vf ${tarball[2]}.tar; \
rm -vrf ${tarball[2]}; \
done; \
echo; \
echo "Contents of /etc/fpc.cfg:"; \
cat /etc/fpc.cfg;
# build and install cross-compilers
RUN tarballs=( \
"$FPC_OLDSTABLE_VER https://sourceforge.net/projects/freepascal/files/Source/$FPC_OLDSTABLE_VER fpc-$FPC_OLDSTABLE_VER source.tar.gz win32 i386" \
"$FPC_OLDSTABLE_VER https://sourceforge.net/projects/freepascal/files/Source/$FPC_OLDSTABLE_VER fpc-$FPC_OLDSTABLE_VER source.tar.gz win64 x86_64" \
"$FPC_STABLE_VER https://sourceforge.net/projects/freepascal/files/Source/$FPC_STABLE_VER fpc-$FPC_STABLE_VER source.tar.gz win32 i386" \
"$FPC_STABLE_VER https://sourceforge.net/projects/freepascal/files/Source/$FPC_STABLE_VER fpc-$FPC_STABLE_VER source.tar.gz win64 x86_64" \
"$FPC_FIXES_VER https://gitlab.com/freepascal.org/fpc/source/-/archive/fixes_3_2 source-fixes_3_2 tar.gz win32 i386" \
"$FPC_FIXES_VER https://gitlab.com/freepascal.org/fpc/source/-/archive/fixes_3_2 source-fixes_3_2 tar.gz win64 x86_64" \
"$FPC_MAIN_VER https://gitlab.com/freepascal.org/fpc/source/-/archive/main source-main tar.gz win32 i386" \
"$FPC_MAIN_VER https://gitlab.com/freepascal.org/fpc/source/-/archive/main source-main tar.gz win64 x86_64" \
); \
# downloading, building and tarball removal are done in separate steps,
# because several targets can be built from one source
#
# download sources
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
if [ ! -f ${tarball[2]}.${tarball[3]} ]; then \
wget --no-verbose ${tarball[1]}/${tarball[2]}.${tarball[3]}; \
fi; \
if [ ! -d ${tarball[2]} ]; then \
tar zxf ${tarball[2]}.${tarball[3]}; \
fi; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
done; \
# build and install cross-compilers
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
cd ${tarball[2]}; \
make all FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]}; \
make crossinstall FPC=/usr/lib/fpc/${tarball[0]}/ppcx64 OS_TARGET=${tarball[4]} CPU_TARGET=${tarball[5]} INSTALL_PREFIX=/usr; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd ..; \
done; \
# save sources for FPC from main branch separately (they are needed e.g. for running Codetools tests)
fpcsrcdir=/fpcsrc; \
fpcsrcdirmain=$fpcsrcdir/$FPC_MAIN_VER; \
mkdir -p $fpcsrcdirmain; \
tar zxf source-main.tar.gz --strip-components=1 --directory $fpcsrcdirmain; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
# compile and install pas2js (needed for running some Codetools tests)
git clone --depth 1 https://gitlab.com/freepascal.org/fpc/pas2js.git; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd pas2js; \
rm -rf compiler; \
ln -s ../source-main compiler; \
make all FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64; \
make install FPC=/usr/lib/fpc/$FPC_MAIN_VER/ppcx64; \
if [ $? -ne 0 ]; then \
exit 1; \
fi; \
cd ..; \
rm -rf pas2js; \
echo "Contents of /usr/local/bin/pas2js.cfg:"; \
cat /usr/local/bin/pas2js.cfg; \
# remove sources
for tbl in "${tarballs[@]}"; do \
tarball=($tbl); \
rm -vf ${tarball[2]}.${tarball[3]}; \
rm -rf ${tarball[2]}; \
done;