Difference between revisions of "MG/Getting The Code"

From MegaGlest
Jump to navigation Jump to search
m (git clone --resursive is depricated)
 
(19 intermediate revisions by 9 users not shown)
Line 1: Line 1:
'''NOTE: Due to problems converting to Git, MegaGlest is still using SVN.'''
+
[[MegaGlest]] has switched to git for managing the game's source code and data (the svn repo is no longer active).
<!-- REMOVE THIS LINE WHEN CONVERTED TO GIT
 
[[MegaGlest]] has now switched to git for managing the game's source code and data (the svn repo is no longer active). Using the command line you would get the code in one of two ways. Either read-only if you will not contribute changes or read and write if you plan to help contribute to the project as well.
 
  
==Choose a git client==
+
==Linux quick setup==
The MegaGlest source is stored in a Git repository (versions prior to 3.6.0.2 are in a different SVN repository, however), and requires a Git client to download. Clients exist for all major operating systems.
+
Do this ( download size is ~600MB ):
  
====Linux====
+
sudo apt-get update && sudo apt-get -y install git
:''This section is currently outdated. You can [http://glest.wikia.com/index.php?title=MG/Getting_The_Code&action=edit edit] this page to improve that.''
+
git clone --recurse-submodules https://github.com/MegaGlest/megaglest-source.git
Most users will want to use the [https://subversion.apache.org/ Apache Software Foundation (ASF) subversion] command line interface (CLI), as provided, on most distributions, by the 'subversion' package. Many distributions also provide graphical interfaces which are either frontends to the ASF subversion CLI or are standalone.
+
cd megaglest-source/mk/linux/
 +
sudo ./setupBuildDeps.sh
 +
./build-mg.sh
  
====Windows====
+
launch with:
Download [http://git-scm.com/ Git] and install it, then run <tt>git-bash.bat</tt> in the installation folder to start the Git command line. For those with a preference for a client with a graphical interface, [http://code.google.com/p/tortoisegit/ TurtoiseGit] exists for that, though you will still need to install Git as well as [http://code.google.com/p/msysgit/ MysisGit].
+
./megaglest
 +
 
 +
==Choose and install a git client==
 +
The MegaGlest source is stored in a Git repository (versions prior to 3.9.0 are in a different - SVN repository, however), and requires a Git client to download. Clients exist for all major operating systems.
 +
 
 +
===Linux===
 +
On Debian GNU/Linux based distributions this is as easy as:
 +
 
 +
sudo apt-get update && sudo apt-get install git
 +
 
 +
On other distributions, the process will be quite similar but you will need to use the package management tools available there and you should look for "git" or "git-core" package.
 +
 
 +
===Windows===
 +
Download [http://git-scm.com/download/win >>GIT<<] and install it ('''Important: '''On install-options choose "Run Git from Windows Command Prompt".), then run <tt>git-bash.bat</tt> in the installation folder to start the Git command line.  
 +
 
 +
For those with a preference for a client with a graphical interface, then e.g. [http://code.google.com/p/tortoisegit/ TortoiseGit] exists for that.
  
 
==Check out the source code==
 
==Check out the source code==
===Making the directory===
 
:''Prior to running this command, you should navigate to the folder you wish to place the MegaGlest source.''
 
mkdir megaglest-git
 
cd megaglest-git
 
 
 
===Cloning the sources===
 
===Cloning the sources===
====Read only====
+
'''''Prior to running these commands, you need to navigate to the directory (folder) you wish to place the MegaGlest source directory in.'''''
git clone git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-source
 
git clone git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-data
 
git clone git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-data-source
 
  
====Read and write====
+
  git clone --recurse-submodules <nowiki>https://github.com/MegaGlest/megaglest-source.git</nowiki>
  git clone ssh://<sourceforge-username>@megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-source
 
git clone ssh://<sourceforge-username>@megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-data
 
git clone ssh://<sourceforge-username>@megaglest.git.sourceforge.net/gitroot/megaglest/megaglest-data-source
 
  
===Create the link===
+
===Popular mistakes===
 +
If you've not read this guide before clone then you probably made a quite popular mistake - "cloned repository without data (submodules)", then you should do this:
 
  cd megaglest-source
 
  cd megaglest-source
  ln -s -T ../megaglest-data data
+
  git submodule update --init --recursive
 +
If you still are not sure that you have downloaded full working source then you can compare your source directory with the [[MG/Project Structure|Project Structure]].
  
===With TortoiseGit===
+
===After the cloning===
:''This section only applies to those using TortoiseGit instead of the command line.''
+
If you want start work on changes in data submodule (or any other) then '''before starting''' you should first checkout HEAD of desirable branch e.g. "develop". In most situations it does not apply to regular users/testers/gamers.
Once TortoiseGit and its prerequisites of Git and MysisGit are installed, right click in the folder you wish to place the sources and choose "Git Clone" from the context menu. Enter the following links in one at a time, waiting for TortoiseGit to finish downloading each one.
+
  cd megaglest-source
  git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest /megaglest-source
+
  cd data/glest_game
  git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest /megaglest-data
+
git checkout <branch>
git://megaglest.git.sourceforge.net/gitroot/megaglest/megaglest /megaglest-data-source
+
cd ../..
REMOVE THIS LINE WHEN CONVERTED TO GIT -->
 
  
==SVN==
+
==Update the source code==
 +
When some time has elapsed after the "clone" and you again want to test the HEAD of the game then you should update the source code.
  
If you chose a subversion CLI then run the following command to retrieve the latest source code:
+
First choose the branch, e.g. "develop":
<pre>svn co https://megaglest.svn.sourceforge.net/svnroot/megaglest/trunk megaglest</pre>
+
git checkout <branch>
 
+
If you’re not actively working on the source and submodules (you are a tester/gamer), then the simplest and most universal way to update is:
===Project folder layout===
+
git pull && git submodule update --init --recursive
[[File:Folder_structure.png]]
+
in the other case you should read more [https://github.com/MegaGlest/megaglest-source/wiki/Git-How-To advanced git tutorial] intended for developers.
  
 
==Tags and branches==
 
==Tags and branches==
This will check out the '''trunk''' directory, which is where active development takes place in. Each release is 'tagged' and a copy resides in the '''tags''' directory, so if you wanted an older release you would check out something below instead. Check [https://megaglest.svn.sourceforge.net/svnroot/megaglest/tags/ here] to see which ones are available.
+
Each release is 'tagged' and resides as '''tags''', so if you wanted an older release you would check out something below instead. Check [https://github.com/MegaGlest/megaglest-source/releases here] to see which ones are available.
  
Branches are created in the '''branches''' subdirectory when required to seperate larger changes from active / stable development, so replace 'trunk' by 'branches' and check with your web brower which ones are available if this is your intention.
+
Branches are created for separate larger changes from active / stable development, so check with your [https://github.com/MegaGlest/megaglest-source/branches web browser] which ones are available if this is your intention.
  
 
==See also==
 
==See also==
*[[MG/SVN Structure|SVN Structure]]
+
*[[MG/Project Structure|Project Structure]]
 +
*[https://github.com/MegaGlest/megaglest-source/wiki/Git-How-To Git-How-To]
 +
 
 
[[Category:MG]]
 
[[Category:MG]]
[[Category:Cate Everett2]]
+
[[Category:Development]]

Latest revision as of 16:14, 11 October 2022

MegaGlest has switched to git for managing the game's source code and data (the svn repo is no longer active).

Linux quick setup[edit]

Do this ( download size is ~600MB ):

sudo apt-get update && sudo apt-get -y install git
git clone --recurse-submodules https://github.com/MegaGlest/megaglest-source.git
cd megaglest-source/mk/linux/
sudo ./setupBuildDeps.sh 
./build-mg.sh

launch with:

./megaglest

Choose and install a git client[edit]

The MegaGlest source is stored in a Git repository (versions prior to 3.9.0 are in a different - SVN repository, however), and requires a Git client to download. Clients exist for all major operating systems.

Linux[edit]

On Debian GNU/Linux based distributions this is as easy as:

sudo apt-get update && sudo apt-get install git

On other distributions, the process will be quite similar but you will need to use the package management tools available there and you should look for "git" or "git-core" package.

Windows[edit]

Download >>GIT<< and install it (Important: On install-options choose "Run Git from Windows Command Prompt".), then run git-bash.bat in the installation folder to start the Git command line.

For those with a preference for a client with a graphical interface, then e.g. TortoiseGit exists for that.

Check out the source code[edit]

Cloning the sources[edit]

Prior to running these commands, you need to navigate to the directory (folder) you wish to place the MegaGlest source directory in.

git clone --recurse-submodules https://github.com/MegaGlest/megaglest-source.git

Popular mistakes[edit]

If you've not read this guide before clone then you probably made a quite popular mistake - "cloned repository without data (submodules)", then you should do this:

cd megaglest-source
git submodule update --init --recursive

If you still are not sure that you have downloaded full working source then you can compare your source directory with the Project Structure.

After the cloning[edit]

If you want start work on changes in data submodule (or any other) then before starting you should first checkout HEAD of desirable branch e.g. "develop". In most situations it does not apply to regular users/testers/gamers.

cd megaglest-source
cd data/glest_game
git checkout <branch>
cd ../..

Update the source code[edit]

When some time has elapsed after the "clone" and you again want to test the HEAD of the game then you should update the source code.

First choose the branch, e.g. "develop":

git checkout <branch>

If you’re not actively working on the source and submodules (you are a tester/gamer), then the simplest and most universal way to update is:

git pull && git submodule update --init --recursive

in the other case you should read more advanced git tutorial intended for developers.

Tags and branches[edit]

Each release is 'tagged' and resides as tags, so if you wanted an older release you would check out something below instead. Check here to see which ones are available.

Branches are created for separate larger changes from active / stable development, so check with your web browser which ones are available if this is your intention.

See also[edit]