Add 'How to get the code' sections to Compile.rst

develop
Petr Mrázek 2012-02-24 20:25:53 +01:00
parent 6696e79838
commit 7ee454fac0
2 changed files with 115 additions and 30 deletions

@ -4,11 +4,29 @@ Building DFHACK
.. contents:: .. contents::
=================
Building on Linux
================= =====
Linux
=====
On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD. On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD.
How to get the code
===================
DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
Having a 'git' package installed is the minimal requirement, but some sort of git gui or git integration for your favorite text editor/IDE will certainly help.
The code resides here: https://github.com/peterix/dfhack
If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address::
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).
Dependencies Dependencies
============ ============
DFHack is meant to be installed into an existing DF folder, so get one ready. DFHack is meant to be installed into an existing DF folder, so get one ready.
@ -45,9 +63,34 @@ extra options.
You can also use a cmake-friendly IDE like KDevelop 4 or the cmake-gui You can also use a cmake-friendly IDE like KDevelop 4 or the cmake-gui
program. program.
=======
Windows
=======
On Linux, DFHack replaces the SDL library distributed with DF.
How to get the code
=================== ===================
Building on Windows DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
=================== You will need some sort of Windows port of git, or a GUI. Some examples:
* http://code.google.com/p/msysgit/ - this is a command line version of git for windows. Most tutorials on git usage will apply.
* http://code.google.com/p/tortoisegit/ - this puts a pretty, graphical face on top of msysgit :)
The code resides here: https://github.com/peterix/dfhack
If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address::
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
The tortoisegit GUI should have the equivalent options included.
If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).
Dependencies
============
First, you need ``cmake``. Get the win32 installer version from the official First, you need ``cmake``. Get the win32 installer version from the official
site: http://www.cmake.org/cmake/resources/software.html site: http://www.cmake.org/cmake/resources/software.html

@ -320,32 +320,49 @@ ul.auto-toc {
<div class="contents topic" id="contents"> <div class="contents topic" id="contents">
<p class="topic-title first">Contents</p> <p class="topic-title first">Contents</p>
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#building-on-linux" id="id2">Building on Linux</a><ul> <li><a class="reference internal" href="#linux" id="id4">Linux</a><ul>
<li><a class="reference internal" href="#dependencies" id="id3">Dependencies</a></li> <li><a class="reference internal" href="#how-to-get-the-code" id="id5">How to get the code</a></li>
<li><a class="reference internal" href="#build" id="id4">Build</a></li> <li><a class="reference internal" href="#dependencies" id="id6">Dependencies</a></li>
<li><a class="reference internal" href="#build" id="id7">Build</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#building-on-windows" id="id5">Building on Windows</a><ul> <li><a class="reference internal" href="#windows" id="id8">Windows</a><ul>
<li><a class="reference internal" href="#id1" id="id6">Build</a></li> <li><a class="reference internal" href="#id1" id="id9">How to get the code</a></li>
<li><a class="reference internal" href="#id2" id="id10">Dependencies</a></li>
<li><a class="reference internal" href="#id3" id="id11">Build</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#build-types" id="id7">Build types</a></li> <li><a class="reference internal" href="#build-types" id="id12">Build types</a></li>
<li><a class="reference internal" href="#using-the-library-as-a-developer" id="id8">Using the library as a developer</a><ul> <li><a class="reference internal" href="#using-the-library-as-a-developer" id="id13">Using the library as a developer</a><ul>
<li><a class="reference internal" href="#contributing-to-dfhack" id="id9">Contributing to DFHack</a><ul> <li><a class="reference internal" href="#contributing-to-dfhack" id="id14">Contributing to DFHack</a><ul>
<li><a class="reference internal" href="#coding-style" id="id10">Coding style</a></li> <li><a class="reference internal" href="#coding-style" id="id15">Coding style</a></li>
<li><a class="reference internal" href="#how-to-get-new-code-into-dfhack" id="id11">How to get new code into DFHack</a></li> <li><a class="reference internal" href="#how-to-get-new-code-into-dfhack" id="id16">How to get new code into DFHack</a></li>
<li><a class="reference internal" href="#memory-research" id="id12">Memory research</a></li> <li><a class="reference internal" href="#memory-research" id="id17">Memory research</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="building-on-linux"> <div class="section" id="linux">
<h1><a class="toc-backref" href="#id2">Building on Linux</a></h1> <h1><a class="toc-backref" href="#id4">Linux</a></h1>
<p>On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD.</p> <p>On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD.</p>
<div class="section" id="how-to-get-the-code">
<h2><a class="toc-backref" href="#id5">How to get the code</a></h2>
<p>DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
Having a 'git' package installed is the minimal requirement, but some sort of git gui or git integration for your favorite text editor/IDE will certainly help.</p>
<p>The code resides here: <a class="reference external" href="https://github.com/peterix/dfhack">https://github.com/peterix/dfhack</a></p>
<p>If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:</p>
<pre class="literal-block">
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
</pre>
<p>If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).</p>
</div>
<div class="section" id="dependencies"> <div class="section" id="dependencies">
<h2><a class="toc-backref" href="#id3">Dependencies</a></h2> <h2><a class="toc-backref" href="#id6">Dependencies</a></h2>
<p>DFHack is meant to be installed into an existing DF folder, so get one ready.</p> <p>DFHack is meant to be installed into an existing DF folder, so get one ready.</p>
<p>For building, you need a 32-bit version of GCC. For example, to build DFHack on <p>For building, you need a 32-bit version of GCC. For example, to build DFHack on
a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.</p> a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.</p>
@ -355,7 +372,7 @@ a 64-bit distribution like Arch, you'll need the multilib development tools and
You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt').</p> You should be able to find them in your distro repositories (on Arch linux 'perl-xml-libxml' and 'perl-xml-libxslt').</p>
</div> </div>
<div class="section" id="build"> <div class="section" id="build">
<h2><a class="toc-backref" href="#id4">Build</a></h2> <h2><a class="toc-backref" href="#id7">Build</a></h2>
<p>Building is fairly straightforward. Enter the <tt class="docutils literal">build</tt> folder and start the build like this:</p> <p>Building is fairly straightforward. Enter the <tt class="docutils literal">build</tt> folder and start the build like this:</p>
<pre class="literal-block"> <pre class="literal-block">
cd build cd build
@ -376,8 +393,32 @@ extra options.</p>
program.</p> program.</p>
</div> </div>
</div> </div>
<div class="section" id="building-on-windows"> <div class="section" id="windows">
<h1><a class="toc-backref" href="#id5">Building on Windows</a></h1> <h1><a class="toc-backref" href="#id8">Windows</a></h1>
<p>On Linux, DFHack replaces the SDL library distributed with DF.</p>
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id9">How to get the code</a></h2>
<p>DFHack doesn't have any kind of system of code snapshots in place, so you will have to get code from the github repository using git.
You will need some sort of Windows port of git, or a GUI. Some examples:</p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://code.google.com/p/msysgit/">http://code.google.com/p/msysgit/</a> - this is a command line version of git for windows. Most tutorials on git usage will apply.</li>
<li><a class="reference external" href="http://code.google.com/p/tortoisegit/">http://code.google.com/p/tortoisegit/</a> - this puts a pretty, graphical face on top of msysgit :)</li>
</ul>
</blockquote>
<p>The code resides here: <a class="reference external" href="https://github.com/peterix/dfhack">https://github.com/peterix/dfhack</a></p>
<p>If you just want to compile DFHack or work on it by contributing patches, it's quite enough to clone from the read-only address:</p>
<pre class="literal-block">
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
</pre>
<p>The tortoisegit GUI should have the equivalent options included.</p>
<p>If you want to get really involved with the development, create an account on github, make a clone there and then use that as your remote repository instead. Detailed instructions are beyond the scope of this document. If you need help, join us on IRC (#dfhack channel on freenode).</p>
</div>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id10">Dependencies</a></h2>
<p>First, you need <tt class="docutils literal">cmake</tt>. Get the win32 installer version from the official <p>First, you need <tt class="docutils literal">cmake</tt>. Get the win32 installer version from the official
site: <a class="reference external" href="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</a></p> site: <a class="reference external" href="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</a></p>
<p>It has the usual installer wizard. Make sure you let it add its binary folder <p>It has the usual installer wizard. Make sure you let it add its binary folder
@ -392,8 +433,9 @@ Grab it from Microsoft's site.</p>
<li>Same with &quot;cpan XML::LibXSLT&quot;.</li> <li>Same with &quot;cpan XML::LibXSLT&quot;.</li>
</ul> </ul>
<p>If you already have a different version of perl (for example the one from cygwin), you can run into some trouble. Either remove the other perl install from PATH, or install libxml and libxslt for it instead. Strawberry perl works though and has all the required packages.</p> <p>If you already have a different version of perl (for example the one from cygwin), you can run into some trouble. Either remove the other perl install from PATH, or install libxml and libxslt for it instead. Strawberry perl works though and has all the required packages.</p>
<div class="section" id="id1"> </div>
<h2><a class="toc-backref" href="#id6">Build</a></h2> <div class="section" id="id3">
<h2><a class="toc-backref" href="#id11">Build</a></h2>
<p>There are several different batch files in the <tt class="docutils literal">build</tt> folder along with a script that's used for picking the DF path.</p> <p>There are several different batch files in the <tt class="docutils literal">build</tt> folder along with a script that's used for picking the DF path.</p>
<p>First, run set_df_path.vbs and point the dialog that pops up at your DF folder that you want to use for development. <p>First, run set_df_path.vbs and point the dialog that pops up at your DF folder that you want to use for development.
Next, run one of the scripts with <tt class="docutils literal">generate</tt> prefix. These create the MSVC solution file(s):</p> Next, run one of the scripts with <tt class="docutils literal">generate</tt> prefix. These create the MSVC solution file(s):</p>
@ -415,7 +457,7 @@ So pick either Release or RelWithDebInfo build and build the INSTALL target.</p>
</div> </div>
</div> </div>
<div class="section" id="build-types"> <div class="section" id="build-types">
<h1><a class="toc-backref" href="#id7">Build types</a></h1> <h1><a class="toc-backref" href="#id12">Build types</a></h1>
<p><tt class="docutils literal">cmake</tt> allows you to pick a build type by changing this <p><tt class="docutils literal">cmake</tt> allows you to pick a build type by changing this
variable: <tt class="docutils literal">CMAKE_BUILD_TYPE</tt></p> variable: <tt class="docutils literal">CMAKE_BUILD_TYPE</tt></p>
<pre class="literal-block"> <pre class="literal-block">
@ -427,7 +469,7 @@ cmake .. -DCMAKE_BUILD_TYPE:string=BUILD_TYPE
'RelWithDebInfo'. 'Debug' is not available on Windows.</p> 'RelWithDebInfo'. 'Debug' is not available on Windows.</p>
</div> </div>
<div class="section" id="using-the-library-as-a-developer"> <div class="section" id="using-the-library-as-a-developer">
<h1><a class="toc-backref" href="#id8">Using the library as a developer</a></h1> <h1><a class="toc-backref" href="#id13">Using the library as a developer</a></h1>
<p>Currently, the only way to use the library is to write a plugin that can be loaded by it. <p>Currently, the only way to use the library is to write a plugin that can be loaded by it.
All the plugins can be found in the 'plugins' folder. There's no in-depth documentation All the plugins can be found in the 'plugins' folder. There's no in-depth documentation
on how to write one yet, but it should be easy enough to copy one and just follow the pattern.</p> on how to write one yet, but it should be easy enough to copy one and just follow the pattern.</p>
@ -444,17 +486,17 @@ The main license is zlib/libpng, some bits are MIT licensed, and some are BSD li
<p>Feel free to add your own extensions and plugins. Contributing back to <p>Feel free to add your own extensions and plugins. Contributing back to
the dfhack repository is welcome and the right thing to do :)</p> the dfhack repository is welcome and the right thing to do :)</p>
<div class="section" id="contributing-to-dfhack"> <div class="section" id="contributing-to-dfhack">
<h2><a class="toc-backref" href="#id9">Contributing to DFHack</a></h2> <h2><a class="toc-backref" href="#id14">Contributing to DFHack</a></h2>
<p>Several things should be kept in mind when contributing to DFHack.</p> <p>Several things should be kept in mind when contributing to DFHack.</p>
<div class="section" id="coding-style"> <div class="section" id="coding-style">
<h3><a class="toc-backref" href="#id10">Coding style</a></h3> <h3><a class="toc-backref" href="#id15">Coding style</a></h3>
<p>DFhack uses ANSI formatting and four spaces as indentation. Line <p>DFhack uses ANSI formatting and four spaces as indentation. Line
endings are UNIX. The files use UTF-8 encoding. Code not following this endings are UNIX. The files use UTF-8 encoding. Code not following this
won't make me happy, because I'll have to fix it. There's a good chance won't make me happy, because I'll have to fix it. There's a good chance
I'll make <em>you</em> fix it ;)</p> I'll make <em>you</em> fix it ;)</p>
</div> </div>
<div class="section" id="how-to-get-new-code-into-dfhack"> <div class="section" id="how-to-get-new-code-into-dfhack">
<h3><a class="toc-backref" href="#id11">How to get new code into DFHack</a></h3> <h3><a class="toc-backref" href="#id16">How to get new code into DFHack</a></h3>
<p>You can send patches or make a clone of the github repo and ask me on <p>You can send patches or make a clone of the github repo and ask me on
the IRC channel to pull your code in. I'll review it and see if there the IRC channel to pull your code in. I'll review it and see if there
are any problems. I'll fix them if they are minor.</p> are any problems. I'll fix them if they are minor.</p>
@ -464,7 +506,7 @@ this is also a good place to dump new ideas and/or bugs that need
fixing.</p> fixing.</p>
</div> </div>
<div class="section" id="memory-research"> <div class="section" id="memory-research">
<h3><a class="toc-backref" href="#id12">Memory research</a></h3> <h3><a class="toc-backref" href="#id17">Memory research</a></h3>
<p>If you want to do memory research, you'll need some tools and some knowledge. <p>If you want to do memory research, you'll need some tools and some knowledge.
In general, you'll need a good memory viewer and optionally something In general, you'll need a good memory viewer and optionally something
to look at machine code without getting crazy :)</p> to look at machine code without getting crazy :)</p>