Skip to content

Commit 5b0b265

Browse files
committed
clean configure & document TLS build options
1 parent 567312d commit 5b0b265

File tree

7 files changed

+65
-51
lines changed

7 files changed

+65
-51
lines changed

R/stream.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
#' Specify only one of 'dial' or 'listen'. If both are specified, 'listen'
2626
#' will be ignored.
2727
#'
28-
#' TLS is automatically configured for dialing a secure websocket address
29-
#' starting 'wss://' (where the NNG library has been built with TLS support).
28+
#' @section TLS Support:
29+
#'
30+
#' Dialing a secure websocket address starting 'wss://' is supported if
31+
#' \code{\link{nng_version}} shows 'TLS supported'.
3032
#'
3133
#' @examples
3234
#' # will succeed only if there is an open connection at the address:

R/utils.R

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@
88
#'
99
#' @section TLS Support:
1010
#'
11-
#' The environment variable 'NANONEXT_TLS' may be set, e.g. by
12-
#' \code{Sys.setenv(NANONEXT_TLS=1)}, prior to package installation to enable
13-
#' TLS where the system NNG library has been built with TLS support (using
14-
#' Mbed TLS). Note: this is not applicable to Windows systems.
11+
#' Where system installations of 'libnng' and 'libmbedtls' development
12+
#' headers are detected in the same location, it is assumed that NNG was
13+
#' built with TLS support (using Mbed TLS) and TLS is configured appropriately.
14+
#'
15+
#' Otherwise, the environment variable `Sys.setenv(NANONEXT_TLS=1)` may be
16+
#' set prior to installation if:
17+
#'
18+
#' - your system installations of 'libnng' (built with TLS support) and
19+
#' 'libmbedtls' are in different locations; or
20+
#'
21+
#' - you have a system installation of 'libmbedtls' but not 'libnng' and want
22+
#' nanonext to download and build a more recent version of 'libnng' than
23+
#' available in system repositories against this.
24+
#'
25+
#' Note: this is not applicable to Windows systems.
1526
#'
1627
#' @examples
1728
#' nng_version()

README.Rmd

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,21 +459,23 @@ This is available in system package repositories as:
459459
- `libnng-dev` (deb)
460460
- `nng-devel` (rpm)
461461
- `nng` (Homebrew on MacOS)
462-
- `nng` from vcpkg (see <https://vcpkg.io/>).
463462

464463
A system installation of 'libnng' in the standard filesystem locations will be detected and used if possible.
465464

466-
Otherwise, a release version of 'libnng' will be downloaded and built from source automatically during package installation (note: this requires 'cmake').
465+
Otherwise, a suitable recent version of 'libnng' will be downloaded and built from source automatically during package installation (note: this requires 'cmake').
467466

468467
#### Windows
469468

470469
Pre-built libraries (for i386 / x64 / x64-UCRT) are automatically downloaded during the package installation process.
471470

472471
#### TLS Support
473472

474-
If a system installation of 'libnng' and 'libmbedtls' development headers are both detected in the same location, it is assumed that NNG was built with TLS support (using Mbed TLS) and the appropriate options are set to ensure a successful install.
473+
If system installations of 'libnng' and 'libmbedtls' development headers are detected in the same location, it is assumed that NNG was built with TLS support (using Mbed TLS) and TLS support is configured appropriately.
475474

476-
If your system installation of NNG was built with TLS support (using Mbed TLS) but detection of 'libmbedtls' failed (possibly as it was installed in another location), you may also set the environment variable `Sys.setenv(NANONEXT_TLS=1)` before installing the package to ensure that the appropriate options are set.
475+
Otherwise, the environment variable `Sys.setenv(NANONEXT_TLS=1)` may be set prior to installation if:
476+
477+
- your system installations of 'libnng' (built with TLS support) and 'libmbedtls' are in different locations; or
478+
- you have a system installation of 'libmbedtls' but not 'libnng' and want nanonext to download and build a more recent version of 'libnng' than available in system repositories against this.
477479

478480
#### Certain ARM architectures
479481

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ aio
377377
#> < recvAio >
378378
#> - $data for message data
379379
aio$data |> str()
380-
#> num [1:100000000] 1.361 -0.547 1.283 -0.905 -1.785 ...
380+
#> num [1:100000000] -0.479 -0.448 0.216 -0.424 0.037 ...
381381
```
382382

383383
As `call_aio()` is blocking and will wait for completion, an alternative
@@ -512,11 +512,11 @@ ncurl("http://httpbin.org/headers")
512512
#> [1] 7b 0a 20 20 22 68 65 61 64 65 72 73 22 3a 20 7b 0a 20 20 20 20 22 48 6f 73
513513
#> [26] 74 22 3a 20 22 68 74 74 70 62 69 6e 2e 6f 72 67 22 2c 20 0a 20 20 20 20 22
514514
#> [51] 58 2d 41 6d 7a 6e 2d 54 72 61 63 65 2d 49 64 22 3a 20 22 52 6f 6f 74 3d 31
515-
#> [76] 2d 36 32 35 33 33 33 66 37 2d 31 38 35 39 61 30 31 35 30 30 39 61 38 36 63
516-
#> [101] 64 35 37 31 63 38 31 35 35 22 0a 20 20 7d 0a 7d 0a
515+
#> [76] 2d 36 32 35 66 65 35 62 35 2d 34 38 38 66 62 31 34 63 32 36 36 37 66 39 65
516+
#> [101] 66 32 30 31 65 33 30 32 38 22 0a 20 20 7d 0a 7d 0a
517517
#>
518518
#> $data
519-
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-625333f7-1859a015009a86cd571c8155\"\n }\n}\n"
519+
#> [1] "{\n \"headers\": {\n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-625fe5b5-488fb14c2667f9ef201e3028\"\n }\n}\n"
520520
```
521521

522522
For advanced use, supports additional HTTP methods such as POST or PUT.
@@ -531,7 +531,7 @@ res
531531
#> - $raw for raw message
532532

533533
call_aio(res)$data
534-
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-625333f8-02809e8e020ccb400cecf3e9\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"79.173.189.204\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
534+
#> [1] "{\n \"args\": {}, \n \"data\": \"{\\\"key\\\": \\\"value\\\"}\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Authorization\": \"Bearer APIKEY\", \n \"Content-Length\": \"16\", \n \"Content-Type\": \"application/json\", \n \"Host\": \"httpbin.org\", \n \"X-Amzn-Trace-Id\": \"Root=1-625fe5b5-073a52686414e1556c6f9853\"\n }, \n \"json\": {\n \"key\": \"value\"\n }, \n \"origin\": \"79.173.189.204\", \n \"url\": \"http://httpbin.org/post\"\n}\n"
535535
```
536536

537537
In this respect, it may be used as a performant and lightweight method
@@ -581,13 +581,12 @@ This is available in system package repositories as:
581581
- `libnng-dev` (deb)
582582
- `nng-devel` (rpm)
583583
- `nng` (Homebrew on MacOS)
584-
- `nng` from vcpkg (see <https://vcpkg.io/>).
585584

586585
A system installation of ‘libnng’ in the standard filesystem locations
587586
will be detected and used if possible.
588587

589-
Otherwise, a release version of ‘libnng’ will be downloaded and built
590-
from source automatically during package installation (note: this
588+
Otherwise, a suitable recent version of ‘libnng’ will be downloaded and
589+
built from source automatically during package installation (note: this
591590
requires ‘cmake’).
592591

593592
#### Windows
@@ -597,16 +596,19 @@ downloaded during the package installation process.
597596

598597
#### TLS Support
599598

600-
If a system installation of ‘libnng’ and ‘libmbedtls’ development
601-
headers are both detected in the same location, it is assumed that NNG
602-
was built with TLS support (using Mbed TLS) and the appropriate options
603-
are set to ensure a successful install.
599+
If system installations of ‘libnng’ and ‘libmbedtls’ development headers
600+
are detected in the same location, it is assumed that NNG was built with
601+
TLS support (using Mbed TLS) and TLS support is configured
602+
appropriately.
604603

605-
If your system installation of NNG was built with TLS support (using
606-
Mbed TLS) but detection of ‘libmbedtls’ failed (possibly as it was
607-
installed in another location), you may also set the environment
608-
variable `Sys.setenv(NANONEXT_TLS=1)` before installing the package to
609-
ensure that the appropriate options are set.
604+
Otherwise, the environment variable `Sys.setenv(NANONEXT_TLS=1)` may be
605+
set prior to installation if:
606+
607+
- your system installations of ‘libnng’ (built with TLS support) and
608+
‘libmbedtls’ are in different locations; or
609+
- you have a system installation of ‘libmbedtls’ but not ‘libnng’ and
610+
want nanonext to download and build a more recent version of
611+
‘libnng’ than available in system repositories against this.
610612

611613
#### Certain ARM architectures
612614

configure

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then
2323
PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS"
2424
PKG_LIBS="-L$LIB_DIR $PKG_LIBS"
2525

26-
elif [ -d "$HOME/vcpkg/installed/x64-linux/include/nng" ]; then
27-
echo "found libnng vcpkg installation..."
28-
PKG_CFLAGS="-I$HOME/vcpkg/installed/x64-linux/include $PKG_CFLAGS"
29-
PKG_LIBS="-L$HOME/vcpkg/installed/x64-linux/lib $PKG_LIBS"
30-
if [ -d "$HOME/vcpkg/installed/x64-linux/include/mbedtls" ]; then
31-
echo "found mbedtls vcpkg installation... using TLS support"
32-
PKG_LIBS="$PKG_LIBS -lmbedtls -lmbedx509 -lmbedcrypto"
33-
fi
34-
SYS_LIB=1
35-
3626
elif [ -d "/usr/local/include/nng" ]; then
3727
echo "found system libnng installation..."
3828
PKG_CFLAGS="-I/usr/local/include $PKG_CFLAGS"
@@ -110,11 +100,7 @@ if [ $? -ne 0 ]; then
110100
echo "Automatic download and/or build also failed. Try installing:"
111101
echo " * deb: libnng-dev (Debian, Ubuntu, etc.)"
112102
echo " * rpm: nng-devel (Fedora, CentOS etc.)"
113-
echo " * arch: https://aur.archlinux.org/nng.git (Arch from AUR)"
114103
echo " * brew: nng (MacOS)"
115-
echo "Alternatively:"
116-
echo " * vcpkg: nng (Linux/MacOS, follow getting started instructions at"
117-
echo " https://vcpkg.io/ starting from your HOME directory)"
118104
echo "If 'libnng' is already installed but in a non-standard location, you"
119105
echo "may set INCLUDE_DIR and LIB_DIR manually via:"
120106
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'"
@@ -154,11 +140,7 @@ if [ $? -ne 0 ]; then
154140
echo "Automatic download and/or build also failed. Try installing:"
155141
echo " * deb: libnng-dev (Debian, Ubuntu, etc.)"
156142
echo " * rpm: nng-devel (Fedora, CentOS etc.)"
157-
echo " * arch: https://aur.archlinux.org/nng.git (Arch from AUR)"
158143
echo " * brew: nng (MacOS)"
159-
echo "Alternatively:"
160-
echo " * vcpkg: nng (Linux/MacOS, follow getting started instructions at"
161-
echo " https://vcpkg.io/ starting from your HOME directory)"
162144
echo "If 'libnng' is already installed but in a non-standard location, you"
163145
echo "may set INCLUDE_DIR and LIB_DIR manually via:"
164146
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'"

man/nng_version.Rd

Lines changed: 15 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/stream.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)