File: update_libuv.R

package info (click to toggle)
r-cran-httpuv 1.6.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,292 kB
  • sloc: ansic: 6,499; cpp: 5,501; makefile: 103; sh: 56
file content (36 lines) | stat: -rwxr-xr-x 969 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env Rscript

# This script can be run from the command line or sourced from an R session.
library(rprojroot)

version <- "1.43.0"

# The git tag for the https://github.com/libuv/libuv repo.
tag <- paste0("v", version)

dest_file <- file.path(tempdir(), paste0("libuv-", version, ".tar.gz"))

url <- paste0("https://github.com/libuv/libuv/archive/", tag, ".tar.gz")
message("Downloading ", url)
download.file(url, dest_file)

src_dir   <- rprojroot::find_package_root_file("src")
libuv_dir <- rprojroot::find_package_root_file("src/libuv")

untar(dest_file, exdir = src_dir)

# Remove old libuv
unlink(libuv_dir, recursive = TRUE)

# Rename new libuv
file.rename(paste0(libuv_dir, "-", version), libuv_dir)

unlink(dest_file)

# Copy over Makefile for mingw
file.copy(
  file.path(rprojroot::find_package_root_file("tools"), "Makefile-libuv.mingw"),
  libuv_dir
)

message("Make sure to fix up the libuv sources in src/libuv/ as described in src/README.md.")