-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
162 lines (147 loc) · 4.02 KB
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
# Variables
#
# RStudio
RSTUDIO_VERSION=rstudio-server-2024.09.1-394-amd64
# Ubuntu version
UBUNTU_CODENAME=$(shell lsb_release -cs)
#
# Targets
#
.PHONY = install install-base install-r install-sits install-rstudio install-cuda
#
# Base
#
install-base: ## Install base dependencies
apt-get update -y \
&& apt-get install -y --no-install-recommends \
gdal-bin git \
htop \
lbzip2 \
libfftw3-dev \
libcairo2-dev \
libgdal-dev libgeos-dev libgit2-dev libgsl0-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libhdf4-alt-dev libhdf5-dev \
libjq-dev \
libnetcdf-dev \
libpq-dev libproj-dev libprotobuf-dev \
libsqlite3-dev libssl-dev \
libudunits2-dev libunwind-dev \
netcdf-bin \
postgis protobuf-compiler \
rsync \
sqlite3 \
texlive-latex-base tk-dev \
unixodbc-dev \
vim \
wget \
qpdf \
texlive-fonts-extra \
texlive-latex-extra \
texlive-latex-recommended \
texlive-fonts-recommended \
ghostscript \
libharfbuzz-dev \
libfribidi-dev \
gdebi-core \
libclang-dev
#
# R language
#
install-r: ## Install R language
apt update -y \
&& apt install -y \
gnupg2 \
software-properties-common \
gpg \
gpg-agent \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(UBUNTU_CODENAME)-cran40/" \
&& apt update -y \
&& apt-get install -y --no-install-recommends \
r-base \
r-base-dev \
r-recommended \
littler
# Configure litter
ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
&& install.r docopt
# Install R dependencies
install2.r --error \
classInt \
deldir \
geosphere gstat \
hdf5r \
mapdata \
ncdf4 \
proj4 \
RColorBrewer RNetCDF \
raster \
rlas \
sf \
sp \
spacetime \
spatstat \
spdep \
rmarkdown \
Rcpp \
knitr \
testthat \
remotes \
qpdf \
shiny \
pacman \
covr \
withr \
devtools \
renv \
torch \
torchopt \
luz \
tmap
#
# SITS R Package
#
install-sits: ## Install SITS R Package
# Install sits
git clone --branch v1.5.1 https://github.com/e-sensing/sits \
&& cd sits \
&& echo "remotes::install_deps(dependencies = TRUE)" | R --no-save \
&& echo "devtools::install('.')" | R --no-save
# Install sitsdata
git clone https://github.com/e-sensing/sitsdata \
&& cd sitsdata \
&& echo "devtools::install('.')" | R --no-save
rm -rf sits sitsdata
#
# RStudio
#
install-rstudio: ## Install RStudio
wget https://download2.rstudio.org/server/$(UBUNTU_CODENAME)/amd64/$(RSTUDIO_VERSION).deb --no-check-certificate \
&& gdebi $(RSTUDIO_VERSION).deb -n \
&& rm $(RSTUDIO_VERSION).deb \
&& mkdir -p /var/lib/rstudio-server/monitor/log/ \
&& chown rstudio-server:rstudio-server /var/lib/rstudio-server/monitor/log/
#
# CUDA for R
#
install-cuda: ## Install CUDA (11.8)
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin \
&& mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 \
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub \
&& add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" \
&& apt install cuda-11-8 cuda-toolkit-11-8 -y \
&& echo "install.packages('torch')" | R --no-save \
&& echo 'torch::install_torch(type = "11.8")' | R --no-save
#
# General installation target
#
install: install-base install-r install-sits install-rstudio install-cuda
echo "all dependencies installed!"
#
# Documentation function (thanks for https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html)
#
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'