Skip to content

Commit

Permalink
more stripping options for INSTALL
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@76297 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Mar 29, 2019
1 parent 9e91e20 commit a49ad52
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
12 changes: 7 additions & 5 deletions doc/NEWS.Rd
Expand Up @@ -5,7 +5,7 @@
\title{R News}
\encoding{UTF-8}

\section{\Rlogo CHANGES IN R-devel}{
\section{\Rlogo CHANGES IN R 3.6.0}{

\subsection{SIGNIFICANT USER-VISIBLE CHANGES}{
\itemize{
Expand Down Expand Up @@ -442,14 +442,16 @@
\item The make macro \samp{F_VISIBILITY} is now preferred for
both fixed-form and free-form Fortran.

\item \command{R CMD INSTALL} gains a new flag \option{--strip}
\item \command{R CMD INSTALL} gains a new option \option{--strip}
which strips installed shared object(s): this can also be achieved
by setting the environment variable \env{_R_SHLIB_STRIP_} to a
true value.

This is most useful on platforms using GNU \code{binutils} (such
as Linux) and compiling with \option{-g} flags: it has negligible
effect on macOS.
The new option \option{--strip-lib} attempts stripping of
static and shared libraries installed under \file{lib}.

These are most useful on platforms using GNU \code{binutils} (such
as Linux) and compiling with \option{-g} flags.

\item There is more support for installing UTF-8-encoded packages
in a strict Latin-1 locale (and probably for other Latin locales):
Expand Down
26 changes: 25 additions & 1 deletion src/library/tools/R/install.R
Expand Up @@ -226,6 +226,7 @@ if(FALSE) {
" --configure-vars=VARS",
" set variables for the configure scripts (if any)",
" --strip strip shared object(s)",
" --strip-lib strip static/dynamic libraries under lib/",
" --dsym (macOS only) generate dSYM directory",
" --built-timestamp=STAMP",
" set timestamp for Built: entry in DESCRIPTION",
Expand Down Expand Up @@ -1682,6 +1683,27 @@ if(FALSE) {
sQuote("--no-staged-install"))
}
}

if (do_strip_lib &&
nzchar(strip_cmd <- Sys.getenv("R_STRIP_STATIC_LIB")) &&
length(a_s <- Sys.glob(file.path(file.path(lib, curPkg),
"lib", "*.a")))) {
if(length(a_s) > 1L)
starsmsg(stars, "stripping static libraries under lib")
else
starsmsg(stars, "stripping static library under lib")
system(paste(c(strip_cmd, shQuote(a_s)), collapse = " "))
}
if (do_strip_lib &&
nzchar(strip_cmd <- Sys.getenv("R_STRIP_SHARED_LIB")) &&
length(so_s <- Sys.glob(file.path(file.path(lib, curPkg), "lib",
paste0("*", SHLIB_EXT))))) {
if(length(so_s) > 1L)
starsmsg(stars, "stripping dynamic libraries under lib")
else
starsmsg(stars, "stripping dynamic library under lib")
system(paste(c(strip_cmd, shQuote(so_s)), collapse = " "))
}
}

options(showErrorCalls = FALSE)
Expand Down Expand Up @@ -1741,7 +1763,7 @@ if(FALSE) {
install_inst <- TRUE
install_help <- TRUE
install_tests <- FALSE
do_strip <- FALSE
do_strip <- do_strip_lib <- FALSE

while(length(args)) {
a <- args[1L]
Expand Down Expand Up @@ -1870,6 +1892,8 @@ if(FALSE) {
dsym <- TRUE
} else if (a == "--strip") {
do_strip <- TRUE
} else if (a == "--strip-lib") {
do_strip_lib <- TRUE
} else if (substr(a, 1, 18) == "--built-timestamp=") {
built_stamp <- substr(a, 19, 1000)
} else if (startsWith(a, "-")) {
Expand Down

0 comments on commit a49ad52

Please sign in to comment.