Skip to content
Permalink
Browse files

move build-pdfium in here

  • Loading branch information...
jcupitt committed Apr 8, 2018
1 parent a108186 commit a6d685eb1b226f0e2f251007d070f2bbd993dedd
@@ -0,0 +1,4 @@
.*.swp
data/build
data/target

@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 John Cupitt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,20 @@
# Build PDFium

See

https://github.com/jcupitt/libvips/issues/689

# Docker build

Make sure you are in the docker group, then enter:

./build.sh

Should (eventually) generate:

-rw-r--r-- 1 john lxd 25934631 Mar 30 17:18 /home/john/GIT/build-pdfium/data/package/libpdfium-master-linux-x64.tar.gz

# Native build

You can just run the `data/build-pdfium.sh` script directly. Seems to work
on 17.10 at least.
@@ -0,0 +1,21 @@
#!/bin/sh

if ! type docker > /dev/null; then
echo "Please install docker"
exit 1
fi

# ubuntu 17.10
docker pull ubuntu:artful

# Create a machine image with all the required build tools pre-installed
docker build -t pdfium-build container

# Run build scripts inside container, with data subdirectory mounted at
# /data
docker run --rm -t -v $PWD/data:/data pdfium-build \
sh -c "./build-pdfium.sh \
&& ./package.sh"

# List result
ls -al $PWD/data/package/*.tar.gz
@@ -0,0 +1,22 @@
FROM ubuntu:artful

RUN \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
build-essential \
git \
subversion \
pkg-config \
python \
libtool \
cmake \
glib2.0-dev \
wget

# Create a default, non-root 'build' user
# we must have an actual user, not just -u etc., since gclient writes to
# $HOME/.something
RUN groupadd -r build && useradd -m -g build build
WORKDIR /data
USER build
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# set -x
set -e

PLATFORM=linux-x64
LIBNAME="libpdfium-dev"
VERSION_PDFIUM=master

git=$(which git)

BASE=$(pwd)
BUILD_DIR="${BASE}/build"
PATCH_DIR="${BASE}/patches"
BUILD_PKG="${BASE}/package"

BUILD_RES="out/Release_${PLATFORM}"

TARGET_PDFIUM="${BASE}/target"

rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}

DEPOT_TOOLS="${BUILD_DIR}/depot_tools"

if [ ! -d "${DEPOT_TOOLS}" ]; then
${git} clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
fi

export PATH="${DEPOT_TOOLS}":"$PATH"

gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git
gclient sync --no-history

cd pdfium

gn gen "${BUILD_RES}" --args='pdf_bundle_freetype = true pdf_enable_v8 = false pdf_enable_xfa = false pdf_use_skia = false pdf_use_skia_paths = false is_component_build = true pdf_is_complete_lib = true use_sysroot = false'

ninja -C "${BUILD_RES}"
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# set -x
set -e

PLATFORM=linux-x64
VERSION_PDFIUM=master

BASE=$(pwd)
BUILD_DIR="${BASE}/build"
PATCH_DIR="${BASE}/patches"
BUILD_PKG="${BASE}/package"

BUILD_RES="out/Release_${PLATFORM}"

TARGET_PDFIUM="${BASE}/target"

cd ${BUILD_DIR}/pdfium

if [ -d ${TARGET_PDFIUM} ]; then
rm -rf ${TARGET_PDFIUM}
fi

mkdir -p ${TARGET_PDFIUM}
mkdir -p "${TARGET_PDFIUM}/lib"
mkdir -p "${TARGET_PDFIUM}/lib/pdfium-obj"
mkdir -p "${TARGET_PDFIUM}/include"

find ${BUILD_RES} -name '*.a' -not -path "**/testing/*" -not -path "**/build/*" -not -name 'libtest_support.a' -exec cp {} ${TARGET_PDFIUM}/lib/pdfium-obj \;

# there are a couple of shared support libs we need too
cp ${BUILD_RES}/libicuuc.so ${TARGET_PDFIUM}/lib
cp ${BUILD_RES}/libicui18n.so ${TARGET_PDFIUM}/lib
cp ${BUILD_RES}/libc++.so ${TARGET_PDFIUM}/lib

cp public/*.h ${TARGET_PDFIUM}/include

if [ -d ${BUILD_PKG} ]; then
rm -rf ${BUILD_PKG}
fi

mkdir -p ${BUILD_PKG}

cd ${TARGET_PDFIUM}

tar czf /${BUILD_PKG}/libpdfium-${VERSION_PDFIUM}-${PLATFORM}.tar.gz include lib
Binary file not shown.
Binary file not shown.

0 comments on commit a6d685e

Please sign in to comment.
You can’t perform that action at this time.