Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Sep 18, 2024
1 parent c5638b1 commit 107776e
Show file tree
Hide file tree
Showing 15 changed files with 373 additions and 552 deletions.
11 changes: 8 additions & 3 deletions recipes/pdf2htmlex/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
sources:
"0.18.8.rc1-20240905-git":
url: "https://github.com/ViliusSutkus89/pdf2htmlEX/archive/0bbd6686f7214c5ddb230fa3323b75e954f39418.zip"
sha256: "394a5a5555005a18ada6f810ef7ab693f6d916cd9302d874483cbc4956caf557"
"0.18.8.rc1-git-6f85c88":
url: "https://github.com/opendocument-app/pdf2htmlEX/archive/refs/tags/v0.18.8.rc1-git-6f85c88.tar.gz"
sha256: "cc19848576f84469d290e6e271e07dd17ffcc15f40357b8d7456e4f6d1b3ebcf"
patches:
"0.18.8.rc1-git-6f85c88":
- patch_file: "patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch"
- patch_file: "patches/0.18.8.rc1-git-6f85c88/0002-CI-Use-Ubuntu-22.04-upgrade-actions-checkout-and-act.patch"
- patch_file: "0003-Update-missing-font-workaround.patch"
44 changes: 22 additions & 22 deletions recipes/pdf2htmlex/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ class pdf2htmlEXConan(ConanFile):
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def validate(self):
if not self.dependencies["poppler"].options.with_cairo:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_cairo" option')
if not self.dependencies["poppler"].options.with_glib:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_glib" option')
if self.dependencies["poppler"].options.shared:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built as a static library (shared=False)')
if not self.dependencies["fontforge"].options.install_private_headers:
raise ConanInvalidConfiguration(
'Dependency "fontforge" needs to be built with "install_private_headers" option')

def requirements(self):
self.requires("poppler/24.08.0-odr", options={
"with_cairo": True,
Expand Down Expand Up @@ -53,6 +72,9 @@ def requirements(self):
# self.requires("libiconv/1.17")
# self.requires("giflib/5.2.2")

def layout(self):
cmake_layout(self, src_folder="src")

def export_sources(self):
export_conandata_patches(self)

Expand All @@ -65,28 +87,6 @@ def source(self):
exe = os.path.join(self.source_folder, "pdf2htmlEX", "share", executable)
os.chmod(exe, os.stat(exe).st_mode | stat.S_IEXEC)

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def validate(self):
if not self.dependencies["poppler"].options.with_cairo:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_cairo" option')
if not self.dependencies["poppler"].options.with_glib:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_glib" option')
if self.dependencies["poppler"].options.shared:
raise ConanInvalidConfiguration('Dependency "poppler" needs to be built as a static library (shared=False)')
if not self.dependencies["fontforge"].options.install_private_headers:
raise ConanInvalidConfiguration(
'Dependency "fontforge" needs to be built with "install_private_headers" option')

def layout(self):
cmake_layout(self, src_folder="src")

def generate(self):
deps = CMakeDeps(self)
deps.generate()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
From 5e5a947bd1320e19c1271f5dfaeef098baae4452 Mon Sep 17 00:00:00 2001
From: Vilius Sutkus '89 <[email protected]>
Date: Thu, 13 Jun 2024 14:18:06 +0300
Subject: [PATCH 1/3] Upgrade Poppler to 24.06.1

Poppler-24.02.0 OutlineItem changed Title from Unicode pointer and length counter into Unicode vector. ( https://gitlab.freedesktop.org/poppler/poppler/-/commit/fc1c711cb5f769546c6b31cc688bf0ee7f0c1dbc )

Poppler-24.03.0 GooString.h exposes std::string::starts_with and ::ends_with which are CXX20.
---
buildScripts/versionEnvs | 5 ++-
pdf2htmlEX/CMakeLists.txt | 4 +-
pdf2htmlEX/src/HTMLRenderer/outline.cc | 2 +-
pdf2htmlEX/src/util/encoding.cc | 60 +++++++++++++++-----------
pdf2htmlEX/src/util/encoding.h | 2 +
5 files changed, 44 insertions(+), 29 deletions(-)

diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs
index 3ea6cba..9ef5f8b 100755
--- a/buildScripts/versionEnvs
+++ b/buildScripts/versionEnvs
@@ -4,11 +4,12 @@
# versions

# see: https://poppler.freedesktop.org/releases.html
-# current working: 24.01.0
+# current working: 24.06.1

export PDF2HTMLEX_VERSION=0.18.8.rc2

-export POPPLER_VERSION=poppler-24.01.0
+export POPPLER_VERSION=poppler-24.06.1
+#export POPPLER_VERSION=poppler-24.01.0
#export POPPLER_VERSION=poppler-23.12.0
#export POPPLER_VERSION=poppler-21.02.0
#export POPPLER_VERSION=poppler-0.89.0
diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt
index 761bb21..84b4a98 100644
--- a/pdf2htmlEX/CMakeLists.txt
+++ b/pdf2htmlEX/CMakeLists.txt
@@ -125,8 +125,8 @@ set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} Threads::Threads)
-# Poppler-23.12.0 requires CXX17
-set(CMAKE_CXX_STANDARD 17)
+# Poppler-24.03.0 requires CXX20
+set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CYGWIN)
set(CMAKE_CXX_EXTENSIONS OFF)
diff --git a/pdf2htmlEX/src/HTMLRenderer/outline.cc b/pdf2htmlEX/src/HTMLRenderer/outline.cc
index 4fdc826..28415c8 100644
--- a/pdf2htmlEX/src/HTMLRenderer/outline.cc
+++ b/pdf2htmlEX/src/HTMLRenderer/outline.cc
@@ -42,7 +42,7 @@ void HTMLRenderer::process_outline_items(const std::vector<OutlineItem*> * items

f_outline.fs << ">";

- writeUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength());
+ writeUnicodes(f_outline.fs, item->getTitle());

f_outline.fs << "</a>";

diff --git a/pdf2htmlEX/src/util/encoding.cc b/pdf2htmlEX/src/util/encoding.cc
index 6b600bc..1e3fc29 100644
--- a/pdf2htmlEX/src/util/encoding.cc
+++ b/pdf2htmlEX/src/util/encoding.cc
@@ -55,34 +55,46 @@ static int mapUTF8(Unicode u, char *buf, int bufSize)
}
}

+static void writeUnicode(ostream & out, const Unicode u) {
+ switch(u)
+ {
+ case '&':
+ out << "&amp;";
+ break;
+ case '\"':
+ out << "&quot;";
+ break;
+ case '\'':
+ out << "&apos;";
+ break;
+ case '<':
+ out << "&lt;";
+ break;
+ case '>':
+ out << "&gt;";
+ break;
+ default:
+ {
+ char buf[4];
+ auto n = mapUTF8(u, buf, 4);
+ out.write(buf, n);
+ }
+ }
+}
+
void writeUnicodes(ostream & out, const Unicode * u, int uLen)
{
for(int i = 0; i < uLen; ++i)
{
- switch(u[i])
- {
- case '&':
- out << "&amp;";
- break;
- case '\"':
- out << "&quot;";
- break;
- case '\'':
- out << "&apos;";
- break;
- case '<':
- out << "&lt;";
- break;
- case '>':
- out << "&gt;";
- break;
- default:
- {
- char buf[4];
- auto n = mapUTF8(u[i], buf, 4);
- out.write(buf, n);
- }
- }
+ writeUnicode(out, u[i]);
+ }
+}
+
+void writeUnicodes(ostream & out, const std::vector<Unicode> & u)
+{
+ for(const auto & i: u)
+ {
+ writeUnicode(out, i);
}
}

diff --git a/pdf2htmlEX/src/util/encoding.h b/pdf2htmlEX/src/util/encoding.h
index c4d7732..da3c00f 100644
--- a/pdf2htmlEX/src/util/encoding.h
+++ b/pdf2htmlEX/src/util/encoding.h
@@ -9,6 +9,7 @@
#define ENCODING_H__

#include <string>
+#include <vector>
#include <iostream>

#include <CharTypes.h>
@@ -19,6 +20,7 @@ namespace pdf2htmlEX {
* Escape necessary characters, and map Unicode to UTF-8
*/
void writeUnicodes(std::ostream & out, const Unicode * u, int uLen);
+void writeUnicodes(std::ostream & out, const std::vector<Unicode> & u);


/*
--
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From b66edbc20b4063d45aaa75191be536c27d137584 Mon Sep 17 00:00:00 2001
From: Vilius Sutkus '89 <[email protected]>
Date: Thu, 13 Jun 2024 14:19:32 +0300
Subject: [PATCH 2/3] [CI] Use Ubuntu 22.04, upgrade actions/checkout and
actions/upload-artifact

Ubuntu 20.04 comes with Freetype 2.10.1, Poppler requires at least 2.11
---
.github/workflows/build.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f7bd2f8..c1a39cf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -4,16 +4,16 @@ on: [push]

jobs:
build:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
steps:
- name: Checkout Code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4

- name: Build project with APT
run: './buildScripts/buildInstallLocallyApt'

- name: Upload artifact
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
with:
name: my-artifact
path: pdf2htmlEX/build
--
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 4753c1e17c815de7773be7ffd99cfbe947e8754a Mon Sep 17 00:00:00 2001
From: Vilius Sutkus '89 <[email protected]>
Date: Mon, 5 Aug 2024 21:35:29 +0300
Subject: [PATCH 3/3] Update missing font workaround

---
pdf2htmlEX/src/HTMLRenderer/font.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pdf2htmlEX/src/HTMLRenderer/font.cc b/pdf2htmlEX/src/HTMLRenderer/font.cc
index 9c3112b..ff27da2 100644
--- a/pdf2htmlEX/src/HTMLRenderer/font.cc
+++ b/pdf2htmlEX/src/HTMLRenderer/font.cc
@@ -1080,7 +1080,10 @@ static string general_font_family(GfxFont * font)
// TODO: this function is called when some font is unable to process, may use the name there as a hint
void HTMLRenderer::export_remote_default_font(long long fn_id)
{
- f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:hidden;}" << endl;
+// Workaround for https://github.com/opendocument-app/pdf2htmlEX-Android/issues/94
+// Workaround for https://github.com/opendocument-app/OpenDocument.droid/issues/348
+// f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:hidden;}" << endl;
+ f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:visible;}" << endl;
}

void HTMLRenderer::export_local_font(const FontInfo & info, GfxFont * font, const string & original_font_name, const string & cssfont)
--
2.39.3 (Apple Git-146)

3 changes: 1 addition & 2 deletions recipes/pdf2htmlex/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
versions:
"0.18.8.rc1-20240905-git":
"0.18.8.rc1-git-6f85c88":
folder: all

12 changes: 5 additions & 7 deletions recipes/wvware/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
sources:
"1.2.9":
url:
- "https://github.com/ViliusSutkus89/OpenSourceMirrors/releases/download/wvWare-1.2.9/wv-1.2.9.tar.gz"
- "https://github.com/opendocument-app/wvWare/releases/download/v1.2.9/wv-1.2.9.tar.gz"
- "http://www.nl.abisource.com/downloads/wv/1.2.9/wv-1.2.9.tar.gz"
sha256: "4c730d3b325c0785450dd3a043eeb53e1518598c4f41f155558385dd2635c19d"
patches:
"1.2.9":
- patch_file: "patches/wv-1.2.9-gsf-meta-names.patch"
- patch_file: "patches/1.2.9/gsf-meta-names.patch"
# https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/wv/files
- patch_file: "patches/wv-1.2.9-C99-decls.patch"
- patch_file: "patches/wv-1.2.9-format-security.patch"
- patch_file: "patches/wv-1.2.9-gcc14-build-fix.patch"

- patch_file: "patches/wvWare-library.patch"
- patch_file: "patches/1.2.9/C99-decls.patch"
- patch_file: "patches/1.2.9/format-security.patch"
- patch_file: "patches/1.2.9/gcc14-build-fix.patch"
4 changes: 4 additions & 0 deletions recipes/wvware/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.build import cross_building
from conan.tools.layout import basic_layout
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps
Expand Down Expand Up @@ -81,6 +82,9 @@ def build_requirements(self):
if is_msvc(self):
self.tool_requires("automake/1.16.5")

def layout(self):
basic_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
# apply patches listed in conandata.yml
Expand Down
24 changes: 24 additions & 0 deletions recipes/wvware/all/patches/1.2.9/0001-gsf-meta-names.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 4105b1e53c1c98d0b4b5d139090de6d7b07ebd2e Mon Sep 17 00:00:00 2001
From: Andreas Stefl <[email protected]>
Date: Wed, 18 Sep 2024 15:54:59 +0200
Subject: [PATCH 1/4] gsf meta names

---
wvSummary.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/wvSummary.c b/wvSummary.c
index 980b856..27b5fed 100644
--- a/wvSummary.c
+++ b/wvSummary.c
@@ -33,6 +33,7 @@
#include <gsf/gsf-msole-utils.h>
#include <gsf/gsf-docprop-vector.h>
#include <gsf/gsf-meta-names.h>
+#include <gsf/gsf-doc-meta-data.h>

#include <stdio.h>
#include <stdlib.h>
--
2.39.3 (Apple Git-146)

Loading

0 comments on commit 107776e

Please sign in to comment.