mirror of
https://gitlab.bmcstudios.org/public_projects/swg-server-docker.git
synced 2026-01-16 17:04:26 -05:00
Apply SED Patches
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -32,9 +32,12 @@ RUN apt-get clean && \
|
||||
RUN mkdir -p /var/log/supervisor
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# === START: Oracle Client Local Copy ===
|
||||
COPY downloads/instantclient-basic-linux-arm64.zip ./
|
||||
COPY downloads/instantclient-sdk-linux-arm64.zip ./
|
||||
COPY downloads/instantclient-sqlplus-linux-arm64.zip ./
|
||||
# === END: Oracle Client Local Copy ===
|
||||
|
||||
|
||||
# Unzip the files, using the -o flag to overwrite duplicates without prompting
|
||||
RUN unzip -o instantclient-basic-linux-arm64.zip -d /usr/local/ && \
|
||||
@@ -53,17 +56,23 @@ RUN rm -f instantclient-basic-linux-arm64.zip \
|
||||
instantclient-sdk-linux-arm64.zip \
|
||||
instantclient-sqlplus-linux-arm64.zip
|
||||
|
||||
# === START: CMAKE COMPATIBILITY FIX ===
|
||||
# Organize the Oracle libraries into a standard 'lib' directory so cmake can find them.
|
||||
RUN mkdir /usr/local/instantclient/lib
|
||||
RUN mv /usr/local/instantclient/*.so* /usr/local/instantclient/lib/
|
||||
# === END: CMAKE COMPATIBILITY FIX ===
|
||||
|
||||
# === START: LDCONFIG FIX ===
|
||||
# Register the Oracle library path with the system's dynamic linker.
|
||||
RUN echo "/usr/local/instantclient/lib" > /etc/ld.so.conf.d/oracle-instantclient.conf
|
||||
RUN ldconfig
|
||||
# === END: LDCONFIG FIX ===
|
||||
|
||||
# === START: ORACLE CONFIGURATION FIX ===
|
||||
RUN mkdir -p /etc/oracle
|
||||
RUN echo 'NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)' > /etc/oracle/sqlnet.ora
|
||||
ENV TNS_ADMIN=/etc/oracle
|
||||
# === END: ORACLE CONFIGURATION FIX ===
|
||||
|
||||
# Update environment variables for the ARM64 paths
|
||||
ENV ORACLE_HOME=/usr/local/instantclient
|
||||
@@ -87,14 +96,17 @@ RUN if [ -n "$REPO_USERNAME" ] && [ -n "$REPO_PASSWORD" ]; then \
|
||||
|
||||
WORKDIR /swg-main
|
||||
|
||||
# Automatically replace the i386 Java paths with the correct arm64 paths.
|
||||
# === START: APPLY ARM64 PATCHES ===
|
||||
COPY apply-patches.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/apply-patches.sh
|
||||
RUN apply-patches.sh
|
||||
# === END: APPLY ARM64 PATCHES ===
|
||||
|
||||
# Automatically patch the build.xml to use ARM64 Java paths (from original README)
|
||||
RUN sed -i 's/java-11-openjdk-i386/java-11-openjdk-arm64/g' /swg-main/build.xml
|
||||
|
||||
RUN ant git_update_submods
|
||||
|
||||
RUN echo "db_service = FREEPDB1" > local.properties && \
|
||||
echo "dbip = oracle" >> local.properties
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
RUN dos2unix /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
|
||||
36
apply-patches.sh
Normal file
36
apply-patches.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# apply-patches.sh
|
||||
|
||||
set -e
|
||||
echo "--- Applying ARM64/64-bit compatibility patches ---"
|
||||
|
||||
# Fix 1: CMAKE_CXX_FLAGS for ARM64 (remove -m32, add -fsigned-char and -fpermissive)
|
||||
echo "Patching /swg-main/src/CMakeLists.txt for compiler flags..."
|
||||
sed -i 's/set(CMAKE_CXX_FLAGS "-m32 -pipe.*/set(CMAKE_CXX_FLAGS "-fsigned-char -fpermissive -pipe -march=native -mtune=native -Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder")/' /swg-main/src/CMakeLists.txt
|
||||
|
||||
# Fix 2: BlockAllocator pointer size issues (3 copies)
|
||||
echo "Patching BlockAllocator files for uintptr_t..."
|
||||
find /swg-main/src/external -type f -name "BlockAllocator.cpp" -exec sed -i -e 's/unsigned int \*/uintptr_t \*/g' -e 's/unsigned \*/uintptr_t \*/g' -e 's/(unsigned)m_blocks/(uintptr_t)m_blocks/g' {} +
|
||||
find /swg-main/src/external -type f -name "BlockAllocator.h" -exec sed -i 's/unsigned \*/uintptr_t \*/g' {} +
|
||||
|
||||
# Fix 3: Crypto pointer-to-int cast issues
|
||||
echo "Patching crypto/misc.cpp for pointer casts..."
|
||||
sed -i -e 's/(unsigned int)buf/(uintptr_t)buf/g' -e 's/(unsigned int)mask/(uintptr_t)mask/g' -e 's/(unsigned int)output/(uintptr_t)output/g' -e 's/(unsigned int)input/(uintptr_t)input/g' /swg-main/src/external/ours/library/crypto/src/shared/original/misc.cpp
|
||||
|
||||
# Fix 4: Pathfinding pointer-to-int cast issues
|
||||
echo "Patching pathfinding files for pointer casts..."
|
||||
sed -i -e 's/reinterpret_cast<int>/reinterpret_cast<intptr_t>/g' -e "s/setMark( 3, (int)((void\*)searchNode) );/setMark( 3, (intptr_t)((void\*)searchNode) );/g" /swg-main/src/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp /swg-main/src/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp
|
||||
|
||||
# Fix 5: JNI NetworkId(jlong) ambiguity
|
||||
echo "Patching serverScript for NetworkId ambiguity..."
|
||||
find /swg-main/src/engine/server/library/serverScript/src/shared/ -type f -name "*.cpp" -exec sed -i -e 's/NetworkId(\([^)]\+\))/NetworkId(static_cast<NetworkId::NetworkIdType>(\1))/g' {} +
|
||||
|
||||
# Fix 6: memmove ambiguity
|
||||
echo "Patching sharedFoundation for memmove ambiguity..."
|
||||
sed -i 's/return memmove(destination, source, static_cast<uint>(length));/return ::memmove(destination, source, static_cast<size_t>(length));/g' /swg-main/src/engine/shared/library/sharedFoundation/src/shared/Misc.h
|
||||
|
||||
# Fix 7: AuctionTransfer long long ambiguity
|
||||
echo "Patching AuctionTransfer for long long ambiguity..."
|
||||
echo 'typedef int64 long long;' >> /swg-main/src/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Types.h
|
||||
|
||||
echo "--- All patches applied successfully ---"
|
||||
Reference in New Issue
Block a user