fee404ef933e569b4089dc656721e2d14ca8a5f7
[platform/framework/web/crosswalk.git] / src / third_party / instrumented_libraries / instrumented_libraries.gyp
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 {
6   'variables': {
7     'verbose_libraries_build%': 0,
8     'instrumented_libraries_jobs%': 1,
9   },
10
11   'conditions': [
12     ['asan==1', {
13       'sanitizer_type': 'asan',
14     }],
15     ['msan==1', {
16       'sanitizer_type': 'msan',
17     }],
18     ['tsan==1', {
19       'sanitizer_type': 'tsan',
20     }],
21     ['use_goma==1', {
22       'cc': '<(gomadir)/gomacc <!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang',
23       'cxx': '<(gomadir)/gomacc <!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang++',
24     }, {
25       'cc': '<!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang',
26       'cxx': '<!(cd <(DEPTH) && pwd -P)/<(make_clang_dir)/bin/clang++',
27     }],
28   ],
29
30   'target_defaults': {
31     'build_method': 'destdir',
32     'extra_configure_flags': [],
33     'jobs': '<(instrumented_libraries_jobs)',
34     'package_cflags': [
35       '-O2',
36       '-gline-tables-only',
37       '-fPIC',
38       '-w',
39       '-U_FORITFY_SOURCE'
40     ],
41     'package_ldflags': [
42       '-Wl,-z,origin',
43       # We set RPATH=XORIGIN when building the package and replace it with
44       # $ORIGIN later. The reason is that this flag goes through configure/make
45       # differently for different packages. Because of this, we can't escape the
46       # $ character in a way that would work for every package.
47       '-Wl,-R,XORIGIN/.'
48     ],
49     'patch': '',
50     'run_before_build': '',
51     'asan_blacklist': '',
52     'msan_blacklist': '',
53     'tsan_blacklist': '',
54
55     'conditions': [
56       ['asan==1', {
57         'package_cflags': ['-fsanitize=address'],
58         'package_ldflags': ['-fsanitize=address'],
59       }],
60       ['msan==1', {
61         'package_cflags': [
62           '-fsanitize=memory',
63           '-fsanitize-memory-track-origins=<(msan_track_origins)'
64         ],
65         'package_ldflags': ['-fsanitize=memory'],
66       }],
67       ['tsan==1', {
68         'package_cflags': ['-fsanitize=thread'],
69         'package_ldflags': ['-fsanitize=thread'],
70       }],
71     ],
72   },
73
74   'targets': [
75     {
76       'target_name': 'instrumented_libraries',
77       'type': 'none',
78       'variables': {
79         'prune_self_dependency': 1,
80         # Don't add this target to the dependencies of targets with type=none.
81         'link_dependency': 1,
82       },
83       'dependencies': [
84         '<(_sanitizer_type)-libcairo2',
85         '<(_sanitizer_type)-libexpat1',
86         '<(_sanitizer_type)-libffi6',
87         '<(_sanitizer_type)-libgcrypt11',
88         '<(_sanitizer_type)-libgpg-error0',
89         '<(_sanitizer_type)-libnspr4',
90         '<(_sanitizer_type)-libp11-kit0',
91         '<(_sanitizer_type)-libpcre3',
92         '<(_sanitizer_type)-libpng12-0',
93         '<(_sanitizer_type)-libx11-6',
94         '<(_sanitizer_type)-libxau6',
95         '<(_sanitizer_type)-libxcb1',
96         '<(_sanitizer_type)-libxcomposite1',
97         '<(_sanitizer_type)-libxcursor1',
98         '<(_sanitizer_type)-libxdamage1',
99         '<(_sanitizer_type)-libxdmcp6',
100         '<(_sanitizer_type)-libxext6',
101         '<(_sanitizer_type)-libxfixes3',
102         '<(_sanitizer_type)-libxi6',
103         '<(_sanitizer_type)-libxinerama1',
104         '<(_sanitizer_type)-libxrandr2',
105         '<(_sanitizer_type)-libxrender1',
106         '<(_sanitizer_type)-libxss1',
107         '<(_sanitizer_type)-libxtst6',
108         '<(_sanitizer_type)-zlib1g',
109         '<(_sanitizer_type)-libglib2.0-0',
110         '<(_sanitizer_type)-libdbus-1-3',
111         '<(_sanitizer_type)-libdbus-glib-1-2',
112         '<(_sanitizer_type)-nss',
113         '<(_sanitizer_type)-libfontconfig1',
114         '<(_sanitizer_type)-pulseaudio',
115         '<(_sanitizer_type)-libasound2',
116         '<(_sanitizer_type)-pango1.0',
117         '<(_sanitizer_type)-libcap2',
118         '<(_sanitizer_type)-libudev0',
119         '<(_sanitizer_type)-libtasn1-3',
120         '<(_sanitizer_type)-libgnome-keyring0',
121         '<(_sanitizer_type)-libgtk2.0-0',
122         '<(_sanitizer_type)-libgdk-pixbuf2.0-0',
123         '<(_sanitizer_type)-libpci3',
124         '<(_sanitizer_type)-libdbusmenu-glib4',
125         '<(_sanitizer_type)-liboverlay-scrollbar-0.2-0',
126         '<(_sanitizer_type)-libgconf-2-4',
127         '<(_sanitizer_type)-libappindicator1',
128         '<(_sanitizer_type)-libdbusmenu',
129         '<(_sanitizer_type)-atk1.0',
130         '<(_sanitizer_type)-libunity9',
131         '<(_sanitizer_type)-dee',
132       ],
133       'conditions': [
134         ['asan==1', {
135           'dependencies': [
136             '<(_sanitizer_type)-libpixman-1-0',
137           ],
138         }],
139         ['msan==1', {
140           'dependencies': [
141             '<(_sanitizer_type)-libcups2',
142           ],
143         }],
144         ['tsan==1', {
145           'dependencies!': [
146             '<(_sanitizer_type)-libpng12-0',
147           ],
148         }],
149       ],
150       'actions': [
151         {
152           'action_name': 'fix_rpaths',
153           'inputs': [
154             'fix_rpaths.sh',
155           ],
156           'outputs': [
157             '<(PRODUCT_DIR)/instrumented_libraries/<(_sanitizer_type)/rpaths.fixed.txt',
158           ],
159           'action': [
160             '<(DEPTH)/third_party/instrumented_libraries/fix_rpaths.sh',
161             '<(PRODUCT_DIR)/instrumented_libraries/<(_sanitizer_type)'
162           ],
163         },
164       ],
165       'direct_dependent_settings': {
166         'target_conditions': [
167           ['_toolset=="target"', {
168             'ldflags': [
169               # Add RPATH to result binary to make it linking instrumented libraries ($ORIGIN means relative RPATH)
170               '-Wl,-R,\$$ORIGIN/instrumented_libraries/<(_sanitizer_type)/lib/:\$$ORIGIN/instrumented_libraries/<(_sanitizer_type)/usr/lib/x86_64-linux-gnu/',
171               '-Wl,-z,origin',
172             ],
173           }],
174         ],
175       },
176     },
177     {
178       'package_name': 'freetype',
179       'dependencies=': [],
180       'run_before_build': 'scripts/freetype.sh',
181       'includes': ['standard_instrumented_package_target.gypi'],
182     },
183     {
184       'package_name': 'libcairo2',
185       'dependencies=': [],
186       'extra_configure_flags': ['--disable-gtk-doc'],
187       'includes': ['standard_instrumented_package_target.gypi'],
188     },
189     {
190       'package_name': 'libdbus-1-3',
191       'dependencies=': [],
192       'includes': ['standard_instrumented_package_target.gypi'],
193     },
194     {
195       'package_name': 'libdbus-glib-1-2',
196       'dependencies=': [],
197       # Use system dbus-binding-tool. The just-built one is instrumented but
198       # doesn't have the correct RPATH, and will crash.
199       'extra_configure_flags': ['--with-dbus-binding-tool=dbus-binding-tool'],
200       'includes': ['standard_instrumented_package_target.gypi'],
201     },
202     {
203       'package_name': 'libexpat1',
204       'dependencies=': [],
205       'includes': ['standard_instrumented_package_target.gypi'],
206     },
207     {
208       'package_name': 'libffi6',
209       'dependencies=': [],
210       'includes': ['standard_instrumented_package_target.gypi'],
211     },
212     {
213       'package_name': 'libfontconfig1',
214       'dependencies=': [],
215       'extra_configure_flags': [
216         '--disable-docs',
217         '--sysconfdir=/etc/',
218         # From debian/rules.
219         '--with-add-fonts=/usr/X11R6/lib/X11/fonts,/usr/local/share/fonts',
220       ],
221       'patch': 'patches/libfontconfig.diff',
222       'includes': ['standard_instrumented_package_target.gypi'],
223     },
224     {
225       'package_name': 'libgcrypt11',
226       'dependencies=': [],
227       'package_ldflags': ['-Wl,-z,muldefs'],
228       'extra_configure_flags': [
229         # From debian/rules.
230         '--enable-noexecstack',
231         '--enable-ld-version-script',
232         '--enable-static',
233         # http://crbug.com/344505
234         '--disable-asm'
235       ],
236       'includes': ['standard_instrumented_package_target.gypi'],
237     },
238     {
239       'package_name': 'libglib2.0-0',
240       'dependencies=': [],
241       'extra_configure_flags': [
242         '--disable-gtk-doc',
243         '--disable-gtk-doc-html',
244         '--disable-gtk-doc-pdf',
245       ],
246       'asan_blacklist': 'blacklists/asan/libglib2.0-0.txt',
247       'includes': ['standard_instrumented_package_target.gypi'],
248     },
249     {
250       'package_name': 'libgpg-error0',
251       'dependencies=': [],
252       'includes': ['standard_instrumented_package_target.gypi'],
253     },
254     {
255       'package_name': 'libnspr4',
256       'dependencies=': [],
257       'extra_configure_flags': [
258         '--enable-64bit',
259         # TSan reports data races on debug variables.
260         '--disable-debug',
261       ],
262       'run_before_build': 'scripts/libnspr4.sh',
263       'includes': ['standard_instrumented_package_target.gypi'],
264     },
265     {
266       'package_name': 'libp11-kit0',
267       'dependencies=': [],
268       'includes': ['standard_instrumented_package_target.gypi'],
269     },
270     {
271       'package_name': 'libpcre3',
272       'dependencies=': [],
273       'extra_configure_flags': [
274         '--enable-utf8',
275         '--enable-unicode-properties',
276       ],
277       'includes': ['standard_instrumented_package_target.gypi'],
278     },
279     {
280       'package_name': 'libpixman-1-0',
281       'dependencies=': [],
282       'includes': ['standard_instrumented_package_target.gypi'],
283     },
284     {
285       'package_name': 'libpng12-0',
286       'dependencies=': [],
287       'includes': ['standard_instrumented_package_target.gypi'],
288     },
289     {
290       'package_name': 'libx11-6',
291       'dependencies=': [],
292       'extra_configure_flags': ['--disable-specs'],
293       'msan_blacklist': 'blacklists/msan/libx11-6.txt',
294       'includes': ['standard_instrumented_package_target.gypi'],
295     },
296     {
297       'package_name': 'libxau6',
298       'dependencies=': [],
299       'includes': ['standard_instrumented_package_target.gypi'],
300     },
301     {
302       'package_name': 'libxcb1',
303       'dependencies=': [],
304       'extra_configure_flags': ['--disable-build-docs'],
305       'includes': ['standard_instrumented_package_target.gypi'],
306     },
307     {
308       'package_name': 'libxcomposite1',
309       'dependencies=': [],
310       'includes': ['standard_instrumented_package_target.gypi'],
311     },
312     {
313       'package_name': 'libxcursor1',
314       'dependencies=': [],
315       'includes': ['standard_instrumented_package_target.gypi'],
316     },
317     {
318       'package_name': 'libxdamage1',
319       'dependencies=': [],
320       'includes': ['standard_instrumented_package_target.gypi'],
321     },
322     {
323       'package_name': 'libxdmcp6',
324       'dependencies=': [],
325       'extra_configure_flags': ['--disable-docs'],
326       'includes': ['standard_instrumented_package_target.gypi'],
327     },
328     {
329       'package_name': 'libxext6',
330       'dependencies=': [],
331       'extra_configure_flags': ['--disable-specs'],
332       'includes': ['standard_instrumented_package_target.gypi'],
333     },
334     {
335       'package_name': 'libxfixes3',
336       'dependencies=': [],
337       'includes': ['standard_instrumented_package_target.gypi'],
338     },
339     {
340       'package_name': 'libxi6',
341       'dependencies=': [],
342       'extra_configure_flags': [
343         '--disable-specs',
344         '--disable-docs',
345       ],
346       'includes': ['standard_instrumented_package_target.gypi'],
347     },
348     {
349       'package_name': 'libxinerama1',
350       'dependencies=': [],
351       'includes': ['standard_instrumented_package_target.gypi'],
352     },
353     {
354       'package_name': 'libxrandr2',
355       'dependencies=': [],
356       'includes': ['standard_instrumented_package_target.gypi'],
357     },
358     {
359       'package_name': 'libxrender1',
360       'dependencies=': [],
361       'includes': ['standard_instrumented_package_target.gypi'],
362     },
363     {
364       'package_name': 'libxss1',
365       'dependencies=': [],
366       'includes': ['standard_instrumented_package_target.gypi'],
367     },
368     {
369       'package_name': 'libxtst6',
370       'dependencies=': [],
371       'extra_configure_flags': ['--disable-specs'],
372       'includes': ['standard_instrumented_package_target.gypi'],
373     },
374     {
375       'package_name': 'zlib1g',
376       'dependencies=': [],
377       'patch': 'patches/zlib1g.diff',
378       'includes': ['standard_instrumented_package_target.gypi'],
379     },
380     {
381       'package_name': 'nss',
382       'dependencies=': [
383         # TODO(earthdok): get rid of this dependency
384         '<(_sanitizer_type)-libnspr4',
385       ],
386       'patch': 'patches/nss.diff',
387       'build_method': 'custom_nss',
388       'includes': ['standard_instrumented_package_target.gypi'],
389     },
390     {
391       'package_name': 'pulseaudio',
392       'dependencies=': [],
393       'patch': 'patches/pulseaudio.diff',
394       'run_before_build': 'scripts/pulseaudio.sh',
395       'jobs': 1,
396       'includes': ['standard_instrumented_package_target.gypi'],
397     },
398     {
399       'package_name': 'libasound2',
400       'dependencies=': [],
401       'run_before_build': 'scripts/libasound2.sh',
402       'includes': ['standard_instrumented_package_target.gypi'],
403     },
404     {
405       'package_name': 'libcups2',
406       'dependencies=': [],
407       'patch': 'patches/libcups2.diff',
408       'jobs': 1,
409       'extra_configure_flags': [
410         # All from debian/rules.
411         '--localedir=/usr/share/cups/locale',
412         '--enable-slp',
413         '--enable-libpaper',
414         '--enable-ssl',
415         '--enable-gnutls',
416         '--disable-openssl',
417         '--enable-threads',
418         '--enable-static',
419         '--enable-debug',
420         '--enable-dbus',
421         '--with-dbusdir=/etc/dbus-1',
422         '--enable-gssapi',
423         '--enable-avahi',
424         '--with-pdftops=/usr/bin/gs',
425         '--disable-launchd',
426         '--with-cups-group=lp',
427         '--with-system-groups=lpadmin',
428         '--with-printcap=/var/run/cups/printcap',
429         '--with-log-file-perm=0640',
430         '--with-local_protocols="CUPS dnssd"',
431         '--with-remote_protocols="CUPS dnssd"',
432         '--enable-libusb',
433       ],
434       'includes': ['standard_instrumented_package_target.gypi'],
435     },
436     {
437       'package_name': 'pango1.0',
438       'dependencies=': [],
439       'extra_configure_flags': [
440         # Avoid https://bugs.gentoo.org/show_bug.cgi?id=425620
441         '--enable-introspection=no',
442         # Pango is normally used with dynamically loaded modules. However,
443         # ensuring pango is able to find instrumented versions of those modules
444         # is a huge pain in the neck. Let's link them statically instead, and
445         # hope for the best.
446         '--with-included-modules=yes'
447       ],
448       'includes': ['standard_instrumented_package_target.gypi'],
449     },
450     {
451       'package_name': 'libcap2',
452       'dependencies=': [],
453       'build_method': 'custom_libcap',
454       'includes': ['standard_instrumented_package_target.gypi'],
455     },
456     {
457       'package_name': 'libudev0',
458       'dependencies=': [],
459       'extra_configure_flags': [
460           # Without this flag there's a linking step that doesn't honor LDFLAGS
461           # and fails.
462           # TODO(earthdok): find a better fix.
463           '--disable-gudev'
464       ],
465       'includes': ['standard_instrumented_package_target.gypi'],
466     },
467     {
468       'package_name': 'libtasn1-3',
469       'dependencies=': [],
470       'includes': ['standard_instrumented_package_target.gypi'],
471     },
472     {
473       'package_name': 'libgnome-keyring0',
474       'extra_configure_flags': [
475           # Build static libs (from debian/rules).
476           '--enable-static',
477           '--enable-tests=no',
478       ],
479       'package_ldflags': ['-Wl,--as-needed'],
480       'dependencies=': [],
481       'includes': ['standard_instrumented_package_target.gypi'],
482     },
483     {
484       'package_name': 'libgtk2.0-0',
485       'package_cflags': ['-Wno-return-type'],
486       'extra_configure_flags': [
487           # From debian/rules.
488           '--prefix=/usr',
489           '--sysconfdir=/etc',
490           '--enable-test-print-backend',
491           '--enable-introspection=no',
492           '--with-xinput=yes',
493       ],
494       'dependencies=': [],
495       'patch': 'patches/libgtk2.0-0.diff',
496       'run_before_build': 'scripts/libgtk2.0-0.sh',
497       'includes': ['standard_instrumented_package_target.gypi'],
498     },
499     {
500       'package_name': 'libgdk-pixbuf2.0-0',
501       'extra_configure_flags': [
502           # From debian/rules.
503           '--with-libjasper',
504           '--with-x11',
505           # Make the build less problematic.
506           '--disable-introspection',
507       ],
508       'dependencies=': [],
509       'patch': 'patches/libgdk-pixbuf2.0-0.diff',
510       'run_before_build': 'scripts/libgdk-pixbuf2.0-0.sh',
511       'includes': ['standard_instrumented_package_target.gypi'],
512     },
513     {
514       'package_name': 'libpci3',
515       'dependencies=': [],
516       'build_method': 'custom_libpci3',
517       'jobs': 1,
518       'includes': ['standard_instrumented_package_target.gypi'],
519     },
520     {
521       'package_name': 'libdbusmenu-glib4',
522       'extra_configure_flags': [
523           # From debian/rules.
524           '--disable-scrollkeeper',
525           '--enable-gtk-doc',
526           # --enable-introspection introduces a build step that attempts to run
527           # a just-built binary and crashes. Vala requires introspection.
528           # TODO(earthdok): find a better fix.
529           '--disable-introspection',
530           '--disable-vala',
531       ],
532       'dependencies=': [],
533       'includes': ['standard_instrumented_package_target.gypi'],
534     },
535     {
536       'package_name': 'liboverlay-scrollbar-0.2-0',
537       'extra_configure_flags': [
538           '--with-gtk=2',
539       ],
540       'dependencies=': [],
541       'includes': ['standard_instrumented_package_target.gypi'],
542     },
543     {
544       'package_name': 'libgconf-2-4',
545       'extra_configure_flags': [
546           # From debian/rules. (Even though --with-gtk=3.0 doesn't make sense.)
547           '--with-gtk=3.0',
548           '--disable-orbit',
549           # See above.
550           '--disable-introspection',
551       ],
552       'dependencies=': [],
553       'includes': ['standard_instrumented_package_target.gypi'],
554     },
555     {
556       'package_name': 'libappindicator1',
557       'extra_configure_flags': [
558           # See above.
559           '--disable-introspection',
560       ],
561       'dependencies=': [],
562       'jobs': 1,
563       'includes': ['standard_instrumented_package_target.gypi'],
564     },
565     {
566       'package_name': 'libdbusmenu',
567       'extra_configure_flags': [
568           # From debian/rules.
569           '--disable-scrollkeeper',
570           '--with-gtk=2',
571           # See above.
572           '--disable-introspection',
573           '--disable-vala',
574       ],
575       'dependencies=': [],
576       'includes': ['standard_instrumented_package_target.gypi'],
577     },
578     {
579       'package_name': 'atk1.0',
580       'extra_configure_flags': [
581           # See above.
582           '--disable-introspection',
583       ],
584       'dependencies=': [],
585       'includes': ['standard_instrumented_package_target.gypi'],
586     },
587     {
588       'package_name': 'libunity9',
589       'dependencies=': [],
590       'includes': ['standard_instrumented_package_target.gypi'],
591     },
592     {
593       'package_name': 'dee',
594       'extra_configure_flags': [
595           # See above.
596           '--disable-introspection',
597       ],
598       'dependencies=': [],
599       'includes': ['standard_instrumented_package_target.gypi'],
600     },
601   ],
602 }