Allow static-only openssl on Linux (#38098)

This commit is contained in:
Alex Richert 2023-08-12 11:42:53 -07:00 committed by GitHub
parent 1b1ed1b1fa
commit e67c61aac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,8 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package
list_url = "https://www.openssl.org/source/old/" list_url = "https://www.openssl.org/source/old/"
list_depth = 1 list_depth = 1
maintainers("AlexanderRichert-NOAA")
tags = ["core-packages", "windows"] tags = ["core-packages", "windows"]
executables = ["openssl"] executables = ["openssl"]
@ -359,7 +361,7 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package
), ),
) )
variant("docs", default=False, description="Install docs and manpages") variant("docs", default=False, description="Install docs and manpages")
variant("shared", default=False, description="Build shared library version") variant("shared", default=True, description="Build shared library version")
with when("platform=windows"): with when("platform=windows"):
variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library")
@ -382,7 +384,12 @@ def determine_version(cls, exe):
@property @property
def libs(self): def libs(self):
return find_libraries(["libssl", "libcrypto"], root=self.prefix, recursive=True) return find_libraries(
["libssl", "libcrypto"],
root=self.prefix,
recursive=True,
shared=self.spec.variants["shared"].value,
)
def handle_fetch_error(self, error): def handle_fetch_error(self, error):
tty.warn( tty.warn(
@ -403,7 +410,7 @@ def install(self, spec, prefix):
# where it happens automatically?) # where it happens automatically?)
env["KERNEL_BITS"] = "64" env["KERNEL_BITS"] = "64"
options = ["zlib", "shared"] options = ["zlib"]
if spec.satisfies("@1.0"): if spec.satisfies("@1.0"):
options.append("no-krb5") options.append("no-krb5")
# clang does not support the .arch directive in assembly files. # clang does not support the .arch directive in assembly files.
@ -433,8 +440,6 @@ def install(self, spec, prefix):
base_args.extend( base_args.extend(
['CC="%s"' % os.environ.get("CC"), 'CXX="%s"' % os.environ.get("CXX"), "VC-WIN64A"] ['CC="%s"' % os.environ.get("CC"), 'CXX="%s"' % os.environ.get("CXX"), "VC-WIN64A"]
) )
if spec.satisfies("~shared"):
base_args.append("no-shared")
else: else:
base_args.extend( base_args.extend(
[ [
@ -443,6 +448,12 @@ def install(self, spec, prefix):
] ]
) )
base_args.extend(options) base_args.extend(options)
if spec.satisfies("~shared"):
base_args.append("no-shared")
else:
base_args.append("shared")
# On Windows, we use perl for configuration and build through MSVC # On Windows, we use perl for configuration and build through MSVC
# nmake. # nmake.
if spec.satisfies("platform=windows"): if spec.satisfies("platform=windows"):