-
Notifications
You must be signed in to change notification settings - Fork 21
/
update_from_upstream.sh
executable file
·38 lines (28 loc) · 1.7 KB
/
update_from_upstream.sh
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
#!/bin/bash
rm -rf src/*
cp -f submodules/DGGRID/src/apps/dggrid/{dggrid,util}.h ./src/
cp -f submodules/DGGRID/src/apps/dggrid/util.cpp ./src/
cp -f submodules/DGGRID/src/lib/dglib/include/dglib/* ./src/
cp -f submodules/DGGRID/src/lib/dglib/lib/* ./src/
cp -f submodules/DGGRID/src/lib/proj4lib/include/* ./src/
cp -f submodules/DGGRID/src/lib/proj4lib/lib/* ./src/
cp -f submodules/DGGRID/src/lib/shapelib/include/shapelib/* ./src/
cp -f submodules/DGGRID/src/lib/shapelib/lib/* ./src/
# Fix a header include
# TODO(r-barnes): Remove when this is fixed upstream https://github.com/sahrk/DGGRID/pull/52
find ./src/ -type f -exec sed -i -r 's/#include "dglib\/DgBase.h"/#include <dglib\/DgBase.h>/' {} \;
find ./src/ -type f -exec sed -i '1 i\#ifndef DGGRIDR\n#define DGGRIDR\n#endif' {} \;
find ./src/ -type f -exec sed -i -r 's/#include <dglib\/([^>]+)>/#include "\1"/' {} \;
find ./src/ -type f -exec sed -i -r 's/#include "..\/lib\//#include "/' {} \;
find ./src/ -type f -exec sed -i -r 's/#include <shapefil.h>/#include "shapefil.h"/' {} \;
find ./src/ -type f -exec sed -i -r 's/#include "shapelib\/shapefil.h"/#include "shapefil.h"/' {} \;
# Drop hpp file extensions because CRAN says "These are unlikely file names for
# src files" and CRAN would rather crush the souls of volunteer OSS developers
# than accept that hpp is a common and appropriate file extension for C++
# headers
find ./src/ -type f -name "*.hpp" -execdir rename 's/\.hpp/_hpp.h/' '{}' \;
find ./src/ -type f -exec sed -i -r 's/\.hpp/_hpp.h/' {} \;
# M_2PI variable because it's included in R and DGGRID doesn't use namespaces
find ./src/ -type f -exec sed -i -r 's/constexpr long double M_2PI.*//' {} \;
rm -rf src/Makefile.noCMake
cp copy_to_src/* ./src/