From 4182868e2206c52383ebfa34fe04eecd261c2aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Sun, 21 Aug 2022 08:35:17 +0100 Subject: [PATCH] libharu: Fix library name and header version. --- .../001-fix-installation-destination.patch | 2 +- .../002-rename-haru-to-hpdf.patch | 26 ++++++++++++++++++ .../003-fix-header-version.patch | 11 ++++++++ .../004-add-compile-definitions.patch | 10 +++++++ mingw-w64-libharu/PKGBUILD | 27 ++++++++++++++++--- 5 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 mingw-w64-libharu/002-rename-haru-to-hpdf.patch create mode 100644 mingw-w64-libharu/003-fix-header-version.patch create mode 100644 mingw-w64-libharu/004-add-compile-definitions.patch diff --git a/mingw-w64-libharu/001-fix-installation-destination.patch b/mingw-w64-libharu/001-fix-installation-destination.patch index 293f56f7a8..5a06cf1eee 100644 --- a/mingw-w64-libharu/001-fix-installation-destination.patch +++ b/mingw-w64-libharu/001-fix-installation-destination.patch @@ -27,7 +27,7 @@ install( - TARGETS -+ TARGETS haru ++ TARGETS hpdf ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/mingw-w64-libharu/002-rename-haru-to-hpdf.patch b/mingw-w64-libharu/002-rename-haru-to-hpdf.patch new file mode 100644 index 0000000000..c9c9094563 --- /dev/null +++ b/mingw-w64-libharu/002-rename-haru-to-hpdf.patch @@ -0,0 +1,26 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -72,19 +72,19 @@ + # ======================================================================= + # create haru library + # ======================================================================= +-add_library(haru ${LIBHPDF_SRCS}) ++add_library(hpdf ${LIBHPDF_SRCS}) + if (PNG_FOUND) + include_directories (${PNG_INCLUDE_DIRS}) +- target_link_libraries (haru ${PNG_LIBRARIES}) ++ target_link_libraries (hpdf ${PNG_LIBRARIES}) + endif() + if (ZLIB_FOUND) + include_directories (${ZLIB_INCLUDE_DIRS}) +- target_link_libraries (haru ${ZLIB_LIBRARIES}) ++ target_link_libraries (hpdf ${ZLIB_LIBRARIES}) + endif() + + # Math library + if(UNIX AND NOT APPLE) +- target_link_libraries (haru ${M_LIB}) ++ target_link_libraries (hpdf ${M_LIB}) + endif() + + install( diff --git a/mingw-w64-libharu/003-fix-header-version.patch b/mingw-w64-libharu/003-fix-header-version.patch new file mode 100644 index 0000000000..4f2adcc911 --- /dev/null +++ b/mingw-w64-libharu/003-fix-header-version.patch @@ -0,0 +1,11 @@ +--- a/include/hpdf_version.h ++++ b/include/hpdf_version.h +@@ -3,6 +3,6 @@ + #define HPDF_MAJOR_VERSION 2 + #define HPDF_MINOR_VERSION 4 + #define HPDF_BUGFIX_VERSION 0 +-#define HPDF_EXTRA_VERSION "dev" +-#define HPDF_VERSION_TEXT "2.4.0dev" ++#define HPDF_EXTRA_VERSION "" ++#define HPDF_VERSION_TEXT "2.4.0" + #define HPDF_VERSION_ID 20400 diff --git a/mingw-w64-libharu/004-add-compile-definitions.patch b/mingw-w64-libharu/004-add-compile-definitions.patch new file mode 100644 index 0000000000..461d17d7d0 --- /dev/null +++ b/mingw-w64-libharu/004-add-compile-definitions.patch @@ -0,0 +1,10 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -3,6 +3,7 @@ + # create haru library + # ======================================================================= + add_library(hpdf ${LIBHPDF_SRCS}) ++target_compile_definitions(hpdf PRIVATE HPDF_DLL_MAKE INTERFACE HPDF_DLL) + if (PNG_FOUND) + include_directories (${PNG_INCLUDE_DIRS}) + target_link_libraries (hpdf ${PNG_LIBRARIES}) diff --git a/mingw-w64-libharu/PKGBUILD b/mingw-w64-libharu/PKGBUILD index 131380cca2..ef867f9065 100644 --- a/mingw-w64-libharu/PKGBUILD +++ b/mingw-w64-libharu/PKGBUILD @@ -4,7 +4,7 @@ _realname=libharu pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=2.4.0 -pkgrel=1 +pkgrel=2 pkgdesc="C library for generating PDF documents (mingw-w64)" url="https://github.com/libharu/libharu" arch=('any') @@ -15,13 +15,32 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-ninja") source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/libharu/libharu/archive/v${pkgver}.tar.gz" - 001-fix-installation-destination.patch) + 001-fix-installation-destination.patch + 002-rename-haru-to-hpdf.patch + 003-fix-header-version.patch + 004-add-compile-definitions.patch) sha256sums=('d1c38c0492257c61fb60c85238d500c05184fd8e9e68fecba9cf304ff2d8726d' - '06744157a002a7f024a048ba18eec041379ae918cd8596a3cc1764e5b7f08640') + 'b9dbd3ddfbf24eb1bc6d8a009b5dfcc6ab4344d20019f7d18f9bd6954c1feccd' + 'bcf2801ca0ce0b8f0236cc072730cb564fc62bf7627690d5ef0bfd61316a7f08' + 'bb1bfff1eca0b97f4feefd6b928b93fba0ac88ca54b5ec1f7fd064d92319bea4' + '89bebe5ce1ecad776ba4442e8c9f19c867fcee5ff656df589236cafe3a0414ca') + +# Helper macros to help make tasks easier # +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying ${_patch}" + patch -Nbp1 -i "${srcdir}/${_patch}" + done +} prepare() { cd "${srcdir}/${_realname}-${pkgver}" - patch -p1 -i "${srcdir}"/001-fix-installation-destination.patch + apply_patch_with_msg \ + 001-fix-installation-destination.patch \ + 002-rename-haru-to-hpdf.patch \ + 003-fix-header-version.patch \ + 004-add-compile-definitions.patch } build() {