Sconstruct update:

Better detection of liblua library 
Warns linux users if zenity is not installed

also got convertUTF to compile in linux
This commit is contained in:
punkrockguy318 2008-08-10 09:34:45 +00:00
parent 41863383eb
commit 6cf8efd2de
6 changed files with 43 additions and 17 deletions

View File

@ -1,4 +1,5 @@
To compile and install FCE Ultra, follow these steps: To compile and install FCE Ultra, follow these steps:
1. Ensure that SCons, SDL, and liblua5.1 are installed on your system. 1. Ensure that SCons, SDL, and liblua5.1 are installed on your system.
2. Run "scons" to build fceux. 2. If you are running linux, ensure zenity is installed on your system.
3. To install on Linux/BSD run "scons install" as root. 3. Run "scons" to build fceux.
4. To install on Linux/BSD run "scons install" as root.

View File

@ -4,20 +4,15 @@ import sys
# XXX path separator fixed right now # XXX path separator fixed right now
opts = Options() opts = Options()
opts.AddOptions( opts.AddOptions(
#BoolOption('PSS_STYLE', 'Path separator style', 1),
#BoolOption('LSB_FIRST', 'Least significant byte first?', None),
BoolOption('FRAMESKIP', 'Enable frameskipping', 0), BoolOption('FRAMESKIP', 'Enable frameskipping', 0),
BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1) BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1)
) )
env = Environment(options = opts) env = Environment(options = opts)
# Default compiler flags: # Default compiler flags:
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare']) env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare'])
if os.environ.has_key('PLATFORM'): if os.environ.has_key('PLATFORM'):
env.Replace(PLATFORM = os.environ['PLATFORM']) env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'): if os.environ.has_key('CC'):
@ -55,6 +50,29 @@ else:
if not conf.CheckLib('lua5.1', autoadd=1): if not conf.CheckLib('lua5.1', autoadd=1):
print 'Did not find liblua5.1 or lua5.1.lib, exiting!' print 'Did not find liblua5.1 or lua5.1.lib, exiting!'
Exit(1) Exit(1)
### Search for zenity.
path = os.getenv('PATH')
directories = []
dir = ''
# check for '$' so last entry is processed
for x in path + '$':
if x != ':' and x != '$':
dir += x
else:
directories.append(dir)
dir = ''
zenity = 0
print "Checking for zenity..."
for x in directories:
if os.path.isfile(os.path.join(x, "zenity")):
zenity = 1
if zenity != 1:
print "*** WARNING ***"
print "Zenity could not be found in the PATH. File dialogs will not work without zenity installed."
raw_input('Press any key to continue. . .')
if conf.CheckFunc('asprintf'): if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF") conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1): if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
@ -62,7 +80,9 @@ else:
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1']) conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
# parse SDL cflags/libs # parse SDL cflags/libs
env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('sdl-config --cflags --libs')
env.ParseConfig('echo "-I/usr/include/lua5.1/ -llua5.1"') # parse liblua cflags/libs
env.Append(CPPPATH = ['/usr/local/include/lua5.1', '/usr/include/lua5.1'])
env.Append(LINKFLAGS = "-llua5.1")
env = conf.Finish() env = conf.Finish()
# Build for this system's endianness, if not overriden # Build for this system's endianness, if not overriden
@ -93,6 +113,7 @@ SConscript('src/SConscript')
exe_suffix = '' exe_suffix = ''
if env['PLATFORM'] == 'win32': if env['PLATFORM'] == 'win32':
exe_suffix = '.exe' exe_suffix = '.exe'
#fceux_r_src = 'src/release/fceux' + exe_suffix #fceux_r_src = 'src/release/fceux' + exe_suffix
#fceux_r_dst = 'bin/fceuxREL' + exe_suffix #fceux_r_dst = 'bin/fceuxREL' + exe_suffix
#fceux_d_src = 'src/debug/fceux' + exe_suffix #fceux_d_src = 'src/debug/fceux' + exe_suffix

View File

@ -701,3 +701,4 @@ bool FCEU_isFileInArchive(const char *path)
} }
return isarchive; return isarchive;
} }

View File

@ -1,4 +1,5 @@
my_list = Split(""" my_list = Split("""
ConvertUTF.c
crc32.cpp crc32.cpp
endian.cpp endian.cpp
general.cpp general.cpp

View File

@ -594,7 +594,7 @@ namespace UtfConverter
if (res != conversionOK) if (res != conversionOK)
{ {
delete [] widestringnative; delete [] widestringnative;
throw std::exception("La falla!"); throw std::exception();
} }
*targetstart = 0; *targetstart = 0;
std::wstring resultstring(widestringnative); std::wstring resultstring(widestringnative);
@ -612,7 +612,7 @@ namespace UtfConverter
if (res != conversionOK) if (res != conversionOK)
{ {
delete [] widestringnative; delete [] widestringnative;
throw std::exception("La falla!"); throw std::exception();
} }
*targetstart = 0; *targetstart = 0;
std::wstring resultstring(widestringnative); std::wstring resultstring(widestringnative);
@ -621,7 +621,7 @@ namespace UtfConverter
} }
else else
{ {
throw std::exception("La falla!"); throw std::exception();
} }
return L""; return L"";
} }
@ -642,7 +642,7 @@ namespace UtfConverter
if (res != conversionOK) if (res != conversionOK)
{ {
delete [] utf8stringnative; delete [] utf8stringnative;
throw std::exception("La falla!"); throw std::exception();
} }
*targetstart = 0; *targetstart = 0;
std::string resultstring(utf8stringnative); std::string resultstring(utf8stringnative);
@ -661,7 +661,7 @@ namespace UtfConverter
if (res != conversionOK) if (res != conversionOK)
{ {
delete [] utf8stringnative; delete [] utf8stringnative;
throw std::exception("La falla!"); throw std::exception();
} }
*targetstart = 0; *targetstart = 0;
std::string resultstring(utf8stringnative); std::string resultstring(utf8stringnative);
@ -670,7 +670,7 @@ namespace UtfConverter
} }
else else
{ {
throw std::exception("La falla!"); throw std::exception();
} }
return ""; return "";
} }
@ -686,3 +686,4 @@ std::string wcstombs(std::wstring str)
{ {
return UtfConverter::ToUtf8(str); return UtfConverter::ToUtf8(str);
} }

View File

@ -120,3 +120,4 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
std::wstring mbstowcs(std::string str); std::wstring mbstowcs(std::string str);
std::string wcstombs(std::wstring str); std::string wcstombs(std::wstring str);