Is it possibly to detect which OpenSSL is used for a port?

Shane Ambler FreeBSD at ShaneWare.Biz
Sat Mar 21 00:34:18 UTC 2015


On 21/03/2015 04:32, Naram Qashat wrote:
> This isn't quite what I'm looking for. I want to be able to tell within a
> port's Makefile if the user wanted the base or ports OpenSSL to be used.
> I've been trying to port TDE to FreeBSD, and tdelibs uses pkg-config to
> check for OpenSSL. This would work if the only form of OpenSSL was in
> ports, but the base OpenSSL doesn't have a pkg-config file to use, so I
> need to know which is going to be used so I can determine when this
> pkg-config check can be removed.

I created a new port devel/godot not long ago, it used pkg-config to
find openssl so I set it to use openssl port as it was a quick easy fix
till I got around to finding a better solution.

I was then offered a patch to fix this, which removed a test whether
"pkg config openssl" failed and changed 'pkg-config openssl --cflags
--libs' to 'echo -lssl -lcrypto'

https://svnweb.freebsd.org/ports/head/devel/godot/files/patch-platform_x11_detect.py?r1=377975&r2=380508

Having USE_OPENSSL=yes in your Makefile leads to LDFLAGS getting -rpath
set to the location of the ssl libs. Therefore adding -lssl -lcrypto
instead of the pkg-config response leads to finding the ssl libs based
on the ssl option set at build time.

Worst case you may need to re-order the LDFLAGS so that other "-L/path" 
entries are placed after the ssl search paths.

If you still need tests then try testing ${OPENSSLBASE} == '/usr'

# The makefile sets this variables:
# OPENSSLBASE       - "/usr" or ${LOCALBASE}
# OPENSSLDIR        - path to openssl
# OPENSSLLIB        - path to the libs
# OPENSSLINC        - path to the matching includes
# OPENSSLRPATH      - rpath for dynamic linker


-- 
FreeBSD - the place to B...Software Developing

Shane Ambler



More information about the freebsd-ports mailing list