Bug 1358023: (2/2) Build freetype2 by using moz.build; r=glandium
authorBruce Sun <brsun@mozilla.com>
Mon, 22 May 2017 12:02:14 +0800
changeset 360078 337fc12b15d02fcb05ef1adc7fe72e45489f159e
parent 360077 5ef43ba36c8c519ed91d5136389cfa89d92f05a2
child 360079 589fca202ae60ae457d3622b0ab006ae41eb9f85
push id31867
push userryanvm@gmail.com
push dateTue, 23 May 2017 14:09:01 +0000
treeherdermozilla-central@4f874bc1e424 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1358023
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1358023: (2/2) Build freetype2 by using moz.build; r=glandium
config/external/freetype2/Makefile.in
config/external/freetype2/moz.build
modules/freetype2/moz.build
old-configure.in
deleted file mode 100644
--- a/config/external/freetype2/Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ifdef MOZ_TREE_FREETYPE
-
-include $(topsrcdir)/config/config.mk
-
-$(STATIC_LIBS):
-	$(MAKE) -C $(DEPTH)/modules/freetype2
-
-endif
--- a/config/external/freetype2/moz.build
+++ b/config/external/freetype2/moz.build
@@ -2,13 +2,13 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 Library('freetype')
 
 if CONFIG['MOZ_TREE_FREETYPE']:
-    USE_LIBS += [
-        'static:/modules/freetype2/.libs/freetype',
+    DIRS += [
+        '/modules/freetype2',
     ]
 else:
     OS_LIBS += CONFIG['FT2_LIBS']
new file mode 100644
--- /dev/null
+++ b/modules/freetype2/moz.build
@@ -0,0 +1,94 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEFINES['FT2_BUILD_LIBRARY'] = True
+
+CFLAGS += ['-std=c99']
+
+LOCAL_INCLUDES += [
+    'include',
+]
+
+# We allow warnings for third-party code that can be updated from upstream.
+ALLOW_COMPILER_WARNINGS = True
+
+# base components
+SOURCES += [
+    'src/base/ftbase.c',
+    'src/base/ftdebug.c',
+    'src/base/ftinit.c',
+    'src/base/ftsystem.c',
+]
+
+# font modules
+SOURCES += [
+    'src/bdf/bdf.c',            # BDF font driver.
+    'src/cff/cff.c',            # CFF/OpenType font driver.
+    'src/cid/type1cid.c',       # Type 1 CID-keyed font driver.
+    'src/pcf/pcf.c',            # PCF font driver.
+    'src/pfr/pfr.c',            # PFR/TrueDoc font driver.
+    'src/sfnt/sfnt.c',          # SFNT files support.
+    'src/truetype/truetype.c',  # TrueType font driver.
+    'src/type1/type1.c',        # PostScript Type 1 font driver.
+    'src/type42/type42.c',      # PostScript Type 42 font driver.
+    'src/winfonts/winfnt.c',    # Windows FONT/FNT font driver.
+]
+
+# hinting modules
+SOURCES += [
+    'src/autofit/autofit.c',    # FreeType's auto hinter.
+    'src/pshinter/pshinter.c',  # PostScript hinter.
+]
+
+# raster modules
+SOURCES += [
+    'src/raster/raster.c',      # Monochrome rasterizer.
+    'src/smooth/smooth.c',      # Anti-aliasing rasterizer.
+]
+
+# auxiliary modules
+SOURCES += [
+    'src/bzip2/ftbzip2.c',      # Support for streams compressed with bzip2 (files with suffix .bz2).
+    'src/cache/ftcache.c',      # FreeType's cache sub-system.
+    'src/gzip/ftgzip.c',        # Support for streams compressed with gzip (files with suffix .gz).
+    'src/lzw/ftlzw.c',          # Support for streams compressed with LZW (files with suffix .Z).
+    'src/psaux/psaux.c',        # Auxiliary PostScript driver component to share common code.
+    'src/psnames/psnames.c',    # Support for PostScript glyph names.
+]
+
+# base module extensions
+SOURCES += [
+    'src/base/ftbbox.c',        # Exact bounding box calculation.
+    'src/base/ftbdf.c',         # Access BDF-specific strings.
+    'src/base/ftbitmap.c',      # Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into 8bpp format, and for emboldening of bitmap glyphs.
+    'src/base/ftcid.c',         # Access CID font information.
+    'src/base/ftfntfmt.c',      # Support functions for font formats.
+    'src/base/ftfstype.c',      # Access FSType information.
+    'src/base/ftgasp.c',        # Support for GASP table queries.
+    'src/base/ftglyph.c',       # Convenience functions to handle glyphs.
+    'src/base/ftgxval.c',       # Interface for gxvalid module.
+    'src/base/ftlcdfil.c',      # Support for LCD color filtering of subpixel bitmaps.
+    'src/base/ftmm.c',          # Multiple Master font interface.
+    'src/base/ftotval.c',       # Interface for otvalid module.
+    'src/base/ftpatent.c',      # Support for FT_Face_CheckTrueTypePatents.
+    'src/base/ftpfr.c',         # Interface for accessing PFR-specific data.
+    'src/base/ftstroke.c',      # Path stroker.
+    'src/base/ftsynth.c',       # Support for synthetic embolding and slanting of fonts.
+    'src/base/fttype1.c',       # Interface to access data specific to PostScript Type 1 and Type 2 (CFF)
+    'src/base/ftwinfnt.c',      # Interface for accessing data specific to Windows FNT files.
+]
+
+# zlib library
+DEFINES['FT_CONFIG_OPTION_SYSTEM_ZLIB'] = True
+CFLAGS += CONFIG['MOZ_ZLIB_CFLAGS']
+USE_LIBS += ['zlib']
+
+# png library
+DEFINES['FT_CONFIG_OPTION_USE_PNG'] = True
+CFLAGS += CONFIG['MOZ_PNG_CFLAGS']
+USE_LIBS += ['mozpng']
+
+FINAL_LIBRARY = 'freetype'
--- a/old-configure.in
+++ b/old-configure.in
@@ -5468,46 +5468,16 @@ AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
 AC_DEFINE(NO_NSPR_10_SUPPORT)
 
 # Don't build NSS libpkix
 NSS_DISABLE_LIBPKIX=1
 AC_SUBST(NSS_DISABLE_LIBPKIX)
 
 MOZ_CREATE_CONFIG_STATUS()
 
-# Run freetype configure script
-
-if test "$MOZ_TREE_FREETYPE"; then
-   export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
-   export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
-   export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
-   export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
-   # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
-   # to force freetype to use our settings rather than autodetecting
-   if test -n "$MOZ_SYSTEM_PNG"; then
-     export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
-   else
-     export LIBPNG_CFLAGS="-I$_objdir/dist/include"
-   fi
-   export LIBPNG_LIBS="$MOZ_PNG_LIBS "
-   export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
-   export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
-   export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
-   ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
-
-   if ! test -e modules; then
-     mkdir modules
-   fi
-   # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
-   # that further down the road.
-   (export CC CXX RANLIB;
-    AC_OUTPUT_SUBDIRS(modules/freetype2)
-   ) || exit 1
-fi
-
 if test -z "$direct_nspr_config"; then
     dnl ========================================================
     dnl = Setup a nice relatively clean build environment for
     dnl = sub-configures.
     dnl ========================================================
     CC="$_SUBDIR_CC"
     CXX="$_SUBDIR_CXX"
     CFLAGS="$_SUBDIR_CFLAGS"