Skip to content
mercury233 edited this page Apr 3, 2022 · 1 revision

Note: experimental, HELP WANTED

The author has no intention of delving into the specific development process of macOS, so he only roughly ran through the compilation steps


Preparation

Download

  • YGOPro distribution

    It is used to obtain cards database and pictures and app, in which database and app are necessary

  • git

    And have GitHub account and SSH key

  • homebrew

  • Xcode

  • premake5

    There are two kinds of project description files, premake and cmake, but cmake has not been maintained recently

  • irrKlang

    Download the 64-bit version, can be disabled by changing USE_IRRKLANG in premake5.lua, the result is no sound

Dependency Libraries

Install via brew:

  • freetype
  • libevent
  • libx11
  • sqlite
  • zlib
  • gpatch

The following two dependency libraries need their source codes to be manually downloaded and statically compiled

  • Irrlicht-1.8.5

    Only this version has been tested and needs to be patched with Chinese support

  • Lua-5.4

    Versions 5.2 and earlier are not supported, must be built with C++, not C

Download repo

Just use git clone, and add --recursive to clone sub modules at the same time, or run git submodule update --init after completion

After cloning is finished, enter the ocgcore and script sub-module dirs and checkout to master branch.

Commands:

git clone [email protected]:Fluorohydride/ygopro.git
cd ygopro
git submodule update --init
cd ocgcore/
git checkout master 
cd ..
cd script/
git checkout master 
cd ..

Install Dependency Libraries

  • Unzip the downloaded irrlicht to the project folder and rename it to irrlicht

  • Unzip the downloaded irrKlang to the project folder and rename it to irrklang ("k" is lowercase)

  • Unzip the downloaded lua to the project folder and rename it to lua

  • Copy all folders in the premake folder to the project folder, which contains the premake description files of each dependent library, which can be modified and improved by yourself

cp -r ./premake/irrlicht .
cp -r ./premake/lua .

Install the dylib of irrKlang to system

cp ./irrklang/bin/macosx-gcc/libirrklang.dylib /usr/local/lib/

Patch Irrlicht

The original version of Irrlicht does not support Chinese, and needs to be patched. Enter the Irrlicht folder and run

patch -p1 < irrlicht.patch

You can also use the modified version directly

Compile irrlicht and install to system

cd irrlicht
cp -r include /usr/local/include/irrlicht
cd source/Irrlicht/MacOSX
xcodebuild -project MacOSX.xcodeproj
cp build/Release/libIrrlicht.a /usr/local/lib/
cd ../../../..

Generate project files and compile

Extract premake5 executable directly into the project folder and run

./premake5 gmake --cc=clang

Then you can enter the build dir and make

At this time, the directory structure should look like this after omitting redundant files:

├── bin
├── build
├── cmake
├── gframe
├── irrklang
│   └── include
├── irrlicht
│   └── include
├── lua
│   └── src
├── obj
├── ocgcore
├── premake
├── script
├── sound
└── textures

Run and Debug

ln cards.cdb and pics dir and deck dir and replay dir to the project folder

Copy a ygopro.app from a working distribution, replace the executable with the file we built

cp ./bin/release/ygopro.app ./ygopro.app/Contents/MacOS/ygopro

Then you can click on ygopro.app to run, or ./ygopro.app/Contents/MacOS/ygopro

(TODO: Generate a normal package and put the static files inside the .app like other software on macOS, not outside)