forked from bblanchon/pdfium-binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·111 lines (88 loc) · 1.94 KB
/
build.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash -eu
OS_NAMES="android|ios|linux|mac|wasm|win"
CPU_NAMES="arm|arm64|x64|x86|wasm"
STEP_REGEX="[0-9]"
START_STEP=0
if [[ $# == 0 ]]
then
echo "PDFium build script.
https://github.com/bblanchon/pdfium-binaries
Usage $0 [options] os cpu
Arguments:
os = Target OS ($OS_NAMES)
cpu = Target CPU ($CPU_NAMES)
Options:
-b branch = Chromium branch (default=main)
-s 0-9 = Set start step (default=0)
-d = debug build
-j = enable v8
-m = build fo musl"
exit
fi
while getopts "b:djms:" OPTION
do
case $OPTION in
b)
export PDFium_BRANCH="$OPTARG"
;;
d)
export PDFium_IS_DEBUG=true
;;
j)
export PDFium_ENABLE_V8=true
;;
m)
export PDFium_TARGET_LIBC=musl
;;
s)
START_STEP="$OPTARG"
;;
*)
echo "Invalid flag -$OPTION"
exit 1
esac
done
shift $(($OPTIND -1))
if [[ $# -lt 2 ]]
then
echo "You must specify target OS and CPU"
exit 1
fi
if [[ $# -gt 2 ]]
then
echo "Too many arguments"
exit 1
fi
if [[ ! $1 =~ ^($OS_NAMES)$ ]]
then
echo "Unknown OS: $1"
exit 1
fi
if [[ ! $2 =~ ^($CPU_NAMES)$ ]]
then
echo "Unknown CPU: $2"
exit 1
fi
if [[ ! $START_STEP =~ ^($STEP_REGEX)$ ]]
then
echo "Invalid step number: $START_STEP"
exit 1
fi
export PDFium_TARGET_OS=$1
export PDFium_TARGET_CPU=$2
set -x
ENV_FILE=${GITHUB_ENV:-.env}
PATH_FILE=${GITHUB_PATH:-.path}
[ $START_STEP -le 0 ] && . steps/00-environment.sh
source "$ENV_FILE"
[ $START_STEP -le 1 ] && . steps/01-install.sh
PATH="$(tr '\n' ':' < "$PATH_FILE")$PATH"
export PATH
[ $START_STEP -le 2 ] && . steps/02-checkout.sh
[ $START_STEP -le 3 ] && . steps/03-patch.sh
[ $START_STEP -le 4 ] && . steps/04-install-extras.sh
[ $START_STEP -le 5 ] && . steps/05-configure.sh
[ $START_STEP -le 6 ] && . steps/06-build.sh
[ $START_STEP -le 7 ] && . steps/07-stage.sh
[ $START_STEP -le 8 ] && . steps/08-test.sh
[ $START_STEP -le 9 ] && . steps/09-pack.sh