forked from bblanchon/pdfium-binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-patch.sh
executable file
·57 lines (45 loc) · 1.45 KB
/
03-patch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash -eux
PATCHES="$PWD/patches"
SOURCE="${PDFium_SOURCE_DIR:-pdfium}"
OS="${PDFium_TARGET_OS:?}"
TARGET_LIBC="${PDFium_TARGET_LIBC:-default}"
pushd "${SOURCE}"
[ "$OS" != "wasm" ] && git apply -v "$PATCHES/shared_library.patch"
git apply -v "$PATCHES/public_headers.patch"
[ "${PDFium_ENABLE_V8:-}" == "true" ] && git apply -v "$PATCHES/v8/pdfium.patch"
case "$OS" in
android)
git apply -v "$PATCHES/android/pdfium.patch"
;;
ios)
git apply -v "$PATCHES/ios/pdfium.patch"
git -C build apply -v "$PATCHES/ios/build.patch"
;;
wasm)
git apply -v "$PATCHES/wasm/pdfium.patch"
git -C build apply -v "$PATCHES/wasm/build.patch"
mkdir -p "build/toolchain/wasm"
cp "$PATCHES/wasm/toolchain.gn" "build/toolchain/wasm/BUILD.gn"
mkdir -p "build/config/wasm"
cp "$PATCHES/wasm/config.gn" "build/config/wasm/BUILD.gn"
;;
win)
git apply -v "$PATCHES/win/pdfium.patch"
git -C build apply -v "$PATCHES/win/build.patch"
VERSION=${PDFium_VERSION:-0.0.0.0}
YEAR=$(date +%Y)
VERSION_CSV=${VERSION//./,}
export YEAR VERSION VERSION_CSV
envsubst < "$PATCHES/win/resources.rc" > "resources.rc"
;;
esac
case "$TARGET_LIBC" in
musl)
git apply -v "$PATCHES/musl/pdfium.patch"
git -C build apply -v "$PATCHES/musl/build.patch"
mkdir -p "build/toolchain/linux/musl"
cp "$PATCHES/musl/toolchain.gn" "build/toolchain/linux/musl/BUILD.gn"
;;
esac
"$PATCHES/aggregate_licenses.sh"
popd