Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 370 lines (309 sloc) 13.7 KB
#! /bin/bash
# COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh
# TESTING=1
# Use this when R is build & installed and the package list 'work in progress'
# PKGDEBUG=1
PKG=R
VERSION=4.4.0
BUILD=0
# https://www.r-project.org/
# https://cran.r-project.org/mirrors.html
# A caching proxy under /project/retarded/rproxy
CRANMIRROR=http://platsch:8010/cran/$PKG-$VERSION-$BUILD/cran
BIOCMIRROR=http://platsch:8010/bioconductor/$PKG-$VERSION-$BUILD/bioc
GITMIRROR=http://platsch:8010/gitclone/$PKG-$VERSION-$BUILD
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi
echo "# Ready player one."
date
set -vxe
umask 022
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD-$USER.build.tmp
test -d $BUILD_TMPDIR && rm -fr $BUILD_TMPDIR/build/*
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) * 4 / 5 + 1 ))
export MAKEFLAGS="-j $NPROC"
BUILDDIR=$BUILD_TMPDIR/build
mkdir -p $BUILDDIR
cd $BUILDDIR
if [ -z "$PKGDEBUG" ]; then
# Start with some extra stuff. Mostly owed to the inability to keep dependencies under control :/
( # for 'dynverse/dyno', see UDUNITS2_INCLUDE, UDUNITS2_LIBS below
UNITSVER=2.2.28
# Orig:https://downloads.unidata.ucar.edu/udunits/2.2.28/udunits-2.2.28.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/58259d94f766c13b5b0cf1aed92ebbe3/udunits-2.2.28.tar.gz
test -e udunits-$UNITSVER.tar.gz || wget -nv $BEEHIVE
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
)
(
PROJVER=9.2.0
# Orig: http://download.osgeo.org/proj/proj-9.2.0.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/1241c7115d8c380ea19469ba0828a22a/proj-9.2.0.tar.gz
test -e proj-$PROJVER.tar.gz || wget -nv $BEEHIVE
test -d proj-$PROJVER || tar -xf proj-$PROJVER.tar.gz
cd proj-$PROJVER
mkdir -p build; cd build
cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=OFF \
-DBUILD_BENCHMARKS=OFF \
-DRUN_NETWORK_DEPENDENT_TESTS=OFF \
..
make
make install
)
(
GEOSVER=3.11.2
# Orig: http://download.osgeo.org/geos/geos-3.11.2.tar.bz2
BEEHIVE=https://beehive.molgen.mpg.de/5967d369c641f0fad42258fcb22af6b5/geos-3.11.2.tar.bz2
test -e geos-$GEOSVER.tar.bz2 || wget -nv $BEEHIVE
test -d geos-$GEOSVER || tar -xf geos-$GEOSVER.tar.bz2
cd geos-$GEOSVER
mkdir -p build; cd build
cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING=OFF \
..
make
make install
)
(
GDALVER=3.6.4
# Orig: http://download.osgeo.org/gdal/3.6.4/gdal-3.6.4.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/7128d0309f9fe2266d72ea7228a3817f/gdal-3.6.4.tar.gz
test -e gdal-$GDALVER.tar.gz || wget -nv $BEEHIVE
test -d gdal-$GDALVER || tar -xf gdal-$GDALVER.tar.gz
cd gdal-$GDALVER
mkdir -p build; cd build
# still required for building... (and why use -DBUILD_CSHARP_BINDINGS and -DBUILD_JAVA_BINDINGS ???)
source /pkg/mono-6.10.0-0/profile
source /pkg/openjdk-11.0.3.2-0/profile
cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_CSHARP_BINDINGS=OFF \
-DBUILD_JAVA_BINDINGS=OFF \
-DBUILD_PYTHON_BINDINGS=OFF \
-DBUILD_TESTING=OFF \
-DGDAL_BUILD_OPTIONAL_DRIVERS=OFF \
-DOGR_BUILD_OPTIONAL_DRIVERS=OFF \
..
make
make install
)
# ###########
# Now Build R
# Orig:https://cran.r-project.org/src/base/R-4/R-4.4.0.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/400b43da0c2e67e62ec9f90d509a9e10/R-4.4.0.tar.gz
test -e R-$VERSION.tar.gz || wget -nv $BEEHIVE
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
# set R_LD_LIBRARY_PATH for etc/ldpaths, so R gets the correct
# env if it is started without sourcing the profile
R_LD_LIBRARY_PATH=${PREFIX}/lib:${PREFIX}/.compatlibs \
./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')))
options(BioC_mirror = '$BIOCMIRROR')
install.packages('BiocManager')
install.packages('remotes')
install.packages('devtools')
BiocManager::install(update = TRUE, ask = FALSE) # update the 'base' packages
RCODEXXX
# java stuff seems to be a troublemaker, install first
cat <<- RCODEXXX | Rscript -
options(repos=structure(c(CRAN='$CRANMIRROR')))
options(BioC_mirror = '$BIOCMIRROR')
BiocManager::install(c('rJava', 'RWeka', 'RWekajars'), update = FALSE)
RCODEXXX
# same applies for V8 (JavaScript, Google)
(
export DOWNLOAD_STATIC_LIBV8=1
cat <<- RCODEXXX | Rscript -
options(repos=structure(c(CRAN='$CRANMIRROR')))
install.packages('V8')
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
# Format hint:
# cat package_list | sed -e 's/\s\s*/\n/g' | sort -f | uniq | tr '\n' ' ' | fmt -w 120
# ends with about 800 dirs in 'R-4.4.0-0/lib/R/library'
cat <<- RCODEXXX > package_list
abind acepack ACME ade4 AdequacyModel affy affyio affyPLM akima ALL annotate AnnotationDbi AnnotationForge aod
ape apeglm arrayQualityMetrics ash assertthat AUCell 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
colorspace combinat corpcor corrgram corrplot cowplot crayon cummeRbund curl cvTools data.table DBI DelayedArray
DelayedMatrixStats deldir DEoptimR DESeq2 DEXSeq dichromat digest DirichletMultinomial DNAcopy doMC doParallel doRNG
doSNOW dostats dplyr dtw dynamicTreeCut e1071 earth edgeR elasticnet energy entropy evaluate evd exactRankTests
ExomeDepth ExperimentHub fail fANCOVA fastcluster fastICA fastmatch FDb.InfiniumMethylation.hg19 fdrtool fields
filehash flashClust foreach foreign formatR Formula futile.logger futile.options gbm gclus gcrma gdata genefilter
GeneNet geneplotter genetics GenomeInfoDb genomeIntervals GenomicAlignments GenomicFeatures GenomicRanges GEOquery
getopt GGally ggbio ggm ggplot2 ggpubr 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 HiCcompare
highr HiveR Hmisc HMM Homo.sapiens htmltools httpuv httr hwriter igraph illuminaio imcRtools impute infotheo
inline intervals ipred IRanges IRkernel iterators itertools jsonlite kernlab KernSmooth knitr ks kSamples
labeling Lahman lambda.r lars lattice latticeExtra lava lazyeval leaps LearnBayes lhs limma linprog lintr lme4
lmtest locfit longitudinal lpSolve lpSolveAPI LSD lumi magrittr manipulate mapproj maps maptree markdown MASS MAST
Matrix MatrixEQTL matrixStats mclust mda MEDIPS memoise meta MethylSeekR methylumi mgcv mice microbenchmark mime
minfi minqa misc3d mitools mixtools mlegp modeltools multcomp multicool multiHiCcompare multtest munsell muscle
mvtnorm nleqslv nlme nloptr NMF nnet nor1mix numDeriv OmicCircos optparse org.Hs.eg.db OrganismDbi pamr party
partykit pbapply pbkrtest pcalg pcaMethods penalizedSVM peperr pheatmap PhyloProfile pkgmaker plotmo plotrix
pls plyr ppcor pracma preprocessCore pROC prodlim profileModel proto proxy pwr qsea qtl quadprog quantreg QuasR
qvalue qvcalc R.cache R.matlab R.methodsS3 R.oo R.utils R2HTML R6 randomForest randomGLM rbenchmark RBGL RCircos
RColorBrewer Rcpp RcppArmadillo RcppEigen RCurl registry relaimpo relimp remotes reshape reshape2 reticulate
rex rFerns rgl Rgraphviz rhandsontable rhdf5 RhpcBLASctl Rhtslib rJava rjson RJSONIO rlecuyer RMariaDB rmarkdown
rmeta RMySQL RNAseq123 rnaseqGene rngtools robustbase ROC ROCR roxygen2 rpart RPostgres RPostgreSQL RRF Rsamtools
RSQLite rstudioapi rtracklayer RUnit rversions S4Vectors sandwich scales scalreg scatterplot3d SCnorm scone
SCORPIUS sda segmented sendmailR seqinr seqLogo seriation setRNG Seurat sf shape shiny shinythemes ShortRead
siggenes SingleCellExperiment sm snow snowfall snpStats som sp spam SparseM spatial splancs spls statmod stepPlr
stringdist stringi stringr strucchange SummarizedExperiment SuppDists survey svMisc svTools tables TeachingDemos
terra testthat TFBSTools TFMPvalue tgp TH.data tidyr tidyverse topGO tradeSeq 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 -
XSAVE_PATH <- Sys.getenv('PATH')
options(repos=structure(c(CRAN='$CRANMIRROR')))
options(BioC_mirror = '$BIOCMIRROR')
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)) {
cat( sprintf('* About to install: %s\n', pk), file='work_monitor_list', append = TRUE)
BiocManager::install(pk, update = FALSE)
ret <- library(p, character.only = TRUE, logical.return = TRUE)
if (! ret) q(save = "no", status = 2)
# the logic fails for 'cole-trapnell-lab/cicero-release', fixed below
detach( paste("package", p, sep = ":"), unload = TRUE, character.only=TRUE)
if (Sys.getenv('PATH') != XSAVE_PATH) {
cat( sprintf('*** PATH SCREWUP OCCURED (package %s)\n', pk))
cat( sprintf('*** expected: %s\n', XSAVE_PATH))
cat( sprintf('*** now: %s\n', Sys.getenv('PATH')))
}
Sys.setenv(PATH = XSAVE_PATH)
cat( sprintf('* REALY_DONE with: %s\n', pk))
} else {
cat( sprintf('* ALREADY_DONE with: %s\n', pk))
}
}
RCODEXXX
( # github nghiavtr/BPSC
mkdir -p BPSC
cd BPSC
# --trust-server-names makes wget use the 'redirected' name
wget -nv --trust-server-names platsch $GITMIRROR/nghiavtr/BPSC && test -e *.latest.tar.gz
tar -xf *.latest.tar.gz
cd BPSC
cat <<- RCODEXXX | Rscript -
devtools::install_local('.')
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
# do the remaining git things.
# do 'cole-trapnell-lab/cicero-release' seperately
echo "BiocManager::install('cole-trapnell-lab/cicero-release', update = FALSE)" | Rscript -
# same with 'GreenleafLab/ArchR', https://www.archrproject.com/index.html
cat <<- RCODEXXX | Rscript -
options(repos=structure(c(CRAN='$CRANMIRROR')))
options(BioC_mirror = '$BIOCMIRROR')
devtools::install_github("GreenleafLab/ArchR", ref="master", repos = BiocManager::repositories())
library(ArchR)
ArchR::installExtraPackages()
RCODEXXX
# finally a source build, this is/was intended to provide a clean velocyto.R package.
# velocyto.R uses an inappropriate makefile and has a silly multitreading issue
cd $BUILDDIR
mkdir -p velocyto_fixup
cd velocyto_fixup
git clone https://github.com/velocyto-team/velocyto.R
cd velocyto.R
git checkout 0.6 --force
git clean -dffx
mv src/Makevars src/Makevars.weird
# yields just -fopenmp, which won't work on macs with clang
echo 'PKG_CXXFLAGS=-Wall $(SHLIB_OPENMP_CXXFLAGS)' > src/Makevars
# intercept the inane 'grab all cores' policy
# defaultNCores <- function() { parallel::detectCores(logical=F) }
cp -p R/momentum_routines.R R/momentum_routines.R.orig
sed -e '/^defaultNCores/ d' -i R/momentum_routines.R
cat <<__NCores_HACK >> R/momentum_routines.R
defaultNCores <- function() {
env <- Sys.getenv('VELOCYTO_CORES')
if (env != "") { return(as.integer(env)) }
parallel::detectCores(logical=F)
}
__NCores_HACK
R CMD INSTALL .
echo "# Game over ..."
date
exit