diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-30 20:01:24 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-30 20:01:24 +0000 |
commit | 777c7bff9d40214069752a8ca91ade106a60536b (patch) | |
tree | 79bb2ed5b72f896eb32564c35e983e994ed913ea /gears | |
parent | df06096817e6fc5a4a3e53b863cd4c439271ba45 (diff) | |
download | chromium_src-777c7bff9d40214069752a8ca91ade106a60536b.zip chromium_src-777c7bff9d40214069752a8ca91ade106a60536b.tar.gz chromium_src-777c7bff9d40214069752a8ca91ade106a60536b.tar.bz2 |
Changes to make Gears build on linux.
Review URL: http://codereview.chromium.org/5023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gears')
-rw-r--r-- | gears/SConscript | 109 | ||||
-rw-r--r-- | gears/SConscript.dll | 135 | ||||
-rw-r--r-- | gears/SConscript.googleurl | 4 | ||||
-rw-r--r-- | gears/SConscript.libgd | 11 | ||||
-rw-r--r-- | gears/SConscript.libjpeg | 12 | ||||
-rw-r--r-- | gears/SConscript.libpng | 2 | ||||
-rw-r--r-- | gears/SConscript.portaudio | 45 | ||||
-rw-r--r-- | gears/SConscript.sqlite | 12 |
8 files changed, 241 insertions, 89 deletions
diff --git a/gears/SConscript b/gears/SConscript index 3ba720d..c06d642 100644 --- a/gears/SConscript +++ b/gears/SConscript @@ -31,8 +31,19 @@ env = env.Clone( ) # Argument switches + +# TODO: how do we detect linux vs osx? +os_guess = env['PLATFORM'] +if os_guess == 'posix': + os_guess = 'linux' +elif os_guess == 'darwin': + os_guess = 'osx' + vars = Variables(None, ARGUMENTS) vars.AddVariables( + EnumVariable('OS', + 'Which OS is the target', + os_guess, ['win32', 'wince', 'linux', 'osx', 'android']), EnumVariable('BROWSER', 'Which browser we want to build the plugin for', 'NPAPI', ['IE', 'FF2', 'FF3', 'SF', 'NPAPI']), @@ -44,12 +55,12 @@ vars.AddVariables( ) vars.Update(env) -env.Append( +env.Replace( USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD']) ) # Version -env.Append( +env.Replace( MAJOR = '0', MINOR = '4', BUILD = '22', @@ -61,10 +72,7 @@ env.Append( ) # Platform -env.Append( - OS = '$PLATFORM', - ARCH = 'i386', -) +env.Replace(ARCH = 'i386') # Add GNU tools to the PATH. Note we have to strip off the build dir. env.PrependENVPath('PATH', @@ -90,19 +98,9 @@ env.Replace( '$THIRD_PARTY_DIR/zlib', '$THIRD_PARTY_DIR/v8/bindings_local', '$GEARS_DIR', - - # TODO: switch over to Chrome's SDK. - # Note: these must come last because we want our own npapi.h to take - # precedence. - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', - '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include', - '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/include', ], LIBPATH = [ '$LIBS_DIR', - '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/lib', - '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/lib', - '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/lib', ], CCFLAGS = [], CPPDEFINES = [], @@ -146,7 +144,7 @@ env.Append( # Platform-specific flags follow. -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env.Append( CPPDEFINES = [ 'STRICT', @@ -217,6 +215,19 @@ if env['PLATFORM'] == 'win32': '/TP', '/J', ], + CPPPATH = [ +# TODO: switch over to Chrome's SDK. +# Note: these must come after $THIRD_PARTY_DIR/npapi because we want our own +# npapi.h to take precedence. + '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include', + '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include', + '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/include', + ], + LIBPATH = [ + '$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/lib', + '$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/lib', + '$PRIVATE_THIRD_PARTY_DIR/vc_80/files/vc/lib', + ], ) if env['MODE'] == 'dbg': env.Append( @@ -236,6 +247,70 @@ if env['PLATFORM'] == 'win32': '/OPT:ICF', ], ) +elif env['OS'] == 'linux': + env.Append( + CPPDEFINES = [ + 'LINUX', + ], + CPPPATH = [ + '$THIRD_PARTY_DIR/gtk/include/gtk-2.0', + '$THIRD_PARTY_DIR/gtk/include/atk-1.0', + '$THIRD_PARTY_DIR/gtk/include/glib-2.0', + '$THIRD_PARTY_DIR/gtk/include/pango-1.0', + '$THIRD_PARTY_DIR/gtk/include/cairo', + '$THIRD_PARTY_DIR/gtk/lib/gtk-2.0/include', + '$THIRD_PARTY_DIR/gtk/lib/glib-2.0/include', + ], + CCFLAGS = [ + '-fPIC', + '-fmessage-length=0', + '-Wall', + '-Werror', +# NS_LITERAL_STRING does not work properly without this compiler option + '-fshort-wchar', +# Additions to compile on hardy + '-Wno-unused-variable', + '-Wno-missing-braces', + '-Wno-address', + '-m32', + ], + CXXFLAGS = [ + '-fno-exceptions', + '-fno-rtti', + '-Wno-non-virtual-dtor', + '-Wno-ctor-dtor-privacy', + '-funsigned-char', + '-Wno-char-subscripts', + ], + LINKFLAGS = [ + '-fPIC', + '-Bsymbolic', + '-pthread', + +# TODO: Following are DLLFLAGS. Figure something out for non-lib targets. + '-shared', + '-Wl,--version-script', + '-Wl,$OPEN_DIR/tools/xpcom-ld-script', +# for PortAudio: need pthread and math + '-lpthread', + '-lm', +# Additions to compile on hardy + '-m32', + ], + ) + if env['MODE'] == 'dbg': + env.Append( + CPPFLAGS = [ + '-g', + '-O0', + ], + ) + else: # MODE=opt + env.Append( + CPPFLAGS = [ + '-O2', + ], + ) # Load all the components diff --git a/gears/SConscript.dll b/gears/SConscript.dll index befdc9a..ed57916 100644 --- a/gears/SConscript.dll +++ b/gears/SConscript.dll @@ -154,6 +154,7 @@ env.Append(BUILDERS = {'Bin2cpp': bin2cpp_builder}) # stupid to apply its include paths to a relative path like "ui/ie/bla.idl" # (it only looks in the current dir). So we have to jump through hoops to fix # up our relative include paths and output files. +env.Tool('midl') if env['BROWSER'] == 'IE': env.Replace( @@ -250,7 +251,7 @@ if env['BROWSER'] in ['FF2', 'FF3']: '$GECKO_SDK/gecko_sdk/include', ], ) -elif env['BROWSER'] == 'NPAPI' and env['PLATFORM'] == 'win32': +elif env['BROWSER'] == 'NPAPI' and env['OS'] == 'win32': env_browser.Prepend( CPPDEFINES = [ 'BROWSER_CHROME=1', @@ -269,9 +270,9 @@ env_browser.Append( 'gd', 'googleurl-gears', # env_browser['ICU_LIBS'], # TODO(sgk): '$ICU_LIBS' when scons is fixed - 'jpeg', - 'modp_b64', - 'png', + 'jpeg-gears', +# 'modp_b64', + 'png-gears', 'portaudio', 'sqlite-gears', # 'skia', @@ -297,20 +298,31 @@ if env['BROWSER'] == 'IE': ) elif env['BROWSER'] in ['FF2', 'FF3']: env_browser.Append( + LIBPATH = '$GECKO_LIB', LIBS = [ - '$GECKO_LIB/xpcom.lib', - '$GECKO_LIB/xpcomglue_s.lib', - '$GECKO_LIB/nspr4.lib', - '$GECKO_LIB/js3250.lib', - 'ole32.lib', - 'shell32.lib', - 'shlwapi.lib', - 'advapi32.lib', - 'wininet.lib', - 'comdlg32.lib', - 'user32.lib', + 'xpcom', + 'xpcomglue_s', ], ) + if env['OS'] == 'win32': + env_browser.Append( + LIBS = [ + 'nspr4.lib', + 'js3250.lib', + 'ole32.lib', + 'shell32.lib', + 'shlwapi.lib', + 'advapi32.lib', + 'wininet.lib', + 'comdlg32.lib', + 'user32.lib', + ], + ) + elif env['OS'] == 'linux': + # Although the 1.9 SDK contains libnspr4, it is better to link against + # libxul, which in turn depends on libnspr4. In Ubuntu 8.04, libnspr4 was + # not listed in /usr/lib, only libxul was. + env_browser.Append(LIBS = (env['BROWSER'] == 'FF2' and 'nspr4' or 'xul')) elif env['BROWSER'] == 'NPAPI': env_browser.Append( LIBS = [ @@ -343,10 +355,10 @@ if env['MODE'] == 'dbg': else: env_res.Append(CPPDEFINES = 'NDEBUG=1') -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env_res.Append(RCFLAGS = ['/l', '0x409']) -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env_browser.Append( CPPFLAGS = [ '/wd4018' # TODO: move to breakpad @@ -382,21 +394,22 @@ binsrcs = NewInputs() #----------------------------------------------------------------------------- # third_party/breakpad -srcs['NPAPI'] += [ - '$THIRD_PARTY_DIR/breakpad/src/client/exception_handler_stub.cc', -] +if env['OS'] == 'win32': + srcs['NPAPI'] += [ + '$THIRD_PARTY_DIR/breakpad/src/client/exception_handler_stub.cc', + ] -srcs['IE'] += [ - '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', - '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', - '$OPEN_DIR/base/common/exception_handler_win32.cc', -] + srcs['IE'] += [ + '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', + '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', + '$OPEN_DIR/base/common/exception_handler_win32.cc', + ] -srcs['FF3'] += [ - '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', - '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', - '$OPEN_DIR/base/common/exception_handler_win32.cc', -] + srcs['FF3'] += [ + '$THIRD_PARTY_DIR/breakpad/src/client/windows/handler/exception_handler.cc', + '$THIRD_PARTY_DIR/breakpad/src/common/windows/guid_string.cc', + '$OPEN_DIR/base/common/exception_handler_win32.cc', + ] #----------------------------------------------------------------------------- # third_party/v8/bindings @@ -428,9 +441,8 @@ srcs['all'] += [ #----------------------------------------------------------------------------- # third_party/modp_b64 -# We're using Chrome's version. Uncomment if that doesn't work. srcs['all'] += [ -# '$THIRD_PARTY_DIR/modp_b64/modp_b64.cc', + '$THIRD_PARTY_DIR/modp_b64/modp_b64.cc', ] #----------------------------------------------------------------------------- @@ -549,7 +561,7 @@ m4srcs['IE'] += [ ] idlsrcs['IE'] += [ - '$OPEN_DIR/base/ie/interfaces.idl', + '$GENFILES_DIR/interfaces.idl', ] srcs['IE'] += [ @@ -570,13 +582,13 @@ srcs['IE'] += [ '$OPEN_DIR/base/common/vista_utils.cc', ] -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': srcs['IE'] += [ '$OPEN_DIR/base/common/file_win32.cc', '$OPEN_DIR/base/common/html_event_monitor_ie.cc', '$OPEN_DIR/base/ie/ie_version.cc', ] -elif env['PLATFORM'] == 'wince': +elif env['OS'] == 'wince': srcs['IE'] += [ '$OPEN_DIR/base/common/common_ie.cc', '$OPEN_DIR/base/common/file_wince.cc', @@ -605,7 +617,7 @@ srcs['NPAPI'] += [ '$OPEN_DIR/base/npapi/plugin.cc', ] -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': srcs['NPAPI'] += [ '$OPEN_DIR/base/common/detect_version_collision_win32.cc', '$OPEN_DIR/base/common/file_win32.cc', @@ -627,7 +639,7 @@ srcs['all'] += [ # canvas # The Canvas API is not yet enabled in official builds. -if not env['OFFICIAL_BUILD'] and env['PLATFORM'] in ['win32', 'osx']: +if not env['OFFICIAL_BUILD'] and env['OS'] in ['win32', 'osx']: srcs['all'] += [ '$OPEN_DIR/canvas/blob_backed_skia_input_stream.cc', '$OPEN_DIR/canvas/blob_backed_skia_output_stream.cc', @@ -893,11 +905,11 @@ stabsrcs['IE'] += [ ] # Additional files specific to Win32 or WinCE. -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_host.cc', ] -elif env['PLATFORM'] == 'wince': +elif env['OS'] == 'wince': m4srcs['IE'] += [ '$OPEN_DIR/ui/ie/html_dialog_bridge_iemobile.rgs.m4', ] @@ -1016,7 +1028,7 @@ if not env['OFFICIAL_BUILD']: # image # The Image API is not yet enabled in official builds. -if not env['OFFICIAL_BUILD'] and env['PLATFORM'] != 'wince': +if not env['OFFICIAL_BUILD'] and env['OS'] != 'wince': srcs['all'] += [ '$OPEN_DIR/image/backing_image.cc', '$OPEN_DIR/image/image.cc', @@ -1099,32 +1111,36 @@ if not env['OFFICIAL_BUILD']: #----------------------------------------------------------------------------- # resources -ui_res = env_res.RES('$GENFILES_DIR/ui_resources.rc'), +dll_resources = [] -module_res = None -if env['BROWSER'] == 'NPAPI': - module_res = env_res.RES('$OPEN_DIR/base/npapi/module.rc') -elif env['BROWSER'] == 'IE': - module_res = env_res.RES('$OPEN_DIR/base/ie/module.rc') +if env['OS'] == 'win32': + ui_res = env_res.RES('$GENFILES_DIR/ui_resources.rc'), -dll_resources = [ - ui_res, -] -if module_res: - dll_resources += [module_res] + module_res = None + if env['BROWSER'] == 'NPAPI': + module_res = env_res.RES('$OPEN_DIR/base/npapi/module.rc') + elif env['BROWSER'] == 'IE': + module_res = env_res.RES('$OPEN_DIR/base/ie/module.rc') + + dll_resources += [ui_res] + if module_res: + dll_resources += [module_res] #----------------------------------------------------------------------------- # libs -libs = [ - '$THIRD_PARTY_DIR/skia/skia-dbg-win32-i386.lib', -] +libs = [] + +if env['OS'] == 'win32': + libs += [ + '$THIRD_PARTY_DIR/skia/skia-${MODE}-${OS}-${ARCH}.lib', + ] if env['BROWSER'] == 'NPAPI': libs += [ - '$THIRD_PARTY_DIR/v8/bin-dbg/libv8core.lib', - '$THIRD_PARTY_DIR/v8/bin-dbg/no_snapshotv8.lib', - '$THIRD_PARTY_DIR/v8/bin-dbg/libjscre.lib', + '$THIRD_PARTY_DIR/v8/bin-${MODE}/libv8core.lib', + '$THIRD_PARTY_DIR/v8/bin-${MODE}/no_snapshotv8.lib', + '$THIRD_PARTY_DIR/v8/bin-${MODE}/libjscre.lib', '$OPEN_DIR/base/chrome/module.def' ] elif env['BROWSER'] == 'IE': @@ -1206,8 +1222,9 @@ if idlsrcs['all']: srcs['all'] += [x for x in idls[0] if str(x).endswith('_i.c')] # TODO: figure out why the .rc scanner doesn't notice these dependencies. -env_browser.Depends(ui_res, html_m4s) -env_browser.Depends(module_res, m4s) +if env['OS'] == 'win32': + env_browser.Depends(ui_res, html_m4s) + env_browser.Depends(module_res, m4s) lib = env_browser.ChromeSharedLibrary('gears', srcs['all'] + libs + dll_resources) diff --git a/gears/SConscript.googleurl b/gears/SConscript.googleurl index 771c0e7..c4fea18 100644 --- a/gears/SConscript.googleurl +++ b/gears/SConscript.googleurl @@ -24,13 +24,15 @@ env.Append( ], ) -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env.Append( CCFLAGS = [ # '/TP', # '/J', ], ) +elif env['OS'] == 'linux': + env.Append(CCFLAGS = '-Wno-char-subscripts') input_files = [ '$GURL_DIR/src/gurl.cc', diff --git a/gears/SConscript.libgd b/gears/SConscript.libgd index 652e4e1..9deed8f 100644 --- a/gears/SConscript.libgd +++ b/gears/SConscript.libgd @@ -27,7 +27,7 @@ env.Append( ) -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env.Append( CPPFLAGS = [ # Disable some warnings when building third-party code, so we can enable /WX. @@ -44,7 +44,14 @@ if env['PLATFORM'] == 'win32': '/wd4102', ], ) - +elif env['OS'] == 'linux': + env.Append( + CPPFLAGS = [ + '-Wno-unused-variable', + '-Wno-unused-function', + '-Wno-unused-label', + ], + ) input_files = [ '$LIBGD_DIR/gd.c', diff --git a/gears/SConscript.libjpeg b/gears/SConscript.libjpeg index 5931eb6..ef7c6c7 100644 --- a/gears/SConscript.libjpeg +++ b/gears/SConscript.libjpeg @@ -17,10 +17,12 @@ env.Replace( ], ) -#env.Append( -# CPPDEFINES = [ -# ], -#) +if env['OS'] == 'linux': + env.Append( + CCFLAGS = [ + '-Wno-main', + ], + ) input_files = [ '$LIBJPEG_DIR/jcapimin.c', @@ -71,4 +73,4 @@ input_files = [ '$LIBJPEG_DIR/jmemnobs.c', ] -env.ChromeStaticLibrary('jpeg', input_files) +env.ChromeStaticLibrary('jpeg-gears', input_files) diff --git a/gears/SConscript.libpng b/gears/SConscript.libpng index 5cdff50..d3d81ae 100644 --- a/gears/SConscript.libpng +++ b/gears/SConscript.libpng @@ -49,4 +49,4 @@ if not env['OFFICIAL_BUILD']: '$LIBPNG_DIR/pngwutil.c', ] -env.ChromeStaticLibrary('png', input_files) +env.ChromeStaticLibrary('png-gears', input_files) diff --git a/gears/SConscript.portaudio b/gears/SConscript.portaudio index 6987457..46506b7 100644 --- a/gears/SConscript.portaudio +++ b/gears/SConscript.portaudio @@ -12,7 +12,6 @@ env.Replace( CPPPATH = [ '$PA_DIR/include', '$PA_DIR/src/common', - '$PA_DIR/src/os/win', ], ) @@ -23,13 +22,33 @@ env.Append( ], ) -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env.Append( + CPPPATH = [ + '$PA_DIR/src/os/win', + ], CPPFLAGS = [ '/wd4133', '/wd4101', ], ) +elif env['OS'] == 'linux': + env.Append( + CPPPATH = [ + '$PA_DIR/src/os/unix', + ], + CPPFLAGS = [ +# disable some warnings + '-Wno-unused-variable', +# enable multithreading support with pthread library + '-pthread', + ], + CPPDEFINES = [ +# build only the OSS hostapi for linux + 'PA_USE_OSS', + 'HAVE_SYS_SOUNDCARD_H=1', + ], + ) input_files = [ '$PA_DIR/src/common/pa_allocation.c', @@ -42,10 +61,30 @@ input_files = [ '$PA_DIR/src/common/pa_skeleton.c', '$PA_DIR/src/common/pa_stream.c', '$PA_DIR/src/common/pa_trace.c', +] + +# Platform-specific inputs +if env['OS'] == 'win32': + input_files += [ '$PA_DIR/src/hostapi/wmme/pa_win_wmme.c', '$PA_DIR/src/os/win/pa_win_hostapis.c', '$PA_DIR/src/os/win/pa_win_util.c', '$PA_DIR/src/os/win/pa_win_waveformat.c', -] + ] +elif env['OS'] == 'linux': + input_files += [ + '$PA_DIR/src/hostapi/oss/pa_unix_oss.c', + '$PA_DIR/src/os/unix/pa_unix_hostapis.c', + '$PA_DIR/src/os/unix/pa_unix_util.c', + ] +elif env['OS'] == 'osx': + input_files += [ + '$PA_DIR/src/common/pa_ringbuffer.c', + '$PA_DIR/src/hostapi/coreaudio/pa_mac_core.c', + '$PA_DIR/src/hostapi/coreaudio/pa_mac_core_blocking.c', + '$PA_DIR/src/hostapi/coreaudio/pa_mac_core_utilities.c', + '$PA_DIR/src/os/osx/pa_mac_hostapis.c', + '$PA_DIR/src/os/unix/pa_unix_util.c', + ] env.ChromeStaticLibrary('portaudio', input_files) diff --git a/gears/SConscript.sqlite b/gears/SConscript.sqlite index f1917dc..5c69258 100644 --- a/gears/SConscript.sqlite +++ b/gears/SConscript.sqlite @@ -48,7 +48,7 @@ env.Append( ], ) -if env['PLATFORM'] == 'win32': +if env['OS'] == 'win32': env.Append( CPPFLAGS = [ # from Chrome @@ -61,6 +61,16 @@ if env['PLATFORM'] == 'win32': '/wd4146', ], ) +elif env['OS'] == 'linux': + env.Append( + CPPFLAGS = [ + '-Wno-uninitialized', + '-Wno-unused-value', + ], + CPPDEFINES = [ + 'HAVE_USLEEP=1', + ], + ) input_files = [ '$SQLITE_DIR/src/alter.c', |