Bug 218688 - [patch] graphics/mupdf links with ssl if a pkgconfig for libcrypto exists
Summary: [patch] graphics/mupdf links with ssl if a pkgconfig for libcrypto exists
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias Kortkamp
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-04-16 15:20 UTC by rsmith
Modified: 2017-05-15 09:39 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (uzsolt)


Attachments
Patch for port makefile (441 bytes, patch)
2017-04-16 15:20 UTC, rsmith
no flags Details | Diff
Patch Makerules to disable SSL for mupdf-1.10a (534 bytes, patch)
2017-05-01 20:07 UTC, rsmith
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rsmith 2017-04-16 15:20:04 UTC
Created attachment 181824 [details]
Patch for port makefile

It checks for libcrypto in Makerules:

    # FreeBSD uses pkg-config for system libraries.
    else ifeq "$(OS)" "FreeBSD"

    HAVE_PTHREADS ?= yes

    ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes"
    HAVE_LIBCRYPTO = yes
    SYS_LIBCRYPTO_CFLAGS = -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto)
    SYS_LIBCRYPTO_LIBS = $(shell pkg-config --libs libcrypto)
    endif

Since I have LibreSSL installed, the pkg-config test yields “yes”:

    > pkg-config --exists libcrypto && echo yes
    yes

Since the base system does not have a pkg-config file for libcrypto, I assume
the test will fail, and mupdf will not link against libcrypto.

The easiest solution is to ad USES = ssl, as is done in the attached patch.
Comment 1 Zsolt Udvari freebsd_committer freebsd_triage 2017-04-17 11:46:48 UTC
Hm, you've right. I think it will be the simplier solution.
I don't accept your patch because I want to update to 1.11, and include USE=ssl too :)

Thanks for your report!
Comment 2 Zsolt Udvari freebsd_committer freebsd_triage 2017-05-01 11:43:45 UTC
Your patch isn't good.

If you add simply "USES+=ssl" it means that mupdf wants to use SSL base (/usr/lib/libcrypto.so) and doesn't trigger to install libre/openssl.
And in this case you don't have any ssl-specific pkg-config file so the mupdf's test will fail.

I think we have two choices:
- full disable the ssl (patch the ssl-test in Makerules)
- use the system's ssl (patch the ssl-test and SYS_LIBCRYPTO_{CFLAGS,LIBS})

Or an another choice:
- use libre/openssl - but I don't want it because I've an idea to more work on mupdf port: print/cups-client now requires mupdf so the install of cups-client requires many Xorg-libraries (if you've a printserver you don't want many Xorg-libraries).

My opinion: the full disable because there isn't any bug report (feature request) about missing ssl in mupdf.
Comment 3 Zsolt Udvari freebsd_committer freebsd_triage 2017-05-01 13:15:35 UTC
Report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218996
Comment 4 rsmith 2017-05-01 20:07:38 UTC
Created attachment 182234 [details]
Patch Makerules to disable SSL for mupdf-1.10a
Comment 5 rsmith 2017-05-01 20:11:01 UTC
Looking at the source code for 1.10a, OpenSSL is only used in one file, `source/pdf/pdf-pkcs7.c`.

Looking at the Makerules file, OS-X disables OpenSSL because they don't use libcrypto. So I made a patch (attached) for Makerules to disable OpenSSL completely on FreeBSD. Mupdf-1.10a then builds, installs and runs OK without libcrypto.

So I'd say: disable OpenSSL.
Comment 6 Zsolt Udvari freebsd_committer freebsd_triage 2017-05-02 09:41:38 UTC
(In reply to rsmith from comment #5)
It's already done in #218996, thanks!
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-05-02 12:22:56 UTC
A commit references this bug:

Author: tobik
Date: Tue May  2 12:22:22 UTC 2017
New revision: 439942
URL: https://svnweb.freebsd.org/changeset/ports/439942

Log:
  Update to 1.11

  - Prevent linking with libcrypto when a pkg-config file for it exists
    on the system [1]
  - Bump PORTREVISION of dependent ports

  PR:		218996, 218688 [1]
  Reported by:	rsmith@xs4all.nl [1]
  Submitted by:	Zsolt Udvari <udvzsolt@gmail.com> (maintainer)
  Approved by:	lme (mentor)
  Differential Revision:	https://reviews.freebsd.org/D10561

Changes:
  head/graphics/llpp/Makefile
  head/graphics/mupdf/Makefile
  head/graphics/mupdf/distinfo
  head/graphics/mupdf/files/patch-Makefile
  head/graphics/mupdf/files/patch-Makerules
  head/graphics/mupdf/files/patch-scripts_fontdump.c
  head/graphics/mupdf/files/patch-scripts_hexdump.c
  head/graphics/mupdf/files/patch-source__fitz__load-jpx.c
  head/graphics/mupdf/pkg-plist
  head/graphics/zathura-pdf-mupdf/Makefile
Comment 8 Zsolt Udvari freebsd_committer freebsd_triage 2017-05-15 07:50:24 UTC
I think this bug is already done. Please close it!