Compile MaNGOS On Mac OS X

From MaNGOS

Jump to: navigation, search

Contents


Dependencies

The following software needs to be installed before continuing:


Notes


Compiling and Installing pkg-config

  1. Download the pkg-config source from pkgconfig.freedesktop.org/releases. The latest is pkg-config-0.25.tar.gz as of this writing.
  2. Untar the pkg-config source:
    cd ~/Downloads/
    tar xvfz pkg-config-0.25.tar.gz
    cd pkg-config-0.25
  3. Configure pkg-config:
    ./configure --prefix=/usr/local
  4. Compile & install:
    make -j2
    sudo make install

If you have an error from the make install command, line 395 in dep/tbb/Makefile is trying to copy a non-OSX library (which doesn't exist). Change that line to try to copy the dy* file(s) and re-run the make install. Lines 394 and 395 should look like this:

install-exec-local:
    $(INSTALL) $(work_dir)/lib*.dy* $(DESTDIR)$(libdir)


Preparing MySQL

  1. Teach the location of the MySQL tools to your Terminal (Bash paths):
    echo 'export PATH=$PATH:/usr/local/mysql/bin' >> ~/.bash_profile
    source ~/.bash_profile
  2. Link the MySQL developer files to their proper locations (requires admin password):
     sudo ln -s /usr/local/mysql/include /usr/include/mysql
     sudo ln -s /usr/local/mysql/lib /usr/lib/mysql


Obtain & patch the MaNGOS source code

  1. Download the MaNGOS repository:
    git clone git://github.com/mangos/mangos.git ~/source/mangos
  2. Download and apply the needed Mac patch:
    cd ~/source/mangos
    curl http://pastie.org/1129119.txt | git apply
    git commit -am "Applied Mac patch."


Obtain & merge ScriptDev2 (optional)

  1. Download the latest ScriptDev2 version:
    cd ~/source/mangos
    svn co https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2 src/bindings/ScriptDev2
    You may receive an "Error validating server certificate" warning at this point however it is safe to type "p" & press return to choose the option "(p)ermanently".
  2. Merge ScriptDev2 into your repository:
    git apply src/bindings/scriptdev2/patches/MaNGOS-9519-ScriptDev2.patch
    git commit -am "Using SD2."


Compile for the first time

  1. Create a directory to compile into:
    cd ~/source/mangos
    mkdir -p build
    cd build
  2. Compile:
    autoreconf -if ..
    ../configure --prefix=/usr/local --datadir=/usr/local/share --sysconfdir=/usr/local/etc LIBS="-lssl -lcrypto" CFLAGS="-framework Carbon" CXXFLAGS="-framework Carbon"
    See the section Configure Notes for more information on the configure options.
    make -j 2
    With make -j 2, change 2 to the number of processors in your Mac. Affects compile speed.
  3. Install (requires admin password):
    sudo make install
    sudo cp /usr/local/etc/realmd.conf.dist /usr/local/etc/realmd.conf
    sudo cp /usr/local/etc/mangosd.conf.dist /usr/local/etc/mangosd.conf


Update & recompile

  1. Update the MaNGOS source code:
    cd ~/source/mangos
    git pull
  2. Update ScriptDev2 (only if you chose to use it):
    svn update src/bindings/ScriptDev2
  3. Compile:
    cd ~/source/mangos/build
    make -j 2
    With make -j 2, change 2 to the number of processors in your Mac. Affects compile speed.
  4. Install (requires admin password):
    sudo make install


Clean the code base

  1. cd ~/source/mangos/build
    make clean


Compile the map & dbc extractor

  1. If you haven't already done so, apply the needed extractor patch:
    cd ~/source/mangos
    curl http://pastie.org/828487.txt | git apply
    git add contrib/extractor/ad.xcodeproj
    git commit -am "Applied Mac extractor patch."
  2. If the patch did not apply cleanly to loadlib.h, simply use http://pastie.org/753771 as a guide to hand-edit the loadlib.h changes.
  3. Open the ad Xcode project file:
    open ~/source/mangos/contrib/extractor/ad.xcodeproj
  4. Click the Build button in the toolbar (or choose Build from the Build menu).
  5. When built, click the Products folder inside Groups & Files on the left. Right click ad in the pane to the right and choose Reveal in Finder.


Extracting maps and dbc files

  1. Copy/move the ad program into your World of Warcraft folder.
  2. Double-click the ad program and wait until it has finished (or press Control-C to cancel).
  3. Move the extracted maps and dbc folders from your World of Warcraft folder into the mangos folder (which is inside the folder you configured as --datadir when compiling, eg. /usr/local/share/mangos ).


Secure MySQL & Database Initialization

  1. Start the MySQL server by using the option in System Preferences.
  2. Enter the mysql console:
    # mysql -u root
  3. Delete the test database and prevent anonymous login:
    DROP DATABASE IF EXISTS `test`;
    DELETE FROM mysql.user WHERE User = '';
  4. Set your MySQL root password; instead of the word oranges, type the password of your choice:
    UPDATE mysql.user SET Password = PASSWORD('oranges') WHERE User = 'root';
    FLUSH PRIVILEGES;
    EXIT;
    To enter the mysql console again, you must provide a password. Make sure you can log in again. If not, correct your MySQL user account before continuing.
    # mysql -u root -p
    EXIT;
  5. Create the MaNGOS databases (use the pass you chose above, not oranges):
    # mysql -u root -poranges < ~/source/mangos/sql/create_mysql.sql
    # mysql -u root -poranges < ~/source/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_database.sql


Databases

Besides using the MySQL console in the Terminal, you can use other tools to administer your databases:

MaNGOS makes use of 4 different databases:

  1. characters database - can be populated with the command:
    mysql --user=mangos --password=mangos characters < ~/source/mangos/sql/characters.sql
  2. realmd database - can be populated with the command:
    mysql --user=mangos --password=mangos realmd < ~/source/mangos/sql/realmd.sql
  3. mangos database - Several groups exist that can populate this database and each have their own method of installation and updating. Consult the forums of your choice:
  4. scriptdev2 database (if you chose to use ScriptDev2) can be initialized with these 2 commands:
    mysql --user=mangos --password=mangos scriptdev2 < ~/source/mangos/src/bindings/ScriptDev2/sql/scriptdev2_create_structure_mysql.sql
    mysql --user=mangos --password=mangos scriptdev2 < ~/source/mangos/src/bindings/ScriptDev2/sql/scriptdev2_script_full.sql


Configuration & settings

Inside the folder you configured as --sysconfdir when compiling (eg. /usr/local/etc), edit the following files:

  1. mangosd.conf
    • Set the DataDir setting to the location of your maps, dbc (and vmaps) folders, eg /usr/local/share/mangos
    • Change the LoginDatabaseInfo setting to use your MySQL account & password, eg 127.0.0.1;3306;mangos;mangos;realmd
    • Change the WorldDatabaseInfo setting to use your MySQL account & password, eg 127.0.0.1;3306;mangos;mangos;mangos
    • Change the CharacterDatabaseInfo setting to use your MySQL account & password, eg 127.0.0.1;3306;mangos;mangos;characters
  2. realmd.conf
    • Change the LoginDatabaseInfo setting to use your MySQL account & password, eg 127.0.0.1;3306;mangos;mangos;realmd
  3. scriptdev2.conf (if you are using ScriptDev2)
    • Change the ScriptDev2DatabaseInfo setting to use your MySQL account & password, eg 127.0.0.1;3306;mangos;mangos;scriptdev2


Configure Notes

  1. --prefix is the base directory that MaNGOS will be installed into. Common prefixes are:
    • /usr/local
    • /opt/mangos
    • $HOME
  2. --sysconfdir is the location that the config (settings) files will be installed into. Common values are:
    • /usr/local/etc
    • /opt/mangos/etc
    • $HOME/etc
  3. --datadir is the location where a folder called "mangos" will be created and the base database sql files installed, that's where you will need to place the extracted maps, dbc (and optionally vmaps) folders. Common values are:
    • /usr/local/share
    • /opt
    • $HOME/share
  4. --enable-cli enables the command line interface, highly recommended.
  5. --enable-ra adds remote access code to your compile, it allows you to connect your server via Telnet if enabled in the configuration files.
  6. --with-debug-info includes debug info in compiled libraries.
  7. --LIBS="-lcrypto" is absolutely necessary in order to compile on OS X!


Vmap files (optional)

  1. Locate the vmap files in the MaNGOS source code directory:
    open ~/source/mangos/contrib/vmap_extract_assembler_bin
  2. Copy the following files into your World of Warcraft folder:
    • splitConfig.txt
    • vmap_assembler.exe
    • vmapextract_v2.exe
  3. Launch Crossover and choose Run Command... from the Programs menu
  4. Click the Open Shell button in the resulting window
  5. After it automatically sets some variables, type cd and press the space bar, then drag your World of Warcraft folder into that Terminal window. Press the return key.
  6. Part 1 of the process (takes a long time):
    wine vmapextract_v2.exe
  7. Part 2 (also takes a long time):
    mkdir vmaps
    wine vmap_assembler.exe buildings vmaps splitConfig.txt
  8. When Part 2 has finished, the buildings folder inside your World of Warcraft folder contains unneeded files and can be deleted. Move the extracted vmaps folder from your World of Warcraft folder into the mangos folder (which is inside the folder you configured as --datadir when compiling eg. /usr/local/share/mangos ). Don't forget to enable the vmap options in your mangosd.conf file.


Miscellaneous

cd ~/source/mangos
git reset --hard origin
rm -rf ./build
rm -rf ./src/bindings/ScriptDev2
mysql --user=mangos --password=mangos --html --execute='select * from `mangos`.`command` order by name' > ~/Desktop/commands.html
sed -i '' "s/\\\n/<BR>/g" ~/Desktop/commands.html
cd ~/source/mangos
git log
cd ~/source/mangos
svn log --limit 10 ./src/bindings/ScriptDev2 | less
cd ~/source/mangos
git gui
cd ~/source/mangos
gitkil


Based on the guide created by Saria then updated and improved by Jylan from the Mang4Mac forums.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox