-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
WIP: Cross compile for x86_64-darwin and arm64-darwin per rake-compiler-dock #2142
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4d1fb5f
Cross compile for x86_64-darwin per rake-compiler-dock
larskanis dff6249
Add support for arm64-darwin platform
larskanis 04352f2
Windows: Newer gcc versions with static libssp need advapi32.dll
larskanis 94b0dd3
Adjust cross-tool for latest changes to rake-compiler-dock
larskanis 08e5560
dev: update JavaExtensionTask source and target version to 1.7
flavorjones 0278fe3
test: update test-gem-file-contents to look for darwin bundles
flavorjones 01578f5
dev: add darwin gems to build-gems; test-gem-set for batch testing
flavorjones 3036da9
test: test-gem-file-contents can be run in a temp container
flavorjones 53b333f
feat: extconf.rb supports --prevent-strip
flavorjones 713e723
fix: avoid calls to `isinf` or `isnan` for musl support
flavorjones File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
This patch is a result of rake-compiler-dock using centos 7 (manylinux2014) to cross-compile. | ||
|
||
Centos, for reasons I have not been able to discern, implements `isnan` and `isinf` as a function | ||
and not as a macro. Debian knows how to resolve that function at dynamic-link time (despite using a | ||
macro at compile time), but musl-based systems (like alpine) do not. Running `nm` on nokogiri.so | ||
created on such a centos system shows: | ||
|
||
``` | ||
U __isinf@@GLIBC_2.2.5 | ||
U __isnan@@GLIBC_2.2.5 | ||
``` | ||
|
||
(see https://github.com/sparklemotion/nokogiri/pull/2142 for more info) | ||
|
||
This patch avoids using glibc's `isnan` and `isinf` calls, instead using libxml2's fallback | ||
implementation. There's history here, see libxml2 commit 8813f39: | ||
|
||
commit 8813f39 | ||
Author: Nick Wellnhofer <wellnhofer@aevum.de> | ||
Date: 2017-09-21 00:11:26 +0200 | ||
|
||
Simplify XPath NaN, inf and -0 handling | ||
|
||
Use C99 macros NAN, INFINITY, isnan, isinf. If they're not available: | ||
|
||
- Assume that (0.0 / 0.0) generates a NaN and !(x == x) tests for NaN. | ||
- Use C89's HUGE_VAL for INFINITY. | ||
|
||
Remove manual handling of NaN, infinity and negative zero in functions | ||
xmlXPathValueFlipSign and xmlXPathDivValues. | ||
|
||
Remove xmlXPathGetSign. All the tests for negative zero can be replaced | ||
with a test for negative or positive zero. | ||
|
||
Simplify xmlXPathRoundFunction. | ||
|
||
Remove Trio dependency. | ||
|
||
This should work on IEEE 754 compliant implementations even if the C99 | ||
macros aren't available, but will likely break some ancient platforms. | ||
If problems arise, my plan is to port the relevant trionan.c solution | ||
to xpath.c. Note that non-compliant implementations are impossible | ||
to fully support, anyway, since XPath requires IEEE 754. | ||
|
||
This patch would be unnecessary if any of the following was true: | ||
|
||
* centos implements these as macros, and doesn't generate an unresolved symbol for either in the shared library | ||
* we had a way to ensure `__isinf` and `__isnan` resolve on musl (e.g., we implement them locally) | ||
|
||
diff --git a/xpath.c b/xpath.c | ||
index 9f64ab9..5b6d999 100644 | ||
--- a/xpath.c | ||
+++ b/xpath.c | ||
@@ -509,11 +509,7 @@ xmlXPathInit(void) { | ||
*/ | ||
int | ||
xmlXPathIsNaN(double val) { | ||
-#ifdef isnan | ||
- return isnan(val); | ||
-#else | ||
return !(val == val); | ||
-#endif | ||
} | ||
|
||
/** | ||
@@ -524,15 +520,11 @@ xmlXPathIsNaN(double val) { | ||
*/ | ||
int | ||
xmlXPathIsInf(double val) { | ||
-#ifdef isinf | ||
- return isinf(val) ? (val > 0 ? 1 : -1) : 0; | ||
-#else | ||
if (val >= INFINITY) | ||
return 1; | ||
if (val <= -INFINITY) | ||
return -1; | ||
return 0; | ||
-#endif | ||
} | ||
|
||
#endif /* SCHEMAS or XPATH */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Method
compile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.