# HG changeset patch # User M. George Hansen # Date 1307785066 36000 # Node ID e201abd8c807d4ba873864321e3ab1e0a736ae85 # Parent 47d58c7a95d7dd8594784eff96be21bc2bac06e4# Parent 5e010218273d97b8e7cadbf7dae094aad6dbdcda Merged in the VFS fix for absolute paths from FIFE svn trunk. * This fix superseeds my previous patch, so that patch has been removed. diff -r 47d58c7a95d7 -r e201abd8c807 build/linux2-config.py --- a/build/linux2-config.py Fri Jun 10 23:36:14 2011 -1000 +++ b/build/linux2-config.py Fri Jun 10 23:37:46 2011 -1000 @@ -1,97 +1,94 @@ -# -*- coding: utf-8 -*- - -# #################################################################### -# Copyright (C) 2005-2010 by the FIFE team -# http://www.fifengine.net -# This file is part of FIFE. -# -# FIFE is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# #################################################################### - -import sys -import os -import platform - -pythonversion = 'python' + str(os.sys.version_info[0]) + '.' + str(os.sys.version_info[1]) - -def initEnvironment(env): - - rootpath = env.Dir('#.').srcnode().abspath - extincludepath = os.path.join(rootpath, 'ext', 'install', 'include') - extlibpath = os.path.join(rootpath, 'ext', 'install', 'lib') - - env.Append(CPPPATH = [os.path.join('/', 'opt', 'include'), - os.path.join('/', 'usr', 'include', 'vorbis'), - os.path.join('/', 'usr', 'include', 'SDL'), - os.path.join('/', 'usr', 'include', pythonversion), - extincludepath]) - - env.Append(LIBPATH = [os.path.join('/', 'opt', 'lib'), - extlibpath]) - - env.AppendENVPath('LD_RUN_PATH', os.path.join('..', '..', '..', extlibpath)) - - env.AppendUnique(CXXFLAGS=["-DPNG_SKIP_SETJMP_CHECK"]) - - return env - -def addExtras(env, opengl): - env.Append(LIBS = pythonversion) - - if opengl: - env.Append(LIBS = ['stdc++', 'GL', 'GLU']) - env.Append(LIBPATH = os.path.join('/', 'usr', 'X11R6', 'lib')) - - return env - -def getRequiredHeaders(opengl): - return None - -def getRequiredLibs(opengl): - # libs is a list of tuples that have the form: - # (libname, headers) - # libname - may be a single library or a tuple of libraries - # headers - may be a single header or a list of headers - # - # This list is somewhat order dependent - # guichan_sdl - depends on at least the SDL libs and guichan prior in the list - # guichan_opengl - depends on at least guichan prior in the list - libs = [('vorbisfile', 'vorbisfile.h'), - ('openal', 'AL/al.h'), - ('SDL', 'SDL.h'), - ('SDL_ttf', 'SDL_ttf.h'), - ('SDL_image', 'SDL_image.h'), - ('guichan', 'guichan.hpp'), - ('guichan_sdl', ''), - (('boost_filesystem', 'boost_filesystem-gcc', 'boost_filesystem-gcc41', 'boost_filesystem-mt', 'libboost_filesystem-mt'), 'boost/filesystem.hpp'), - (('boost_regex', 'boost_regex-gcc', 'boost_regex-gcc41', 'boost_regex-mt', 'libboost_regex-mt'), 'boost/regex.hpp'), - ('png', 'png.h'), - ('Xcursor', '')] - - # fedora hack - if 'fedora' in platform.platform(): - libs.insert(0,('boost_system', '')) - - if (opengl): - libs.append(('guichan_opengl', '')) - - return libs - -def getOptionalLibs(opengl): - return None - -# vim: set filetype=python: - +# -*- coding: utf-8 -*- + +# #################################################################### +# Copyright (C) 2005-2010 by the FIFE team +# http://www.fifengine.net +# This file is part of FIFE. +# +# FIFE is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# #################################################################### + +import sys +import os +import platform + +pythonversion = 'python' + str(os.sys.version_info[0]) + '.' + str(os.sys.version_info[1]) + +def initEnvironment(env): + + rootpath = env.Dir('#.').srcnode().abspath + extincludepath = os.path.join(rootpath, 'ext', 'install', 'include') + extlibpath = os.path.join(rootpath, 'ext', 'install', 'lib') + + env.Append(CPPPATH = [os.path.join('/', 'opt', 'include'), + os.path.join('/', 'usr', 'include', 'vorbis'), + os.path.join('/', 'usr', 'include', 'SDL'), + os.path.join('/', 'usr', 'include', pythonversion), + extincludepath]) + + env.Append(LIBPATH = [os.path.join('/', 'opt', 'lib'), + extlibpath]) + + env.AppendENVPath('LD_RUN_PATH', os.path.join('..', '..', '..', extlibpath)) + + env.AppendUnique(CXXFLAGS=["-DPNG_SKIP_SETJMP_CHECK"]) + + return env + +def addExtras(env, opengl): + env.Append(LIBS = pythonversion) + + if opengl: + env.Append(LIBS = ['stdc++', 'GL', 'GLU']) + env.Append(LIBPATH = os.path.join('/', 'usr', 'X11R6', 'lib')) + + return env + +def getRequiredHeaders(opengl): + return None + +def getRequiredLibs(opengl): + # libs is a list of tuples that have the form: + # (libname, headers) + # libname - may be a single library or a tuple of libraries + # headers - may be a single header or a list of headers + # + # This list is somewhat order dependent + # guichan_sdl - depends on at least the SDL libs and guichan prior in the list + # guichan_opengl - depends on at least guichan prior in the list + libs = [('vorbisfile', 'vorbisfile.h'), + ('openal', 'AL/al.h'), + ('SDL', 'SDL.h'), + ('SDL_ttf', 'SDL_ttf.h'), + ('SDL_image', 'SDL_image.h'), + ('guichan', 'guichan.hpp'), + ('guichan_sdl', ''), + ('boost_system', ''), + (('boost_filesystem', 'boost_filesystem-gcc', 'boost_filesystem-gcc41', 'boost_filesystem-mt', 'libboost_filesystem-mt'), 'boost/filesystem.hpp'), + (('boost_regex', 'boost_regex-gcc', 'boost_regex-gcc41', 'boost_regex-mt', 'libboost_regex-mt'), 'boost/regex.hpp'), + ('png', 'png.h'), + ('Xcursor', '')] + + if (opengl): + libs.append(('guichan_opengl', '')) + + return libs + +def getOptionalLibs(opengl): + return None + +# vim: set filetype=python: + diff -r 47d58c7a95d7 -r e201abd8c807 build/openbsd4-config.py --- a/build/openbsd4-config.py Fri Jun 10 23:36:14 2011 -1000 +++ b/build/openbsd4-config.py Fri Jun 10 23:37:46 2011 -1000 @@ -1,63 +1,64 @@ -# Install the following packages: libvorbis python py-yaml swig png openal sdl -# sdl-image sdl-ttf guichan boost -# - -import sys -import os - -def initEnvironment(env): - # Vorbisfile - env.Append(CPPPATH = [ - os.path.join('/', 'usr', 'local', 'include'), - os.path.join('/', 'usr', 'local', 'include', 'vorbis') - ]) - env.Append(LIBPATH = [os.path.join('/', 'usr', 'local', 'lib')]) - env.Append(LIBS = ['ogg', 'vorbis']) - - # PNG - env.Append(CPPPATH = [os.path.join('/', 'usr', 'local', 'include', 'libpng')]) - - # Python library - pythonversion = 'python' + str(os.sys.version_info[0]) + '.' + str(os.sys.version_info[1]) - env.Append(CPPPATH = os.path.join('/', 'usr', 'local', 'include', pythonversion)) - env.Append(LIBS = [pythonversion, 'util']) - - # OpenBSD specific pthreads option - env.Append(LINKFLAGS = ['-pthread']) - - return env - -def addExtras(env, opengl): - if opengl: - env.Append(LIBS = ['stdc++', 'GL', 'GLU']) - env.Append(LIBPATH = os.path.join('/', 'usr', 'X11R6', 'lib')) - - return env - -def getRequiredHeaders(opengl): - return None - -def getRequiredLibs(opengl): - libs = [ - ('vorbisfile', 'vorbisfile.h'), - ('openal', 'AL/al.h'), - ('SDL', 'SDL.h'), - ('SDL_ttf', 'SDL_ttf.h'), - ('SDL_image', 'SDL_image.h'), - ('guichan', 'guichan.hpp'), - ('guichan_sdl', ''), - (('boost_filesystem', 'boost_filesystem-gcc', 'boost_filesystem-gcc41', 'boost_filesystem-mt'), 'boost/filesystem.hpp'), - (('boost_regex', 'boost_regex-gcc', 'boost_regex-gcc41', 'boost_regex-mt'), 'boost/regex.hpp'), - ('png', 'png.h'), - ('Xcursor', 'X11/Xcursor/Xcursor.h')] - - if (opengl): - libs.append(('guichan_opengl', '')) - - return libs - -def getOptionalLibs(opengl): - return None - -# vim: ft=python: - +# Install the following packages: libvorbis python py-yaml swig png openal sdl +# sdl-image sdl-ttf guichan boost +# + +import sys +import os + +def initEnvironment(env): + # Vorbisfile + env.Append(CPPPATH = [ + os.path.join('/', 'usr', 'local', 'include'), + os.path.join('/', 'usr', 'local', 'include', 'vorbis') + ]) + env.Append(LIBPATH = [os.path.join('/', 'usr', 'local', 'lib')]) + env.Append(LIBS = ['ogg', 'vorbis']) + + # PNG + env.Append(CPPPATH = [os.path.join('/', 'usr', 'local', 'include', 'libpng')]) + + # Python library + pythonversion = 'python' + str(os.sys.version_info[0]) + '.' + str(os.sys.version_info[1]) + env.Append(CPPPATH = os.path.join('/', 'usr', 'local', 'include', pythonversion)) + env.Append(LIBS = [pythonversion, 'util']) + + # OpenBSD specific pthreads option + env.Append(LINKFLAGS = ['-pthread']) + + return env + +def addExtras(env, opengl): + if opengl: + env.Append(LIBS = ['stdc++', 'GL', 'GLU']) + env.Append(LIBPATH = os.path.join('/', 'usr', 'X11R6', 'lib')) + + return env + +def getRequiredHeaders(opengl): + return None + +def getRequiredLibs(opengl): + libs = [ + ('vorbisfile', 'vorbisfile.h'), + ('openal', 'AL/al.h'), + ('SDL', 'SDL.h'), + ('SDL_ttf', 'SDL_ttf.h'), + ('SDL_image', 'SDL_image.h'), + ('guichan', 'guichan.hpp'), + ('guichan_sdl', ''), + ('boost_system', ''), + (('boost_filesystem', 'boost_filesystem-gcc', 'boost_filesystem-gcc41', 'boost_filesystem-mt'), 'boost/filesystem.hpp'), + (('boost_regex', 'boost_regex-gcc', 'boost_regex-gcc41', 'boost_regex-mt'), 'boost/regex.hpp'), + ('png', 'png.h'), + ('Xcursor', 'X11/Xcursor/Xcursor.h')] + + if (opengl): + libs.append(('guichan_opengl', '')) + + return libs + +def getOptionalLibs(opengl): + return None + +# vim: ft=python: + diff -r 47d58c7a95d7 -r e201abd8c807 engine/core/controller/engine.cpp --- a/engine/core/controller/engine.cpp Fri Jun 10 23:36:14 2011 -1000 +++ b/engine/core/controller/engine.cpp Fri Jun 10 23:37:46 2011 -1000 @@ -169,7 +169,6 @@ FL_LOG(_log, "Adding root directory to VFS"); m_vfs->addSource( new VFSDirectory(m_vfs) ); - m_vfs->addSource( new VFSDirectory(m_vfs, "./") ); m_vfs->addProvider( new DirectoryProvider() ); #ifdef HAVE_ZIP FL_LOG(_log, "Adding zip provider to VFS"); diff -r 47d58c7a95d7 -r e201abd8c807 engine/core/vfs/directoryprovider.cpp --- a/engine/core/vfs/directoryprovider.cpp Fri Jun 10 23:36:14 2011 -1000 +++ b/engine/core/vfs/directoryprovider.cpp Fri Jun 10 23:37:46 2011 -1000 @@ -23,6 +23,8 @@ #include // 3rd party library includes +#include +#include // FIFE includes // These includes are split up in two parts, separated by one empty line @@ -34,14 +36,17 @@ #include "directoryprovider.h" #include "vfsdirectory.h" +// alias boost::filesystem namespace to make shorter +namespace bfs = boost::filesystem; + namespace FIFE { bool DirectoryProvider::isReadable(const std::string& path) const { - return getVFS()->isDirectory(path); + return bfs::is_directory(bfs::path(path)); } FIFE::VFSSource* DirectoryProvider::createSource(const std::string& path) const { if (isReadable(path)) - return new VFSDirectory(getVFS(), path); + return new VFSDirectory(getVFS(), path); else throw Exception("Path " + path + " is not readable."); } diff -r 47d58c7a95d7 -r e201abd8c807 engine/core/vfs/directoryprovider.h --- a/engine/core/vfs/directoryprovider.h Fri Jun 10 23:36:14 2011 -1000 +++ b/engine/core/vfs/directoryprovider.h Fri Jun 10 23:37:46 2011 -1000 @@ -43,18 +43,20 @@ public: DirectoryProvider() : VFSSourceProvider("OS Directory") { } - /** Check if a given directory is readable for this VFSSource. - * Directory sources must be denoted by a trailing '/', otherwise VFS will consider - * the source to be a file, and unreadable asa a directory. + /** Check if a given directory is readable. + * The path must either be an absolute path or relative + * to the current working directory where the client was launched * - * @param file the filename to check + * @param path the filename to check * @return true if readable, false otherwise */ virtual bool isReadable(const std::string& path) const; /** Create a new instance of a VFSSource initialized with the given directory - * - * @param file the directory to open + * This will only pass if the path is readable and recognized + * as a directory as per the description of isReadable + * + * @param path the directory to open * @return the new VFSSource */ virtual VFSSource* createSource(const std::string& path) const; diff -r 47d58c7a95d7 -r e201abd8c807 engine/core/vfs/vfsdirectory.h --- a/engine/core/vfs/vfsdirectory.h Fri Jun 10 23:36:14 2011 -1000 +++ b/engine/core/vfs/vfsdirectory.h Fri Jun 10 23:37:46 2011 -1000 @@ -47,7 +47,7 @@ * Creates the given file system's VFS Source, Uses boost_filesystem to * achieve Plattform independancy. */ - VFSDirectory(VFS* vfs, const std::string& root = "/"); + VFSDirectory(VFS* vfs, const std::string& root = "./"); /** Destructor */ virtual ~VFSDirectory(); diff -r 47d58c7a95d7 -r e201abd8c807 engine/swigwrappers/python/fife.i.templ --- a/engine/swigwrappers/python/fife.i.templ Fri Jun 10 23:36:14 2011 -1000 +++ b/engine/swigwrappers/python/fife.i.templ Fri Jun 10 23:37:46 2011 -1000 @@ -1,3 +1,14 @@ +%{ +/** + * This is a workaround for a minor swig bug when building on gcc 4.6.1 and above. + * Prior to gcc 4.6.1 the STL headers like vector, string, etc. used to + * automatically pull in the cstddef header but starting with gcc 4.6.1 they no + * longer do. This leads to swig generated a file that does not compile so we + * explicitly include cstddef so the swig generated file will compile. + */ +#include +%} + %module(directors="1") fife %include "std_string.i" %include "std_vector.i"