diff options
34 files changed, 171 insertions, 100 deletions
diff --git a/app/app.gyp b/app/app.gyp index 3d027d6..71a72d0 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -238,6 +238,9 @@ }, 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/app/grit/<(RULE_INPUT_ROOT).h', + # TODO(benl) Generate this list from a helper script, like + # repack_locales_cmd in chrome.gyp (see TODO(mmoss)) + '<(SHARED_INTERMEDIATE_DIR)/app/<(RULE_INPUT_ROOT)_ar.pak', '<(SHARED_INTERMEDIATE_DIR)/app/<(RULE_INPUT_ROOT)_en-US.pak', ], 'action': ['python', '<@(_inputs)', '-i', '<(RULE_INPUT_PATH)', diff --git a/app/resource_bundle.h b/app/resource_bundle.h index 51a8ff6..52c85c5 100644 --- a/app/resource_bundle.h +++ b/app/resource_bundle.h @@ -20,12 +20,12 @@ #include "base/scoped_ptr.h" #include "base/string16.h" -#if defined(OS_LINUX) || defined(OS_MACOSX) +#if defined(USE_BASE_DATA_PACK) namespace base { class DataPack; } #endif -#if defined(OS_LINUX) +#if defined(USE_X11) typedef struct _GdkPixbuf GdkPixbuf; #endif namespace gfx { @@ -123,7 +123,7 @@ class ResourceBundle { #elif defined(OS_MACOSX) // Wrapper for GetBitmapNamed. Converts the bitmap to an autoreleased NSImage. NSImage* GetNSImageNamed(int resource_id); -#elif defined(OS_LINUX) +#elif defined(USE_X11) // Gets the GdkPixbuf with the specified resource_id, first by looking into // the theme data, than in the current module data if applicable. Returns a // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is @@ -160,7 +160,7 @@ class ResourceBundle { #if defined(OS_WIN) // Windows stores resources in DLLs, which are managed by HINSTANCE. typedef HINSTANCE DataHandle; -#elif defined(OS_LINUX) || defined(OS_MACOSX) +#elif defined(USE_BASE_DATA_PACK) // Linux uses base::DataPack. typedef base::DataPack* DataHandle; #endif @@ -208,7 +208,7 @@ class ResourceBundle { // ownership of the pointers. typedef std::map<int, SkBitmap*> SkImageMap; SkImageMap skia_images_; -#if defined(OS_LINUX) +#if defined(USE_X11) typedef std::map<int, GdkPixbuf*> GdkPixbufMap; GdkPixbufMap gdk_pixbufs_; #endif diff --git a/base/base.gyp b/base/base.gyp index 6636b53..d0a2209 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -366,7 +366,7 @@ 4244, 4554, 4018, 4102, ], 'conditions': [ - [ 'OS == "linux"', { + [ 'OS == "linux" or OS == "freebsd"', { 'variables' : { 'linux_use_tcmalloc%': 0, }, @@ -398,17 +398,21 @@ 'cflags': [ '-Wno-write-strings', ], - 'link_settings': { - 'libraries': [ - # We need rt for clock_gettime(). - '-lrt', - ], - }, + 'conditions': [ + [ 'OS == "linux"', { + 'link_settings': { + 'libraries': [ + # We need rt for clock_gettime(). + '-lrt', + ], + }, + }, + ] ], 'export_dependent_settings': [ '../build/linux/system.gyp:gtk', ], }, - { # else: OS != "linux" + { # else: OS != "linux" && OS != "freebsd" 'sources/': [ ['exclude', '/xdg_mime/'], ], @@ -437,6 +441,15 @@ ], }, ], + [ 'OS == "freebsd"', { + 'sources!': [ + 'directory_watcher_inotify.cc', + ], + 'sources': [ + 'directory_watcher_stub.cc', + ], + }, + ], [ 'OS == "mac"', { 'sources/': [ ['exclude', '_(linux|win|chromeos)\\.cc$'] ], 'sources!': [ @@ -544,7 +557,7 @@ 'base', ], 'conditions': [ - ['OS == "linux"', { + ['OS == "linux" or OS == "freebsd"', { 'dependencies': [ '../build/linux/system.gyp:gtk', ], @@ -554,7 +567,7 @@ 'gfx/native_theme.cc', ], }], - [ 'OS != "linux"', { 'sources!': [ + [ 'OS != "linux" and OS != "freebsd"', { 'sources!': [ 'gfx/gtk_native_view_id_manager.cc', 'gfx/gtk_util.cc', 'gfx/native_widget_types_gtk.cc', @@ -663,7 +676,7 @@ '../testing/gtest.gyp:gtest', ], 'conditions': [ - ['OS == "linux"', { + ['OS == "linux" or OS == "freebsd"', { 'sources!': [ 'file_version_info_unittest.cc', # Linux has an implementation of idle_timer, but it's unclear @@ -675,7 +688,7 @@ '../build/linux/system.gyp:gtk', '../build/linux/system.gyp:nss', ], - }, { # OS != "linux" + }, { # OS != "linux" and OS != "freebsd" 'sources!': [ 'message_pump_glib_unittest.cc', ] @@ -727,7 +740,7 @@ 'test_file_util_win.cc', ], 'conditions': [ - [ 'OS == "linux"', { + [ 'OS == "linux" or OS == "freebsd"', { 'sources/': [ ['exclude', '_(mac|win|chromeos)\\.cc$'], ['exclude', '\\.mm?$' ] ], 'conditions': [ @@ -766,7 +779,7 @@ ], }, 'conditions': [ - ['OS == "linux"', { + ['OS == "linux" or OS == "freebsd"', { 'dependencies': [ # Needed to handle the #include chain: # base/perf_test_suite.h @@ -795,7 +808,7 @@ }, ], }], - [ 'OS == "linux"', { + [ 'OS == "linux" or OS == "freebsd"', { 'targets': [ { 'target_name': 'linux_versioninfo', diff --git a/base/clipboard.h b/base/clipboard.h index de0f62d..bd4aefd 100644 --- a/base/clipboard.h +++ b/base/clipboard.h @@ -21,7 +21,7 @@ class FilePath; class Clipboard { public: typedef std::string FormatType; -#if defined(OS_LINUX) +#if defined(USE_X11) typedef struct _GtkClipboard GtkClipboard; typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap; #endif @@ -167,7 +167,7 @@ class Clipboard { void WriteFiles(const char* file_data, size_t file_len); void WriteBitmap(const char* pixel_data, const char* size_data); -#if defined(OS_WIN) || defined(OS_LINUX) +#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD) // |format_name| is an ASCII string and should be NULL-terminated. // TODO(estade): port to mac. void WriteData(const char* format_name, size_t format_len, @@ -200,7 +200,7 @@ class Clipboard { // True if we can create a window. bool create_window_; -#elif defined(OS_LINUX) +#elif defined(USE_X11) // Data is stored in the |clipboard_data_| map until it is saved to the system // clipboard. The Store* functions save data to the |clipboard_data_| map. The // SetGtkClipboard function replaces whatever is on the system clipboard with diff --git a/base/clipboard_linux.cc b/base/clipboard_linux.cc index c259cea..6aedc91 100644 --- a/base/clipboard_linux.cc +++ b/base/clipboard_linux.cc @@ -119,7 +119,10 @@ void Clipboard::SetGtkClipboard() { int i = 0; for (Clipboard::TargetMap::iterator iter = clipboard_data_->begin(); iter != clipboard_data_->end(); ++iter, ++i) { - targets[i].target = strndup(iter->first.data(), iter->first.size()); + targets[i].target = static_cast<gchar*>(malloc(iter->first.size() + 1)); + memcpy(targets[i].target, iter->first.data(), iter->first.size()); + targets[i].target[iter->first.size()] = '\0'; + targets[i].flags = 0; targets[i].info = i; } diff --git a/base/crypto/signature_verifier.h b/base/crypto/signature_verifier.h index 18873e8..89bf565 100644 --- a/base/crypto/signature_verifier.h +++ b/base/crypto/signature_verifier.h @@ -7,7 +7,7 @@ #include "build/build_config.h" -#if defined(OS_LINUX) +#if defined(USE_NSS) #include <cryptoht.h> #elif defined(OS_MACOSX) #include <Security/cssm.h> @@ -81,7 +81,7 @@ class SignatureVerifier { std::vector<uint8> signature_; -#if defined(OS_LINUX) +#if defined(USE_NSS) VFYContext* vfy_context_; #elif defined(OS_MACOSX) std::vector<uint8> public_key_info_; diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 5bc3306..3715d21 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -82,6 +82,19 @@ class LocaleAwareComparator { namespace file_util { +#if defined(OS_FREEBSD) +typedef struct stat stat_wrapper_t; +static int CallStat(const char *path, stat_wrapper_t *sb) { + return stat(path, sb); +} +#else +typedef struct stat64 stat_wrapper_t; +static int CallStat(const char *path, stat_wrapper_t *sb) { + return stat64(path, sb); +} +#endif + + #if defined(GOOGLE_CHROME_BUILD) static const char* kTempFileName = "com.google.chrome.XXXXXX"; #else @@ -114,7 +127,7 @@ int CountFilesCreatedAfter(const FilePath& path, DIR* dir = opendir(path.value().c_str()); if (dir) { -#if !defined(OS_LINUX) && !defined(OS_MACOSX) +#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) #error Depending on the definition of struct dirent, additional space for \ pathname may be needed #endif @@ -125,8 +138,8 @@ int CountFilesCreatedAfter(const FilePath& path, (strcmp(ent->d_name, "..") == 0)) continue; - struct stat64 st; - int test = stat64(path.Append(ent->d_name).value().c_str(), &st); + stat_wrapper_t st; + int test = CallStat(path.Append(ent->d_name).value().c_str(), &st); if (test != 0) { LOG(ERROR) << "stat64 failed: " << strerror(errno); continue; @@ -160,8 +173,8 @@ int CountFilesCreatedAfter(const FilePath& path, // here. bool Delete(const FilePath& path, bool recursive) { const char* path_str = path.value().c_str(); - struct stat64 file_info; - int test = stat64(path_str, &file_info); + stat_wrapper_t file_info; + int test = CallStat(path_str, &file_info); if (test != 0) { // The Windows version defines this condition as success. bool ret = (errno == ENOENT || errno == ENOTDIR); @@ -302,19 +315,19 @@ bool CopyDirectory(const FilePath& from_path, } bool PathExists(const FilePath& path) { - struct stat64 file_info; - return (stat64(path.value().c_str(), &file_info) == 0); + stat_wrapper_t file_info; + return CallStat(path.value().c_str(), &file_info) == 0; } bool PathIsWritable(const FilePath& path) { FilePath test_path(path); - struct stat64 file_info; - if (stat64(test_path.value().c_str(), &file_info) != 0) { + stat_wrapper_t file_info; + if (CallStat(test_path.value().c_str(), &file_info) != 0) { // If the path doesn't exist, test the parent dir. test_path = test_path.DirName(); // If the parent dir doesn't exist, then return false (the path is not // directly writable). - if (stat64(test_path.value().c_str(), &file_info) != 0) + if (CallStat(test_path.value().c_str(), &file_info) != 0) return false; } if (S_IWOTH & file_info.st_mode) @@ -327,8 +340,8 @@ bool PathIsWritable(const FilePath& path) { } bool DirectoryExists(const FilePath& path) { - struct stat64 file_info; - if (stat64(path.value().c_str(), &file_info) == 0) + stat_wrapper_t file_info; + if (CallStat(path.value().c_str(), &file_info) == 0) return S_ISDIR(file_info.st_mode); return false; } @@ -460,8 +473,8 @@ bool CreateDirectory(const FilePath& full_path) { } bool GetFileInfo(const FilePath& file_path, FileInfo* results) { - struct stat64 file_info; - if (stat64(file_path.value().c_str(), &file_info) != 0) + stat_wrapper_t file_info; + if (CallStat(file_path.value().c_str(), &file_info) != 0) return false; results->is_directory = S_ISDIR(file_info.st_mode); results->size = file_info.st_size; @@ -637,7 +650,7 @@ bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries, if (!dir) return false; -#if !defined(OS_LINUX) && !defined(OS_MACOSX) +#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) #error Depending on the definition of struct dirent, additional space for \ pathname may be needed #endif diff --git a/base/gfx/native_widget_types.h b/base/gfx/native_widget_types.h index 08bf76f..0ca82f2 100644 --- a/base/gfx/native_widget_types.h +++ b/base/gfx/native_widget_types.h @@ -46,7 +46,7 @@ class NSView; class NSWindow; class NSTextField; #endif // __OBJC__ -#elif defined(OS_LINUX) +#elif defined(USE_X11) typedef struct _GdkCursor GdkCursor; typedef struct _GtkWidget GtkWidget; typedef struct _GtkWindow GtkWindow; @@ -69,7 +69,7 @@ typedef NSTextField* NativeEditView; typedef CGContext* NativeDrawingContext; typedef void* NativeCursor; typedef void* NativeMenu; -#elif defined(OS_LINUX) +#elif defined(USE_X11) typedef GtkWidget* NativeView; typedef GtkWindow* NativeWindow; typedef GtkWidget* NativeEditView; @@ -102,15 +102,15 @@ static inline NativeView NativeViewFromId(NativeViewId id) { #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_ON_MAC -#elif defined(OS_LINUX) +#elif defined(USE_X11) // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from // the renderer have to use Xlib. This is fine since these functions are // generally performed on the BACKGROUND_X thread which can't use GTK anyway. -#define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX +#define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_X11 -#endif // defined(OS_LINUX) +#endif // defined(USE_X11) // Convert a NativeView to a NativeViewId. See the comments above // NativeViewFromId. @@ -118,10 +118,10 @@ static inline NativeView NativeViewFromId(NativeViewId id) { static inline NativeViewId IdFromNativeView(NativeView view) { return reinterpret_cast<NativeViewId>(view); } -#elif defined(OS_LINUX) +#elif defined(USE_X11) // Not inlined because it involves pulling too many headers. NativeViewId IdFromNativeView(NativeView view); -#endif // defined(OS_LINUX) +#endif // defined(USE_X11) // PluginWindowHandle is an abstraction wrapping "the types of windows @@ -129,7 +129,7 @@ NativeViewId IdFromNativeView(NativeView view); // window id. #if defined(OS_WIN) typedef HWND PluginWindowHandle; -#elif defined(OS_LINUX) +#elif defined(USE_X11) typedef unsigned long PluginWindowHandle; #else // On OS X we don't have windowed plugins. diff --git a/base/gfx/rect.h b/base/gfx/rect.h index f944dd7..414a348 100644 --- a/base/gfx/rect.h +++ b/base/gfx/rect.h @@ -19,7 +19,7 @@ #if defined(OS_WIN) typedef struct tagRECT RECT; -#elif defined(OS_LINUX) +#elif defined(USE_X11) typedef struct _GdkRectangle GdkRectangle; #endif @@ -34,7 +34,7 @@ class Rect { explicit Rect(const RECT& r); #elif defined(OS_MACOSX) explicit Rect(const CGRect& r); -#elif defined(OS_LINUX) +#elif defined(USE_X11) explicit Rect(const GdkRectangle& r); #endif Rect(const gfx::Point& origin, const gfx::Size& size); @@ -45,7 +45,7 @@ class Rect { Rect& operator=(const RECT& r); #elif defined(OS_MACOSX) Rect& operator=(const CGRect& r); -#elif defined(OS_LINUX) +#elif defined(USE_X11) Rect& operator=(const GdkRectangle& r); #endif @@ -97,7 +97,7 @@ class Rect { #if defined(OS_WIN) // Construct an equivalent Win32 RECT object. RECT ToRECT() const; -#elif defined(OS_LINUX) +#elif defined(USE_X11) GdkRectangle ToGdkRectangle() const; #elif defined(OS_MACOSX) // Construct an equivalent CoreGraphics object. diff --git a/base/keyboard_codes.h b/base/keyboard_codes.h index 3d8700f..49add77 100644 --- a/base/keyboard_codes.h +++ b/base/keyboard_codes.h @@ -9,7 +9,7 @@ #if defined(OS_WIN) #include "base/keyboard_codes_win.h" -#elif defined(OS_LINUX) +#elif defined(USE_X11) #include "base/keyboard_codes_linux.h" #elif defined(OS_MACOSX) #include "base/keyboard_codes_mac.h" diff --git a/build/build_config.h b/build/build_config.h index a95edc5..906f492 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -26,16 +26,34 @@ #elif defined(_WIN32) #define OS_WIN 1 #define TOOLKIT_VIEWS 1 +#elif defined(__FreeBSD__) +#define OS_FREEBSD 1 +#define TOOLKIT_GTK #else #error Please add support for your platform in build/build_config.h #endif -// For access to standard POSIX features, use OS_POSIX instead of a more -// specific macro. -#if defined(OS_MACOSX) || defined(OS_LINUX) +// For access to standard POSIXish features, use OS_POSIX instead of a +// more specific macro. +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) #define OS_POSIX 1 #endif +// Use base::DataPack for name/value pairs. +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) +#define USE_BASE_DATA_PACK 1 +#endif + +// Use NSS for crypto. +#if defined(OS_LINUX) || defined(OS_FREEBSD) +#define USE_NSS 1 +#endif + +// Use X11 (and hence GTK/GDK) +#if defined(OS_LINUX) || defined(OS_FREEBSD) +#define USE_X11 1 +#endif + // Compiler detection. #if defined(__GNUC__) #define COMPILER_GCC 1 diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index fa3f0a1..b460814 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -52,7 +52,7 @@ #if defined(OS_WIN) #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/printer_query.h" -#elif defined(OS_MACOSX) || defined(OS_LINUX) +#elif defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) // TODO(port) remove this. #include "chrome/common/temp_scaffolding_stubs.h" #endif diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2167098..5aa5234 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -146,7 +146,7 @@ ['exclude', '/(gtk|win|x11)_[^/]*\\.cc$'], ], 'conditions': [ - ['OS=="linux"', {'sources/': [ + ['OS=="linux" or OS=="freebsd"', {'sources/': [ ['include', '/gtk/'], ['include', '_(gtk|linux|posix|skia|x)(_unittest)?\\.cc$'], ['include', '/(gtk|x11)_[^/]*\\.cc$'], @@ -2224,6 +2224,12 @@ 'browser/views/autocomplete/autocomplete_popup_gtk.h' ], }], + ['OS=="freebsd"', { + 'dependencies': [ + '../build/linux/system.gyp:gtk', + '../build/linux/system.gyp:nss', + ], + }], ['OS=="mac"', { 'sources!': [ 'browser/automation/automation_provider_list_generic.cc', @@ -2680,7 +2686,7 @@ 'browser/debugger/inspectable_tab_proxy.h', ], 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '../build/linux/system.gyp:gtk', ], @@ -3021,7 +3027,7 @@ 'INFOPLIST_FILE': 'app/app-Info.plist', }, 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'actions': [ { 'action_name': 'manpage', @@ -3462,7 +3468,7 @@ 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], 'process_outputs_as_mac_bundle_resources': 1, 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'outputs=': [ '<(INTERMEDIATE_DIR)/repack/default.pak', ] diff --git a/chrome/common/transport_dib.h b/chrome/common/transport_dib.h index c28d78d..6462ffc 100644 --- a/chrome/common/transport_dib.h +++ b/chrome/common/transport_dib.h @@ -13,7 +13,7 @@ #if defined(OS_WIN) #include <windows.h> -#elif defined(OS_LINUX) +#elif defined(USE_X11) #include "chrome/common/x11_util.h" #endif @@ -81,7 +81,7 @@ class TransportDIB { // Returns a default, invalid handle, that is meant to indicate a missing // Transport DIB. static Handle DefaultHandleValue() { return Handle(); } -#elif defined(OS_LINUX) +#elif defined(USE_X11) typedef int Handle; // These two ints are SysV IPC shared memory keys typedef int Id; @@ -123,7 +123,7 @@ class TransportDIB { // wire to give this transport DIB to another process. Handle handle() const; -#if defined(OS_LINUX) +#if defined(USE_X11) // Map the shared memory into the X server and return an id for the shared // segment. XID MapToX(Display* connection); @@ -135,7 +135,7 @@ class TransportDIB { explicit TransportDIB(base::SharedMemoryHandle dib); base::SharedMemory shared_memory_; uint32 sequence_num_; -#elif defined(OS_LINUX) +#elif defined(USE_X11) int key_; // SysV shared memory id void* address_; // mapped address XID x_shm_; // X id for the shared segment diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc index b6d53a7..2f1af81 100644 --- a/media/base/media_posix.cc +++ b/media/base/media_posix.cc @@ -21,7 +21,7 @@ namespace { #if defined(OS_MACOSX) #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." #VERSION ".dylib") -#elif defined(OS_LINUX) +#elif defined(OS_POSIX) #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION) #else #error "Do not know how to construct DSO name for this OS." diff --git a/media/media.gyp b/media/media.gyp index d846874..896374c 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -12,6 +12,7 @@ 'target_defaults': { 'conditions': [ ['OS!="linux"', {'sources/': [['exclude', '/linux/']]}], + ['OS!="freebsd"', {'sources/': [['exclude', '/freebsd/']]}], ['OS!="mac"', {'sources/': [['exclude', '/mac/']]}], ['OS!="win"', {'sources/': [['exclude', '/win/']]}], ], @@ -127,6 +128,14 @@ ], }, }], + ['OS =="freebsd"', { + 'sources/': [ ['exclude', '_(mac|win)\\.cc$'], + ['exclude', '\\.mm?$' ] ], + 'link_settings': { + 'libraries': [ + ], + }, + }], ['OS =="mac"', { 'link_settings': { 'libraries': [ @@ -183,7 +192,7 @@ 'filters/video_renderer_base_unittest.cc', ], 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ # Needed for the following #include chain: # base/run_all_unittests.cc diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h index f16fa1f..a1a55c0 100644 --- a/skia/ext/platform_canvas.h +++ b/skia/ext/platform_canvas.h @@ -47,7 +47,7 @@ class PlatformCanvas : public SkCanvas { // For two-part init, call if you use the no-argument constructor above bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); -#elif defined(__linux__) +#elif defined(__linux__) || defined(__FreeBSD__) // Linux --------------------------------------------------------------------- // Construct a canvas from the given memory region. The memory is not cleared diff --git a/skia/ext/platform_device.h b/skia/ext/platform_device.h index 00845ca..f54da7a 100644 --- a/skia/ext/platform_device.h +++ b/skia/ext/platform_device.h @@ -12,7 +12,7 @@ #include "skia/ext/platform_device_win.h" #elif defined(__APPLE__) #include "skia/ext/platform_device_mac.h" -#elif defined(__linux__) +#elif defined(__linux__) || defined(__FreeBSD__) #include "skia/ext/platform_device_linux.h" #endif diff --git a/skia/skia.gyp b/skia/skia.gyp index 67d1079..833235f 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -578,7 +578,7 @@ [ 'OS != "win"', { 'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ], }], - [ 'OS == "linux"', { + [ 'OS == "linux" or OS == "freebsd"', { 'dependencies': [ '../build/linux/system.gyp:gdk', '../build/linux/system.gyp:fontconfig', diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp index 49aa5cf..623aa06 100755 --- a/third_party/ffmpeg/ffmpeg.gyp +++ b/third_party/ffmpeg/ffmpeg.gyp @@ -8,7 +8,7 @@ ], 'target_defaults': { 'conditions': [ - ['OS!="linux"', {'sources/': [['exclude', '/linux/']]}], + ['OS!="linux" and OS!="freebsd"', {'sources/': [['exclude', '/linux/']]}], ['OS!="mac"', {'sources/': [['exclude', '/mac/']]}], ['OS!="win"', {'sources/': [['exclude', '/win/']]}], ], @@ -201,7 +201,7 @@ ], }, 'dependencies': ['../../build/win/system.gyp:cygwin'], - }], ['OS=="linux"', { + }], ['OS=="linux" or OS=="freebsd"', { 'conditions': [ ['use_system_ffmpeg==0', { 'variables': { diff --git a/third_party/libevent/libevent.gyp b/third_party/libevent/libevent.gyp index b9dcabc..fc95efb 100644 --- a/third_party/libevent/libevent.gyp +++ b/third_party/libevent/libevent.gyp @@ -39,7 +39,7 @@ # provided and live in platform-specific directories. [ 'OS == "linux"', { 'sources': [ 'epoll.c', 'epoll_sub.c' ], 'include_dirs': [ 'linux' ] } ], - [ 'OS == "mac"', { 'sources': [ 'kqueue.c' ], + [ 'OS == "mac" or OS == "freebsd"', { 'sources': [ 'kqueue.c' ], 'include_dirs': [ 'mac' ] } ], ], }, diff --git a/third_party/libxml/libxml.gyp b/third_party/libxml/libxml.gyp index 50528ad..848c857 100644 --- a/third_party/libxml/libxml.gyp +++ b/third_party/libxml/libxml.gyp @@ -5,7 +5,7 @@ { 'variables': { 'conditions': [ - ['OS=="linux"', {'os_include': 'linux'}], + ['OS=="linux" or OS=="freebsd"', {'os_include': 'linux'}], ['OS=="mac"', {'os_include': 'mac'}], ['OS=="win"', {'os_include': 'win32'}], ], @@ -18,7 +18,7 @@ { 'target_name': 'libxml', 'conditions': [ - ['OS=="linux" and use_system_libxml', { + ['(OS=="linux" or OS=="freebsd") and use_system_libxml', { 'type': 'settings', 'direct_dependent_settings': { 'cflags': [ diff --git a/third_party/libxslt/libxslt.gyp b/third_party/libxslt/libxslt.gyp index 76f6091..61bf795 100644 --- a/third_party/libxslt/libxslt.gyp +++ b/third_party/libxslt/libxslt.gyp @@ -5,7 +5,7 @@ { 'variables': { 'conditions': [ - ['OS=="linux"', {'os_include': 'linux'}], + ['OS=="linux" or OS=="freebsd"', {'os_include': 'linux'}], ['OS=="mac"', {'os_include': 'mac'}], ['OS=="win"', {'os_include': 'win32'}], ], diff --git a/third_party/npapi/bindings/npapi.h b/third_party/npapi/bindings/npapi.h index e60ef7a..44f3612 100644 --- a/third_party/npapi/bindings/npapi.h +++ b/third_party/npapi/bindings/npapi.h @@ -105,7 +105,7 @@ // BEGIN GOOGLE MODIFICATIONS // On Linux and Mac, be sure to set Mozilla-specific macros. -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_FREEBSD) #define XP_UNIX 1 #define MOZ_X11 1 #elif defined(OS_MACOSX) diff --git a/webkit/build/rule_gperf.py b/webkit/build/rule_gperf.py index 873eff8..ef24b40 100755 --- a/webkit/build/rule_gperf.py +++ b/webkit/build/rule_gperf.py @@ -41,13 +41,16 @@ assert input_name in gperf_commands (input_root, input_ext) = posixpath.splitext(input_name) output_cpp = posixpath.join(output_dir, input_root + '.cpp') -command = ['gperf', '--output-file', output_cpp] +#command = ['gperf', '--output-file', output_cpp] +command = ['gperf'] command.extend(gperf_commands[input_name]) command.append(input_file) +ofile = open(output_cpp, 'w') + # Do it. check_call is new in 2.5, so simulate its behavior with call and # assert. -return_code = subprocess.call(command) +return_code = subprocess.call(command, stdout=ofile.fileno()) assert return_code == 0 output_c = posixpath.join(output_dir, input_root + '.c') diff --git a/webkit/glue/plugins/nphostapi.h b/webkit/glue/plugins/nphostapi.h index c9751c0..c6ee0af 100644 --- a/webkit/glue/plugins/nphostapi.h +++ b/webkit/glue/plugins/nphostapi.h @@ -266,7 +266,7 @@ typedef struct _NPNetscapeFuncs { // // NPAPI library entry points // -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_FREEBSD) typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pNFuncs, NPPluginFuncs* pPFuncs); #else diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc index 11f8675..05c12e9 100644 --- a/webkit/glue/plugins/plugin_lib.cc +++ b/webkit/glue/plugins/plugin_lib.cc @@ -104,7 +104,7 @@ NPError PluginLib::NP_Initialize() { if (host == 0) return NPERR_GENERIC_ERROR; -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_FREEBSD) NPError rv = entry_points_.np_initialize(host->host_functions(), &plugin_funcs_); #else @@ -170,7 +170,7 @@ bool PluginLib::Load() { if (entry_points_.np_initialize == 0) rv = false; -#if !defined(OS_LINUX) +#if !defined(OS_LINUX) && !defined(OS_FREEBSD) entry_points_.np_getentrypoints = (NP_GetEntryPointsFunc)base::GetFunctionPointerFromNativeLibrary( library, "NP_GetEntryPoints"); @@ -190,7 +190,7 @@ bool PluginLib::Load() { if (rv) { plugin_funcs_.size = sizeof(plugin_funcs_); plugin_funcs_.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; -#if !defined(OS_LINUX) +#if !defined(OS_LINUX) && !defined(OS_FREEBSD) if (entry_points_.np_getentrypoints(&plugin_funcs_) != NPERR_NO_ERROR) rv = false; #else diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 4c103c0..d8b5662 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -35,7 +35,7 @@ class PluginInstance; // This struct holds entry points into a plugin. The entry points are // slightly different between Linux and other platforms. struct PluginEntryPoints { -#if !defined(OS_LINUX) +#if !defined(OS_LINUX) && !defined(OS_FREEBSD) NP_GetEntryPointsFunc np_getentrypoints; #endif NP_InitializeFunc np_initialize; diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 56d5b6e..6d53339 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -19,7 +19,7 @@ #include "webkit/glue/webcursor.h" #include "webkit/glue/webplugin_delegate.h" -#if defined(OS_LINUX) +#if defined(USE_X11) typedef struct _GdkDrawable GdkPixmap; #endif @@ -217,7 +217,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { bool is_calling_wndproc; #endif // OS_WIN -#if defined(OS_LINUX) +#if defined(USE_X11) // The pixmap we're drawing into, for a windowless plugin. GdkPixmap* pixmap_; double first_event_time_; @@ -298,7 +298,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // Runnable Method Factory used to invoke the OnUserGestureEnd method // asynchronously. -#if !defined(OS_LINUX) +#if !defined(USE_X11) ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; #endif diff --git a/webkit/glue/webcursor.h b/webkit/glue/webcursor.h index 86d693f..afd27a5 100644 --- a/webkit/glue/webcursor.h +++ b/webkit/glue/webcursor.h @@ -15,7 +15,7 @@ typedef struct HINSTANCE__* HINSTANCE; typedef struct HICON__* HICON; typedef HICON HCURSOR; -#elif defined(OS_LINUX) +#elif defined(USE_X11) // GdkCursorType is an enum, which we can't forward-declare. :( // If you work around this, be sure to fix webkit.gyp:glue to not put // GTK in the export_dependent_settings section! @@ -77,7 +77,7 @@ class WebCursor { // APIs on it. void InitFromExternalCursor(HCURSOR handle); -#elif defined(OS_LINUX) +#elif defined(USE_X11) // Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP // if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor // should be set to the system default. diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index a8b0aaf..7521532 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1066,7 +1066,7 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) { return 0; } -#if defined(OS_WIN) || defined(OS_LINUX) +#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD) PlatformContextSkia context(canvas); GraphicsContext spool(&context); #elif defined(OS_MACOSX) diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 5fdaf9e..0abcce9 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -1334,7 +1334,7 @@ bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy( return false; const MouseEvent* event = static_cast<const MouseEvent*>(action.event()); -#if defined(OS_WIN) || defined(OS_LINUX) +#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD) const bool new_tab_modifier = (event->button() == 1) || event->ctrlKey(); #elif defined(OS_MACOSX) const bool new_tab_modifier = (event->button() == 1) || event->metaKey(); diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 4fd1626..3dfdca2 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -8,7 +8,7 @@ #if defined(OS_WIN) #include <objidl.h> #include <mlang.h> -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_FREEBSD) #include <sys/utsname.h> #endif diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index a493546..bc02539 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -288,7 +288,7 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit', ], }], - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'defines': ['WTF_USE_PTHREADS=1'], 'direct_dependent_settings': { 'defines': ['WTF_USE_PTHREADS=1'], @@ -775,7 +775,7 @@ '../v8/tools/gyp/v8.gyp:v8', ], }], - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '../build/linux/system.gyp:fontconfig', '../build/linux/system.gyp:gtk', @@ -936,7 +936,7 @@ 'include_dirs+++': ['../third_party/WebKit/WebCore/dom'], }, }], - ['OS!="linux"', {'sources/': [['exclude', '(Gtk|Linux)\\.cpp$']]}], + ['OS!="linux" and OS!="freebsd"', {'sources/': [['exclude', '(Gtk|Linux)\\.cpp$']]}], ['OS!="mac"', {'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']]}], ['OS!="win"', { 'sources/': [ @@ -1109,7 +1109,7 @@ 'api/src/win/WebScreenInfoFactory.cpp', ], 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '../build/linux/system.gyp:x11', '../build/linux/system.gyp:gtk', @@ -1119,7 +1119,7 @@ 'api/public/gtk', 'api/public/linux', ], - }, { # else: OS!="linux" + }, { # else: OS!="linux" and OS!="freebsd" 'sources/': [ ['exclude', '/gtk/'], ['exclude', '/x11/'], @@ -1204,6 +1204,9 @@ ], 'outputs': [ '<(grit_out_dir)/grit/webkit_strings.h', + # TODO(benl) Generate this list from a helper script, like + # repack_locales_cmd in chrome.gyp (see TODO(mmoss)) + '<(grit_out_dir)/webkit_strings_ar.pak', '<(grit_out_dir)/webkit_strings_da.pak', '<(grit_out_dir)/webkit_strings_da.rc', '<(grit_out_dir)/webkit_strings_en-US.pak', @@ -1482,7 +1485,7 @@ 'webcore', ], 'conditions': [ - ['OS=="linux"', { + ['OS=="linux" or OS=="freebsd"', { 'dependencies': [ '../build/linux/system.gyp:gtk', '../base/base.gyp:linux_versioninfo', @@ -1494,7 +1497,7 @@ 'sources!': [ 'glue/plugins/plugin_stubs.cc', ], - }, { # else: OS!="linux" + }, { # else: OS!="linux" and OS!="freebsd" 'sources/': [['exclude', '_(linux|gtk)(_data)?\\.cc$'], ['exclude', r'/gtk_']], }], |