Bug 214575

Summary: [PATCH] security/gpgme-{cpp,qt5}: Stop requiring ports libc++ on FreeBSD 9 and 10
Product: Ports & Packages Reporter: Raphael Kubo da Costa <rakuco>
Component: Individual Port(s)Assignee: Jason E. Hale <jhale>
Status: Closed FIXED    
Severity: Affects Only Me CC: gerald, jhale, kde
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Proposed patch jhale: maintainer-approval+

Description Raphael Kubo da Costa freebsd_committer freebsd_triage 2016-11-16 16:43:31 UTC
Created attachment 177081 [details]
Proposed patch

Using ports libc++ on non-leaf ports is problematic, as the requirement basically flows to all ports that depend on gpgme-{cpp,qt5}. In particular, sysutils/kf5-kwallet was breaking in FreeBSD 9.x because mismatches between libc++ and libstdc++ from gcc48 were causing a gpgme symbol not to be found:

  backendpersisthandler.cpp:(.text+0xf61): undefined reference to `GpgME::Context::encrypt(std::vector<GpgME::Key, std::allocator<GpgME::Key> > const&, GpgME::Data const&, GpgME::Data&, GpgME::Context::EncryptionFlags)'

The attached patch switches the build of both ports to lang/gcc on FreeBSD 9 and the system compiler on FreeBSD 10:
* Use USES:compiler-c++11-lib instead of compiler-c++11-lang, as we do need a C++11-compatible standard library. This causes the right compiler to be chosen as described above.
* Set _GLIBCXX_USE_C99 so that gpgme-cpp builds with GCC 4.8 (std::to_string() is not exposed by default on FreeBSD). Several other ports need to do the same.
* Add a few patches to fix the gpgme-qt5:
** patch-git_b4658f6a1 is a backport from an upstream commit to make the port build with GCC 4.8 without errors.
** patch-lang_qt_src_qgpgmeencryptjob.cpp is a local workaround for the std::bind() bug mentioned in ports r424451.

I've verified both ports to build on 9.3 and 10.3.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-11-17 13:56:13 UTC
A commit references this bug:

Author: jhale
Date: Thu Nov 17 13:55:48 UTC 2016
New revision: 426284
URL: https://svnweb.freebsd.org/changeset/ports/426284

Log:
  Using ports libc++ on non-leaf ports is problematic, as the requirement
  basically flows to all ports that depend on gpgme-{cpp,qt5}. In particular,
  sysutils/kf5-kwallet was breaking in FreeBSD 9.x because mismatches between
  libc++ and libstdc++ from gcc48 were causing a gpgme symbol not to be found:

  backendpersisthandler.cpp:(.text+0xf61): undefined reference to
  `GpgME::Context::encrypt(std::vector<GpgME::Key, std::allocator<GpgME::Key> >
  const&, GpgME::Data const&, GpgME::Data&, GpgME::Context::EncryptionFlags)'

  Switch the build of both ports to lang/gcc on FreeBSD 9 and the system compiler
  on FreeBSD 10:
  * Use USES:compiler-c++11-lib instead of compiler-c++11-lang, as we do need a
  C++11-compatible standard library. This causes the right compiler to be chosen
  as described above.
  * Set _GLIBCXX_USE_C99 so that gpgme-cpp builds with GCC 4.8 (std::to_string()
  is not exposed by default on FreeBSD). Several other ports need to do the same.
  * Add a few patches to fix the gpgme-qt5:
  ** patch-git_b4658f6a1 is a backport from an upstream commit to make the port
     build with GCC 4.8 without errors.
  ** patch-lang_qt_src_qgpgmeencryptjob.cpp is a local workaround for the
     std::bind() bug mentioned in ports r424451.

  PR:		214575
  Submitted by:	rakuco

Changes:
  head/security/gpgme/Makefile
  head/security/gpgme/files/patch-git_b4658f6a1
  head/security/gpgme/files/patch-lang_qt_src_qgpgmeencryptjob.cpp
  head/security/gpgme-cpp/Makefile
  head/security/gpgme-qt5/Makefile
Comment 2 Jason E. Hale freebsd_committer freebsd_triage 2016-11-17 13:57:10 UTC
Committed, thanks for your work on this!