Skip to content

Commit 135a848

Browse files
committed
ci: pack
1 parent 04a0df1 commit 135a848

File tree

3 files changed

+69
-10
lines changed

3 files changed

+69
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
- name: Build
138138
shell: bash
139139
run: |
140-
just build
140+
just build pack
141141
- name: Configure
142142
run: |
143143
cat <<END >>$GITHUB_STEP_SUMMARY

justfile

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ depot_tools_repo := "https://chromium.googlesource.com/chromium/tools/depot_tool
44
pdfium_repo := "https://pdfium.googlesource.com/pdfium.git"
55
pdfium_branch := env_var_or_default('PDFIUM_BRANCH', "chromium/6694")
66

7-
patches_dir := "$PWD/patches"
8-
pdfium_dir := "pdfium"
7+
dist := "$PWD/dist"
8+
patches := "$PWD/patches"
9+
pdfium := "pdfium"
910
target := if "$target_os" == "$target_cpu" { "$target_os" } else { "$target_os-$target_cpu" }
1011

1112
clone_depot_tools:
@@ -36,7 +37,7 @@ build: clone_depot_tools
3637

3738
just clone_pdfium
3839

39-
mkdir -p {{pdfium_dir}}/out/{{target}}
40+
mkdir -p {{pdfium}}/out/{{target}}
4041

4142
env=$(
4243
cat .env
@@ -47,20 +48,37 @@ build: clone_depot_tools
4748
)
4849
args="$(echo $env | sed 's/ = /=/g' | sort)"
4950

50-
pushd {{pdfium_dir}}
51+
pushd {{pdfium}}
5152
case {{target}} in
5253
ios)
53-
[ -f {{patches_dir}}/ios.build.patch ] && git apply -v {{patches_dir}}/patches/ios.build.patch
54-
[ -f {{patches_dir}}/ios.rules.patch ] && git -C build {{patches_dir}}/patches/ios.rules.patch
55-
;;
54+
[ -f {{patches}}/ios.build.patch ] && git apply -v {{patches}}/patches/ios.build.patch
55+
[ -f {{patches}}/ios.rules.patch ] && git -C build {{patches}}/patches/ios.rules.patch
56+
;;
5657
win)
57-
[ -f {{patches_dir}}/win.toolchain.patch ] && git -C build apply -v {{patches_dir}}/win.toolchain.patch
58-
;;
58+
[ -f {{patches}}/win.toolchain.patch ] && git -C build apply -v {{patches}}/win.toolchain.patch
59+
;;
5960
esac
6061

6162
gn gen out/{{target}} --args="$args"
6263
ninja -C out/{{target}} pdfium -v
64+
ls -la out/{{target}}/obj
6365
popd
6466

6567
test:
6668
echo 'test'
69+
70+
pack:
71+
#!/usr/bin/env bash
72+
set -euo pipefail
73+
74+
mkdir -p {{dist}}
75+
mkdir -p {{dist}}/lib
76+
77+
cd {{pdfium}} && git apply -C public {{patches}}/patches/headers.patch
78+
79+
cp -r {{pdfium}}/public {{dist}}/include
80+
rm -f {{dist}}/include/DEPS
81+
rm -f {{dist}}/include/README
82+
rm -f {{dist}}/include/PRESUBMIT.py
83+
84+
#cp {{pdfium}}/out/{{target}}/obj/libpdfium.a {{dist}}/lib

patches/headers.patch

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git a/public/cpp/fpdf_deleters.h b/public/cpp/fpdf_deleters.h
2+
index d58f8d593..55b85d9ed 100644
3+
--- a/public/cpp/fpdf_deleters.h
4+
+++ b/public/cpp/fpdf_deleters.h
5+
@@ -5,15 +5,15 @@
6+
#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
7+
#define PUBLIC_CPP_FPDF_DELETERS_H_
8+
9+
-#include "public/fpdf_annot.h"
10+
-#include "public/fpdf_dataavail.h"
11+
-#include "public/fpdf_edit.h"
12+
-#include "public/fpdf_formfill.h"
13+
-#include "public/fpdf_javascript.h"
14+
-#include "public/fpdf_structtree.h"
15+
-#include "public/fpdf_text.h"
16+
-#include "public/fpdf_transformpage.h"
17+
-#include "public/fpdfview.h"
18+
+#include "../fpdf_annot.h"
19+
+#include "../fpdf_dataavail.h"
20+
+#include "../fpdf_edit.h"
21+
+#include "../fpdf_formfill.h"
22+
+#include "../fpdf_javascript.h"
23+
+#include "../fpdf_structtree.h"
24+
+#include "../fpdf_text.h"
25+
+#include "../fpdf_transformpage.h"
26+
+#include "../fpdfview.h"
27+
28+
// Custom deleters for using FPDF_* types with std::unique_ptr<>.
29+
30+
diff --git a/public/cpp/fpdf_scopers.h b/public/cpp/fpdf_scopers.h
31+
index fd9ce6997..34cf9c46a 100644
32+
--- a/public/cpp/fpdf_scopers.h
33+
+++ b/public/cpp/fpdf_scopers.h
34+
@@ -8,7 +8,7 @@
35+
#include <memory>
36+
#include <type_traits>
37+
38+
-#include "public/cpp/fpdf_deleters.h"
39+
+#include "fpdf_deleters.h"
40+
41+
// Versions of FPDF types that clean up the object at scope exit.

0 commit comments

Comments
 (0)