Merge branch 'master' of https://github.com/minetest/minetest into mergestuff1

Conflicts:
	util/buildbot/buildwin32.sh

Fixed buildwin merge
master
rarkenin 2013-03-21 16:48:11 -04:00
commit 13a918d1bb
9 changed files with 153 additions and 13 deletions

View File

@ -9,9 +9,10 @@ and contributors (see source file comments and the version control log)
In case you downloaded the source code:
---------------------------------------
If you downloaded the Minetest Engine source code in which this file is
contained, you probably want to download the minetest_game project too:
contained, you probably want to download these projects too:
https://github.com/minetest/common/
https://github.com/minetest/minetest_game/
See the README.txt in it.
See the README.txt in them.
Further documentation
----------------------
@ -87,10 +88,17 @@ $ wget https://github.com/minetest/minetest/tarball/master -O master.tar.gz
$ tar xf master.tar.gz
$ cd minetest-minetest-286edd4 (or similar)
Download common (needed for minetest_game and some others)
$ cd games/
$ wget https://github.com/minetest/common/tarball/master -O common.tar.gz
$ tar xf common.tar.gz
$ mv minetest-common-* common
$ cd ..
Download minetest_game (otherwise only the "Minimal development test" game is available)
$ cd games/
$ wget https://github.com/minetest/minetest_game/tarball/master -O master.tar.gz
$ tar xf master.tar.gz
$ wget https://github.com/minetest/minetest_game/tarball/master -O minetest_game.tar.gz
$ tar xf minetest_game.tar.gz
$ mv minetest-minetest_game-* minetest_game
$ cd ..
@ -111,7 +119,7 @@ $ ./minetest
Compiling on Windows:
---------------------
- This section is outdated. In addition to what is described here:
- In addition to minetest, you need to download minetest_game.
- In addition to minetest, you need to download common and minetest_game.
- If you wish to have sound support, you need libogg, libvorbis and libopenal
- You need:

View File

@ -27,6 +27,39 @@ Startup
Mods are loaded during server startup from the mod load paths by running
the init.lua scripts in a shared environment.
Paths
-----
RUN_IN_PLACE=1: (Windows release, local build)
$path_user: Linux: <build directory>
Windows: <build directory>
$path_share: Linux: <build directory>
Windows: <build directory>
RUN_IN_PLACE=0: (Linux release)
$path_share: Linux: /usr/share/minetest
Windows: <install directory>/minetest-0.4.x
$path_user: Linux: ~/.minetest
Windows: C:/users/<user>/AppData/minetest (maybe)
Games
-----
Games are looked up from:
$path_share/games/gameid/
$path_user/games/gameid/
where gameid is unique to each game.
The game directory contains the file game.conf, which contains these fields:
name = <Human-readable full name of the game>
common_mods = <Comma-separated list of common mods>
eg.
name = Minetest
common_mods = bucket, default, doors, fire, stairs
Common mods are loaded from the pseudo-game "common".
The game directory can contain the file minetest.conf, which will be used
to set default settings when running the particular game.
Mod load path
-------------
Generic:

View File

@ -243,3 +243,12 @@ void set_default_settings(Settings *settings)
settings->setDefault("gravity_acceleration_client", "9.86");
}
void override_default_settings(Settings *settings, Settings *from)
{
std::vector<std::string> names = from->getNames();
for(size_t i=0; i<names.size(); i++){
const std::string &name = names[i];
settings->setDefault(name, from->get(name));
}
}

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Settings;
void set_default_settings(Settings *settings);
void override_default_settings(Settings *settings, Settings *from);
#endif

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "subgame.h"
#include "settings.h"
#include "strfnd.h"
std::map<std::string, ModSpec> getModsInPath(std::string path)
{
@ -188,11 +189,58 @@ void ModConfiguration::addMods(std::vector<ModSpec> new_mods)
}
}
// If failed, returned modspec has name==""
static ModSpec findCommonMod(const std::string &modname)
{
// Try to find in {$user,$share}/games/common/$modname
std::vector<std::string> find_paths;
find_paths.push_back(porting::path_user + DIR_DELIM + "games" +
DIR_DELIM + "common" + DIR_DELIM + "mods" + DIR_DELIM + modname);
find_paths.push_back(porting::path_share + DIR_DELIM + "games" +
DIR_DELIM + "common" + DIR_DELIM + "mods" + DIR_DELIM + modname);
for(u32 i=0; i<find_paths.size(); i++){
const std::string &try_path = find_paths[i];
if(fs::PathExists(try_path))
return ModSpec(modname, try_path);
}
// Failed to find mod
return ModSpec();
}
ModConfiguration::ModConfiguration(std::string worldpath)
{
SubgameSpec gamespec = findWorldSubgame(worldpath);
// Add common mods without dependency handling
std::vector<std::string> inexistent_common_mods;
Settings gameconf;
if(getGameConfig(gamespec.path, gameconf)){
if(gameconf.exists("common_mods")){
Strfnd f(gameconf.get("common_mods"));
while(!f.atend()){
std::string modname = trim(f.next(","));
if(modname.empty())
continue;
ModSpec spec = findCommonMod(modname);
if(spec.name.empty())
inexistent_common_mods.push_back(modname);
else
m_sorted_mods.push_back(spec);
}
}
}
if(!inexistent_common_mods.empty()){
std::string s = "Required common mods ";
for(u32 i=0; i<inexistent_common_mods.size(); i++){
if(i != 0) s += ", ";
s += std::string("\"") + inexistent_common_mods[i] + "\"";
}
s += " could not be found.";
throw ModError(s);
}
// Add all world mods and all game mods
addModsInPath(worldpath + DIR_DELIM + "worldmods");
SubgameSpec gamespec = findWorldSubgame(worldpath);
addModsInPath(gamespec.gamemods_path);
// check world.mt file for mods explicitely declared to be
@ -217,6 +265,6 @@ ModConfiguration::ModConfiguration(std::string worldpath)
}
for(std::set<std::string>::const_iterator i = gamespec.addon_mods_paths.begin();
i != gamespec.addon_mods_paths.end(); ++i)
i != gamespec.addon_mods_paths.end(); ++i)
addModsInPathFiltered((*i),exclude_mod_names);
}

View File

@ -58,6 +58,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/mathconstants.h"
#include "rollback.h"
#include "util/serialize.h"
#include "defaultsettings.h"
void * ServerThread::Thread()
{
@ -687,6 +688,13 @@ Server::Server(
infostream<<"- config: "<<m_path_config<<std::endl;
infostream<<"- game: "<<m_gamespec.path<<std::endl;
// Initialize default settings and override defaults with those provided
// by the game
set_default_settings(g_settings);
Settings gamedefaults;
getGameMinetestConfig(gamespec.path, gamedefaults);
override_default_settings(g_settings, &gamedefaults);
// Create biome definition manager
m_biomedef = new BiomeDefManager(this);
@ -736,10 +744,10 @@ Server::Server(
}
// complain about mods declared to be loaded, but not found
for(std::vector<ModSpec>::iterator it = m_mods.begin();
it != m_mods.end(); ++it)
it != m_mods.end(); ++it)
load_mod_names.erase((*it).name);
for(std::list<ModSpec>::iterator it = unsatisfied_mods.begin();
it != unsatisfied_mods.end(); ++it)
it != unsatisfied_mods.end(); ++it)
load_mod_names.erase((*it).name);
if(!load_mod_names.empty())
{

View File

@ -24,12 +24,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "util/string.h"
std::string getGameName(const std::string &game_path)
bool getGameMinetestConfig(const std::string &game_path, Settings &conf)
{
std::string conf_path = game_path + DIR_DELIM + "minetest.conf";
return conf.readConfigFile(conf_path.c_str());
}
bool getGameConfig(const std::string &game_path, Settings &conf)
{
std::string conf_path = game_path + DIR_DELIM + "game.conf";
return conf.readConfigFile(conf_path.c_str());
}
std::string getGameName(const std::string &game_path)
{
Settings conf;
bool succeeded = conf.readConfigFile(conf_path.c_str());
if(!succeeded)
if(!getGameConfig(game_path, conf))
return "";
if(!conf.exists("name"))
return "";
@ -117,6 +127,11 @@ std::set<std::string> getAvailableGameIds()
for(u32 j=0; j<dirlist.size(); j++){
if(!dirlist[j].dir)
continue;
// If configuration file is not found or broken, ignore game
Settings conf;
if(!getGameConfig(*i + DIR_DELIM + dirlist[j].name, conf))
continue;
// Add it to result
const char *ends[] = {"_game", NULL};
std::string shorter = removeStringEnd(dirlist[j].name, ends);
if(shorter != "")

View File

@ -24,6 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <set>
#include <vector>
class Settings;
#define WORLDNAME_BLACKLISTED_CHARS "/\\"
struct SubgameSpec
@ -52,6 +54,11 @@ struct SubgameSpec
}
};
// minetest.conf
bool getGameMinetestConfig(const std::string &game_path, Settings &conf);
// game.conf
bool getGameConfig(const std::string &game_path, Settings &conf);
std::string getGameName(const std::string &game_path);
SubgameSpec findSubgame(const std::string &id);

View File

@ -53,6 +53,9 @@ cd $builddir
wget http://github.com/rarkenin/minetest/zipball/master \
-c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
[ -e $packagedir/minetest.zip ] || (echo "minetest.zip not found"; exit 1)
wget http://github.com/minetest/common/zipball/master \
-c -O $packagedir/common.zip --tries=3 || (echo "Please download http://github.com/minetest/common/zipball/master manually and save it as $packagedir/common.zip"; read -s)
[ -e $packagedir/common.zip ] || (echo "common.zip not found"; exit 1)
wget http://github.com/minetest/minetest_game/zipball/master \
-c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
[ -e $packagedir/minetest_game.zip ] || (echo "minetest_game.zip not found"; exit 1)
@ -66,6 +69,7 @@ wget http://github.com/minetest/minetest_game/zipball/master \
minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
minetestdir=$builddir/rarkenin-$minetestdirname || exit 1
git_hash=`echo $minetestdirname | sed -e 's/rarkenin-minetest-//'`
commondirname=`unzip -l $packagedir/common.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
minetest_gamedirname=`unzip -l $packagedir/minetest_game.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
# Extract stuff
@ -86,6 +90,13 @@ unzip -o $packagedir/minetest.zip || exit 1
rm -rf $builddir/minetest
ln -s $minetestdir $builddir/minetest
# Extract common
cd $minetestdir/games || exit 1
rm -rf common || exit 1
unzip -o $packagedir/common.zip || exit 1
commondir=$minetestdir/games/$commondirname || exit 1
mv $commondir $minetestdir/games/common || exit 1
# Extract minetest_game
cd $minetestdir/games || exit 1
rm -rf minetest_game || exit 1
@ -123,7 +134,7 @@ cmake $minetestdir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file -DENABLE_SOUND=1 \
-DCMAKE_INSTALL_PREFIX=/tmp \
-DVERSION_EXTRA=rark-`date +%F`$2 \
|| exit 1
nice -n 15 make -j2 package || exit 1
make -j2 package || exit 1
#pubdir=/home/celeron55/public_html/random/`date +%Y-%m` || exit 1
#mkdir -p $pubdir || exit 1