From 6cf8efd2dece96d713a29accd41c2519048b6a43 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 10 Aug 2008 09:34:45 +0000 Subject: [PATCH] Sconstruct update: Better detection of liblua library Warns linux users if zenity is not installed also got convertUTF to compile in linux --- INSTALL | 5 +++-- SConstruct | 33 +++++++++++++++++++++++++++------ src/file.cpp | 3 ++- src/utils/SConscript | 1 + src/utils/xstring.cpp | 15 ++++++++------- src/utils/xstring.h | 3 ++- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/INSTALL b/INSTALL index c15cf4c2..79426907 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,5 @@ To compile and install FCE Ultra, follow these steps: 1. Ensure that SCons, SDL, and liblua5.1 are installed on your system. - 2. Run "scons" to build fceux. - 3. To install on Linux/BSD run "scons install" as root. + 2. If you are running linux, ensure zenity is installed on your system. + 3. Run "scons" to build fceux. + 4. To install on Linux/BSD run "scons install" as root. diff --git a/SConstruct b/SConstruct index d6d175fb..9530212c 100644 --- a/SConstruct +++ b/SConstruct @@ -4,20 +4,15 @@ import sys # XXX path separator fixed right now opts = Options() opts.AddOptions( - #BoolOption('PSS_STYLE', 'Path separator style', 1), - #BoolOption('LSB_FIRST', 'Least significant byte first?', None), BoolOption('FRAMESKIP', 'Enable frameskipping', 0), BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1) ) env = Environment(options = opts) - # Default compiler flags: env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare']) - - if os.environ.has_key('PLATFORM'): env.Replace(PLATFORM = os.environ['PLATFORM']) if os.environ.has_key('CC'): @@ -55,6 +50,29 @@ else: if not conf.CheckLib('lua5.1', autoadd=1): print 'Did not find liblua5.1 or lua5.1.lib, exiting!' 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'): conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF") 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']) # parse SDL 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() # Build for this system's endianness, if not overriden @@ -93,6 +113,7 @@ SConscript('src/SConscript') exe_suffix = '' if env['PLATFORM'] == 'win32': exe_suffix = '.exe' + #fceux_r_src = 'src/release/fceux' + exe_suffix #fceux_r_dst = 'bin/fceuxREL' + exe_suffix #fceux_d_src = 'src/debug/fceux' + exe_suffix diff --git a/src/file.cpp b/src/file.cpp index 3e543a02..15c53a0c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -700,4 +700,5 @@ bool FCEU_isFileInArchive(const char *path) delete fp; } return isarchive; -} \ No newline at end of file +} + diff --git a/src/utils/SConscript b/src/utils/SConscript index 2520f070..c45ebe8a 100644 --- a/src/utils/SConscript +++ b/src/utils/SConscript @@ -1,4 +1,5 @@ my_list = Split(""" +ConvertUTF.c crc32.cpp endian.cpp general.cpp diff --git a/src/utils/xstring.cpp b/src/utils/xstring.cpp index 45c3a6a5..c4e23643 100644 --- a/src/utils/xstring.cpp +++ b/src/utils/xstring.cpp @@ -594,7 +594,7 @@ namespace UtfConverter if (res != conversionOK) { delete [] widestringnative; - throw std::exception("La falla!"); + throw std::exception(); } *targetstart = 0; std::wstring resultstring(widestringnative); @@ -612,7 +612,7 @@ namespace UtfConverter if (res != conversionOK) { delete [] widestringnative; - throw std::exception("La falla!"); + throw std::exception(); } *targetstart = 0; std::wstring resultstring(widestringnative); @@ -621,7 +621,7 @@ namespace UtfConverter } else { - throw std::exception("La falla!"); + throw std::exception(); } return L""; } @@ -642,7 +642,7 @@ namespace UtfConverter if (res != conversionOK) { delete [] utf8stringnative; - throw std::exception("La falla!"); + throw std::exception(); } *targetstart = 0; std::string resultstring(utf8stringnative); @@ -661,7 +661,7 @@ namespace UtfConverter if (res != conversionOK) { delete [] utf8stringnative; - throw std::exception("La falla!"); + throw std::exception(); } *targetstart = 0; std::string resultstring(utf8stringnative); @@ -670,7 +670,7 @@ namespace UtfConverter } else { - throw std::exception("La falla!"); + throw std::exception(); } return ""; } @@ -685,4 +685,5 @@ std::wstring mbstowcs(std::string str) std::string wcstombs(std::wstring str) { return UtfConverter::ToUtf8(str); -} \ No newline at end of file +} + diff --git a/src/utils/xstring.h b/src/utils/xstring.h index 05b09025..fe15e5c9 100644 --- a/src/utils/xstring.h +++ b/src/utils/xstring.h @@ -119,4 +119,5 @@ template void putdec(std::ostream* os, T dec) std::string mass_replace(const std::string &source, const std::string &victim, const std::string &replacement); std::wstring mbstowcs(std::string str); -std::string wcstombs(std::wstring str); \ No newline at end of file +std::string wcstombs(std::wstring str); +