Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pkg-scripts/R-3.6.1-1.build.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
277 lines (232 sloc)
10.9 KB
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
#! /bin/bash | |
PKG=R | |
VERSION=3.6.1 | |
BUILD=1 | |
# https://www.r-project.org/ | |
# https://cran.r-project.org/mirrors.html | |
CRANMIRROR=https://packages.othr.de/cran/ | |
PREFIX=/pkg/$PKG-$VERSION-$BUILD | |
if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi | |
# export GITHUB_PAT='5***b' 38 secret chars | |
. ./github_pat.source | |
if [ -z "$GITHUB_PAT" ] ; then | |
echo "# Error: GITHUB_PAT is not set, build of 'dynverse/dyno' is supposed to fail." | |
echo "# Check the dvteam mails for 'personal access token'" | |
exit 1 | |
fi | |
# neither home nor /usr/local/package - but texlive kpsewhich for nghiavtr/BPSC | |
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/package/texlive/2015/bin | |
set -xe | |
umask 022 | |
# Use this when R is build & installed and the package list 'work in progress' | |
# PKGDEBUG=1 | |
BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp | |
test -d $BUILD_TMPDIR && rm -r $BUILD_TMPDIR | |
mkdir -p $BUILD_TMPDIR/home | |
export TMPDIR=$BUILD_TMPDIR | |
export HOME=$BUILD_TMPDIR/home | |
exec </dev/null | |
mkdir -p $PREFIX | |
cat >$PREFIX/profile <<-EOF | |
PATH=$PREFIX/bin:\$PATH | |
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig\${PKG_CONFIG_PATH:+:\$PKG_CONFIG_PATH} | |
LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} | |
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi | |
export PKG_CONFIG_PATH LD_LIBRARY_PATH | |
EOF | |
. $PREFIX/profile | |
NPROC=$(nproc) | |
export MAKEFLAGS="-j $NPROC" | |
BUILDDIR=$BUILD_TMPDIR/build | |
mkdir -p $BUILDDIR | |
cd $BUILDDIR | |
if [ -z "$PKGDEBUG" ]; then | |
# Start with some extra stuff. Since this build includes a full | |
# installation of fairly recent boost templates (1.69), there is | |
# no argument against reinstalling gdal, proj, and the like (cf. | |
# /package/gis). | |
( # for 'dynverse/dyno', see UDUNITS2_INCLUDE, UDUNITS2_LIBS below | |
UNITSVER=2.2.26 | |
test -e udunits-$UNITSVER.tar.gz || wget --no-verbose ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-$UNITSVER.tar.gz | |
test -d udunits-$UNITSVER || tar -xf udunits-$UNITSVER.tar.gz | |
cd udunits-$UNITSVER | |
CFLAGS='-O2 -fPIC' \ | |
./configure --prefix=$PREFIX --libdir=$PREFIX/lib --enable-shared=no | |
make | |
make install | |
) | |
# The rest is for 'sf', with 'spdep' as the real culprit. | |
# sf is a pain in the ass, as it carries tons of system dependencies (GDAL, PROJ, ...) | |
# https://github.com/r-spatial/sf - Simple Features for R | |
# ('Simple' in the sense of brainless I guess) | |
# OTOH its needed by monocle3, which is related to AG Mundlos & M. Spielmann, a Nature publication ... | |
( | |
PROJVER=6.1.0 | |
test -e proj-$PROJVER.tar.gz || wget --no-verbose http://download.osgeo.org/proj/proj-$PROJVER.tar.gz | |
test -d proj-$PROJVER || tar -xf proj-$PROJVER.tar.gz | |
cd proj-$PROJVER | |
./configure \ | |
--prefix=$PREFIX \ | |
--libdir=$PREFIX/lib \ | |
--with-external-gtest=no | |
make | |
make install | |
) | |
( | |
GEOSVER=3.7.2 | |
test -e geos-$GEOSVER.tar.bz2 || wget --no-verbose http://download.osgeo.org/geos/geos-$GEOSVER.tar.bz2 | |
test -d geos-$GEOSVER || tar -xf geos-$GEOSVER.tar.bz2 | |
cd geos-$GEOSVER | |
./configure \ | |
--prefix=$PREFIX \ | |
--libdir=$PREFIX/lib | |
make | |
make install | |
) | |
( | |
GDALVER=2.4.1 | |
test -e gdal-$GDALVER.tar.xz || wget --no-verbose http://download.osgeo.org/gdal/$GDALVER/gdal-$GDALVER.tar.xz | |
test -d gdal-$GDALVER || tar -xf gdal-$GDALVER.tar.xz | |
cd gdal-$GDALVER | |
export CFLAGS="-O2 -fPIC" | |
export CXXFLAGS="-O2 -fPIC" | |
./configure \ | |
--prefix=$PREFIX \ | |
--libdir=$PREFIX/lib | |
make | |
make install | |
) | |
# ########### | |
# Now Build R | |
test -e R-$VERSION.tar.gz || wget --no-verbose https://cran.r-project.org/src/base/R-3/R-$VERSION.tar.gz | |
test -d R-$VERSION || tar -xf R-$VERSION.tar.gz | |
cd R-$VERSION | |
sed -i 's/en_GB/en_US/g' tests/reg-tests-3.R tests/reg-tests-3.Rout.save | |
./configure \ | |
--prefix=$PREFIX \ | |
--libdir=$PREFIX/lib \ | |
--with-pic \ | |
--with-recommended-packages \ | |
--enable-shared \ | |
--with-x \ | |
--enable-R-shlib \ | |
LDFLAGS=-Wl,-rpath,$PREFIX/lib/R/lib | |
export TZ=CEST # some tests need timezone | |
make | |
make check | |
make install | |
cd $BUILDDIR | |
cat <<- RCODEXXX | Rscript - | |
options(repos=structure(c(CRAN='$CRANMIRROR'))) | |
install.packages('BiocManager') | |
install.packages('remotes') # or installs from github will fail. | |
BiocManager::install() # this should update the 'base' packages | |
RCODEXXX | |
echo "# State of lib/R/library after initial setup:" | |
ls -la $PREFIX/lib/R/library | |
fi ### -z "$PKGDEBUG" | |
unset DISPLAY # avoid warnings about 'RGL: unable to open X11 display' | |
export UDUNITS2_INCLUDE=$PREFIX/include | |
export UDUNITS2_LIBS=$PREFIX/lib | |
# List of packages | |
# Package names containing a '/' are treated as GitHub repositories | |
# | |
# Format hint: | |
# cat package_list | sed -e 's/\s\s*/\n/g' | sort -f | uniq | tr '\n' ' ' | fmt -w 120 | |
cat <<- RCODEXXX > package_list | |
abind acepack ACME ade4 AdequacyModel affy affyio affyPLM akima ALL annotate AnnotationDbi AnnotationForge aod | |
ape apeglm arrayQualityMetrics ash assertthat bamsignals base64 base64enc batchelor BatchJobs BayesDA BBmisc | |
bdsmatrix beadarray BeadDataPackR beanplot beeswarm bgmm BH bigmemory bigmemory.sri Biobase BiocGenerics | |
BiocParallel biomaRt BioNet Biostrings biovizBase bit bitops boot bootstrap Boruta bpca BradleyTerry2 brew | |
brglm BSgenome BSgenome.Ecoli.NCBI.20080805 bumphunter c060 C50 Cairo car caret Category caTools CellNOptR | |
checkmate ChIPpeakAnno chipseq chron circlize CircStats Ckmeans.1d.dp class clue cluster CNEr coda codetools coin | |
cole-trapnell-lab/leidenbase cole-trapnell-lab/monocle3 colorspace combinat corpcor corrgram corrplot crayon | |
cummeRbund curl data.table DBI DelayedArray DelayedMatrixStats deldir DEoptimR DESeq DESeq2 devtools DEXSeq | |
dichromat digest DirichletMultinomial dismo DNAcopy doMC doParallel doRNG doSNOW dostats dplyr dtw dynamicTreeCut | |
dynverse/dyno e1071 earth easyRNASeq edgeR elasticnet energy entropy evaluate evd exactRankTests exomeCopy | |
ExomeDepth fail fANCOVA fastcluster fastICA fastmatch FDb.InfiniumMethylation.hg19 fdrtool FField fields filehash | |
flashClust foreach foreign formatR Formula futile.logger futile.options gbm gclus gcrma gdata genefilter GeneNet | |
geneplotter genetics GenomeGraphs GenomeInfoDb genomeIntervals GenomicAlignments GenomicFeatures GenomicRanges | |
GEOquery getopt GGally ggbio ggm ggplot2 git2r glasso Glimma glmnet GlobalAncova GlobalOptions globaltest gmp | |
gnm GO.db GOstats GOTHiC gplots graph gRbase gridBase gridExtra gridSVG GSEABase GSEAlm gsl gsubfn gtable gtools | |
Gviz h2o haplo.stats HardyWeinberg hash hdf5r hdi hdrcde hexbin hflights hgu95av2 hgu95av2.db hgu95av2cdf highr | |
Hmisc HMM Homo.sapiens hsmm htmltools HTqPCR httpuv httr hwriter igraph illuminaio impute inline intervals ipred | |
IRanges iterators itertools jokergoo/ComplexHeatmap jokergoo/EnrichedHeatmap jsonlite kernlab KernSmooth knitr | |
ks labeling Lahman lambda.r lars lattice latticeExtra lava lazyeval leaps LearnBayes lhs limma linprog lintr lme4 | |
lmtest locfit longitudinal lpSolve LSD lumi magrittr manipulate mapproj maps maptools maptree markdown MASS MAST | |
Matrix MatrixEQTL matrixStats mclust mda MEDIPS memoise meta MethylSeekR methylumi mgcv mice microbenchmark mime | |
minfi minqa misc3d mitools mixtools mlegp mnormt modeltools monocle multcomp multicool multtest munsell muscle | |
mvtnorm nghiavtr/BPSC nleqslv nlme nloptr nnet nor1mix numDeriv OmicCircos optparse org.Hs.eg.db OrganismDbi pamr | |
party partykit pbapply pbkrtest pcalg pcaMethods penalizedSVM peperr PerfMeas pheatmap pkgmaker plotmo plotrix pls | |
plus plyr preprocessCore pROC prodlim profileModel proto proxy pwr qsea qtl quadprog quantreg QuasR qvalue qvcalc | |
R.cache R.methodsS3 R.oo R.utils R2HTML R6 randomForest randomGLM raster rbenchmark RBGL RCircos RColorBrewer Rcpp | |
RcppArmadillo RcppEigen RCurl registry relaimpo relimp remotes reshape reshape2 reticulate rex rFerns rggobi rgl | |
Rgraphviz RGtk2 rhdf5 RhpcBLASctl Rhtslib rJava rjson RJSONIO rlecuyer rmarkdown rmeta RMySQL RNAseq123 rnaseqGene | |
rngtools robustbase ROC ROCR roxygen2 rpart RRF Rsamtools RSQLite rstudioapi rtracklayer RUnit rversions RWeka | |
RWekajars S4Vectors sandwich scales scalreg scatterplot3d scDD SCnorm scone SCORPIUS sda segmented sendmailR seqinr | |
seqLogo seriation setRNG Seurat sf sfsmisc shape shiny ShortRead siggenes simpleaffy SingleCellExperiment sm snow | |
snowfall snpStats som sp spam SparseM spatial splancs spls statmod stepPlr stringdist stringi stringr strucchange | |
SummarizedExperiment SuppDists survey survival svMisc svTools tables TeachingDemos testthat TFBSTools TFMPvalue tgp | |
TH.data tidyr topGO TSP TxDb.Hsapiens.UCSC.hg19.knownGene VariantAnnotation vcd VennDiagram venneuler verification | |
VGAM vsn waveslim WGCNA whisker xlsx xlsxjars XML xml2 xtable XVector yaml yeastCC zinbwave zipfR zlibbioc zoo | |
RCODEXXX | |
cat <<- RCODEXXX | Rscript - | |
options(repos=structure(c(CRAN='$CRANMIRROR'))) | |
pkgs <- scan('package_list', what = character()) | |
for (pk in pkgs) { | |
pa <- unlist(strsplit(pk, '/')); p <- pa[1]; if (! is.na(pa[2])) p <- pa[2] | |
# there is no simple way to get rid of the error message, so avoid mimimi... | |
cat('* if there is no package, install it - errors here are part of the test!\n') | |
chk <- NULL; try(chk <- find.package(p)) | |
if (is.null(chk)) { | |
BiocManager::install(pk, Ncpus = $NPROC, update = FALSE) # we are fresh within an 2h interval | |
ret <- library(p, character.only = TRUE, logical.return = TRUE) | |
if (! ret) q(save = "no", status = 2) | |
detach( paste("package", p, sep = ":"), unload = TRUE, character.only=TRUE) | |
cat( sprintf('* REALY_DONE with: %s\n', pk)) | |
} else { | |
cat( sprintf('* ALREADY_DONE with: %s\n', pk)) | |
} | |
} | |
RCODEXXX | |
# simple test: can everything be found? | |
cat <<- RCODEXXX | Rscript - | |
pkgs <- scan('package_list', what = character()) | |
for (pk in pkgs) { | |
pa <- unlist(strsplit(pk, '/')); p <- pa[1]; if (! is.na(pa[2])) p <- pa[2] | |
chk <- NULL; try(chk <- find.package(p)) | |
if (is.null(chk)) { | |
cat( sprintf('* ERROR: Missing package: %s\n', pk)) | |
q(save = "no", status = 3) | |
} | |
} | |
RCODEXXX | |
# stress test: load all packages (uses 4G, claims 16G) | |
cat <<- RCODEXXX | Rscript - | |
pkgs <- scan('package_list', what = character()) | |
for (pk in pkgs) { | |
pa <- unlist(strsplit(pk, '/')); p <- pa[1]; if (! is.na(pa[2])) p <- pa[2] | |
ret <- library(p, character.only = TRUE, logical.return = TRUE) | |
if (! ret) { | |
cat( sprintf('* ERROR: Failed to load package/library: %s\n', pk)) | |
q(save = "no", status = 4) | |
} | |
} | |
RCODEXXX | |
# rstudios rsession does a lot of magic to detect the true R binary, thus bypassing | |
# our friendly 'hints' from the wrapper. | |
# tell lib/R/library/sf/libs/sf.so about lib -- yes it's the beloved sf package again! | |
# the original rpath is only set to /pkg/R-3.6.1-0/lib/R/lib, add /pkg/R-3.6.1-0/lib. | |
# to be fixed in next rstudio build | |
patchelf --set-rpath $PREFIX/lib/R/lib:$PREFIX/lib \ | |
$PREFIX/lib/R/library/sf/libs/sf.so | |
exit | |
# NOTES: | |
# | |
# From git to bioconductor: | |
# YosefLab/scone # 29.03.2017 pacini 1.3.0 -> 1.8.0 | |
# rhondabacher/SCnorm # 29.03.2017 pacini 1.5.7 -> 1.6.0 | |
# | |
# Goners (not available for R version 3.6.x): | |
# BiocInstaller Slingshot bigrf grofit harvestr | |
# lint setwidth spdepbio survrec | |