|
| 1 | +# Note that this script can accept some limited command-line arguments, run |
| 2 | +# `julia build_tarballs.jl --help` to see a usage message. |
| 3 | +using BinaryBuilder, Pkg |
| 4 | + |
| 5 | +name = "Skia" |
| 6 | +version = v"0.40.0" |
| 7 | + |
| 8 | +# Collection of sources required to complete build |
| 9 | +sources = [ |
| 10 | + GitSource("https://github.com/google/skia.git", "482de011c920d85fdbe21a81c45852655df6a809"), |
| 11 | + GitSource("https://github.com/stensmo/cskia.git", "3438e6efd3a4f27f43457db675ceb33da30c60cf"), |
| 12 | + DirectorySource("./bundled"), |
| 13 | + # Missing header ft2build.h for freetype2 |
| 14 | + GitSource("https://chromium.googlesource.com/chromium/src/third_party/freetype2.git","5d4e649f740c675426fbe4cdaffc53ee2a4cb954"), |
| 15 | + GitSource("https://chromium.googlesource.com/libyuv/libyuv.git","d248929c059ff7629a85333699717d7a677d8d96"), |
| 16 | + # These two have some kind of source dependency. |
| 17 | + GitSource("https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git","e3f919ccfe3ef542cfc983a82146070258fb57f8"), |
| 18 | + GitSource("https://chromium.googlesource.com/chromium/src/third_party/zlib","646b7f569718921d7d4b5b8e22572ff6c76f2596"), |
| 19 | + # Need 10.15 SDK for Mac |
| 20 | + FileSource("https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz","2408d07df7f324d3beea818585a6d990ba99587c218a3969f924dfcc4de93b62"), |
| 21 | +] |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +# These are the platforms we will build for by default, unless further |
| 26 | +# platforms are passed in on the command line |
| 27 | +platforms = supported_platforms() |
| 28 | +filter!(p -> !Sys.iswindows(p), platforms) |
| 29 | +platforms = expand_cxxstring_abis(platforms) |
| 30 | + |
| 31 | +# Remove musl && cxx03, since there is a bug preventing Skia to build |
| 32 | +filter!(p -> !(cxxstring_abi(p) == "cxx03" && libc(p) == "musl"), platforms) |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +# The products that we will ensure are always built |
| 37 | +products = [ |
| 38 | + LibraryProduct("libskia", :libskia) |
| 39 | +] |
| 40 | + |
| 41 | +# Dependencies that must be installed before this package can be built |
| 42 | +dependencies = [ |
| 43 | + Dependency("Fontconfig_jll"; compat="2.16.0") |
| 44 | + Dependency("JpegTurbo_jll"; compat="3.1.1") |
| 45 | + Dependency("libpng_jll"; compat="1.6.49") |
| 46 | + Dependency("libwebp_jll"; compat="1.5.0") |
| 47 | + Dependency("ICU_jll"; compat="76.1") |
| 48 | + Dependency("Expat_jll"; compat="2.6.5") |
| 49 | + Dependency(PackageSpec(name="Xorg_libX11_jll", uuid="4f6342f7-b3d2-589e-9d20-edeb45f2b2bc");) |
| 50 | + Dependency(PackageSpec(name="xkbcommon_jll", uuid="d8fb68d0-12a3-5cfd-a85a-d49703b185fd"); ) |
| 51 | + Dependency(PackageSpec(name="Libglvnd_jll", uuid="7e76a0d4-f3c7-5321-8279-8d96eeed0f29"); ) |
| 52 | + BuildDependency(PackageSpec(name="Xorg_xorgproto_jll", uuid="c4d99508-4286-5418-9131-c86396af500b");) |
| 53 | +] |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +# Bash recipe for building across all platforms |
| 58 | +script = raw""" |
| 59 | +
|
| 60 | +cd $WORKSPACE/srcdir/ |
| 61 | +for f in ${WORKSPACE}/srcdir/patches/*.patch; do |
| 62 | + atomic_patch -p1 ${f} |
| 63 | +done |
| 64 | +
|
| 65 | +mkdir skia/third_party/externals/ |
| 66 | +shopt -s extglob |
| 67 | +
|
| 68 | +# Rename libraries to the names used in Skia |
| 69 | +mv wuffs-mirror-release-c wuffs |
| 70 | +mv freetype2 freetype |
| 71 | +
|
| 72 | +# Move dependencies to the correct location |
| 73 | +mv !(cskia|skia|patches|MacOSX10.15.sdk.tar.xz) skia/third_party/externals/ |
| 74 | +
|
| 75 | +
|
| 76 | +cd skia |
| 77 | +
|
| 78 | +install_license LICENSE |
| 79 | +
|
| 80 | +bin/fetch-gn |
| 81 | +
|
| 82 | +
|
| 83 | +cp ../cskia/capi/sk_capi.cpp src/base/ |
| 84 | +cp ../cskia/capi/sk_capi.h src/base/ |
| 85 | +
|
| 86 | +
|
| 87 | +if [[ "${target}" == x86_64-* ]]; then |
| 88 | + target_cpu=x64 |
| 89 | +elif [[ "${target}" == aarch64-* ]]; then |
| 90 | + target_cpu=arm64 |
| 91 | +elif [[ "${target}" == riscv64-* ]]; then |
| 92 | + target_cpu=riscv |
| 93 | +elif [[ "${target}" == powerpc64le-* ]]; then |
| 94 | + target_cpu=powerpc64le |
| 95 | +elif [[ "${target}" == i686-* ]]; then |
| 96 | + target_cpu=x86 |
| 97 | +elif [[ "${target}" == armv7l-* ]]; then |
| 98 | + target_cpu=armv7-a |
| 99 | +elif [[ "${target}" == armv6l-* ]]; then |
| 100 | + target_cpu=arm |
| 101 | +fi |
| 102 | +
|
| 103 | +
|
| 104 | +if [[ "${target}" == x86_64-apple-darwin* ]]; then |
| 105 | + # Work around the issue |
| 106 | + export MACOSX_DEPLOYMENT_TARGET=10.15 |
| 107 | + # ...and install a newer SDK |
| 108 | + rm -rf /opt/${target}/${target}/sys-root/System |
| 109 | + tar --extract --file=${WORKSPACE}/srcdir/MacOSX10.15.sdk.tar.xz --directory="/opt/${target}/${target}/sys-root/." --strip-components=1 MacOSX10.15.sdk/System MacOSX10.15.sdk/usr |
| 110 | +
|
| 111 | +PLATFORM_ARGS=" |
| 112 | +skia_use_x11=false \ |
| 113 | +target_os=\\"mac\\" |
| 114 | +skia_use_metal=false |
| 115 | +skia_use_fonthost_mac=true |
| 116 | +skia_use_dng_sdk=false |
| 117 | +skia_use_fontconfig=false |
| 118 | +skia_use_freetype=false |
| 119 | +" |
| 120 | +elif [[ "${target}" == *-apple-* ]]; then |
| 121 | +PLATFORM_ARGS=" |
| 122 | +skia_use_x11=false \ |
| 123 | +target_os=\\"mac\\" |
| 124 | +skia_use_metal=true |
| 125 | +skia_enable_fontmgr_fontconfig=false |
| 126 | +skia_use_fonthost_mac=true |
| 127 | +" |
| 128 | +elif [[ "${target}" == *-unknown-* ]]; then |
| 129 | +PLATFORM_ARGS=" |
| 130 | +target_os=\\"FreeBSD\\" \ |
| 131 | +skia_use_dng_sdk=false |
| 132 | +" |
| 133 | +else |
| 134 | +PLATFORM_ARGS=" |
| 135 | +skia_use_fontconfig=true \ |
| 136 | +" |
| 137 | +fi |
| 138 | +
|
| 139 | +ARGS=" |
| 140 | +is_component_build=true \ |
| 141 | +target_cpu=\\"$target_cpu\\" |
| 142 | +cc=\\"clang\\" |
| 143 | +cxx=\\"clang++\\" |
| 144 | +is_official_build=true |
| 145 | +skia_enable_pdf=true |
| 146 | +skia_use_gl=true |
| 147 | +skia_use_harfbuzz=false |
| 148 | +skia_use_system_expat=true |
| 149 | +skia_use_system_freetype2=false |
| 150 | +skia_use_system_icu=true |
| 151 | +skia_use_system_libjpeg_turbo=true |
| 152 | +skia_use_system_libpng=true |
| 153 | +skia_use_system_libwebp=true |
| 154 | +skia_use_system_zlib=true |
| 155 | +skia_use_lua=false |
| 156 | +skia_use_piex=false |
| 157 | +skia_use_dng_sdk=false |
| 158 | +extra_cflags=[\\"-fpic\\", \\"-fvisibility=default\\"] |
| 159 | +$PLATFORM_ARGS |
| 160 | +" |
| 161 | +bin/gn gen out/Dynamic --args="$ARGS" |
| 162 | +
|
| 163 | +ninja -j${nproc} -C out/Dynamic |
| 164 | +
|
| 165 | +cd out/Dynamic/ |
| 166 | +
|
| 167 | +
|
| 168 | +install -Dvm 755 "libskia.${dlext}" "${libdir}/libskia.${dlext}" |
| 169 | +""" |
| 170 | + |
| 171 | + |
| 172 | +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version= v"11.1.0", preferred_llvm_version = v"15.0.7", julia_compat="1.10") |
0 commit comments