Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Jun 14, 2018
1 parent 58ea7fe commit 374afae
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ language: cpp
matrix:
include:
- os: linux
env: CONFIGURATION=Release
env: PDFium_BRANCH=$TRAVIS_BRANCH CONFIGURATION=Release
- os: linux
env: CONFIGURATION=Debug
env: PDFium_BRANCH=$TRAVIS_BRANCH CONFIGURATION=Debug
- os: osx
osx_image: xcode9
env: CONFIGURATION=Release
env: PDFium_BRANCH=$TRAVIS_BRANCH CONFIGURATION=Release
- os: osx
osx_image: xcode9
env: CONFIGURATION=Debug
env: PDFium_BRANCH=$TRAVIS_BRANCH CONFIGURATION=Debug

script:
- bash build.sh
Expand Down
5 changes: 1 addition & 4 deletions args/linux.args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ pdf_enable_v8 = false
# Build PDFium standalone (default = false)
pdf_is_standalone = true

# Use GCC
is_clang=false
use_cxx11=true

# Static link to c++ library
use_custom_libcxx=true
libcpp_is_static=true
2 changes: 1 addition & 1 deletion args/windows.args.gn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Disable component build (must be false)
is_component_build = true
is_component_build = false

# Build PDFium either with or without v8 support (default = true)
pdf_enable_v8 = false
Expand Down
15 changes: 8 additions & 7 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ call git apply -v "%PDFium_PATCH_DIR%\shared_library.patch"
call git apply -v "%PDFium_PATCH_DIR%\relative_includes.patch"

: Configure
if "%CONFIGURATION%"=="Release" echo is_debug=false >> %PDFium_ARGS%
if "%PLATFORM%"=="x86" echo target_cpu="x86" >> %PDFium_ARGS%
move %PDFium_ARGS% %PDFium_BUILD_DIR%\args.gn
copy %PDFium_ARGS% %PDFium_BUILD_DIR%\args.gn
if "%CONFIGURATION%"=="Release" echo is_debug=false >> %PDFium_BUILD_DIR%\args.gn
if "%PLATFORM%"=="x86" echo target_cpu="x86" >> %PDFium_BUILD_DIR%\args.gn

: Generate Ninja files
call gn gen %PDFium_BUILD_DIR%
Expand All @@ -64,12 +64,13 @@ call gn gen %PDFium_BUILD_DIR%
call ninja -C %PDFium_BUILD_DIR% pdfium

: Install
move %PDFium_CMAKE_CONFIG% %PDFium_STAGING_DIR%
move %PDFium_SOURCE_DIR%\LICENSE %PDFium_STAGING_DIR%
move %PDFium_SOURCE_DIR%\public %PDFium_INCLUDE_DIR%
copy %PDFium_CMAKE_CONFIG% %PDFium_STAGING_DIR%
copy %PDFium_SOURCE_DIR%\LICENSE %PDFium_STAGING_DIR%
xcopy /S /Y %PDFium_SOURCE_DIR%\public %PDFium_INCLUDE_DIR%\
del %PDFium_INCLUDE_DIR%\DEPS
del %PDFium_INCLUDE_DIR%\README
move %PDFium_BUILD_DIR%\pdfium.dll.lib %PDFium_LIB_DiR%
del %PDFium_INCLUDE_DIR%\PRESUBMIT.py
move %PDFium_BUILD_DIR%\pdfium.dll.lib %PDFium_LIB_DIR%
move %PDFium_BUILD_DIR%\pdfium.dll %PDFium_BIN_DIR%
if "%CONFIGURATION%"=="Debug" move %PDFium_BUILD_DIR%\pdfium.dll.pdb %PDFium_BIN_DIR%

Expand Down
16 changes: 8 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mkdir -p "$PDFium_LIB_DIR"

# Download depot_tools
git clone "$DepotTools_URL" "$DepotTools_DIR"
PATH="$DepotTools_DIR:$PATH"
export PATH="$DepotTools_DIR:$PATH"

# Clone
gclient config --unmanaged "$PDFium_URL"
Expand All @@ -55,12 +55,11 @@ gclient sync
cd "$PDFium_SOURCE_DIR"
git apply -v "$PDFium_PATCH_DIR/shared_library.patch"
git apply -v "$PDFium_PATCH_DIR/relative_includes.patch"
cd "$PDFium_SOURCE_DIR/build"
git apply -v "$PDFium_PATCH_DIR/static_libstdcxx.patch"
#git apply -v "$PDFium_PATCH_DIR/static_libstdcxx.patch"

# Configure
[ "$CONFIGURATION" == "Release" ] && echo 'is_debug=false' >> "$PDFium_ARGS"
mv "$PDFium_ARGS" "$PDFium_BUILD_DIR/args.gn"
cp "$PDFium_ARGS" "$PDFium_BUILD_DIR/args.gn"
[ "$CONFIGURATION" == "Release" ] && echo 'is_debug=false' >> "$PDFium_BUILD_DIR/args.gn"

# Generate Ninja files
gn gen "$PDFium_BUILD_DIR"
Expand All @@ -70,11 +69,12 @@ ninja -C "$PDFium_BUILD_DIR" pdfium
ls -l "$PDFium_BUILD_DIR"

# Install
mv "$PDFium_CMAKE_CONFIG" "$PDFium_STAGING_DIR"
mv "$PDFium_SOURCE_DIR/LICENSE" "$PDFium_STAGING_DIR"
mv "$PDFium_SOURCE_DIR/public" "$PDFium_INCLUDE_DIR"
cp "$PDFium_CMAKE_CONFIG" "$PDFium_STAGING_DIR"
cp "$PDFium_SOURCE_DIR/LICENSE" "$PDFium_STAGING_DIR"
cp -R "$PDFium_SOURCE_DIR/public" "$PDFium_INCLUDE_DIR"
rm -f "$PDFium_INCLUDE_DIR/DEPS"
rm -f "$PDFium_INCLUDE_DIR/README"
rm -f "$PDFium_INCLUDE_DIR/PRESUBMIT.py"
[ "$OS" == "linux" ] && mv "$PDFium_BUILD_DIR/libpdfium.so" "$PDFium_LIB_DIR"
[ "$OS" == "darwin" ] && mv "$PDFium_BUILD_DIR/libpdfium.dylib" "$PDFium_LIB_DIR"

Expand Down
6 changes: 4 additions & 2 deletions patches/relative_includes.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
diff --git a/public/cpp/fpdf_deleters.h b/public/cpp/fpdf_deleters.h
index 238ef30e6..720074222 100644
index 51e7cba7f..955391e3f 100644
--- a/public/cpp/fpdf_deleters.h
+++ b/public/cpp/fpdf_deleters.h
@@ -5,12 +5,12 @@
@@ -5,13 +5,13 @@
#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
#define PUBLIC_CPP_FPDF_DELETERS_H_

-#include "public/fpdf_annot.h"
-#include "public/fpdf_dataavail.h"
-#include "public/fpdf_edit.h"
-#include "public/fpdf_formfill.h"
-#include "public/fpdf_structtree.h"
-#include "public/fpdf_text.h"
-#include "public/fpdfview.h"
+#include "../fpdf_annot.h"
+#include "../fpdf_dataavail.h"
+#include "../fpdf_edit.h"
+#include "../fpdf_formfill.h"
Expand Down
20 changes: 10 additions & 10 deletions patches/shared_library.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
diff --git a/BUILD.gn b/BUILD.gn
index b4b93b584..d57bb555d 100644
index 132f3c28e..a2d6cfa84 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -23,6 +23,7 @@ config("pdfium_common_config") {
@@ -24,6 +24,7 @@ config("pdfium_common_config") {
"OPJ_STATIC",
"PNG_PREFIX",
"PNG_USE_READ_MACROS",
+ "FPDFSDK_EXPORTS"
+ "FPDFSDK_EXPORTS",
]

if (pdf_use_skia) {
@@ -100,7 +101,7 @@ config("xfa_warnings") {
if (pdf_enable_v8) {
@@ -105,7 +106,7 @@ config("xfa_warnings") {
}
}

-static_library("pdfium") {
-jumbo_static_library("pdfium") {
+shared_library("pdfium") {
sources = [
"fpdfsdk/cba_annotiterator.cpp",
"fpdfsdk/cba_annotiterator.h",
"fpdfsdk/cfx_systemhandler.cpp",
"fpdfsdk/cfx_systemhandler.h",
diff --git a/public/fpdfview.h b/public/fpdfview.h
index 135d00a8f..89c89ed9c 100644
index de0421eb3..ff491d96b 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -142,13 +142,22 @@ typedef int FPDF_ANNOTATION_SUBTYPE;
@@ -153,13 +153,22 @@ typedef int FPDF_ANNOT_APPEARANCEMODE;
// Dictionary value types.
typedef int FPDF_OBJECT_TYPE;

Expand Down

0 comments on commit 374afae

Please sign in to comment.