Skip to content

Commit

Permalink
Add the unofficial pdf2htmlEX 0.18.8.rc2 release. Bump fontforge dep
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Dec 14, 2023
1 parent ac12eae commit 77cd473
Show file tree
Hide file tree
Showing 9 changed files with 1,171 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pdf2htmlEX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ on:
- '.github/workflows/pdf2htmlEX.yml'

jobs:
build-pdf2htmlEX-0_18_8_rc2:
name: pdf2htmlEX 0.18.8.rc2
uses: ./.github/workflows/build.yml
with:
package: pdf2htmlEX
version: '0.18.8.rc2'

build-pdf2htmlEX-0_18_8_rc1:
name: pdf2htmlEX 0.18.8.rc1
uses: ./.github/workflows/build.yml
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Available versions:

Available versions:

- v0.18.8.rc2 (unofficial release, https://github.com/pdf2htmlEX/pdf2htmlEX/pull/145)
- v0.18.8.rc1
- v0.18.7-poppler-0.81.0

Expand Down
51 changes: 35 additions & 16 deletions pdf2htmlEX/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ val portVersion = when(project.findProperty("packageVersion")) {
version = "0.18.7-poppler-0.81.0-beta-4"
"0.18.7-poppler-0.81.0"
}
else /* "0.18.8.rc1" */ -> {
"0.18.8.rc1" -> {
version = "0.18.8.rc1-beta-4"
"0.18.8.rc1"
}
// https://github.com/pdf2htmlEX/pdf2htmlEX/pull/145 Will probably be named rc2
else /* "0.18.8.rc2" */ -> {
version = "0.18.8.rc2-beta-1"
"0.18.8.rc2"
}
}

plugins {
Expand All @@ -30,24 +35,28 @@ dependencies {

when (portVersion) {
"0.18.7-poppler-0.81.0" -> {
implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20170731-beta-5")
implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20170731-beta-6")
implementation("com.viliussutkus89.ndk.thirdparty:poppler${ndkVersionSuffix}-static:0.81.0-beta-3")
}
"0.18.8.rc1" -> {
implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20200314-beta-9")
implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20200314-beta-10")
implementation("com.viliussutkus89.ndk.thirdparty:poppler${ndkVersionSuffix}-static:0.89.0-beta-3")
}
// "0.18.8.rc2" -> {
// implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20230101-beta-8")
// implementation("com.viliussutkus89.ndk.thirdparty:poppler${ndkVersionSuffix}-static:21.02.0-beta-3")
// }
"0.18.8.rc2" -> {
implementation("com.viliussutkus89.ndk.thirdparty:fontforge${ndkVersionSuffix}-static:20230101-beta-9")
implementation("com.viliussutkus89.ndk.thirdparty:poppler${ndkVersionSuffix}-static:21.02.0-beta-3")
}
}
}

ndkPorts {
ndkPath.set(File(project.findProperty("ndkPath") as String))
minSdkVersion.set(rootProject.extra.get("minSdkSupportedByNdk").toString().toInt())
source.set(project.file("v${portVersion}.tar.gz"))
if (portVersion == "0.18.7-poppler-0.81.0") {
source.set(project.file("v${portVersion}.tar.gz"))
} else {
source.set(project.file("v0.18.8.rc1.tar.gz"))
}
}

fun File.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false) {
Expand Down Expand Up @@ -101,7 +110,17 @@ tasks.extractSrc {
srcDir.patch("make-a-library.patch")

srcDir.resolve("pdf2htmlEX/src/util/ffw.c")
.patch("fontforge-share.patch")
.patch("ffw.patch")
}
"0.18.8.rc2" -> {
srcDir.resolve("pdf2htmlEX/CMakeLists.txt")
.patch("find-libraries.patch")
.patch("cflags.patch")
.patch("missing-tests.patch")
srcDir.patch("make-a-library.patch")

srcDir.resolve("pdf2htmlEX/src/util/ffw.c")
.patch("ffw.patch")
}
}
}
Expand All @@ -112,10 +131,8 @@ tasks.prefab {
}

tasks.register<CMakePortTask>("buildPort") {
when (portVersion) {
"0.18.8.rc1" -> {
sourceSubDirectory.set("pdf2htmlEX")
}
if (portVersion != "0.18.7-poppler-0.81.0") {
sourceSubDirectory.set("pdf2htmlEX")
}

cmake { }
Expand All @@ -137,7 +154,9 @@ tasks.register<CMakePortTask>("buildPort") {
tasks.prefabPackage {
version.set(CMakeCompatibleVersion.parse(when(portVersion) {
"0.18.7-poppler-0.81.0" -> "0.18.7.0810"
// rc versions are 0
"0.18.8.rc1" -> "0.18.8.0"
"0.18.8.rc2" -> "0.18.8.0"
else -> portVersion
}))

Expand Down Expand Up @@ -185,17 +204,17 @@ publishing {
// Poppler licenses
license {
name.set("GPLv3-or-later")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/$portVersion/LICENSE")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/v0.18.8.rc1/LICENSE")
distribution.set("repo")
}
license {
name.set("MIT")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/$portVersion/share/LICENSE")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/v0.18.8.rc1/pdf2htmlEX/share/LICENSE")
distribution.set("repo")
}
license {
name.set("CC-BY-3.0")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/$portVersion/logo/LICENSE")
url.set("https://raw.githubusercontent.com/pdf2htmlEX/pdf2htmlEX/v0.18.8.rc1/pdf2htmlEX/logo/LICENSE")
distribution.set("repo")
}
}
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions pdf2htmlEX/patches/0.18.8.rc2/cflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- pdf2htmlEX/CMakeLists.txt 2023-11-15 02:31:51.534000000 +0200
+++ pdf2htmlEX/CMakeLists.txt 2023-11-15 02:31:58.159000000 +0200
@@ -39,15 +39,6 @@
pkg_search_module(FONTFORGE REQUIRED IMPORTED_TARGET libfontforge=20200314)
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} PkgConfig::FONTFORGE)

-# debug build flags (overwrite default cmake debug flags)
-set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")
-set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -pg")
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg")
-
-# release build flags (overwrite default cmake release flags)
-set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
-
# generic flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual")
15 changes: 15 additions & 0 deletions pdf2htmlEX/patches/0.18.8.rc2/ffw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- pdf2htmlEX/src/util/ffw.c 2023-12-14 07:45:44.994000000 +0200
+++ pdf2htmlEX/src/util/ffw.c 2023-12-14 07:46:21.870000000 +0200
@@ -70,7 +70,9 @@
void ffw_init(const char* progPath, int debug)
{
ffwSetAction("initialize");
- char *localProgPath = strdup(progPath);
- FindProgDir(localProgPath);
+ char *localProgPath = NULL;
+ if (progPath != NULL)
+ localProgPath = strdup(progPath);
+ FindProgRoot(localProgPath);
InitSimpleStuff();
if ( default_encoding==NULL )
default_encoding=FindOrMakeEncoding("ISO8859-1");
104 changes: 104 additions & 0 deletions pdf2htmlEX/patches/0.18.8.rc2/find-libraries.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
--- pdf2htmlEX/CMakeLists.txt 2023-11-14 03:32:25.260000000 +0200
+++ pdf2htmlEX/CMakeLists.txt 2023-11-15 02:28:10.440000000 +0200
@@ -23,90 +23,22 @@

find_package(PkgConfig)

-
-# SINCE we have a very intimate relationship with a particular version of
-# poppler... we explicitly describe the poppler include and library
-# paths.
-#
-include_directories(
- ../poppler/build/poppler
- ../poppler/build
- ../poppler/poppler
- ../poppler
-)
-#
-# The following order is critical as the glib functions use functions
-# located in the main poppler library
-#
-set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES}
- ${CMAKE_SOURCE_DIR}/../poppler/build/glib/libpoppler-glib.a
- ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a
-)
-
+pkg_search_module(POPPLER-GLIB REQUIRED IMPORTED_TARGET poppler-glib=21.02.0)
+set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} PkgConfig::POPPLER-GLIB)

if(ENABLE_SVG)
- pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0)
- message("-- Trying to locate cairo-svg...")
- find_path(CAIRO_SVG_INCLUDE_PATH cairo-svg.h PATHS ${CAIRO_INCLUDE_DIRS} NO_DEFAULT_PATH)
- if(CAIRO_SVG_INCLUDE_PATH)
- message("-- found cairo-svg...")
- include_directories(${CAIRO_INCLUDE_DIRS})
- if(NOT DEFINED ENV{USING_BREW})
- link_directories(${CAIRO_LIBRARY_DIRS})
- set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES})
- endif()
- set(ENABLE_SVG 1)
- else()
- message(FATAL_ERROR "Error: no SVG support found in Cairo")
- endif()
-
- find_package(Freetype REQUIRED)
- include_directories(${FREETYPE_INCLUDE_DIRS})
- link_directories(${FREETYPE_LIBRARY_DIRS})
-# set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES})
-endif()
+ pkg_search_module(CAIRO_SVG REQUIRED IMPORTED_TARGET cairo-svg)
+ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} PkgConfig::CAIRO_SVG)
+
+ set(ENABLE_SVG 1)

-# SINCE we have a very intimate relationship with a particular version of
-# fontforge... we explicitly describe the fontforge include and library
-# paths.
-#
-include_directories(
- ../fontforge/fontforge
- ../fontforge
- ../fontforge/build/inc
- ../fontforge/inc
-)
-#
-include_directories(${FONTFORGE_INCLUDE_DIRS})
-link_directories(${FONTFORGE_LIBRARY_DIRS})
-set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES}
- ${CMAKE_SOURCE_DIR}/../fontforge/build/lib/libfontforge.a
-)
-
-# If we are using Alpine Linux then we need to add -lintl
-#
-if (EXISTS /usr/lib/libintl.so )
- set(LIB_INTL_LIBRARIES -lintl )
-else ()
- set(LIB_INTL_LIBRARIES "" )
+ pkg_search_module(FREETYPE REQUIRED IMPORTED_TARGET freetype2)
+ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} PkgConfig::FREETYPE)
endif()

-set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS}
- ${POPPLER_LIBRARIES}
- ${FONTFORGE_LIBRARIES}
- ${LIB_INTL_LIBRARIES}
- ${CAIRO_LIBRARIES}
- -ljpeg
- -lpng
- -lfontconfig
- -lfreetype
- -lxml2
- -lglib-2.0
- -lgio-2.0
- -pthread
- -lz
- -lm
-)
+pkg_search_module(FONTFORGE REQUIRED IMPORTED_TARGET libfontforge=20230101)
+set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} PkgConfig::FONTFORGE)
+include_directories(${FONTFORGE_INCLUDEDIR}/private)

# debug build flags (overwrite default cmake debug flags)
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg")
Loading

0 comments on commit 77cd473

Please sign in to comment.