# vim: ft=make ts=4 sw=4 noet

NAME    = openssl
VERSION = 3.5.7
GARTYPE = v2

DESCRIPTION = Secure Sockets Layer and cryptography libraries
define BLURB
  OpenSSL is a robust, full-featured open source toolkit for TLS/SSL and
  cryptography. Provides libssl and libcrypto.
endef

MASTER_SITES =
DYNURLS     = https://github.com/openssl/openssl/releases/download/openssl-$(VERSION)/$(DISTNAME).tar.gz
DISTFILES   += $(DISTNAME).tar.gz

LICENSE = LICENSE.txt

RUNTIME_DEP_PKGS_OZSWopenssl += OZSWzlib
BUILD_DEP_PKGS += OZSWzlib OZSWperl

PACKAGES                  += OZSWopenssl
SPKG_DESC_OZSWopenssl     = OpenSSL TLS/SSL libraries and tools
CATALOGNAME_OZSWopenssl   = openssl
# Catch-all: leave PKGFILES_OZSWopenssl unset (GAR uses exclude-other-pkgs mechanism).

# Keep static libs (.a) alongside shared so packages can statically link.
MERGE_EXCLUDE_STATICLIBS =

# OpenSSL uses a Perl-based Configure (not autoconf).
# solaris-x86-gcc = 32-bit x86 on Solaris with GCC.
# CC/CFLAGS/LDFLAGS are already in CONFIGURE_ENV; pass prefix/libdir/openssldir
# explicitly since OpenSSL does not use DIRPATHS-style autoconf conventions.
CONFIGURE_SCRIPTS = $(WORKSRC)/Configure

CONFIGURE_ARGS  = solaris-x86-gcc
CONFIGURE_ARGS += --prefix=$(prefix)
CONFIGURE_ARGS += --libdir=$(libdir)
CONFIGURE_ARGS += --openssldir=$(sysconfdir)/ssl
CONFIGURE_ARGS += shared
CONFIGURE_ARGS += zlib

# Pattern rule to invoke OpenSSL's Perl-based Configure.
# The stem $* is the source directory; we cd into it and run Configure
# with the CONFIGURE_ENV cleared to our controlled environment.
# PATH in CONFIGURE_ENV includes $(BUILD_PREFIX)/bin so perl is found.
configure-%/Configure:
	@echo " ==> Running OpenSSL Configure in $*"
	cd $* && /usr/bin/env -i $(CONFIGURE_ENV) perl Configure $(CONFIGURE_ARGS)
	@$(MAKECOOKIE)

include gar/category.mk
