| 1 |
Description: Debian-specific makefile. |
| 2 |
Forwarded: not-needed |
| 3 |
Author: Filip Strömbäck <[email protected]> |
| 4 |
--- /dev/null |
| 5 |
+++ b/bin/install-headers.py |
| 6 |
@@ -0,0 +1,47 @@ |
| 7 |
+#!/usr/bin/env python3 |
| 8 |
+ |
| 9 |
+import argparse |
| 10 |
+import os, os.path |
| 11 |
+import re |
| 12 |
+ |
| 13 |
+parser = argparse.ArgumentParser() |
| 14 |
+parser.add_argument("--src", help="Source directory for includes", required=True) |
| 15 |
+parser.add_argument("--dest", help="Destination path for includes", required=True) |
| 16 |
+parser.add_argument("--ignore", help="Ignore files matching regex", action="append") |
| 17 |
+args = parser.parse_args() |
| 18 |
+ |
| 19 |
+filemode = 0o644 |
| 20 |
+ |
| 21 |
+def update_file(filename): |
| 22 |
+ global args, filemode |
| 23 |
+ |
| 24 |
+ if not filename.endswith(".h"): |
| 25 |
+ return |
| 26 |
+ |
| 27 |
+ if args.ignore: |
| 28 |
+ for i in args.ignore: |
| 29 |
+ if re.fullmatch(i, filename): |
| 30 |
+ return |
| 31 |
+ |
| 32 |
+ skia_include = re.compile(r'^([ \t]*)# *include *"include/([^"]*)"[ \t]*(//.*)?\n?$') |
| 33 |
+ skcms_include = re.compile('^([ \t]*)# *include *"modules/skcms/skcms.h"[ \t]*(//.*)?\n?$') |
| 34 |
+ |
| 35 |
+ dstfile = os.path.join(args.dest, filename[len(args.src):]) |
| 36 |
+ os.makedirs(os.path.dirname(dstfile), exist_ok=True) |
| 37 |
+ |
| 38 |
+ with open(filename, "r") as src: |
| 39 |
+ with open(dstfile, "w") as dst: |
| 40 |
+ for line in src: |
| 41 |
+ if match := skia_include.fullmatch(line): |
| 42 |
+ dst.write("{}#include <skia/{}>\n".format(match[1], match[2])) |
| 43 |
+ elif match := skcms_include.fullmatch(line): |
| 44 |
+ dst.write("{}#include <skia/skcms.h>\n".format(match[1])) |
| 45 |
+ else: |
| 46 |
+ dst.write(line) |
| 47 |
+ |
| 48 |
+ |
| 49 |
+ os.chmod(dstfile, filemode) |
| 50 |
+ |
| 51 |
+for dirname, dirs, files in os.walk(args.src): |
| 52 |
+ for f in files: |
| 53 |
+ update_file(os.path.join(dirname, f)) |
| 54 |
--- a/BUILD.gn |
| 55 |
+++ b/BUILD.gn |
| 56 |
@@ -2,13 +2,12 @@ |
| 57 |
# |
| 58 |
# Use of this source code is governed by a BSD-style license that can be |
| 59 |
# found in the LICENSE file. |
| 60 |
- |
| 61 |
import("gn/codec.gni") |
| 62 |
import("gn/pathops.gni") |
| 63 |
import("gn/rust.gni") |
| 64 |
import("gn/shared_sources.gni") |
| 65 |
import("gn/skia.gni") |
| 66 |
-import("gn/toolchain/wasm.gni") |
| 67 |
+#import("gn/toolchain/wasm.gni") |
| 68 |
|
| 69 |
if (defined(skia_settings)) { |
| 70 |
import(skia_settings) |
| 71 |
@@ -1333,7 +1332,11 @@ |
| 72 |
enabled = skia_use_freetype |
| 73 |
|
| 74 |
public_defines = [ "SK_TYPEFACE_FACTORY_FREETYPE" ] |
| 75 |
- deps = [ "//third_party/freetype2" ] |
| 76 |
+ # Use system freetype instead: |
| 77 |
+ #deps = [ "//third_party/freetype2" ] |
| 78 |
+ libs = [ "freetype" ] |
| 79 |
+ cflags = [ "-isystem/usr/include/freetype2" ] |
| 80 |
+ |
| 81 |
sources = skia_ports_freetype_sources |
| 82 |
sources_for_tests = [ "tests/FontScanner_FreeTypeTest.cpp" ] |
| 83 |
} |
| 84 |
--- a/gn/toolchain/BUILD.gn |
| 85 |
+++ b/gn/toolchain/BUILD.gn |
| 86 |
@@ -7,6 +7,8 @@ |
| 87 |
host_cc = cc |
| 88 |
host_cxx = cxx |
| 89 |
|
| 90 |
+ skia_so_version = -1 |
| 91 |
+ |
| 92 |
if (is_android) { |
| 93 |
_prefix = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin" |
| 94 |
if (host_os == "win") { |
| 95 |
@@ -322,6 +324,10 @@ |
| 96 |
soname = "{{target_output_name}}{{output_extension}}" |
| 97 |
|
| 98 |
rpath = "-Wl,-soname,$soname" |
| 99 |
+ if (skia_so_version >= 0) { |
| 100 |
+ rpath = "$rpath.$skia_so_version" |
| 101 |
+ } |
| 102 |
+ |
| 103 |
if (is_mac || is_ios) { |
| 104 |
rpath = "-Wl,-install_name,@rpath/$soname" |
| 105 |
} |
| 106 |
--- a/gn/BUILDCONFIG.gn |
| 107 |
+++ b/gn/BUILDCONFIG.gn |
| 108 |
@@ -182,7 +182,8 @@ |
| 109 |
default_configs = [ |
| 110 |
"//gn/skia:default", |
| 111 |
"//gn/skia:no_exceptions", |
| 112 |
- "//gn/skia:no_rtti", |
| 113 |
+ # We want RTTI, otherwise builds *with* RTTI don't work. |
| 114 |
+ # "//gn/skia:no_rtti", |
| 115 |
"//gn/skia:strict_aliasing", |
| 116 |
] |
| 117 |
if (!is_debug) { |
| 118 |
--- /dev/null |
| 119 |
+++ b/bin/install-pc.py |
| 120 |
@@ -0,0 +1,29 @@ |
| 121 |
+#!/usr/bin/env python3 |
| 122 |
+import os |
| 123 |
+import os.path |
| 124 |
+import sys |
| 125 |
+ |
| 126 |
+template = ''' |
| 127 |
+prefix=/usr |
| 128 |
+exec_prefix=${prefix} |
| 129 |
+libdir=${prefix}/lib/%(DEB_HOST_MULTIARCH)s |
| 130 |
+includedir=${prefix}/include |
| 131 |
+ |
| 132 |
+Name: skia |
| 133 |
+Description: 2D graphics library |
| 134 |
+Version: %(FULL_VERSION)s |
| 135 |
+Libs: -L${libdir} -lskia |
| 136 |
+Cflags: -I${includedir}/skia |
| 137 |
+''' |
| 138 |
+ |
| 139 |
+if len(sys.argv) < 2: |
| 140 |
+ print("Expected output path.") |
| 141 |
+ exit(1) |
| 142 |
+ |
| 143 |
+output = sys.argv[1] |
| 144 |
+ |
| 145 |
+os.makedirs(os.path.dirname(output), exist_ok=True) |
| 146 |
+ |
| 147 |
+with open(output, 'w') as f: |
| 148 |
+ f.write((template.strip() % os.environ) + "\n") |
| 149 |
+ |
| 150 |
--- a/gn/skia.gni |
| 151 |
+++ b/gn/skia.gni |
| 152 |
@@ -105,6 +105,8 @@ |
| 153 |
} |
| 154 |
|
| 155 |
skia_build_rust_targets = false |
| 156 |
+ |
| 157 |
+ skia_no_pic = false |
| 158 |
} |
| 159 |
|
| 160 |
declare_args() { |
| 161 |
--- a/gn/skia/BUILD.gn |
| 162 |
+++ b/gn/skia/BUILD.gn |
| 163 |
@@ -120,8 +120,10 @@ |
| 164 |
"$win_vc/Tools/MSVC/$win_toolchain_version/lib/$current_cpu", |
| 165 |
] |
| 166 |
} else { |
| 167 |
+ if (!skia_no_pic) { |
| 168 |
+ cflags += [ "-fPIC" ] |
| 169 |
+ } |
| 170 |
cflags += [ |
| 171 |
- "-fPIC", |
| 172 |
"-fvisibility=hidden", |
| 173 |
] |
| 174 |
cflags_cc += [ "-fvisibility-inlines-hidden" ] |