summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 06:49:30 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 06:49:30 +0000
commit732fa94a7ac29dd39eb6afcb321ba97921660383 (patch)
treeb075741f6fe9b3a067d1a32321428a38a10069e1
parent63a8ba1e1fb71156beff23b4a26828dbc387c734 (diff)
downloadchromium_src-732fa94a7ac29dd39eb6afcb321ba97921660383.zip
chromium_src-732fa94a7ac29dd39eb6afcb321ba97921660383.tar.gz
chromium_src-732fa94a7ac29dd39eb6afcb321ba97921660383.tar.bz2
Linux: clean up the usage of "use_cups" gyp switch:
This CL removes duplication and fixes a build error on system with no CUPS. It uses cups-config instead of hardcoding flags. Also, it removes a superfluous dependency on gcrypt from chrome_browser.gypi. printing uses gcrypt explicitly, but chrome/browser doesn't. It was just blindly copy-pasted. I just extracted libgcrypt target to build/linux/system.gyp, and switched to libgcrypt-config instead of hardcoding flags. BUG=none Review URL: http://codereview.chromium.org/6883221 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83489 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/linux/system.gyp17
-rw-r--r--chrome/browser/ui/webui/print_preview_handler.cc14
-rw-r--r--chrome/chrome.gyp19
-rw-r--r--chrome/chrome_browser.gypi5
-rw-r--r--printing/printing.gyp54
5 files changed, 70 insertions, 39 deletions
diff --git a/build/linux/system.gyp b/build/linux/system.gyp
index cbe51940..9a160b7 100644
--- a/build/linux/system.gyp
+++ b/build/linux/system.gyp
@@ -270,6 +270,23 @@
}]]
},
{
+ 'target_name': 'libgcrypt',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(libgcrypt-config --cflags)',
+ ],
+ },
+ 'link_settings': {
+ 'libraries': [
+ '<!@(libgcrypt-config --libs)',
+ ],
+ },
+ }]]
+ },
+ {
'target_name': 'selinux',
'type': 'settings',
'conditions': [
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index d6ebd19..0aefdc9 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -30,7 +30,7 @@
#include "printing/metafile_impl.h"
#include "printing/print_job_constants.h"
-#if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#if defined(USE_CUPS)
#include <cups/cups.h>
#include "base/file_util.h"
@@ -44,7 +44,7 @@ const bool kLandscapeDefaultValue = false;
const char kDisableColorOption[] = "disableColorOption";
const char kSetColorAsDefault[] = "setColorAsDefault";
-#if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#if defined(USE_CUPS)
const char kColorDevice[] = "ColorDevice";
#elif defined(OS_WIN)
const char kPskColor[] = "psk:Color";
@@ -127,7 +127,7 @@ class PrintSystemTaskProxy
return;
}
- #if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#if defined(USE_CUPS)
FilePath ppd_file_path;
if (!file_util::CreateTemporaryFile(&ppd_file_path))
return;
@@ -149,16 +149,16 @@ class PrintSystemTaskProxy
ppdClose(ppd);
}
file_util::Delete(ppd_file_path, false);
- #elif defined(OS_WIN)
+#elif defined(OS_WIN)
// According to XPS 1.0 spec, only color printers have psk:Color.
// Therefore we don't need to parse the whole XML file, we just need to
// search the string. The spec can be found at:
// http://msdn.microsoft.com/en-us/windows/hardware/gg463431.
supports_color = (printer_info.printer_capabilities.find(kPskColor) !=
std::string::npos);
- #elif defined(OS_CHROMEOS)
- NOTIMPLEMENTED();
- #endif
+#else
+ NOTIMPLEMENTED();
+#endif
DictionaryValue settings_info;
settings_info.SetBoolean(kDisableColorOption, !supports_color);
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 73aeb1e..3f53f8e 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -807,6 +807,9 @@
],
}],
['use_cups==1', {
+ 'dependencies': [
+ '../printing/printing.gyp:cups',
+ ],
'defines': [
# CP_PRINT_SYSTEM_AVAILABLE disables default dummy implementation
# of cloud print system, and allows to use custom implementaiton.
@@ -815,22 +818,6 @@
'sources': [
'service/cloud_print/print_system_cups.cc',
],
- 'conditions': [
- ['OS=="mac"', {
- 'link_settings': {
- 'libraries': [
- '$(SDKROOT)/usr/lib/libcups.dylib',
- ]
- },
- }, {
- 'link_settings': {
- 'libraries': [
- '-lcups',
- '-lgcrypt',
- ],
- },
- }],
- ],
}],
['remoting==1', {
'dependencies': [
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index da723a2..8192940 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3501,6 +3501,11 @@
'browser/platform_util_linux.cc',
],
}],
+ ['use_cups==1', {
+ 'dependencies': [
+ '../printing/printing.gyp:cups',
+ ],
+ }],
['use_gconf==0', {
'sources!': [
'browser/ui/gtk/gconf_titlebar_listener.cc',
diff --git a/printing/printing.gyp b/printing/printing.gyp
index 1a39bfd..e3cafd2 100644
--- a/printing/printing.gyp
+++ b/printing/printing.gyp
@@ -125,6 +125,16 @@
],
}],
['use_cups==1', {
+ 'dependencies': [
+ 'cups',
+ ],
+ 'conditions': [
+ ['OS!="mac"', {
+ 'dependencies': [
+ '../build/linux/system.gyp:libgcrypt',
+ ],
+ }],
+ ],
'defines': [
# PRINT_BACKEND_AVAILABLE disables the default dummy implementation
# of the print backend and enables a custom implementation instead.
@@ -135,22 +145,6 @@
'backend/cups_helper.h',
'backend/print_backend_cups.cc',
],
- 'conditions': [
- ['OS=="mac"', {
- 'link_settings': {
- 'libraries': [
- '$(SDKROOT)/usr/lib/libcups.dylib',
- ]
- },
- }, {
- 'link_settings': {
- 'libraries': [
- '-lcups',
- '-lgcrypt',
- ],
- },
- }],
- ],
}],
],
},
@@ -201,6 +195,34 @@
}],
],
},
+ {
+ 'target_name': 'cups',
+ 'type': 'none',
+ 'conditions': [
+ ['use_cups==1', {
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'USE_CUPS',
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'link_settings': {
+ 'libraries': [
+ '$(SDKROOT)/usr/lib/libcups.dylib',
+ ]
+ },
+ }, {
+ 'link_settings': {
+ 'libraries': [
+ '<!@(cups-config --libs)',
+ ],
+ },
+ }],
+ ],
+ },
+ }],
+ ],
+ },
],
}