Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup.py #594

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def using_system_libs():
"""If true, don't build any dependencies. Use the libs that are already on the system."""
return os.getenv('AWS_CRT_BUILD_USE_SYSTEM_LIBS') == '1'

def using_shared_libs():
"""If true, the shared libs are used instead of the static ones, which is the default. Has no effect on Windows and Darwin."""
return os.getenv('AWS_CRT_BUILD_USE_SHARED_LIBS') == '1'

def using_system_libcrypto():
"""If true, don't build AWS-LC. Use the libcrypto that's already on the system."""
Expand Down Expand Up @@ -337,15 +340,18 @@ def awscrt_ext():
extra_link_args += ['-framework', 'Security']

else: # unix
# linker will prefer shared libraries over static if it can find both.
# force linker to choose static variant by using using
# "-l:libaws-c-common.a" syntax instead of just "-laws-c-common".
# Linker will prefer shared libraries over static if it can find both.
# This forces linker to choose static variant by using
# "-l:libaws-c-common.a" syntax instead of just "-laws-c-common",
# unless user has explicitely opted out from this by setting
# `AWS_CRT_BUILD_USE_SHARED_LIBS` to `1`.
#
# This helps AWS developers creating Lambda applications from Brazil.
# In Brazil, both shared and static libs are available.
# But Lambda requires all shared libs to be explicitly packaged up.
# So it's simpler to link them in statically and have less runtime dependencies.
libraries = [':lib{}.a'.format(x) for x in libraries]
if not using_shared_libs():
libraries = [':lib{}.a'.format(x) for x in libraries]

# OpenBSD doesn't have librt; functions are found in libc instead.
if not sys.platform.startswith('openbsd'):
Expand Down