Bug 216311 - [maintainer patch] fix building databases/mysql56-client databases/mysql56-server ports with libressl instead of openssl
Summary: [maintainer patch] fix building databases/mysql56-client databases/mysql56-se...
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: Mahdi Mokhtari
URL:
Keywords: patch-ready
Depends on:
Blocks:
 
Reported: 2017-01-20 12:16 UTC by Mahdi Mokhtari
Modified: 2017-01-27 19:36 UTC (History)
4 users (show)

See Also:
mmokhi: maintainer-feedback+


Attachments
patch-fixes_mysql56_libressl (1.44 KB, patch)
2017-01-20 12:16 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff
svn diff for databases/mysql56-server (2.75 KB, patch)
2017-01-23 07:35 UTC, Bernard Spil
no flags Details | Diff
The tested patch (brnrd's) + revisions (2.57 KB, patch)
2017-01-23 12:35 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-20 12:16:19 UTC
Created attachment 179134 [details]
patch-fixes_mysql56_libressl

Currently MySQL 56 failed to build/configure if you used LibreSSL instead of OpenSSL
With this patch this problem is fixed.
Comment 1 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-20 12:17:10 UTC
portlint is fine.
poudriere builds fine.
Comment 2 Bernard Spil freebsd_committer freebsd_triage 2017-01-21 12:10:01 UTC
See review D9272 for a fix that works both for LibreSSL and OpenSSL.
Comment 3 Bernard Spil freebsd_committer freebsd_triage 2017-01-21 12:12:59 UTC
The patch as such is OK but I feel the check that MySQL added is a bit weird. All they are looking for is version 1.x. The VERSION_GREATER will always match that unless OpenSSL is 0.9.8 (which FreeBSD no longer has).
Comment 4 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-21 12:49:41 UTC
(In reply to Bernard Spil from comment #3)
Yeah they are actually just search for openssl/libressl components in BASEDIR including headers, shared/static libs and conf files.
So, yes, that makes sense why it always matches (and should be :D)
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-01-21 13:23:11 UTC
A commit references this bug:

Author: brnrd
Date: Sat Jan 21 13:22:52 UTC 2017
New revision: 432035
URL: https://svnweb.freebsd.org/changeset/ports/432035

Log:
  databases/mysql56-server: Fix build with LibreSSL

    - Fix CMake SSL detection
    - Always set WITH_SSL=${OPENSSLBASE}

  PR:		216311
  Approved by:	Mahdi Moktari <mokhi64@gmail.com> (maintainer)
  Differential Revision:	D9272

Changes:
  head/databases/mysql56-client/files/patch-cmake_ssl.cmake
  head/databases/mysql56-server/Makefile
  head/databases/mysql56-server/files/patch-cmake_ssl.cmake
Comment 6 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-23 05:11:47 UTC
ReOpen this issue,
Commit was reverted due breakage.
brnrd@, would you please commit the attached patch instead of review?
Comment 7 Bernard Spil freebsd_committer freebsd_triage 2017-01-23 07:35:54 UTC
Created attachment 179246 [details]
svn diff for databases/mysql56-server

Reworked the patch.

MySQL tries to link statically (hence issues on libssl.a) whereas FreeBSD ports prefers dynamic linking. Attached patch fixes the OpenSSL version detection by switching from STREQUAL to VERSION_GREATER_EQUAL as supported by current CMake.
Additionally, it forces MySQL to dynamically link libssl and libcrypto from the user-selected SSL_DEFAULT.

Please test build/run thoroughly! (both client and user)
Comment 8 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-23 12:27:59 UTC
(In reply to Bernard Spil from comment #7)
Okay, I've tested build with both libressl and openssl on a 10.3 jail, both built fine, and ran (mysql-server daemon and client) fine inside the jail.
I'm attaching the build logs as a reference.
Comment 9 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-23 12:33:34 UTC
Build log for mysql56 + libressl  --> http://s000.tinyupload.com/index.php?file_id=39612543602085433765

Build log for mysql56 + openssl  --> http://s000.tinyupload.com/index.php?file_id=73538428972672226996
Comment 10 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-23 12:35:26 UTC
Created attachment 179253 [details]
The tested patch (brnrd's) +  revisions

This is exactly the tested patch (brnrd@ 's) plus that I increased PORTREVISIONs
Comment 11 commit-hook freebsd_committer freebsd_triage 2017-01-26 19:59:43 UTC
A commit references this bug:

Author: brnrd
Date: Thu Jan 26 19:58:07 UTC 2017
New revision: 432535
URL: https://svnweb.freebsd.org/changeset/ports/432535

Log:
  MFH: r431919 r431968 r431975 r432035 r432066 r432458

  databases/mysql56: Update to 5.6.35

  - Port improvements from MySQL 5.7 port
  - Use system libs instead of bundled
  - Fix many open PRs
  - Change MAINTAINER

  PR:		216244 192657 198812 199751 205093
  PR:		209618 211248 205983 209338

  databases/mysql56-server: Rollback rc script changes

  databases/mysql56-server: Do not install my.cnf sample

  An issue was discovered where users of mysql did not have a my.cnf and
  the recent update was causing mysqld to find a sample my.cnf and load
  its parameters. This was causing errors on startup for users of innodb
  as the parameters used to init the database did not match the ones in
  the sample config file it was now reading.

  databases/mysql56-server: Fix build with LibreSSL

    - Fix CMake SSL detection
    - Always set WITH_SSL=${OPENSSLBASE}

  PR:		216311
  Approved by:	Mahdi Moktari <mokhi64@gmail.com> (maintainer)
  Differential Revision:	D9272

  Revert r432035 part 2, it breaks build with openssl from base

  With hat:	portmgr

  databases/mysql56-server: Fix OpenSSL linking

    - Force dynamic linking with OpenSSL

  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2017Q1/
  branches/2017Q1/databases/mysql56-client/Makefile
  branches/2017Q1/databases/mysql56-client/files/patch-CMakeLists.txt
  branches/2017Q1/databases/mysql56-client/files/patch-cmake_ssl.cmake
  branches/2017Q1/databases/mysql56-client/files/patch-extra_CMakeLists.txt
  branches/2017Q1/databases/mysql56-client/files/patch-man_CMakeLists.txt
  branches/2017Q1/databases/mysql56-client/files/patch-mysys_ssl_my_default.cc
  branches/2017Q1/databases/mysql56-client/files/patch-scripts_CMakeLists.txt
  branches/2017Q1/databases/mysql56-client/files/patch-support-files_CMakeLists.txt
  branches/2017Q1/databases/mysql56-client/pkg-message
  branches/2017Q1/databases/mysql56-server/Makefile
  branches/2017Q1/databases/mysql56-server/distinfo
  branches/2017Q1/databases/mysql56-server/files/my.cnf.sample.in
  branches/2017Q1/databases/mysql56-server/files/patch-cmake_ssl.cmake
  branches/2017Q1/databases/mysql56-server/files/patch-mysys_ssl_my_default.cc
  branches/2017Q1/databases/mysql56-server/pkg-message
  branches/2017Q1/databases/mysql56-server/pkg-plist
Comment 12 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-01-26 22:36:09 UTC
(In reply to commit-hook from comment #11)
Thanks :)