Skip to content

Commit

Permalink
Merge pull request youtube#381 from jellefoks/freetype2-update-to-2_13_0
Browse files Browse the repository at this point in the history
Freetype2 update to 2 13 0

* adds the Starboardization and customization for Cobalt to FreeType.

b/172481249
  • Loading branch information
kaidokert authored May 17, 2023
2 parents 868e91d + 99ebeda commit f0c47f5
Show file tree
Hide file tree
Showing 734 changed files with 51,247 additions and 20,505 deletions.
16 changes: 16 additions & 0 deletions third_party/freetype2/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
BasedOnStyle: Chromium
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
# AlignOperands: Align
AlignTrailingComments: true
AlwaysBreakAfterReturnType: AllDefinitions
BreakBeforeBraces: Allman
ColumnLimit: 80
DerivePointerAlignment: false
IndentCaseLabels: false
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
SpacesInParentheses: true
10 changes: 7 additions & 3 deletions third_party/freetype2/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
config.mk
objs/vc2010/
build
/build/
/config.mk
include/dlg/
src/dlg/dlg.c
subprojects/*
!subprojects/*.wrap
/tests/data/*
230 changes: 230 additions & 0 deletions third_party/freetype2/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
# CI setup for FreeType.

stages:
- build

# FIXME: Use --werror once warnings are fixed.
variables:
MESON_ARGS: --fatal-meson-warnings --default-library=both
MESON_ARGS_WINDOWS: ${MESON_ARGS} --force-fallback-for=zlib

.build windows common:
# TODO: should probably get its own image at some point instead of reusing the GStreamer one
# See https://gitlab.freedesktop.org/gstreamer/gstreamer/container_registry/18035 for latest
image: "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-07-29.3-main"
stage: 'build'
tags:
- 'docker'
- 'windows'
- '2022'
- 'gstreamer-windows'

.build linux common:
# See
# https://gitlab.freedesktop.org/freetype/docker-images/container_registry/20896
image: 'registry.freedesktop.org/freetype/docker-images/debian:latest'
stage: 'build'

.build macos common:
stage: 'build'
tags:
- 'gst-macos-11.1'

.build windows meson:
extends: '.build windows common'
variables:
# Make sure any failure in PowerShell scripts is fatal.
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
# Uncomment the following key if you need to pass custom args, as well
# with the `$env:MESON_ARGS` line in the `script:` blocks.
# MESON_ARGS: >-
# -Dfoo=enabled
# -Dbar=disabled
before_script:
# Update RootCAs in order to access to some sites.
- certutil -generateSSTFromWU "C:\roots.sst"
- Import-Certificate -CertStoreLocation "Cert:\LocalMachine\Root" "C:\roots.sst"
# Make sure meson is up to date so we don't need to rebuild the image
# with each release.
- pip3 install -U 'meson==0.59.*'
- pip3 install --upgrade certifi
- pip3 install -U ninja

# Generate a UWP cross-file in case it's used
- $PSDefaultParameterValues['Out-File:Encoding'] = 'ASCII'
- echo "[binaries]" > uwp-crossfile.meson
- echo "c = 'cl'" >> uwp-crossfile.meson
- echo "strip = ['true']" >> uwp-crossfile.meson
- echo "[built-in options]" >> uwp-crossfile.meson
- echo "c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-DUNICODE', '-D_WIN32_WINNT=0x0A00', '-we4013']" >> uwp-crossfile.meson
- echo "c_winlibs = ['windowsapp.lib']" >> uwp-crossfile.meson
script:
# For some reason, options are separated by newlines instead of spaces,
# so we have to replace them first.
#
# - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
#
# Gitlab executes PowerShell in docker, but `VsDevCmd.bat` is a batch
# script. Environment variables substitutions is done by PowerShell
# before calling `cmd.exe`, that's why we use `$env:FOO` instead of
# `%FOO%`.
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH $env:VS_UWP &&
meson setup build $env:MESON_ARGS_WINDOWS $env:MESON_ARGS_UWP &&
meson compile --verbose -C build
$env:MESON_WINDOWS_TESTS"


# Format of job names:
# <OS> <Build-Tool> <Build-Params> <Architecture>


# Windows jobs.

windows meson vs2019 amd64:
extends: '.build windows meson'
variables:
ARCH: 'amd64'
MESON_WINDOWS_TESTS: '&& meson test -C build && meson test -C build --benchmark'

windows meson vs2019 x86:
extends: '.build windows meson'
variables:
ARCH: 'x86'
MESON_WINDOWS_TESTS: '&& meson test -C build && meson test -C build --benchmark'

windows meson vs2019 amd64 uwp:
extends: '.build windows meson'
variables:
ARCH: 'amd64'
VS_UWP: '-app_platform=UWP'
MESON_ARGS_UWP: '--cross-file uwp-crossfile.meson -Dc_winlibs="windowsapp.lib"'

# Linux Jobs.
#
# Jobs with "libs" in the name force-enable libraries.
# They are disabled for the remaining jobs.

linux autotools:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=no \
--with-bzip2=no \
--with-harfbuzz=no \
--with-png=no \
--with-zlib=no \
CC=gcc
make -j$(nproc) && make install
linux autotools libs:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=yes \
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes \
CC=gcc
make -j$(nproc) && make install
linux autotools libs clang:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=yes \
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes \
CC=clang
make -j$(nproc) && make install
linux meson:
extends: '.build linux common'
script: |
meson setup build ${MESON_ARGS} \
-Dbrotli=disabled \
-Dbzip2=disabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
-Dzlib=disabled
meson compile --verbose -C build
meson install -C build
linux meson libs:
extends: '.build linux common'
script: |
meson setup build ${MESON_ARGS} \
-Dbrotli=enabled \
-Dbzip2=enabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
-Dzlib=disabled
meson compile --verbose -C build
meson install -C build
linux cmake:
extends: '.build linux common'
script: |
cmake -B build -D FT_DISABLE_BROTLI=TRUE \
-D FT_DISABLE_BZIP2=TRUE \
-D FT_DISABLE_HARFBUZZ=TRUE \
-D FT_DISABLE_PNG=TRUE \
-D FT_DISABLE_ZLIB=TRUE
cmake --build build --target install
linux cmake libs:
extends: '.build linux common'
script: |
cmake -B build -D FT_REQUIRE_BROTLI=TRUE \
-D FT_REQUIRE_BZIP2=TRUE \
-D FT_REQUIRE_HARFBUZZ=TRUE \
-D FT_REQUIRE_PNG=TRUE \
-D FT_REQUIRE_ZLIB=TRUE
cmake --build build --target install
# MacOS jobs.

macos autotools:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- ./configure
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install

macos autotools clang:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- './configure CC=clang'
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install

macos meson:
extends: '.build macos common'
script:
- pip3 install --upgrade pip
- pip3 install -U meson
- pip3 install --upgrade certifi
- pip3 install -U ninja

- meson setup build ${MESON_ARGS}
- meson compile --verbose -C build
- sudo meson install -C build
24 changes: 19 additions & 5 deletions third_party/freetype2/.mailmap
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
Behdad Esfahbod (بهداد اسفهبد) <[email protected]> <[email protected]>
Behdad Esfahbod (بهداد اسفهبد) <[email protected]> <[email protected]>
Behdad Esfahbod (بهداد اسفهبد) <[email protected]>
Alexander Borsuk <[email protected]> <[email protected]>
Ewald Hew (Hew Yih Shiuan 丘毅宣) <[email protected]>
Moazin Khatti (موؤذن کھٹی) <[email protected]>
Priyesh Kumar (प्रियेश कुमार) <[email protected]>
Alexei Podtelezhnikov (Алексей Подтележников) <[email protected]>
Behdad Esfahbod <[email protected]> <behdad.esfahbod@gmail.com>
Bram Tassyns <[email protected]> bram tassyns <[email protected]>
Bram Tassyns <[email protected]> <BramT@enfocus.com>
Nikhil Ramakrishnan (निखिल रामकृष्णन) <ramakrishnan.nikhil@gmail.com>
Dominik Röttsches <[email protected]> <[email protected]>
Kostya Serebryany <[email protected]> <konstantin.s.serebryany@gmail.com>
Suzuki, Toshiya (鈴木俊哉) <[email protected]> <[email protected]>
Suzuki, Toshiya (鈴木俊哉) <[email protected]> sssa <[email protected]>
Suzuki, Toshiya (鈴木俊哉) <[email protected]> sssa <[email protected]>
Suzuki, Toshiya (鈴木俊哉) <[email protected]> suzuki toshiya <[email protected]>
Bram Tassyns <[email protected]> bram tassyns <[email protected]>
Bram Tassyns <[email protected]> <[email protected]>
David Turner <[email protected]> <[email protected]>
David Turner <[email protected]> <[email protected]>
Anuj Verma (अनुज वर्मा) <[email protected]>
Ben Wagner <[email protected]> Bungeman <[email protected]>
Ewald Hew (Hew Yih Shiuan 丘毅宣) <[email protected]>
Nikhil Ramakrishnan (निखिल रामकृष्णन) <[email protected]>
Ben Wagner <[email protected]> <[email protected]>
Ben Wagner <[email protected]> <[email protected]>
Nikolaus Waxweiler <[email protected]> <[email protected]>
35 changes: 4 additions & 31 deletions third_party/freetype2/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

config("freetype2_config") {
cflags = []
if (is_clang) {
cflags += [ "-Wno-tautological-compare" ]
}

if (is_win) {
cflags += [
# Level 1 - Formal parameter 'number' is different from declaration.
"/wd4028",

# Level 1 - Incompatible types conversion.
"/wd4133",

# Level 2 - Unary minus operator applied to unsigned type; result is
# still unsigned.
"/wd4146",

# Level 1 - Conversion from 'type1' to 'type2' of a greater size.
# Typically when 32-bit value is assigned to a 64-bit pointer value.
"/wd4312",
]
}
}

config("freetype2_config_public") {
include_dirs = [
"include_cobalt",
"builds/starboard/include",
"include",
]

defines = [
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
"FT_CONFIG_CONFIG_H=\"ftconfig.h\"",
"FT_CONFIG_MODULES_H=\"ftmodule.h\"",
"FT_CONFIG_OPTIONS_H=\"ftoption.h\"",
"FT_CONFIG_CONFIG_H=\"freetype/config/ftconfig.h\"",
"FT_CONFIG_MODULES_H=<config/ftmodule.h>",
"FT_CONFIG_OPTIONS_H=<config/ftoption.h>",
]
}

Expand Down Expand Up @@ -81,8 +56,6 @@ static_library("freetype2") {

defines = [ "FT2_BUILD_LIBRARY" ]

configs += [ ":freetype2_config" ]

public_configs = [ ":freetype2_config_public" ]

deps = [
Expand Down
Loading

0 comments on commit f0c47f5

Please sign in to comment.