aboutsummaryrefslogtreecommitdiff
path: root/travis/install.sh
blob: 2363be43398035ec4827680224cdedc44380afa7 (plain)
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
#!/bin/bash

set -e

UNAME="$(uname)" || UNAME=""
if test "${UNAME}" = "Linux" ; then
    NPROC=$(nproc);
elif test "${UNAME}" = "Darwin" ; then
    NPROC=$(sysctl -n hw.ncpu);
fi
if test "x${NPROC}" = "x"; then
    NPROC=2;
fi
echo "NPROC=${NPROC}"

# Download grid files
wget https://download.osgeo.org/proj/proj-datumgrid-1.8.zip

# prepare build files
./autogen.sh
TOP_DIR=$PWD

# autoconf build
mkdir build_autoconf
cd build_autoconf
../configure
make dist-all
# Check consistency of generated tarball
TAR_FILENAME=`ls *.tar.gz`
TAR_DIRECTORY=`basename $TAR_FILENAME .tar.gz`
tar xvzf $TAR_FILENAME
cd $TAR_DIRECTORY

# autoconf build from generated tarball
mkdir build_autoconf
cd build_autoconf
if [ -f /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h ]; then
    CXXFLAGS="-I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux $CXXFLAGS" ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all --with-jni
else
    ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all
fi

make -j${NPROC}

if [ "$(uname)" == "Linux" -a -f src/.libs/libproj.so ]; then
    echo "Checking exported symbols..."
    ${TOP_DIR}/scripts/dump_exported_symbols.sh src/.libs/libproj.so > /tmp/got_symbols.txt
    diff -u ${TOP_DIR}/scripts/reference_exported_symbols.txt /tmp/got_symbols.txt || (echo "Difference(s) found in exported symbols. If intended, refresh scripts/reference_exported_symbols.txt with 'scripts/dump_exported_symbols.sh src/.libs/libproj.so > scripts/reference_exported_symbols.txt'"; exit 1)
fi

make check
make install
find /tmp/proj_autoconf_install_from_dist_all

/tmp/proj_autoconf_install_from_dist_all/bin/projinfo EPSG:32631 -o PROJJSON -q > out.json
cat out.json
echo "Validating JSON"
jsonschema -i out.json /tmp/proj_autoconf_install_from_dist_all/share/proj/projjson.schema.json && echo "Valid !"

/tmp/proj_autoconf_install_from_dist_all/bin/projinfo EPSG:4326+3855 -o PROJJSON -q > out.json
cat out.json
echo "Validating JSON"
jsonschema -i out.json /tmp/proj_autoconf_install_from_dist_all/share/proj/projjson.schema.json && echo "Valid !"

/tmp/proj_autoconf_install_from_dist_all/bin/projinfo "+proj=longlat +ellps=GRS80 +nadgrids=@foo +type=crs" -o PROJJSON -q > out.json
cat out.json
echo "Validating JSON"
jsonschema -i out.json /tmp/proj_autoconf_install_from_dist_all/share/proj/projjson.schema.json && echo "Valid !"
/tmp/proj_autoconf_install_from_dist_all/bin/projinfo @out.json -o PROJJSON -q > out2.json
diff -u out.json out2.json

/tmp/proj_autoconf_install_from_dist_all/bin/projinfo -s EPSG:3111 -t GDA2020 -o PROJJSON -o PROJJSON -q > out.json
cat out.json
echo "Validating JSON"
jsonschema -i out.json /tmp/proj_autoconf_install_from_dist_all/share/proj/projjson.schema.json && echo "Valid !"
/tmp/proj_autoconf_install_from_dist_all/bin/projinfo @out.json -o PROJJSON -q > out2.json
diff -u out.json out2.json

cd ..

# cmake build from generated tarball
mkdir build_cmake
cd build_cmake
cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/proj_cmake_install
VERBOSE=1 make -j${NPROC}
make install
ctest
find /tmp/proj_cmake_install
cd ..

# return to root
cd ../..

# Install grid files
(cd data && unzip -o ../proj-datumgrid-1.8.zip)

# autoconf build with grids
mkdir build_autoconf_grids
cd build_autoconf_grids
../configure --prefix=/tmp/proj_autoconf_install_grids
make -j${NPROC}
make check
(cd src && make multistresstest && make test228)
PROJ_LIB=../data src/multistresstest
make install
find /tmp/proj_autoconf_install_grids
cd ..

# There's an issue with the clang on Travis + coverage + cpp code
if [ "$BUILD_NAME" != "linux_clang" ]; then
    # autoconf build with grids and coverage
    if [ $TRAVIS_OS_NAME == "osx" ]; then
        CFLAGS="--coverage" CXXFLAGS="--coverage" ./configure;
    else
        CFLAGS="$CFLAGS --coverage" CXXFLAGS="$CXXCFLAGS --coverage" LDFLAGS="$LDFLAGS -lgcov" ./configure;
    fi
else
    ./configure
fi
make -j${NPROC}
make check

# Rerun tests without grids not included in proj-datumgrid
rm -v data/egm96_15.gtx
make check

if [ "$BUILD_NAME" != "linux_clang" ]; then
    mv src/.libs/*.gc* src
    mv src/conversions/.libs/*.gc* src/conversions
    mv src/iso19111/.libs/*.gc* src/iso19111
    mv src/projections/.libs/*.gc* src/projections
    mv src/transformations/.libs/*.gc* src/transformations
fi