Last active
June 8, 2023 11:41
-
-
Save johngray1965/5e9f98b4390ed50181d8129072e472d3 to your computer and use it in GitHub Desktop.
Script for build pdfium for Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# current the latest stable android branch (from Jan 2020) | |
githash=daabea6ba6c09f72e956e826b132f1d1b77acb9b | |
# if want to run this from somewhere other then /data adjust below | |
basedir=/data | |
# exit when any command fails | |
set -e | |
# keep track of the last executed command | |
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG | |
# echo an error message before exiting | |
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT | |
apt-get update | |
apt-get install -y build-essential git subversion pkg-config python libtool cmake glib2.0-dev libatspi2.0-dev wget lsb-release sudo | |
cd $basedir | |
mkdir -p build/source | |
if [ ! -e depot_tools ]; then | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
fi | |
export PATH=$PATH:$basedir/depot_tools/ | |
cd build/source/ | |
gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git@$githash | |
echo "target_os = [ 'android' ]" >> .gclient | |
if [ ! -e pdfium ]; then | |
ln -s pdfium.git@$githash pdfium | |
fi | |
gclient sync | |
cd pdfium | |
./build/install-build-deps.sh | |
gclient runhooks | |
tmpfile=$(mktemp /tmp/build_pdfium.XXXXXX) | |
sed '/.*"PNG_USE_READ_MACROS",.*/a "FPDFSDK_EXPORTS",' BUILD.gn | uniq > $tmpfile | |
mv $tmpfile BUILD.gn | |
for arch in x86 x64 arm arm64; do | |
gn gen out/$arch --args="target_os=\"android\" target_cpu=\"$arch\" is_debug = false pdf_is_standalone = true is_component_build = true pdf_enable_xfa = false pdf_enable_v8 = false pdf_use_skia = false symbol_level = 1" | |
ninja -C out/$arch/ pdfium | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment