# Allow building against system-wide graphite2/harfbuzz. diff --git config/Makefile.in config/Makefile.in index 10807cf..f4b8587 100644 --- config/Makefile.in +++ config/Makefile.in @@ -49,6 +49,8 @@ export:: $(export-preqs) -DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \ -DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \ -DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \ + -DMOZ_SYSTEM_GRAPHITE2=$(MOZ_SYSTEM_GRAPHITE2) \ + -DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \ $(srcdir)/system-headers $(srcdir)/stl-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers $(INSTALL) system_wrappers $(DIST) diff --git config/system-headers config/system-headers index 48afa0f..61612f6 100644 --- config/system-headers +++ config/system-headers @@ -1331,3 +1331,12 @@ unicode/utypes.h #endif libutil.h unwind.h +#if MOZ_SYSTEM_GRAPHITE2==1 +graphite2/Font.h +graphite2/Segment.h +#endif +#if MOZ_SYSTEM_HARFBUZZ==1 +harfbuzz/hb-glib.h +harfbuzz/hb-ot.h +harfbuzz/hb.h +#endif diff --git dom/base/moz.build dom/base/moz.build index 6e0d4f5..0770717 100644 --- dom/base/moz.build +++ dom/base/moz.build @@ -457,6 +457,9 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']: if CONFIG['MOZ_X11']: CXXFLAGS += CONFIG['TK_CFLAGS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + GENERATED_FILES += [ 'PropertyUseCounterMap.inc', 'UseCounterList.h', diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh index faaab1b..04eff5f 100644 --- gfx/graphite2/moz-gr-update.sh +++ gfx/graphite2/moz-gr-update.sh @@ -1,6 +1,7 @@ #!/bin/bash # Script used to update the Graphite2 library in the mozilla source tree +# and bump version for --with-system-graphite2 # This script lives in gfx/graphite2, along with the library source, # but must be run from the top level of the mozilla-central tree. @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s///;s/Windows.h/windows.h/;" {} \; #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s///;s/Windows.h/windows.h/;" {} \; +# chase version for --with-system-graphite2 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \ + if /GR2_VERSION_REQUIRE/" old-configure.in + # summarize what's been touched echo Updated to $RELEASE. echo Here is what changed in the gfx/graphite2 directory: echo -hg stat gfx/graphite2 +hg stat old-configure.in gfx/graphite2 echo echo If gfx/graphite2/src/files.mk has changed, please make corresponding diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla index 24e6cbb..0b7a5df 100644 --- gfx/harfbuzz/README-mozilla +++ gfx/harfbuzz/README-mozilla @@ -20,3 +20,8 @@ the mozilla tree. If the collection of source files changes, manual updates to moz.build may be needed, as we don't use the upstream makefiles. + +The in-tree copy may be omitted during build by --with-system-harfbuzz. +Make sure to keep pkg-config version check within old-configure.in in sync +with checkout version or increment latest tag by one if it's not based +on upstream release. diff --git gfx/moz.build gfx/moz.build index 2509198..5cc4663 100644 --- gfx/moz.build +++ gfx/moz.build @@ -7,6 +7,12 @@ if CONFIG['MOZ_TREE_CAIRO']: DIRS += ['cairo'] +if not CONFIG['MOZ_SYSTEM_GRAPHITE2']: + DIRS += ['graphite2/src' ] + +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']: + DIRS += ['harfbuzz/src'] + DIRS += [ '2d', 'ycbcr', @@ -15,8 +21,6 @@ DIRS += [ 'qcms', 'gl', 'layers', - 'graphite2/src', - 'harfbuzz/src', 'ots/src', 'thebes', 'ipc', diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py index ab1365f..8897c27 100755 --- gfx/skia/generate_mozbuild.py +++ gfx/skia/generate_mozbuild.py @@ -140,6 +140,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']: '-Wno-unused-private-field', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] diff --git gfx/skia/moz.build gfx/skia/moz.build index a2f914b..d3759b0 100644 --- gfx/skia/moz.build +++ gfx/skia/moz.build @@ -664,6 +664,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']: '-Wno-unused-private-field', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] diff --git gfx/thebes/moz.build gfx/thebes/moz.build index bbbce6fd..db0ceb1 100644 --- gfx/thebes/moz.build +++ gfx/thebes/moz.build @@ -289,7 +289,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES'] -DEFINES['GRAPHITE2_STATIC'] = True +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + +if CONFIG['MOZ_SYSTEM_GRAPHITE2']: + CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS'] +else: + DEFINES['GRAPHITE2_STATIC'] = True if CONFIG['CLANG_CXX']: # Suppress warnings from Skia header files. diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build index 9754753..768cc7d 100644 --- intl/unicharutil/util/moz.build +++ intl/unicharutil/util/moz.build @@ -42,4 +42,7 @@ if CONFIG['_MSC_VER']: if CONFIG['ENABLE_INTL_API']: USE_LIBS += ['icu'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + DIST_INSTALL = True diff --git moz.configure moz.configure index e762576..196dafd 100644 --- moz.configure +++ moz.configure @@ -216,6 +216,30 @@ check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'), check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'), allow_missing=True) +option('--with-system-graphite2', + help="Use system graphite2 (located with pkgconfig)") + +@depends('--with-system-graphite2', compile_environment) +def check_for_graphite2(value, compile_env): + return value and compile_env + +system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2', + check_for_graphite2) + +set_config('MOZ_SYSTEM_GRAPHITE2', system_graphite2) + +option('--with-system-harfbuzz', + help="Use system harfbuzz (located with pkgconfig)") + +@depends('--with-system-harfbuzz', compile_environment) +def check_for_harfbuzz(value, compile_env): + return value and compile_env + +system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.3.3', + check_for_harfbuzz) + +set_config('MOZ_SYSTEM_HARFBUZZ', system_harfbuzz) + option('--enable-system-hunspell', help="Use system hunspell (located with pkgconfig)") diff --git netwerk/dns/moz.build netwerk/dns/moz.build index f788d9a..5662301 100644 --- netwerk/dns/moz.build +++ netwerk/dns/moz.build @@ -66,6 +66,9 @@ LOCAL_INCLUDES += [ '/netwerk/base', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['ENABLE_INTL_API']: DEFINES['IDNA2008'] = True USE_LIBS += ['icu'] diff --git old-configure.in old-configure.in index 0070d48..9d1129f 100644 --- old-configure.in +++ old-configure.in @@ -5764,6 +5764,27 @@ if test "$USE_FC_FREETYPE"; then fi dnl ======================================================== +dnl Check for graphite2 +dnl ======================================================== +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then + dnl graphite2.pc has bogus version, check manually + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS" + AC_TRY_COMPILE([ #include + #define GR2_VERSION_REQUIRE(major,minor,bugfix) \ + ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \ + * 100 + GR2_VERSION_BUGFIX >= \ + (major) * 10000 + (minor) * 100 + (bugfix) ) + ], [ + #if !GR2_VERSION_REQUIRE(1,3,8) + #error "Insufficient graphite2 version." + #endif + ], [], + [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])]) + CFLAGS=$_SAVE_CFLAGS +fi + +dnl ======================================================== dnl Check for pixman and cairo dnl ======================================================== diff --git toolkit/library/moz.build toolkit/library/moz.build index a3d5450..2c684a7e 100644 --- toolkit/library/moz.build +++ toolkit/library/moz.build @@ -217,6 +217,12 @@ if CONFIG['MOZ_SYSTEM_JPEG']: if CONFIG['MOZ_SYSTEM_PNG']: OS_LIBS += CONFIG['MOZ_PNG_LIBS'] +if CONFIG['MOZ_SYSTEM_GRAPHITE2']: + OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS'] + +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS'] + if CONFIG['MOZ_SYSTEM_HUNSPELL']: OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']