commit:     179ae2aff7affd4cc9e273ae1c7ec4ef3b443578
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 14 21:37:36 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 14 22:00:16 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=179ae2af

app-text/mupdf: improve build on Darwin, ${ED} usage, libressl--

Not quite there on Darwin, need to fix -soname usage, but
a lot further than before.

We also fix incorrect ${ED} usage, export ${PKG_CONFIG}, and
drop USE=libressl.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-text/mupdf/files/mupdf-1.18.0-darwin.patch | 41 +++++++++++++++++++++++
 app-text/mupdf/mupdf-1.18.0-r3.ebuild          | 45 +++++++++++++++-----------
 2 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/app-text/mupdf/files/mupdf-1.18.0-darwin.patch 
b/app-text/mupdf/files/mupdf-1.18.0-darwin.patch
new file mode 100644
index 00000000000..cdd8ccf0f40
--- /dev/null
+++ b/app-text/mupdf/files/mupdf-1.18.0-darwin.patch
@@ -0,0 +1,41 @@
+--- a/Makerules
++++ b/Makerules
+@@ -117,11 +117,11 @@ ifeq ($(OS),MINGW)
+ else ifeq ($(OS),MACOS)
+   HAVE_GLUT := yes
+   SYS_GLUT_CFLAGS := -Wno-deprecated-declarations
+-  SYS_GLUT_LIBS := -framework GLUT -framework OpenGL
+-  CC = xcrun cc
+-  AR = xcrun ar
+-  LD = xcrun ld
+-  RANLIB = xcrun ranlib
++  SYS_GLUT_LIBS ?= -framework GLUT -framework OpenGL
++  CC ?= xcrun cc
++  AR ?= xcrun ar
++  LD ?= xcrun ld
++  RANLIB ?= xcrun ranlib
+ 
+ else ifeq ($(OS),Linux)
+   HAVE_OBJCOPY := yes
+--- a/Makerules
++++ b/Makerules
+@@ -122,9 +122,7 @@ else ifeq ($(OS),MACOS)
+   AR ?= xcrun ar
+   LD ?= xcrun ld
+   RANLIB ?= xcrun ranlib
+-
+-else ifeq ($(OS),Linux)
+-  HAVE_OBJCOPY := yes
++endif
+ 
+   ifeq ($(shell $(PKG_CONFIG) --exists freetype2 && echo yes),yes)
+       SYS_FREETYPE_CFLAGS := $(shell $(PKG_CONFIG) --cflags freetype2)
+@@ -197,8 +195,6 @@ else ifeq ($(OS),Linux)
+       PTHREAD_LIBS := -lpthread
+   endif
+ 
+-endif
+-
+ # The following section has various cross compilation configurations.
+ #
+ # Invoke these as:

diff --git a/app-text/mupdf/mupdf-1.18.0-r3.ebuild 
b/app-text/mupdf/mupdf-1.18.0-r3.ebuild
index 8c96cdb6255..60145d9c3d3 100644
--- a/app-text/mupdf/mupdf-1.18.0-r3.ebuild
+++ b/app-text/mupdf/mupdf-1.18.0-r3.ebuild
@@ -8,18 +8,17 @@ inherit desktop flag-o-matic toolchain-funcs xdg
 DESCRIPTION="A lightweight PDF viewer and toolkit written in portable C"
 HOMEPAGE="https://mupdf.com/ https://git.ghostscript.com/?p=mupdf.git";
 SRC_URI="https://mupdf.com/downloads/archive/${P}-source.tar.xz";
-S="${WORKDIR}/${P}-source"
+S="${WORKDIR}"/${P}-source
 
 LICENSE="AGPL-3"
 SLOT="0/${PV}"
 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~s390 x86"
-IUSE="+javascript libressl opengl ssl X"
+IUSE="+javascript opengl ssl X"
 REQUIRED_USE="opengl? ( javascript )"
 
 # Although we use the bundled, patched version of freeglut in mupdf (because of
 # bug #653298), the best way to ensure that its dependencies are present is to
 # install system's freeglut.
-BDEPEND="virtual/pkgconfig"
 RDEPEND="
        dev-libs/gumbo
        media-libs/freetype:2=
@@ -30,21 +29,20 @@ RDEPEND="
        virtual/jpeg
        javascript? ( >=dev-lang/mujs-1.0.7:= )
        opengl? ( >=media-libs/freeglut-3.0.0 )
-       ssl? (
-               libressl? ( >=dev-libs/libressl-3.1.4:0= )
-               !libressl? ( >=dev-libs/openssl-1.1:0= )
-       )
+       ssl? ( >=dev-libs/openssl-1.1:0= )
        X? (
                x11-libs/libX11
                x11-libs/libXext
        )
 "
 DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-1.15-CFLAGS.patch
        "${FILESDIR}"/${PN}-1.18-Makefile.patch
        "${FILESDIR}"/${PN}-1.10a-add-desktop-pc-xpm-files.patch
+       "${FILESDIR}"/${PN}-1.18.0-darwin.patch
        # See bugs #662352
        "${FILESDIR}"/${PN}-1.15-openssl-x11.patch
        # General cross fixes from Debian (refreshed)
@@ -69,14 +67,12 @@ src_prepare() {
                -e "1iAR = $(tc-getAR)" \
                -e "1iverbose = yes" \
                -e "1ibuild = debug" \
-               -e "1iprefix = ${ED}/usr" \
-               -e "1ilibdir = ${ED}/usr/$(get_libdir)" \
-               -e "1idocdir = ${ED}/usr/share/doc/${PF}" \
                -i Makerules || die
 }
 
 _emake() {
        # When HAVE_OBJCOPY is yes, we end up with a lot of QA warnings.
+       #
        # Bundled libs
        # * General
        # Note that USE_SYSTEM_LIBS=yes is a metaoption which will set to 
upstream's
@@ -100,19 +96,24 @@ _emake() {
        #
        # [0] 
https://git.ghostscript.com/?p=mupdf.git;a=blob;f=Makethird;h=c4c540fa4a075df0db85e6fdaab809099881f35a;hb=HEAD#l9
        # [1] https://www.ghostscript.com/doc/lcms2mt/doc/WhyThisFork.txt
-       emake \
-               GENTOO_PV=${PF} \
-               HAVE_GLUT=$(usex opengl) \
-               HAVE_LIBCRYPTO=$(usex ssl) \
-               HAVE_X11=$(usex X) \
-               USE_SYSTEM_LIBS=yes \
-               USE_SYSTEM_MUJS=$(usex javascript) \
-               USE_SYSTEM_GLUT=no \
-               HAVE_OBJCOPY=no \
+       local myemakeargs=(
+               GENTOO_PV=${PF}
+               HAVE_GLUT=$(usex opengl)
+               HAVE_LIBCRYPTO=$(usex ssl)
+               HAVE_X11=$(usex X)
+               USE_SYSTEM_LIBS=yes
+               USE_SYSTEM_MUJS=$(usex javascript)
+               USE_SYSTEM_GLUT=no
+               HAVE_OBJCOPY=no
                "$@"
+       )
+
+       emake "${myemakeargs[@]}"
 }
 
 src_compile() {
+       tc-export PKG_CONFIG
+
        _emake XCFLAGS="-fPIC"
 }
 
@@ -124,6 +125,12 @@ src_install() {
                rm docs/man/${PN}.1 || die
        fi
 
+       sed -i \
+               -e "1iprefix = ${ED}/usr" \
+               -e "1ilibdir = ${ED}/usr/$(get_libdir)" \
+               -e "1idocdir = ${ED}/usr/share/doc/${PF}" \
+               -i Makerules || die
+
        _emake install
 
        dosym libmupdf.so.${PV} /usr/$(get_libdir)/lib${PN}.so

Reply via email to