user/pdf4qt: new aport

This commit is contained in:
Antoine Martin 2024-02-04 10:37:46 -05:00
parent e1c9e01b27
commit 6bfd1707ab
4 changed files with 189 additions and 0 deletions

54
user/pdf4qt/APKBUILD Normal file
View file

@ -0,0 +1,54 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=pdf4qt
pkgver=1.3.7
pkgrel=0
pkgdesc="Open source PDF editor"
arch="x86_64"
url="https://jakubmelka.github.io/"
license="LGPL-3.0"
# opt depends:
# 'flite: Text-To-Speech using flite synthesizer',
# 'libspeechd: Text-To-Speech using speechd synthesizer'
makedepends="
cmake
openssl-dev
libjpeg-turbo-dev
openjpeg-dev
onetbb-dev
lcms2-dev
freetype-dev
zlib-dev
musl-dev
qt6-qtbase-dev
qt6-qtsvg-dev
qt6-qtspeech-dev
qt6-qtdeclarative-dev
qt6-qtmultimedia-dev
"
source="
$pkgname-$pkgver.tar.gz::https://github.com/JakubMelka/PDF4QT/archive/refs/tags/v$pkgver.tar.gz
CMakeListsMain.patch
CMakeListsLib.patch
FindLCMS2.cmake
"
builddir="$srcdir"/PDF4QT-$pkgver
build() {
cmake -B build \
-DCMAKE_BUILD_TYPE='Release' \
-DCMAKE_INSTALL_PREFIX='/' \
-Wno-dev \
-DCMAKE_MODULE_PATH="$srcdir" \
-DPDF4QT_INSTALL_DEPENDENCIES=0
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
86be79c901edee7ca9a0f534979b88ae1cf6dac3ecb0cd40b165354765dabdfcae94b288001e918e068a0bb4e61d8e9c90842d7f415659403979aa87d8830ee7 pdf4qt-1.3.7.tar.gz
98392178a57739a3f5629aac27ac36f0aa0f33a508b2bd3d3de66c61a20c799a86a5dec6feabb250388c2e17319f7bdff05b34131d95c4c9ce8ee33d3dae3a8d CMakeListsMain.patch
f0ee3675a70624f2ecefd8a157a68941aa7b18da03298186317c566e3b26a34e60991ce4c5501a619b7aa8744ab193b74417a84278f13eecd1ffaec28116dc30 CMakeListsLib.patch
48cdc9f6cf0691baef2d80b423c62315772e51ac7b9bfa1c0c619315a11a6867e282fcf764c50290eb3c310d51be496502bb0e60b6a82e9bbcfd4f15e6ee1a73 FindLCMS2.cmake
"

View file

@ -0,0 +1,13 @@
diff --git a/Pdf4QtLibCore/CMakeLists.txt b/Pdf4QtLibCore/CMakeLists.txt
index 6f12727..e0fd971 100644
--- a/Pdf4QtLibCore/CMakeLists.txt
+++ b/Pdf4QtLibCore/CMakeLists.txt
@@ -153,7 +153,7 @@ GENERATE_EXPORT_HEADER(Pdf4QtLibCore
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h")
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::Core Qt6::Gui Qt6::Xml Qt6::Svg)
-target_link_libraries(Pdf4QtLibCore PRIVATE lcms2::lcms2)
+target_link_libraries(Pdf4QtLibCore PRIVATE LCMS2::LCMS2)
target_link_libraries(Pdf4QtLibCore PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(Pdf4QtLibCore PRIVATE ZLIB::ZLIB)
target_link_libraries(Pdf4QtLibCore PRIVATE Freetype::Freetype)

View file

@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7dc98bc..ea790b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,10 +64,10 @@ endif()
qt_standard_project_setup()
find_package(OpenSSL REQUIRED)
-find_package(lcms REQUIRED)
+find_package(LCMS2 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Freetype REQUIRED)
-find_package(OpenJPEG CONFIG REQUIRED)
+find_package(OpenJPEG REQUIRED)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)

105
user/pdf4qt/FindLCMS2.cmake Normal file
View file

@ -0,0 +1,105 @@
# Copyright (C) 2021 Igalia S.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#[=======================================================================[.rst:
FindLCMS2
---------
Find LCMS2 headers and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
``LCMS2::LCMS2``
The LCMS2 library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``LCMS2_FOUND``
true if (the requested version of) LCMS2 is available.
``LCMS2_VERSION``
the version of LCMS2.
``LCMS2_LIBRARIES``
the libraries to link against to use LCMS2.
``LCMS2_INCLUDE_DIRS``
where to find the LCMS2 headers.
``LCMS2_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
find_package(PkgConfig QUIET)
if (PkgConfig_FOUND)
pkg_check_modules(PC_LCMS2 QUIET lcms2)
set(LCMS2_COMPILE_OPTIONS ${PC_LCMS2_CFLAGS_OTHER})
set(LCMS2_VERSION ${PC_LCMS2_VERSION})
endif ()
find_path(LCMS2_INCLUDE_DIR
NAMES lcms2.h
HINTS ${PC_LCMS2_INCLUDEDIR} ${PC_LCMS2_INCLUDE_DIRS} ${LCMS2_INCLUDE_DIR}
PATH_SUFFIXES lcms2 liblcms2
)
find_library(LCMS2_LIBRARY
NAMES ${LCMS2_NAMES} lcms2 liblcms2 lcms-2 liblcms-2
HINTS ${PC_LCMS2_LIBDIR} ${PC_LCMS2_LIBRARY_DIRS}
PATH_SUFFIXES lcms2
)
if (LCMS2_INCLUDE_DIR AND NOT LCMS_VERSION)
file(READ ${LCMS2_INCLUDE_DIR}/lcms2.h LCMS2_VERSION_CONTENT)
string(REGEX MATCH "#define[ \t]+LCMS_VERSION[ \t]+([0-9]+)[ \t]*\n" LCMS2_VERSION_MATCH ${LCMS2_VERSION_CONTENT})
if (LCMS2_VERSION_MATCH)
string(SUBSTRING ${CMAKE_MATCH_1} 0 1 LCMS2_VERSION_MAJOR)
string(SUBSTRING ${CMAKE_MATCH_1} 1 2 LCMS2_VERSION_MINOR)
set(LCMS2_VERSION "${LCMS2_VERSION_MAJOR}.${LCMS2_VERSION_MINOR}")
endif ()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LCMS2
FOUND_VAR LCMS2_FOUND
REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR
VERSION_VAR LCMS2_VERSION
)
if (LCMS2_LIBRARY AND NOT TARGET LCMS2::LCMS2)
add_library(LCMS2::LCMS2 UNKNOWN IMPORTED GLOBAL)
set_target_properties(LCMS2::LCMS2 PROPERTIES
IMPORTED_LOCATION "${LCMS2_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${LCMS2_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIR}"
)
endif ()
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
if (LCMS2_FOUND)
set(LCMS2_LIBRARIES ${LCMS2_LIBRARY})
set(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
endif ()