commit:     e5ea9207faf58a5468d0e663d1a41b67618ab259
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  6 05:50:39 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Wed Mar  6 05:58:25 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5ea9207

media-libs/libpgf: fix build on musl

Drop off64_t, add AC_SYS_LARGEFILE.

Closes: https://bugs.gentoo.org/907091
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 .../files/libpgf-7.21.7-remove-off64_t.patch       | 45 +++++++++++++++++
 media-libs/libpgf/libpgf-7.21.7-r2.ebuild          | 58 ++++++++++++++++++++++
 2 files changed, 103 insertions(+)

diff --git a/media-libs/libpgf/files/libpgf-7.21.7-remove-off64_t.patch 
b/media-libs/libpgf/files/libpgf-7.21.7-remove-off64_t.patch
new file mode 100644
index 000000000000..9844bd589b94
--- /dev/null
+++ b/media-libs/libpgf/files/libpgf-7.21.7-remove-off64_t.patch
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/907091
+
+Remove off64_t, add AC_SYS_LARGEFILE to configure.ac instead
+
+--- a/include/PGFplatform.h
++++ b/include/PGFplatform.h
+@@ -341,10 +341,6 @@
+ #define __POSIX__ 
+ #endif 
+ 
+-#ifndef off64_t 
+-#define off64_t off_t 
+-#endif 
+-
+ #ifndef lseek64 
+ #define lseek64 lseek 
+ #endif 
+@@ -536,7 +532,7 @@
+                       return NoError;
+               }
+       #else
+-              off64_t ret;
++              off_t ret;
+               if ((ret = lseek64(hFile, 0, SEEK_CUR)) == -1) {
+                       return errno;
+               } else {
+@@ -554,7 +550,7 @@
+                       return NoError;
+               }
+       #else
+-              if ((lseek64(hFile, (off64_t)posOff, posMode)) == -1) {
++              if ((lseek64(hFile, (off_t)posOff, posMode)) == -1) {
+                       return errno;
+               } else {
+                       return NoError;
+--- a/configure.ac
++++ b/configure.ac
+@@ -31,6 +31,7 @@
+ AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_HEADERS( [config.h] )
+ AC_PROG_CXX
++AC_SYS_LARGEFILE
+ 
+ dnl Check for doxygen support
+ AC_PATH_PROG([DOXYGEN], [doxygen])

diff --git a/media-libs/libpgf/libpgf-7.21.7-r2.ebuild 
b/media-libs/libpgf/libpgf-7.21.7-r2.ebuild
new file mode 100644
index 000000000000..1cb3334335d0
--- /dev/null
+++ b/media-libs/libpgf/libpgf-7.21.7-r2.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools edos2unix
+
+DESCRIPTION="Library to load, handle and manipulate images in the PGF format"
+HOMEPAGE="https://libpgf.org/";
+SRC_URI="https://downloads.sourceforge.net/project/libpgf/libpgf/${PV}/libpgf.zip
 -> ${P}.zip"
+S="${WORKDIR}/libpgf"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="doc"
+
+BDEPEND="
+       app-arch/unzip
+       doc? (
+               app-text/doxygen
+               dev-texlive/texlive-fontutils
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-remove-off64_t.patch
+)
+
+src_prepare() {
+       default
+
+       # configure.ac has wrong version number
+       sed -i "s/7.15.32/${PV}/g" configure.ac || die
+
+       # many files, including configure.ac and Makefile.am, are saved in dos 
format, causing errors in autotools
+       edos2unix *.{am,ac,in,sh} */*.{am,in}
+
+       # the package does not respect --docdir and installs docs in 
/usr/share/doc/${PN}
+       sed -i -e 's/\$(DOC_DIR)/$(DESTDIR)@docdir@/' doc/Makefile.am || die
+
+       if ! use doc; then
+               sed -i -e "/HAS_DOXYGEN/{N;N;d}" Makefile.am || die
+       fi
+
+       eautoreconf
+}
+
+src_install() {
+       default
+
+       if use doc; then
+               docinto pdf
+               dodoc doc/*.pdf doc/latex/*.pdf
+       fi
+
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to