Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add incomplete support for building for ARM arch
- Loading branch information
Showing
6 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM jetbrains/teamcity-minimal-agent:latest | ||
|
||
# Set to 1 to configure this image as Teamcity build agent | ||
# Default value is 0 (manual build) | ||
ENV AS_BUILDAGENT=0 | ||
|
||
# Set this to the target arm architecture: arm64 or armhf | ||
ENV BUILD_ARCHITECTURE=arm64 | ||
|
||
# Set this to the target build configuration | ||
ENV BUILD_CONFIG=release | ||
|
||
# This is important for using apt-get | ||
USER root | ||
|
||
# Add architecture support for armhf and arm64 | ||
COPY utils/arm-cross-compile-sources.list /etc/apt/sources.list.d/ | ||
|
||
RUN sed -i 's/deb http/deb \[arch=amd64,i386\] http/' /etc/apt/sources.list && \ | ||
dpkg --add-architecture arm64 && \ | ||
dpkg --add-architecture armhf && \ | ||
apt-get update && \ | ||
apt-get install -y make git \ | ||
gcc-10-arm-linux-gnueabihf g++-10-arm-linux-gnueabihf \ | ||
libncursesw5:armhf libncursesw5-dev:armhf \ | ||
gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu \ | ||
libncursesw5:arm64 libncursesw5-dev:arm64 libmysqlclient-dev:arm64 | ||
|
||
# Set build directory | ||
VOLUME /build | ||
WORKDIR /build | ||
|
||
# Copy entrypoint script | ||
COPY utils/docker-entrypoint-arm.sh /docker-entrypoint.sh | ||
|
||
# Set entrypoint | ||
ENTRYPOINT bash /docker-entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash -e | ||
|
||
BUILD_ARCHITECTURE=arm64 | ||
BUILD_CONFIG=release | ||
NUM_CORES=$(grep -c ^processor /proc/cpuinfo) | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--arch=*) | ||
BUILD_ARCHITECTURE="${1#*=}" | ||
;; | ||
--config=*) | ||
BUILD_CONFIG="${1#*=}" | ||
;; | ||
*) | ||
printf "Error: Invalid argument: $1\n" | ||
exit 1 | ||
esac | ||
shift | ||
done | ||
|
||
echo "BUILD_ARCHITECTURE = $BUILD_ARCHITECTURE" | ||
echo "BUILD_CONFIG = $BUILD_CONFIG" | ||
|
||
case $BUILD_ARCHITECTURE in | ||
arm64) | ||
GCC_PREFIX=aarch64-linux-gnu- | ||
;; | ||
armhf) | ||
GCC_PREFIX=arm-linux-gnueabihf- | ||
;; | ||
*) | ||
printf "Error: Invalid build architecture\n" | ||
exit 1 | ||
esac | ||
|
||
echo "GCC_PREFIX = $GCC_PREFIX" | ||
|
||
# Clean old build files | ||
rm -Rf Build/ | ||
rm -Rf Bin/ | ||
|
||
# Generate makefiles | ||
utils/premake5 --arch=$BUILD_ARCHITECTURE --gccprefix=$GCC_PREFIX gmake | ||
|
||
# Remove -m32, -m64, -msse2 from *FLAGS | ||
sed -i '/FLAGS +=/ s/-m32//i;/FLAGS +=/ s/-msse2//i;/FLAGS +=/ s/-m64//i' Build/*.make | ||
|
||
# Build! | ||
make -C Build/ -j $NUM_CORES \ | ||
AR=/bin/${GCC_PREFIX}ar \ | ||
CC=/bin/${GCC_PREFIX}gcc-10 \ | ||
CXX=/bin/${GCC_PREFIX}g++-10 \ | ||
config=debug_x64 \ | ||
all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal main restricted | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal-updates main restricted | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal universe | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal-updates universe | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal multiverse | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal-updates multiverse | ||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
# If configured as a build agent, we start the TeamCity agent | ||
if [[ $AS_BUILDAGENT = "1" ]]; then | ||
# https://github.com/JetBrains/teamcity-docker-minimal-agent/blob/master/Dockerfile#L17 | ||
exec /run-services.sh | ||
fi | ||
|
||
# Manually invoke build process | ||
umask 000 | ||
if [ ! -f ./premake5.lua ]; then | ||
git clone --depth=1 https://github.com/multitheftauto/mtasa-blue.git . | ||
fi | ||
|
||
# Set the default build target | ||
if [ -z "$BUILD_CONFIG" ]; then | ||
BUILD_CONFIG=release | ||
fi | ||
|
||
# Start manual building | ||
./linux-build-arm.sh --arch=$BUILD_ARCHITECTURE --config=$BUILD_CONFIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters