forked from bblanchon/pdfium-binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
07-stage.sh
executable file
·59 lines (48 loc) · 1.41 KB
/
07-stage.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
#!/bin/bash -eux
IS_DEBUG=${PDFium_IS_DEBUG:-false}
OS=${PDFium_TARGET_OS:?}
VERSION=${PDFium_VERSION:-}
PATCHES="$PWD/patches"
SOURCE=${PDFium_SOURCE_DIR:-pdfium}
BUILD=${PDFium_BUILD_DIR:-pdfium/out}
STAGING="$PWD/staging"
STAGING_BIN="$STAGING/bin"
STAGING_LIB="$STAGING/lib"
mkdir -p "$STAGING"
mkdir -p "$STAGING_LIB"
sed "s/#VERSION#/${VERSION:-0.0.0.0}/" <"$PATCHES/PDFiumConfig.cmake" >"$STAGING/PDFiumConfig.cmake"
cp "$SOURCE/LICENSES" "$STAGING/LICENSE"
cp "$BUILD/args.gn" "$STAGING"
cp -R "$SOURCE/public" "$STAGING/include"
rm -f "$STAGING/include/DEPS"
rm -f "$STAGING/include/README"
rm -f "$STAGING/include/PRESUBMIT.py"
case "$OS" in
android|linux)
mv "$BUILD/libpdfium.so" "$STAGING_LIB"
;;
mac|ios)
mv "$BUILD/libpdfium.dylib" "$STAGING_LIB"
;;
wasm)
mv "$BUILD/pdfium.html" "$STAGING_LIB"
mv "$BUILD/pdfium.js" "$STAGING_LIB"
mv "$BUILD/pdfium.wasm" "$STAGING_LIB"
rm -rf "$STAGING/include/cpp"
rm "$STAGING/PDFiumConfig.cmake"
;;
win)
mv "$BUILD/pdfium.dll.lib" "$STAGING_LIB"
mkdir -p "$STAGING_BIN"
mv "$BUILD/pdfium.dll" "$STAGING_BIN"
[ "$IS_DEBUG" == "true" ] && mv "$BUILD/pdfium.dll.pdb" "$STAGING_BIN"
;;
esac
if [ -n "$VERSION" ]; then
cat >"$STAGING/VERSION" <<END
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
BUILD=$(echo "$VERSION" | cut -d. -f3)
PATCH=$(echo "$VERSION" | cut -d. -f4)
END
fi