conan-recipes/recipes/breakpad/all/patches/0009-Teach-gyp-generated-Makefile-to-build-crash_generati.patch

166 lines
5.4 KiB
Diff
Raw Permalink Normal View History

2020-10-19 08:52:36 +11:00
From c2929728b60c9d5051acbce095d44da946cc080f Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Mon, 10 Feb 2014 18:12:14 +0000
Subject: [PATCH 09/19] Teach gyp generated Makefile to build
crash_generation_app correctly
- Use linker flag for Windows subsystem
- Use linker flag for unicode
- Add rule for compiling windows resources, using $RC to name the resource compiler
- Rename crash_generation_app.rc to avoid a clash in corresponding .o names
Also
- Fix linking of unit test when built using gyp generated Makefile by providing
needed library
XXX: We need to arrange for the gyp Makefile generator to set
CXXFLAGS="-DUNICODE -D_UNICODE" somewhere when generating for Windows. This is
already done in generated MSVS projects.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
.../crash_generation_app.gyp | 29 ++++++++++++++++---
.../{crash_generation_app.rc => resource.rc} | 13 ++++-----
src/client/windows/unittests/client_tests.gyp | 12 ++++++--
3 files changed, 41 insertions(+), 13 deletions(-)
rename src/client/windows/tests/crash_generation_app/{crash_generation_app.rc => resource.rc} (96%)
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp b/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
index 3ce307da..774f6004 100644
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
+++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
@@ -40,19 +40,40 @@
'crash_generation_app.cc',
'crash_generation_app.h',
'crash_generation_app.ico',
- 'crash_generation_app.rc',
+ 'resource.rc',
'resource.h',
'small.ico',
],
- 'libraries': [
- 'user32.lib',
- ],
'dependencies': [
'../../breakpad_client.gyp:common',
'../../crash_generation/crash_generation.gyp:crash_generation_server',
'../../crash_generation/crash_generation.gyp:crash_generation_client',
'../../handler/exception_handler.gyp:exception_handler',
],
+ 'conditions': [
+ [ '"<(GENERATOR)" == "make"', {
+ 'ldflags': [
+ '-Wl,--subsystem=2', '-municode'
+ ],
+ 'rules': [
+ { 'rule_name': 'windres',
+ 'extension': 'rc',
+ 'inputs' : [ ],
+ 'outputs' : [ '$(builddir)/<(RULE_INPUT_ROOT).o' ],
+ 'action' : [ '$(RC)', '--input=<(RULE_INPUT_PATH)', '--output=$(builddir)/<(RULE_INPUT_ROOT).o', '--input-format=rc', '--output-format=coff', '-v', '--use-temp-file' ],
+ 'message' : 'Compiling Windows resources',
+ 'process_outputs_as_sources' : 1,
+ },
+ ],
+ }
+ ],
+ [ '"<(GENERATOR)" == "msvs"', {
+ 'libraries': [
+ 'user32.lib',
+ ],
+ }
+ ]
+ ],
'msvs_settings': {
'VCLinkerTool': {
'SubSystem': '2', # Windows Subsystem as opposed to a console app
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.rc b/src/client/windows/tests/crash_generation_app/resource.rc
similarity index 96%
rename from src/client/windows/tests/crash_generation_app/crash_generation_app.rc
rename to src/client/windows/tests/crash_generation_app/resource.rc
index a362562b..6c7e8b63 100644
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.rc
+++ b/src/client/windows/tests/crash_generation_app/resource.rc
@@ -38,7 +38,7 @@ IDI_SMALL ICON "small.ico"
// Menu
//
-IDC_CRASHGENERATIONAPP MENU
+IDC_CRASHGENERATIONAPP MENU
BEGIN
POPUP "&File"
BEGIN
@@ -64,7 +64,7 @@ END
// Accelerator
//
-IDC_CRASHGENERATIONAPP ACCELERATORS
+IDC_CRASHGENERATIONAPP ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
@@ -94,12 +94,12 @@ END
// TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
@@ -107,7 +107,7 @@ BEGIN
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -121,7 +121,7 @@ END
// String Table
//
-STRINGTABLE
+STRINGTABLE
BEGIN
IDS_APP_TITLE "CrashGenerationApp"
IDC_CRASHGENERATIONAPP "CRASHGENERATIONAPP"
@@ -141,4 +141,3 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/src/client/windows/unittests/client_tests.gyp b/src/client/windows/unittests/client_tests.gyp
index 768f8fd8..87caf8d6 100644
--- a/src/client/windows/unittests/client_tests.gyp
+++ b/src/client/windows/unittests/client_tests.gyp
@@ -51,8 +51,16 @@
'../crash_generation/crash_generation.gyp:crash_generation_server',
'../crash_generation/crash_generation.gyp:crash_generation_client',
'../handler/exception_handler.gyp:exception_handler',
- 'processor_bits',
- ]
+ 'processor_bits',
+ ],
+ 'conditions': [
+ [ '"<(GENERATOR)" == "make"', {
+ 'libraries': [
+ '-ldbghelp', '-lversion', '-lpthread',
+ ],
+ },
+ ],
+ ],
},
{
'target_name': 'processor_bits',
--
2.28.0