-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingularity-cdo.def
153 lines (125 loc) · 4.28 KB
/
singularity-cdo.def
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
BootStrap: docker
From: ubuntu:20.04
%labels
Author Ahmed Homoudi
Version v1.0.0
CDO_Version 2.1.1
%environment
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
export CDO_VERSION=2.1.1
%files
%post
# Get dependencies
apt-get update
apt-get install -y --no-install-recommends \
locales software-properties-common wget
# Configure default locale
echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen en_GB.utf8
/usr/sbin/update-locale LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
export TZ='Europe/Berlin'
export DEBIAN_FRONTEND=noninteractive
# build tools
apt-get install -y build-essential gfortran cmake
# others
apt-get install -y libpng-dev libudunits2-dev libgl1-mesa-dev doxygen
apt-get install -y m4 curl libcurl4-openssl-dev libxml2-dev
#szip
wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz
gunzip -c szip-2.1.1.tar.gz | tar xf -
cd szip-2.1.1/
./configure --prefix=/usr/local
make -j4
make check
make install
cd ../
rm -rf szip-2.1.1/ szip-2.1.1.tar.gz
# HDF5
wget https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_12_0/source/hdf5-1.12.0.tar.gz && \
tar xvf hdf5-1.12.0.tar.gz
cd hdf5-1.12.0/
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
CC=gcc && FC=gfortran && CFLAGS=-fPIC
./configure --enable-shared --enable-fortran --enable-fortran2003 --enable-cxx --prefix=/usr/local --with-zlib=/usr --with-szlib=/usr/local
make -j4
make install
cd ../
rm -rf hdf5-1.12.0/ hdf5-1.12.0.tar.gz
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# netdf-c
wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.0/netcdf-c-4.9.0.tar.gz
tar xvf netcdf-c-4.9.0.tar.gz
cd netcdf-c-4.9.0/
LDFLAGS=-L/usr/local/lib && LIBS=-lhdf5 && CPPFLAGS=-I/usr/local/include
./configure --prefix=/usr/local # without Pnetcdf because WRF don't like it
make -j4
make install
cd ../
rm -rf netcdf-c-4.9.0/ netcdf-c-4.9.0.tar.gz
# netcf-f
wget https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.0/netcdf-fortran-4.6.0.tar.gz
tar xf netcdf-fortran-4.6.0.tar.gz
cd netcdf-fortran-4.6.0
LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include LIBS=-lnetcdf
./configure --prefix=/usr/local --enable-parallel-testsmake
make -j4
make install
cd ../
rm -rf netcdf-fortran-4.6.0 netcdf-fortran-4.6.0.tar.gz
# FFTW
wget http://www.fftw.org/fftw-3.3.10.tar.gz
tar xf fftw-3.3.10.tar.gz
cd fftw-3.3.10/
./configure --enable-openmp --enable-threads --enable-shared --prefix=/usr/local
make -j4
make install # sudo
rm -rf fftw-3.3.10 fftw-3.3.10.tar.gz
#JasPer
wget http://www.ece.uvic.ca/~frodo/jasper/software/jasper-2.0.14.tar.gz
tar -xzf jasper-2.0.14.tar.gz
cd jasper-2.0.14
mkdir BUILD && cd BUILD
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../
make -j4
make install
cd ../../
rm -rf jasper-2.0.14/ jasper-2.0.14.tar.gz
# AEC
apt-get update
apt-get -y install libaec-dev
#ecCodes
wget https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.35.0-Source.tar.gz
tar -xzf eccodes-2.35.0-Source.tar.gz
mkdir BUILD && cd BUILD
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_PNG=ON -DENABLE_JPG_LIBJASPER=ON ../eccodes-2.35.0-Source
make -j4
make install
cd ../
rm -rf BUILD/ eccodes-2.35.0-Source/ eccodes-2.35.0-Source.tar.gz
# PROJ
apt-get update
apt-get install -y libproj-dev proj-bin
# CDO
wget https://code.mpimet.mpg.de/attachments/download/27954/cdo-2.1.1.tar.gz
tar -xf cdo-2.1.1.tar.gz
cd cdo-2.1.1/
./configure --prefix=/usr/local --with-szlib=yes --with-hdf5=/usr/local --with-netcdf=yes --with-eccodes=/usr/local --with-fftw3=/usr/local --with-proj=yes
make -j4 && make install
cd ../
rm -rf cdo-2.1.1 cdo-2.1.1.tar.gz
# Ensure shared libraries are wired up
ldconfig
# Clean up
rm -rf /var/lib/apt/lists/*
unset DEBIAN_FRONTEND
%test
INSTALLED_VERSION=$(cdo -V | grep -oP '(?<=version )\d+\.\d+\.\d+') && \
if [ "$INSTALLED_VERSION" == "$CDO_VERSION" ]; then
echo "Expected CDO version $CDO_VERSION found."
else
echo "Expected CDO version $CDO_VERSION but found $INSTALLED_VERSION."
fi