Skip to content

Instantly share code, notes, and snippets.

@vvuk
Created December 4, 2013 07:05
Show Gist options
  • Save vvuk/7783496 to your computer and use it in GitHub Desktop.
Save vvuk/7783496 to your computer and use it in GitHub Desktop.
Second is changes to skia itself to get it to build; largely removing platform specific stuff that we don't want/can't build. Also removing things like forcing a build of images from effects. No idea if the result will link yet.
diff -ru /c/proj/skia/gyp/common_conditions.gypi gfx/skia/trunk/gyp/common_conditions.gypi
--- /c/proj/skia/gyp/common_conditions.gypi 2013-12-02 14:54:18 +0800
+++ gfx/skia/trunk/gyp/common_conditions.gypi 2013-12-04 14:25:16 +0800
@@ -112,6 +112,15 @@
},
},
}],
+ [ 'skia_shared_lib', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ 'defines': [
+ 'SKIA_DLL',
+ 'SKIA_IMPLEMENTATION=1',
+ ],
+ }],
],
},
],
diff -ru /c/proj/skia/gyp/effects.gyp gfx/skia/trunk/gyp/effects.gyp
--- /c/proj/skia/gyp/effects.gyp 2013-12-02 14:54:18 +0800
+++ gfx/skia/trunk/gyp/effects.gyp 2013-12-04 14:19:08 +0800
@@ -8,7 +8,7 @@
'standalone_static_library': 1,
'dependencies': [
'core.gyp:*',
- 'images.gyp:*',
+# 'images.gyp:*',
'utils.gyp:*',
],
'includes': [
diff -ru /c/proj/skia/gyp/gpu.gyp gfx/skia/trunk/gyp/gpu.gyp
--- /c/proj/skia/gyp/gpu.gyp 2013-12-02 14:54:18 +0800
+++ gfx/skia/trunk/gyp/gpu.gyp 2013-12-04 14:58:17 +0800
@@ -1,5 +1,8 @@
{
'target_defaults': {
+ # for gecko -- we've got our own goop here
+ 'sources/': [ ['exclude', '_(win|mac|unix|iOS|android|nacl).(h|cpp|m|mm)$'], ],
+
'conditions': [
['skia_os != "win"', {
'sources/': [ ['exclude', '_win.(h|cpp)$'],
@@ -81,7 +84,7 @@
'type': 'static_library',
'standalone_static_library': 1,
'dependencies': [
- 'angle.gyp:*',
+# 'angle.gyp:*',
'core.gyp:*',
'edtaa.gyp:*',
'utils.gyp:*',
@@ -95,12 +98,12 @@
'../src/gpu',
],
'export_dependent_settings': [
- 'angle.gyp:*',
+# 'angle.gyp:*',
],
'sources': [
'<@(skgpu_sources)',
'<@(skgpu_native_gl_sources)',
- '<@(skgpu_angle_gl_sources)',
+# '<@(skgpu_angle_gl_sources)',
'<@(skgpu_mesa_gl_sources)',
'<@(skgpu_debug_gl_sources)',
'<@(skgpu_null_gl_sources)',
@@ -146,8 +149,8 @@
}],
[ 'skia_os == "linux" or skia_os == "chromeos"', {
'sources!': [
- '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
- '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
+# '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
+# '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
],
'link_settings': {
'libraries': [
@@ -178,8 +181,8 @@
],
},
'sources!': [
- '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
- '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
+# '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
+# '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
],
}],
[ 'not skia_mesa', {
@@ -200,25 +203,14 @@
}],
[ 'skia_os in ["win", "ios"]', {
'sources!': [
- '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
- '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
- ],
- }],
- [ 'not skia_angle', {
- 'sources!': [
- '<@(skgpu_angle_gl_sources)',
- ],
- 'dependencies!': [
- 'angle.gyp:*',
- ],
- 'export_dependent_settings!': [
- 'angle.gyp:*',
+# '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
+# '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
],
}],
[ 'skia_os == "android"', {
'sources!': [
- '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
- '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
+# '../src/gpu/gl/GrGLDefaultInterface_none.cpp',
+# '../src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
],
'link_settings': {
'libraries': [
diff -ru /c/proj/skia/gyp/utils.gyp gfx/skia/trunk/gyp/utils.gyp
--- /c/proj/skia/gyp/utils.gyp 2013-12-02 14:54:18 +0800
+++ gfx/skia/trunk/gyp/utils.gyp 2013-12-04 14:43:18 +0800
@@ -25,13 +25,13 @@
],
'sources': [
# Classes for a threadpool.
- '../include/utils/SkCondVar.h',
- '../include/utils/SkCountdown.h',
+# '../include/utils/SkCondVar.h',
+# '../include/utils/SkCountdown.h',
'../include/utils/SkRunnable.h',
- '../include/utils/SkThreadPool.h',
- '../src/utils/SkCondVar.cpp',
- '../src/utils/SkCountdown.cpp',
- '../src/utils/SkThreadPool.cpp',
+# '../include/utils/SkThreadPool.h',
+# '../src/utils/SkCondVar.cpp',
+# '../src/utils/SkCountdown.cpp',
+# '../src/utils/SkThreadPool.cpp',
'../include/utils/SkBoundaryPatch.h',
'../include/utils/SkFrontBufferedStream.h',
diff -ru /c/proj/skia/src/ports/SkFontHost_win_dw.cpp gfx/skia/trunk/src/ports/SkFontHost_win_dw.cpp
--- /c/proj/skia/src/ports/SkFontHost_win_dw.cpp 2013-12-02 14:54:20 +0800
+++ gfx/skia/trunk/src/ports/SkFontHost_win_dw.cpp 2013-12-04 14:35:51 +0800
@@ -1864,7 +1864,8 @@
///////////////////////////////////////////////////////////////////////////////
-typedef decltype(GetUserDefaultLocaleName)* GetUserDefaultLocaleNameProc;
+typedef int (WINAPI * GetUserDefaultLocaleNameProc) (LPWSTR, int);
+//typedef decltype(GetUserDefaultLocaleName)* GetUserDefaultLocaleNameProc;
static HRESULT GetGetUserDefaultLocaleNameProc(GetUserDefaultLocaleNameProc* proc) {
*proc = reinterpret_cast<GetUserDefaultLocaleNameProc>(
GetProcAddress(LoadLibraryW(L"Kernel32.dll"), "GetUserDefaultLocaleName")
diff --git a/configure.in b/configure.in
index 8ad62cf..0b34317 100644
--- a/configure.in
+++ b/configure.in
@@ -5088,26 +5088,26 @@ AC_TRY_COMPILE([#include <linux/ethtool.h>],
# target_arch is from {ia32|x64|arm|ppc}
case "$CPU_ARCH" in
x86_64)
- WEBRTC_TARGET_ARCH=x64
+ GYP_TARGET_ARCH=x64
;;
arm*)
- WEBRTC_TARGET_ARCH=arm
+ GYP_TARGET_ARCH=arm
;;
x86)
- WEBRTC_TARGET_ARCH=ia32
+ GYP_TARGET_ARCH=ia32
;;
ppc*)
- WEBRTC_TARGET_ARCH=ppc
+ GYP_TARGET_ARCH=ppc
;;
ia64)
- WEBRTC_TARGET_ARCH=ia64
+ GYP_TARGET_ARCH=ia64
;;
*)
# unsupported arch for webrtc
- WEBRTC_TARGET_ARCH=unknown
+ GYP_TARGET_ARCH=unknown
MOZ_WEBRTC=
;;
@@ -8827,13 +8827,13 @@ if test "${OS_TARGET}" = "WINNT"; then
else
OS_BITS=32
fi
- EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
+ EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
elif test "${OS_TARGET}" = "Android"; then
if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
- EXTRA_GYP_DEFINES="-G os=linux "
+ EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -G os=linux "
else
- EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
+ EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
fi
fi
@@ -8851,36 +8851,94 @@ if test -n "$ARM_ARCH"; then
fi
fi
-# Keep libcubeb and audio_device backends in sync
-if test -n "$MOZ_ALSA"; then
- EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1"
-else
- EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0"
-fi
-if test -n "$MOZ_PULSEAUDIO"; then
- EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1"
-else
- EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0"
-fi
+if test -n "$MOZ_ENABLE_SKIA"; then
+ AC_MSG_RESULT("generating Skia Makefiles...")
-# Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
-if test -n "$INTEL_ARCHITECTURE"; then
- if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
- EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
- fi
+ SKIA_CONFIG=""
+
+ if test -n "$MOZ_ENABLE_SKIA_GPU"; then
+ SKIA_CONFIG="${SKIA_CONFIG} -D skia_gpu=1"
+ fi
+
+ case "${OS_TARGET}" in
+ Linux) SKIA_CONFIG="${SKIA_CONFIG} -D skia_os=linux" ;;
+ Darwin) SKIA_CONFIG="${SKIA_CONFIG} -D skia_os=mac" ;;
+ Android) SKIA_CONFIG="${SKIA_CONFIG} -D skia_os=android" ;;
+ WINNT) SKIA_CONFIG="${SKIA_CONFIG} -D skia_os=win" ;;
+ *)
+ echo Unknown OS_TARGET for Skia
+ exit 1
+ ;;
+ esac
+
+ if test "$HAVE_64BIT_OS"; then
+ SKIA_CONFIG="${SKIA_CONFIG} -D skia_arch_width=64"
+ else
+ SKIA_CONFIG="${SKIA_CONFIG} -D skia_arch_width=32"
+ fi
+
+ case "${target_cpu}" in
+ arm)
+ SKIA_CONFIG="${SKIA_CONFIG} -D skia_arch_type=arm"
+ if test "$ARM_ARCH" -lt 7; then
+ SKIA_CONFIG="${SKIA_CONFIG} -D arm_version=6"
+ else
+ SKIA_CONFIG="${SKIA_CONFIG} -D arm_version=7"
+ fi
+ ;;
+ i?86|x86_64)
+ SKIA_CONFIG="${SKIA_CONFIG} -D skia_arch_type=x86"
+ ;;
+ *)
+ echo Unknown target_cpu for SKIA
+ exit 1
+ ;;
+ esac
+
+ GYP_SKIA_OPTIONS="--format=mozmake ${GYP_MOZMAKE_OPTIONS} ${SKIA_CONFIG} -D target_arch=${GYP_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/gfx/skia/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+ echo GYP_SKIA_OPTIONS: $GYP_SKIA_OPTIONS
+
+ $PYTHON ${srcdir}/gfx/skia/trunk/gyp_skia_gecko \
+ $GYP_SKIA_OPTIONS \
+ --generator-output=${_objdir}/gfx/skia/trunk \
+ ${srcdir}/gfx/skia/trunk/skia_gecko.gyp
+
+ if test "$?" != 0; then
+ AC_MSG_ERROR([failed to generate Skia Makefiles])
+ fi
fi
if test -n "$MOZ_WEBRTC"; then
AC_MSG_RESULT("generating WebRTC Makefiles...")
- if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
- EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D build_with_gonk=1"
- fi
-
dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
dnl so that regeneration via dependencies works correctly
WEBRTC_CONFIG="-D build_with_mozilla=1 -D build_with_chromium=0 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
+ # Keep libcubeb and audio_device backends in sync
+ if test -n "$MOZ_ALSA"; then
+ WEBRTC_CONFIG="$WEBRTC_CONFIG -D include_alsa_audio=1"
+ else
+ WEBRTC_CONFIG="$WEBRTC_CONFIG -D include_alsa_audio=0"
+ fi
+ if test -n "$MOZ_PULSEAUDIO"; then
+ WEBRTC_CONFIG="$WEBRTC_CONFIG -D include_pulse_audio=1"
+ else
+ WEBRTC_CONFIG="$WEBRTC_CONFIG -D include_pulse_audio=0"
+ fi
+
+ # Don't try to compile ssse3/sse4.1 code if toolchain doesn't support
+ if test -n "$INTEL_ARCHITECTURE"; then
+ if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSSE3" -o -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
+ WEBRTC_CONFIG="$WEBRTC_CONFIG -D yuv_disable_asm=1"
+ fi
+ fi
+
+ if test "${MOZ_WIDGET_TOOLKIT}" = "gonk"; then
+ WEBRTC_CONFIG="${WEBRTC_CONFIG} -D build_with_gonk=1"
+ fi
+
if test -n HAVE_CLOCK_MONOTONIC; then
WEBRTC_CONFIG="${WEBRTC_CONFIG} -D have_clock_monotonic=1"
else
@@ -8896,24 +8954,24 @@ dnl so that regeneration via dependencies works correctly
if test -n "$CROSS_COMPILE"; then
case "$target" in
*-mingw*)
- GYP_MOZMAKE_OPTIONS="-G os=win"
+ WEBRTC_CONFIG="-G os=win"
;;
*-darwin*)
- GYP_MOZMAKE_OPTIONS="-G os=mac"
+ WEBRTC_CONFIG="-G os=mac"
if test "$MACOS_SDK_DIR"; then
- GYP_MOZMAKE_OPTIONS="${GYP_MOZMAKE_OPTIONS} -D mac_sdk_path=$MACOS_SDK_DIR"
+ WEBRTC_CONFIG="${WEBRTC_CONFIG} -D mac_sdk_path=$MACOS_SDK_DIR"
fi
;;
*-*linux*)
- GYP_MOZMAKE_OPTIONS="-G os=linux"
+ WEBRTC_CONFIG="-G os=linux"
;;
*)
AC_MSG_ERROR([Don't know what options to give to WebRTC for cross-compilation])
- ;;
+ ;;
esac
fi
-
- GYP_WEBRTC_OPTIONS="--format=mozmake ${GYP_MOZMAKE_OPTIONS} ${WEBRTC_CONFIG} -D target_arch=${WEBRTC_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+ GYP_WEBRTC_OPTIONS="--format=mozmake ${GYP_MOZMAKE_OPTIONS} ${WEBRTC_CONFIG} -D target_arch=${GYP_TARGET_ARCH} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
$GYP_WEBRTC_OPTIONS \
diff --git a/gfx/skia/skia_config.gypi b/gfx/skia/skia_config.gypi
new file mode 100644
index 0000000..60df21f
--- /dev/null
+++ b/gfx/skia/skia_config.gypi
@@ -0,0 +1,27 @@
+# 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/.
+
+# definitions to control what gets built in skia
+# NOTE!!! if you change something here, due to .gyp files not
+# being reprocessed on .gypi changes, run this before building:
+# "find . -name '*.gyp' | xargs touch"
+{
+ 'variables': {
+ 'build_with_mozilla': 1,
+ 'build_with_chromium': 0,
+ 'use_system_libjpeg': 1,
+ 'skia_shared_lib': 0,
+
+ 'arm_neon': 0,
+ 'arm_neon_optional': 0,
+
+ 'skia_angle': 0,
+
+ 'conditions': [
+ ['skia_arch_type=="arm"', {
+ 'arm_neon_optional': 1,
+ }],
+ ]
+ },
+}
diff --git a/gfx/skia/trunk/gyp_skia_gecko b/gfx/skia/trunk/gyp_skia_gecko
new file mode 100644
index 0000000..4824137
--- /dev/null
+++ b/gfx/skia/trunk/gyp_skia_gecko
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+# Copyright 2011 The Android Open Source Project
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script is a wrapper which invokes gyp with the correct --depth argument,
+# and supports the automatic regeneration of build files if all.gyp is
+# changed (Linux-only).
+
+import glob
+import os
+import platform
+import shlex
+import sys
+
+script_dir = os.path.dirname(__file__)
+
+# Directory within which we can find the gyp source.
+gyp_source_dir = os.path.join(script_dir, '..', '..', '..', 'media', 'webrtc', 'trunk', 'tools', 'gyp')
+
+# Directory within which we can find most of Skia's gyp configuration files.
+gyp_config_dir = os.path.join(script_dir, 'gyp')
+
+# Ensure we import our current gyp source's module, not any version
+# pre-installed in your PYTHONPATH.
+sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib'))
+import gyp
+
+if __name__ == '__main__':
+ args = sys.argv[1:]
+
+ args.extend(['-I' + os.path.join(script_dir, '..', 'skia_config.gypi')])
+ args.extend(['-I' + os.path.join(script_dir, 'gyp', 'common.gypi')])
+
+ print 'Updating projects from gyp files...'
+ print args
+ sys.stdout.flush()
+
+ # Off we go...
+ sys.exit(gyp.main(args))
diff --git a/gfx/skia/trunk/skia_gecko.gyp b/gfx/skia/trunk/skia_gecko.gyp
new file mode 100644
index 0000000..c9f34da
--- /dev/null
+++ b/gfx/skia/trunk/skia_gecko.gyp
@@ -0,0 +1,56 @@
+# Top-level gyp configuration for Skia.
+#
+# Projects that use Skia should depend on one or more of the targets
+# defined here.
+#
+# More targets are defined within the gyp/ directory, but those are
+# not intended for external use and may change without notice.
+#
+# Full documentation at https://sites.google.com/site/skiadocs/
+#
+{
+ 'variables': {
+ 'component_libs': [
+ 'gyp/core.gyp:core',
+ 'gyp/effects.gyp:effects',
+ 'gyp/opts.gyp:opts',
+ 'gyp/ports.gyp:ports',
+ ],
+ 'conditions': [
+ [ 'skia_arch_type == "x86" and skia_os != "android"', {
+ 'component_libs': [
+ 'gyp/opts.gyp:opts_ssse3',
+ ],
+ }],
+ [ 'arm_neon == 1', {
+ 'component_libs': [
+ 'gyp/opts.gyp:opts_neon',
+ ],
+ }],
+ [ 'skia_gpu', {
+ 'component_libs': [
+ 'gyp/gpu.gyp:skgpu',
+ ],
+ }],
+ ],
+ },
+
+ 'targets': [
+ {
+ 'target_name': 'all',
+ 'type': 'none',
+ 'dependencies': [
+ '<@(component_libs)',
+ ],
+ 'export_dependent_settings': [
+ '<@(component_libs)',
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment