|
| 1 | +# Build Command & Conquer Zero Hour on Docker with VC6 |
| 2 | + |
| 3 | +Docker is a popular platform to standertize environments. |
| 4 | +In this case docker is used to to gather all the dependency's |
| 5 | +and compile a **zerohour.exe** windows executable that you |
| 6 | +can now run directly on windows or on wine. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +You need to know how to execute docker commands and a basic understanding |
| 11 | +how docker works and how to customize the the dockerfile if you want to |
| 12 | +compile your own code with it. |
| 13 | + |
| 14 | +## Dockerfile |
| 15 | + |
| 16 | +On your project folder create a file named `Dockerfile` and copy the |
| 17 | +following content inside of it and save the file. |
| 18 | + |
| 19 | +```docker |
| 20 | +FROM ubuntu:24.10 |
| 21 | +
|
| 22 | +WORKDIR /build |
| 23 | +
|
| 24 | +# Install utils |
| 25 | +RUN apt update |
| 26 | +RUN apt install wget gpg unzip git -y |
| 27 | +
|
| 28 | +# Install wine32 |
| 29 | +RUN dpkg --add-architecture i386 |
| 30 | +RUN mkdir -pm755 /etc/apt/keyrings |
| 31 | +RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key - |
| 32 | +RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/oracular/winehq-oracular.sources |
| 33 | +RUN apt update |
| 34 | +RUN apt install --install-recommends winehq-stable -y |
| 35 | +
|
| 36 | +WORKDIR /build/tools/ |
| 37 | +
|
| 38 | +# Install cmake windows |
| 39 | +RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-windows-x86_64.zip |
| 40 | +RUN unzip cmake-3.31.6-windows-x86_64.zip -d /build/tools/ |
| 41 | +RUN mv /build/tools/cmake-3.31.6-windows-x86_64 /build/tools/cmake |
| 42 | +
|
| 43 | +# Install git windows |
| 44 | +RUN wget https://github.com/git-for-windows/git/releases/download/v2.49.0-rc1.windows.1/MinGit-2.49.0-rc1-64-bit.zip |
| 45 | +RUN unzip MinGit-2.49.0-rc1-64-bit.zip -d /build/tools/ |
| 46 | +RUN mv /build/tools/cmd /build/tools/git |
| 47 | +
|
| 48 | +# Install Visual Studio 6 Portable |
| 49 | +RUN wget https://github.com/itsmattkc/MSVC600/archive/refs/heads/master.zip |
| 50 | +RUN unzip master.zip -d /build/tools |
| 51 | +RUN mv /build/tools/MSVC600-master/ /build/tools/vs6 |
| 52 | +
|
| 53 | +WORKDIR /build |
| 54 | +
|
| 55 | +# Setup wine prefix |
| 56 | +ENV WINEDEBUG=-all |
| 57 | +ENV WINEARCH=win64 |
| 58 | +ENV WINEPREFIX=/build/prefix64 |
| 59 | +RUN wineboot |
| 60 | +
|
| 61 | +# Create empty TEMP folder for linking |
| 62 | +RUN mkdir /build/tmp |
| 63 | +ENV TMP="Z:\\build\\tmp" |
| 64 | +ENV TEMP="Z:\\build\\tmp" |
| 65 | +ENV TEMPDIR="Z:\\build\\tmp" |
| 66 | +
|
| 67 | +# Setup Visual Studio 6 Environment variables |
| 68 | +ENV VS="Z:\\build\\tools\\vs6" |
| 69 | +ENV MSVCDir="$VS\\vc98" |
| 70 | +ENV WINEPATH="C:\\windows\\system32;\ |
| 71 | +$VS\\vc98\\bin;\ |
| 72 | +$VS\\vc98\\lib;\ |
| 73 | +$VS\\vc98\\include;\ |
| 74 | +$VS\\common\\Tools;\ |
| 75 | +$VS\\common\\MSDev98\\bin" |
| 76 | +ENV LIB="$VS\\vc98\\Lib;$VS\\vc98\\MFC\\Lib;Z:\\build\\cnc\\build\\vc6" |
| 77 | +ENV INCLUDE="$VS\\vc98\\ATL\\INCLUDE;\ |
| 78 | +$VS\\vc98\\INCLUDE;\ |
| 79 | +$VS\\vc98\\MFC\\INCLUDE;\ |
| 80 | +$VS\\vc98\\Include" |
| 81 | +ENV CC="$VS\\vc98\\bin\\CL.exe" |
| 82 | +ENV CXX="$VS\\vc98\\bin\\CL.exe" |
| 83 | +
|
| 84 | +# Clone the source code |
| 85 | +ENV GIT_VERSION_STRING="2.49.0" |
| 86 | +RUN git clone https://github.com/OmniBlade/CnC_Generals_Zero_Hour.git |
| 87 | +RUN mv /build/CnC_Generals_Zero_Hour /build/cnc |
| 88 | +
|
| 89 | +WORKDIR /build/cnc |
| 90 | +
|
| 91 | +# Switch to WIP branch |
| 92 | +RUN git switch blade/cmake-build |
| 93 | +
|
| 94 | +# Run cmake |
| 95 | +RUN wine /build/tools/cmake/bin/cmake.exe \ |
| 96 | + --preset vc6 \ |
| 97 | + -DCMAKE_SYSTEM="Windows" \ |
| 98 | + -DCMAKE_SYSTEM_NAME="Windows" \ |
| 99 | + -DCMAKE_SIZEOF_VOID_P=4 \ |
| 100 | + -DCMAKE_MAKE_PROGRAM="Z:/build/tools/vs6/vc98/bin/nmake.exe" \ |
| 101 | + -DCMAKE_C_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ |
| 102 | + -DCMAKE_CXX_COMPILER="Z:/build/tools/vs6/vc98/bin/cl.exe" \ |
| 103 | + -DGIT_EXECUTABLE="Z:/build/tools/git/git.exe" \ |
| 104 | + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ |
| 105 | + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ |
| 106 | + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ |
| 107 | + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ |
| 108 | + -DCMAKE_C_COMPILER_WORKS=1 \ |
| 109 | + -DCMAKE_CXX_COMPILER_WORKS=1 |
| 110 | +
|
| 111 | +WORKDIR /build/cnc/build/vc6 |
| 112 | +
|
| 113 | +# Compile |
| 114 | +RUN wine cmd /c "set TMP=Z:\build\tmp& set TEMP=Z:\build\tmp& Z:\build\tools\vs6\VC98\Bin\NMAKE.exe" |
| 115 | +
|
| 116 | +# Keep the container alive |
| 117 | +CMD tail -f /dev/null |
| 118 | +``` |
| 119 | + |
| 120 | +Build the game by executing `docker build -t zerohour .` |
| 121 | + |
| 122 | +After the build you can run the container and use `docker cp` |
| 123 | +or you could mount a volume to `/build` so you can directly |
| 124 | +compile your own code and copy the binary off. |
0 commit comments