-
Notifications
You must be signed in to change notification settings - Fork 87
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
Use system copy of libuv if found #368
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9a8c48e
Use system copy of libuv if found
jcheng5 ac10f07
Update .gitignore
nealrichardson 2061599
Rewrite configure
nealrichardson bbeccbb
Simplify configure and always use static linking on macOS
nealrichardson 6b5ec80
Remove pull_request branch restriction
nealrichardson d58d5de
Add workflow to test installation flags
nealrichardson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, rc-**] | ||
pull_request: | ||
schedule: | ||
- cron: '0 6 * * 1' # every monday | ||
|
||
name: Test system libuv | ||
|
||
jobs: | ||
R-CMD-check: | ||
# Ubuntu 22.04 has libuv1-dev version 1.43, which is sufficient | ||
runs-on: ubuntu-latest | ||
name: Installed=${{ matrix.config.install }} Bundled=${{ matrix.config.use }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
# This one should test that we've used system and everything runs ok | ||
- {install: true} | ||
# This one should test for bundling log message | ||
- {install: true, use: true} | ||
# This one should test for failure | ||
- {install: false, use: false} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- name: Install libuv | ||
if: ${{ matrix.config.install }} | ||
# If we add tests for e.g. rhel/centos, we couldn't assume apt-get | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libuv1-dev | ||
|
||
- name: Ensure libuv is not on the system | ||
if: ${{ !matrix.config.install }} | ||
run: | | ||
sudo apt-get remove -y libuv1-dev || true | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
if: ${{ matrix.config.install }} | ||
env: | ||
USE_BUNDLED_LIBUV: ${{ matrix.config.use }} | ||
with: | ||
upload-snapshots: true | ||
|
||
- name: Confirm that USE_BUNDLED_LIBUV was respected | ||
if: ${{ matrix.config.install }} | ||
env: | ||
USE_BUNDLED_LIBUV: ${{ matrix.config.use }} | ||
run: | | ||
if [ "$USE_BUNDLED_LIBUV" = "true" ]; then | ||
grep "Using bundled copy of libuv" check/httpuv.Rcheck/00install.out | ||
else | ||
grep "Using libuv found by pkg-config" check/httpuv.Rcheck/00install.out | ||
fi | ||
|
||
- name: Confirm error if system libuv missing and use=false | ||
if: ${{ !matrix.config.install && !matrix.config.use }} | ||
env: | ||
USE_BUNDLED_LIBUV: ${{ matrix.config.use }} | ||
run: | | ||
R CMD INSTALL . > install.log || true | ||
grep "Did not find suitable libuv on your system" install.log |
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,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
rm -f src/Makevars configure.log |
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,45 @@ | ||
#!/usr/bin/env sh | ||
|
||
PKG_CONFIG_NAME="libuv" | ||
LIBUV_VERSION_REQUIRED="$PKG_CONFIG_NAME >= 1.43 $PKG_CONFIG_NAME < 2" | ||
|
||
# If unset (default), will try to find libuv on system and fall back to bundled | ||
# If true (case insensitive), will not look for system library | ||
# If false, will not fall back to bundled if system library not found | ||
USE_BUNDLED_LIBUV=`echo $USE_BUNDLED_LIBUV | tr '[:upper:]' '[:lower:]'` | ||
|
||
if [ `uname -s` = "Darwin" ]; then | ||
# Always do static linking on macOS | ||
PKG_CONFIG="pkg-config --static" | ||
else | ||
PKG_CONFIG="pkg-config" | ||
fi | ||
|
||
# First, look for suitable libuv installed on the system | ||
if [ "${USE_BUNDLED_LIBUV}" != "true" ] && ${PKG_CONFIG} --exists ''"${LIBUV_VERSION_REQUIRED}"'' 2>&1; then | ||
echo "** Using libuv found by pkg-config in `${PKG_CONFIG} --variable=prefix --silence-errors ${PKG_CONFIG_NAME}`" | ||
PKG_CFLAGS=`${PKG_CONFIG} --cflags --silence-errors ${PKG_CONFIG_NAME}` | ||
PKG_LIBS=`${PKG_CONFIG} --libs ${PKG_CONFIG_NAME}` | ||
DEPS="" | ||
elif [ "${USE_BUNDLED_LIBUV}" != "false" ]; then | ||
# If not found, use the bundled copy (unless directed otherwise) | ||
echo "** Using bundled copy of libuv" | ||
PKG_CFLAGS="-Ilibuv/include" | ||
PKG_LIBS="./libuv/.libs/libuv.a" | ||
# By setting DEPS, this triggers the libuv build in src/Makevars | ||
DEPS="libuv/.libs/libuv.a" | ||
else | ||
echo "** Did not find suitable libuv on your system," | ||
echo "** and not building from source because USE_BUNDLED_LIBUV=false." | ||
echo "** Please install ${LIBUV_VERSION_REQUIRED} or unset USE_BUNDLED_LIBUV" | ||
exit 1 | ||
fi | ||
|
||
# For debugging | ||
echo "** PKG_CFLAGS=$PKG_CFLAGS" | ||
echo "** PKG_LIBS=$PKG_LIBS" | ||
# Write to Makevars | ||
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" -e "s|@deps@|$DEPS|" src/Makevars.in > src/Makevars | ||
|
||
# Success | ||
exit 0 |
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
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.
Note to self. This is all of the possible combinations and their expected results:
(I think you did a good job of narrowing it down to 3 configs)