-
Notifications
You must be signed in to change notification settings - Fork 11
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
Static build support #41
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,22 +108,31 @@ def library_name | |
end | ||
|
||
# | ||
# The basename of the Rust shared library. | ||
# The basename of the shared library built by Cargo. | ||
# | ||
def shared_library | ||
@shared_library ||= begin | ||
def cargo_shared_library | ||
@cargo_shared_library ||= begin | ||
filename = "#{library_name}.#{shared_ext}" | ||
filename = "lib#{filename}" unless Gem.win_platform? | ||
filename | ||
end | ||
end | ||
|
||
# | ||
# The basename of the Rust shared library, as installed in the {#ruby_extension_path}. | ||
# | ||
def shared_library | ||
@shared_library ||= "#{library_name}.so" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently Ruby always expects the file extension to be |
||
end | ||
|
||
# | ||
# Return the basename of the tarball generated by the `thermite:tarball` Rake task, given a | ||
# package `version`. | ||
# | ||
def tarball_filename(version) | ||
"#{library_name}-#{version}-#{ruby_version}-#{target_os}-#{target_arch}.tar.gz" | ||
static = static_extension? ? '-static' : '' | ||
|
||
"#{library_name}-#{version}-#{ruby_version}-#{target_os}-#{target_arch}#{static}.tar.gz" | ||
end | ||
|
||
# | ||
|
@@ -261,6 +270,13 @@ def dynamic_linker_flags | |
@dynamic_linker_flags ||= RbConfig::CONFIG['DLDFLAGS'].strip | ||
end | ||
|
||
# | ||
# Whether to use a statically linked extension. | ||
# | ||
def static_extension? | ||
ENV.key?('RUBY_STATIC') || RbConfig::CONFIG['ENABLE_SHARED'] == 'no' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
|
||
private | ||
|
||
def dlext | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less variable mutation.