Skip to content

Commit 24dea64

Browse files
committed
Add Docker image for macOS
1 parent 0e7abac commit 24dea64

File tree

5 files changed

+70
-4
lines changed

5 files changed

+70
-4
lines changed

Dockerfile.osx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM jetbrains/teamcity-minimal-agent:latest
2+
3+
# This is important for using apt-get
4+
USER root
5+
6+
# Install cross-build dependencies
7+
RUN apt-get update && \
8+
apt-get install -y --no-install-recommends ca-certificates subversion ncftp \
9+
git autoconf wget make patch cmake clang llvm-dev uuid-dev libssl-dev lzma-dev libxml2-dev python3
10+
11+
# Prepare cross-build environment
12+
ENV MACOSX_DEPLOYMENT_TARGET=10.15 \
13+
PATH="${PATH}:/opt/osxcross/bin" \
14+
OSXCROSS_MP_INC=1
15+
16+
RUN mkdir -p /opt/osxcross && \
17+
git clone https://github.com/tpoechtrager/osxcross.git /opt/osxcross/setup_files && \
18+
cd /opt/osxcross/setup_files && \
19+
wget -P tarballs https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz && \
20+
UNATTENDED=1 TARGET_DIR=/opt/osxcross ./build.sh && \
21+
UNATTENDED=1 ../bin/osxcross-macports install mysql8 libidn2
22+
23+
# Default build configuration
24+
ENV AS_BUILDAGENT=0 \
25+
BUILD_ARCHITECTURE=x64 \
26+
BUILD_CONFIG=release \
27+
AR=x86_64-apple-darwin20.4-ar \
28+
CC=x86_64-apple-darwin20.4-clang \
29+
CXX=x86_64-apple-darwin20.4-clang++
30+
31+
# Set build directory
32+
VOLUME /build
33+
WORKDIR /build
34+
35+
# Copy entrypoint script
36+
COPY utils/docker-entrypoint-osx.sh /docker-entrypoint.sh
37+
38+
# Set entrypoint
39+
ENTRYPOINT /docker-entrypoint.sh

Server/dbconmy/premake5.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ project "Dbconmy"
3838
links { "rt" }
3939

4040
filter "system:macosx"
41-
includedirs { os.findheader("mysql.h", "/usr/local/opt/mysql/include/mysql") }
41+
includedirs {
42+
os.findheader("mysql.h", {
43+
"/usr/local/opt/mysql/include/mysql",
44+
"/opt/osxcross/macports/pkgs/opt/local/include/mysql8/mysql",
45+
})
46+
}
47+
libdirs {
48+
os.findlib("libmysqlclient.a", "/opt/osxcross/macports/pkgs/opt/local/lib/mysql8/mysql")
49+
}
4250

4351
if GLIBC_COMPAT then
4452
filter { "system:linux" }

Shared/mods/deathmatch/logic/lua/LuaBasic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace lua
4242

4343
inline void Push(lua_State* L, bool value) { lua_pushboolean(L, value); }
4444

45-
inline void Push(lua_State* L, nullptr_t) { lua_pushnil(L); }
45+
inline void Push(lua_State* L, std::nullptr_t) { lua_pushnil(L); }
4646

4747
inline void Push(lua_State* L, const char* value) { lua_pushstring(L, value); }
4848

linux-build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash -e
22

33
# Set variable defaults
4+
: ${BUILD_OS:=linux}
45
: ${BUILD_ARCHITECTURE:=x64}
56
: ${BUILD_CONFIG:=release}
67

@@ -21,6 +22,7 @@ fi
2122
# Read script arguments
2223
while [ $# -gt 0 ]; do
2324
case "$1" in
25+
--os=*) BUILD_OS="${1#*=}" ;;
2426
--arch=*) BUILD_ARCHITECTURE="${1#*=}" ;;
2527
--config=*) BUILD_CONFIG="${1#*=}" ;;
2628
*)
@@ -58,6 +60,7 @@ case $BUILD_ARCHITECTURE in
5860
exit 1
5961
esac
6062

63+
echo " OS = $BUILD_OS"
6164
echo " CONFIG = $CONFIG"
6265
echo " AR = ${AR:=ar}"
6366
echo " CC = ${CC:=gcc}"
@@ -69,9 +72,9 @@ rm -Rf Bin/
6972

7073
# Generate Makefiles
7174
if [[ -n "$GCC_PREFIX" ]]; then
72-
$PREMAKE5 --gccprefix="$GCC_PREFIX" gmake
75+
$PREMAKE5 --gccprefix="$GCC_PREFIX" --os="$BUILD_OS" gmake
7376
else
74-
$PREMAKE5 gmake
77+
$PREMAKE5 --os="$BUILD_OS" gmake
7578
fi
7679

7780
# Build!

utils/docker-entrypoint-osx.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# If configurede as a build agent, start Teamcity agent
4+
if [[ $AS_BUILDAGENT = "1" ]]; then
5+
# https://github.com/JetBrains/teamcity-docker-minimal-agent/blob/master/Dockerfile#L17
6+
exec /run-services.sh
7+
fi
8+
9+
# Manually invoke build process
10+
# So, first make a shallow clone of the repository if it not exists
11+
umask 000
12+
if [ ! -f ./premake5.lua ]; then
13+
git clone --depth=1 https://github.com/multitheftauto/mtasa-blue.git .
14+
fi
15+
16+
./linux-build.sh --os=macosx --arch=$BUILD_ARCHITECTURE --config=$BUILD_CONFIG

0 commit comments

Comments
 (0)