Commit 4cedf03ba0fdda1ec41f7742572d8c9f13fc959f

Authored by Benjamin Renard
1 parent 235044f0

Update script used to compile and install DDServer

CMakeLists.txt
... ... @@ -20,6 +20,12 @@ else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
20 20 set(USRLIB_DIR "/usr/lib/:/usr/local/lib/")
21 21 endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
22 22  
  23 +set (USERLOCAL_ROOT "/usr/local/lib/")
  24 +if (EXISTS "$ENV{USERLOCAL_ROOT}")
  25 + set(USERLOCAL_ROOT "$ENV{USERLOCAL_ROOT}")
  26 + message("USERLOCAL_ROOT forced to ${USERLOCAL_ROOT}")
  27 +endif()
  28 +
23 29 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
24 30  
25 31 find_package( Threads REQUIRED )
... ... @@ -31,11 +37,10 @@ find_package( LibXML2 REQUIRED )
31 37  
32 38 get_filename_component(NETCDFLIB_DIR ${NETCDFLIBRARIES} PATH)
33 39 get_filename_component(DDCLIENTLIB_DIR ${DDCLIENTLIBRARIES} PATH)
34   -
35 40 set(DDSERVICE_URL $ENV{DDSERVICE_URL})
36 41 set(DDRESPATH $ENV{DDRESPATH})
37   -set(DDBASEDATA $ENV{DDBASEDATA})
38   -set(DDBASEINFO $ENV{DDBASEINFO})
  42 +set(DDBASEDATA "$ENV{DDBASEPATH}/DATA")
  43 +set(DDBASEINFO "$ENV{DDBASEPATH}/INFO")
39 44 set(PROXY_HOST $ENV{PROXY_HOST})
40 45 set(PROXY_USERPWD $ENV{PROXY_USERPWD})
41 46  
... ...
README deleted
... ... @@ -1,23 +0,0 @@
1   -1. Set NETCDF_ROOT to use a specific netcdf installation directory :
2   -> export NETCDF_ROOT="/usr/lib/"
3   -
4   -2. Set DDCLIENT_ROOT to define DDClient installation directory :
5   -> export DDCLIENT_ROOT="/home/benjamin/DDClient/"
6   -
7   -3. Make the build directory :
8   -> cmake -E make_directory build
9   -
10   -4. Configure the build. Set CMAKE_BUILD_TYPE to Debug or Release to configure the build type. Set CMAKE_INSTALL_PREFIX to configure the install directory :
11   -> cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/benjamin/DDServer ..
12   -
13   -5. Build DDServer :
14   -> cmake --build build
15   -
16   -6. Install DDServer :
17   -> make -C build install VERBOSE=1
18   -
19   -7. Configure DDServer :
20   -In the install directory, open "StartServer" and set DDPATH and DDBASE.
21   -
22   -8. Run DDServer:
23   -> ./StartServer
README.md 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +# DDServer #
  2 +
  3 +## Compilation and installation ##
  4 +
  5 +Script `compilAndInstall.sh` is dedicated to the compilation and the installation of DDServer.
  6 +
  7 +This script use these following arguments:
  8 +
  9 +* -d (required) : Destination folder in which DDServer will be deployed,
  10 +* -u (required) : DDService entry point,
  11 +* -r (required) : Path to the folder that contains the DD.res file,
  12 +* -b (required) : Path to the DDBASE folder,
  13 +* -l (optional) : Path to the user local directory. By default it's `/usr/local`. DDServer dependencies (netCDF lib., CDF lib., DDClient lib. and libxml2) will be search in this folder during the compilation.
  14 +* -h (optional) : Proxy host and port, write in the following pattern: `proxy_host:proxy_port`. To define only if DDServer is installed behind a proxy,
  15 +* -p (optional) : Proxy user name and password, used to authenticate the user to the proxy, write in the following pattern: `proxy_user_name:proxy_user_password`. To define only if DDServer is installed behind a proxy.
0 16 \ No newline at end of file
... ...
cmake/modules/FindCDF.cmake
... ... @@ -5,8 +5,8 @@
5 5 # libcdf_INCLUDE_DIR - the libcdf include directory
6 6 # libcdf_LIBRARIES - the libcdf library directory
7 7  
8   -FIND_PATH(libcdf_INCLUDE_DIR cdf.h PATHS /include /usr/include /usr/local/include /usr/local/cdf/include ${USERLOCAL_ROOT}/include /opt/local/include )
9   -FIND_LIBRARY(libcdf_LIBRARIES NAMES cdf PATHS /lib /usr/lib /usr/local/lib /usr/local/cdf/lib ${USERLOCAL_ROOT}/lib /opt/local/lib)
  8 +FIND_PATH(libcdf_INCLUDE_DIR cdf.h PATHS ${USERLOCAL_ROOT}/include)
  9 +FIND_LIBRARY(libcdf_LIBRARIES NAMES cdf PATHS ${USERLOCAL_ROOT}/lib NO_DEFAULT_PATH)
10 10  
11 11 # set FOUND flag
12 12 IF(libcdf_INCLUDE_DIR AND libcdf_LIBRARIES)
... ...
cmake/modules/FindDDClient.cmake
1 1 FIND_PATH(DDCLIENTINCLUDE_DIR DD.h
2 2 HINTS
3   - $ENV{DDCLIENT_ROOT}/include/DDClientLibC
4   - ${DDCLIENT_ROOT}/include/DDClientLibC
  3 + ${USERLOCAL_ROOT}/include/DDClientLibC
5 4 )
6 5 mark_as_advanced(DDCLIENTINCLUDE_DIR)
7 6  
8 7 find_library(DDCLIENTLIBRARY
9 8 NAMES DDClientLibC
10 9 HINTS
11   - $ENV{DDCLIENT_ROOT}
12   - ${DDCLIENT_ROOT}
13   - PATH_SUFFIXES lib
  10 + ${USERLOCAL_ROOT}/lib
  11 + NO_DEFAULT_PATH
14 12 )
15 13 mark_as_advanced(DDCLIENTLIBRARY)
16 14  
... ...
cmake/modules/FindLibXML2.cmake
... ... @@ -5,9 +5,9 @@
5 5 # LIBXML2_LIBRARIES - The libraries needed to use LibXml2
6 6 # LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
7 7  
8   -FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xinclude.h PATHS /usr/include/libxml2 ${USERLOCAL_ROOT}/include/libxml2 /opt/local/include/libxml2)
  8 +FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xinclude.h PATHS ${USERLOCAL_ROOT}/include/libxml2)
9 9  
10   -FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 PATHS /usr/lib64 ${USERLOCAL_ROOT}/lib /opt/local/lib NO_DEFAULT_PATH)
  10 +FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 PATHS ${USERLOCAL_ROOT}/lib NO_DEFAULT_PATH)
11 11  
12 12 IF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
13 13 SET(LibXML2_FOUND 1)
... ...
cmake/modules/FindNetCDF.cmake
1 1 FIND_PATH(NETCDFINCLUDE_DIR netcdf.h
2 2 HINTS
3   - $ENV{NETCDF_ROOT}/include
4   - ${NETCDF_ROOT}/include
  3 + ${USERLOCAL_ROOT}/include
5 4 )
6 5 mark_as_advanced(NETCDFINCLUDE_DIR)
7 6  
8 7 find_library(NETCDFLIBRARY
9 8 NAMES netcdf
10 9 HINTS
11   - $ENV{NETCDF_ROOT}
12   - ${NETCDF_ROOT}
13   - PATH_SUFFIXES lib
  10 + ${USERLOCAL_ROOT}/lib
  11 + NO_DEFAULT_PATH
14 12 )
15 13 mark_as_advanced(NETCDFLIBRARY)
16 14  
... ...
compil.sh deleted
... ... @@ -1,32 +0,0 @@
1   -#!/bin/sh
2   -
3   -export INSTALL_DIR="/opt/local"
4   -export DDSERVICE_URL="http://amdadev.fr/DDService"
5   -export DDRESPATH="/var/amda-data/"
6   -export DDBASEDATA="/home/budnik/AMDA-NG.core/DDBASE/DATA"
7   -export DDBASEINFO="/home/budnik/AMDA-NG.core/DDBASE/INFO"
8   -#export PROXY_HOST=""
9   -#export PROXY_USERPWD=""
10   -
11   -echo "Install dir. : ${INSTALL_DIR}"
12   -echo "DDService Url : ${DDSERVICE_URL}"
13   -echo "DD.res path : ${DDRESPATH}"
14   -echo "DDBASE DATA path : ${DDBASEDATA}"
15   -echo "DDBASE INFO path : ${DDBASEINFO}"
16   -if [ -n "$PROXY_HOST" ]
17   -then
18   - echo "Proxy host : ${PROXY_HOST}"
19   -fi
20   -if [ -n "$PROXY_USERPWD" ]
21   -then
22   - echo "Proxy user/pwd : ${PROXY_USERPWD}"
23   -fi
24   -read -p "Press any key to continue..."
25   -
26   -export NETCDF_ROOT=$INSTALL_DIR
27   -export DDCLIENT_ROOT=$INSTALL_DIR
28   -
29   -cmake -E make_directory build
30   -cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ..
31   -cmake --build build
32   -sudo make -C build install VERBOSE=1
compilAndInstall.sh 0 → 100755
... ... @@ -0,0 +1,78 @@
  1 +#!/bin/sh
  2 +
  3 +usage="
  4 + \n ### Install ddserver###
  5 + \n
  6 + \n Usage : $0 -d <Destination path> -u <DDService URL> -r <DD.res directory path> -b <DDBASE path> [-l <User local directory. By default, it's /usr/local>] [-p <Proxy host:port>] [-a <Proxy user name:password for authentication>]
  7 + \n
  8 + \n $0 -d /opt/tools/DDServer -u http://amdadev.fr/DDService -r /var/amda-data/ -b /var/amda-data/DDBASE -l /opt/local -h 'myproxy.fr:9090' -p 'username:userpwd'
  9 + \n
  10 + \n
  11 + \n ###"
  12 +
  13 +USERLOCAL_ROOT='/usr/lib'
  14 +
  15 +while getopts "d:u:r:b:l:p:a:h" options; do
  16 + case $options in
  17 + d ) INSTALL_DIR=`echo $OPTARG`;;
  18 + u ) DDSERVICE_URL=`echo $OPTARG`;;
  19 + r ) DDRESPATH=`echo $OPTARG`;;
  20 + b ) DDBASEPATH=`echo $OPTARG`;;
  21 + l ) USERLOCAL_ROOT=`echo $OPTARG`;;
  22 + p ) PROXY_HOST=`echo $OPTARG`;;
  23 + a ) PROXY_USERPWD=`echo $OPTARG`;;
  24 + h ) echo -e $usage
  25 + exit 1;;
  26 + \? ) echo -e $usage
  27 + exit 1;;
  28 + * ) echo -e $usage
  29 + exit 1;;
  30 + esac
  31 +done
  32 +
  33 +if [ "$INSTALL_DIR" = "" ]
  34 +then
  35 + echo "[ERROR] Missing INSTALL_DIR definition"
  36 + echo -e $usage
  37 + exit 1
  38 +fi
  39 +
  40 +if [ "$DDSERVICE_URL" = "" ]
  41 +then
  42 + echo "[ERROR] Missing DDSERVICE_URL definition"
  43 + echo -e $usage
  44 + exit 1
  45 +fi
  46 +
  47 +if [ "$DDBASEPATH" = "" ]
  48 +then
  49 + echo "[ERROR] Missing DDBASE definition"
  50 + echo -e $usage
  51 + exit 1
  52 +fi
  53 +
  54 +if [ "$DDRESPATH" = "" ]
  55 +then
  56 + echo "[ERROR] Missing DDBASE definition"
  57 + echo -e $usage
  58 + exit 1
  59 +fi
  60 +
  61 +export INSTALL_DIR DDSERVICE_URL DDRESPATH DDBASEPATH USERLOCAL_ROOT PROXY_HOST PROXY_USERPWD
  62 +
  63 +cmake -E make_directory build
  64 +if [[ $? != 0 ]]; then exit 1; fi
  65 +
  66 +cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ..
  67 +if [[ $? != 0 ]]; then exit 1; fi
  68 +
  69 +cmake --build build
  70 +if [[ $? != 0 ]]; then exit 1; fi
  71 +
  72 +sudo make -C build install VERBOSE=1
  73 +if [[ $? != 0 ]]; then exit 1; fi
  74 +
  75 +# Post install
  76 +sudo ln -s ${DDBASEPATH} ${INSTALL_DIR}/DDService/BASE
  77 +
  78 +exit 0
... ...