Index: palm/trunk/INSTALL/palm_installer_components
===================================================================
--- palm/trunk/INSTALL/palm_installer_components	(revision 3506)
+++ palm/trunk/INSTALL/palm_installer_components	(revision 3628)
@@ -25,4 +25,9 @@
 palm_installer_build() {
    printf "%s\n" "${program_name} installer is configuring using cmake..."
+   if [[ "$palm_installer_build_rrtmg" == "true" ]]; then
+      if [[ "$RRTMG_ROOT" == "" ]]; then
+         RRTMG_ROOT=${install_prefix}/rrtmg
+      fi
+   fi
    palm_installer_create_files
    rm -rf ${build_dir}
@@ -33,4 +38,5 @@
          ${NETCDF_C_ROOT:+-DNETCDF_C_ROOT=}${NETCDF_C_ROOT} \
          ${NETCDF_FORTRAN_ROOT:+-DNETCDF_FORTRAN_ROOT=}${NETCDF_FORTRAN_ROOT} \
+         ${RRTMG_ROOT:+-DRRTMG_ROOT=}${RRTMG_ROOT} \
          -DPALM_CORES=$NUM_PROC_BUILD \
          -DCMAKE_BUILD_TYPE=Release \
@@ -53,8 +59,41 @@
       palm_installer_abort_message
    fi
+   if [[ "$palm_installer_build_rrtmg" == "true" ]]; then
+       palm_installer_build_rrtmg
+   fi
    cd ${install_prefix}
    rm -rf ${source_dir}
    rm -rf MAKE_DEPOSITORY_parallel
    bash ${trunk_dir}/SCRIPTS/palmbuild -v -c "default"
+}
+
+palm_installer_build_rrtmg() {
+   printf "%s\n" "${program_name} installer is building the RRTMG library..."
+   local version="1.0"
+   local prog="librrtmg"
+   build_dir_rrtmg=${source_dir}/rrtmg
+   mkdir -p ${build_dir_rrtmg}
+   cp ${trunk_dir}/LIB/rrtmg/*.f90  ${build_dir_rrtmg}/
+   cp ${trunk_dir}/LIB/rrtmg/Makefile  ${build_dir_rrtmg}/
+   cd ${build_dir_rrtmg}
+   bash ${build_dir_rrtmg}/build_rrtmg
+   mkdir -p ${build_dir_rrtmg}/lib
+   mkdir -p ${build_dir_rrtmg}/include
+   cp ${build_dir_rrtmg}/$prog.so ${build_dir_rrtmg}/lib/$prog.so.$version
+   cp ${build_dir_rrtmg}/*.mod    ${build_dir_rrtmg}/include/
+   mkdir -p ${RRTMG_ROOT}/lib
+   mkdir -p ${RRTMG_ROOT}/include
+   cp ${build_dir_rrtmg}/lib/$prog.so.$version ${RRTMG_ROOT}/lib/
+   cp ${build_dir_rrtmg}/include/*.mod ${RRTMG_ROOT}/include/
+   if [ -f ${RRTMG_ROOT}/lib/$prog.so.1 ]
+   then
+       rm ${RRTMG_ROOT}/lib/$prog.so.1
+   fi
+   ln -s ${RRTMG_ROOT}/lib/$prog.so.$version ${RRTMG_ROOT}/lib/$prog.so.1
+   if [ -f ${RRTMG_ROOT}/lib/$prog.so ]
+   then
+       rm ${RRTMG_ROOT}/lib/$prog.so
+   fi
+   ln -s ${RRTMG_ROOT}/lib/$prog.so.1 ${RRTMG_ROOT}/lib/$prog.so
 }
 
@@ -186,4 +225,12 @@
 set(config \${CMAKE_INSTALL_PREFIX}/.palm.config.default)
 
+# palmtest.yml locations
+set(palmtest_in \${CMAKE_CURRENT_SOURCE_DIR}/.palmtest.yml.in)
+set(palmtest \${CMAKE_INSTALL_PREFIX}/palmtest.yml)
+
+# build_rrtmg locations
+set(build_rrtmg_in \${CMAKE_CURRENT_SOURCE_DIR}/build_rrtmg.in)
+set(build_rrtmg \${CMAKE_CURRENT_SOURCE_DIR}/rrtmg/build_rrtmg)
+
 # include local cmake files
 set(PALM_CMAKE_FILES \${CMAKE_CURRENT_SOURCE_DIR})
@@ -254,4 +301,6 @@
    set(PALM_COMPILER_OPTIONS "\${PALM_COMPILER_OPTIONS} -I \${NETCDF_INCLUDES}")
    set(PALM_LINKER_OPTIONS "\${PALM_LINKER_OPTIONS} \${NETCDF_LIBRARIES}")
+   set(PALMTEST_NETCDF_INCLUDES "netcdf: \"-I \${NETCDF_INCLUDES}\"")
+   set(PALMTEST_NETCDF_LIBRARIES "netcdf: \"\${NETCDF_LIBRARIES}\"")
 endif()
 
@@ -259,4 +308,11 @@
    set(PALM_COMPILER_OPTIONS "\${PALM_COMPILER_OPTIONS} -I \${FFTW_INCLUDES}")
    set(PALM_LINKER_OPTIONS "\${PALM_LINKER_OPTIONS} \${FFTW_LIBRARIES}")
+   set(PALMTEST_FFTW_INCLUDES "fftw: \"-I \${FFTW_INCLUDES}\"")
+   set(PALMTEST_FFTW_LIBRARIES "fftw: \"\${FFTW_LIBRARIES}\"")
+endif()
+
+if(RRTMG_ROOT)
+   set(PALMTEST_RRTMG_INCLUDES "rrtmg: \"-I \${RRTMG_ROOT}/include\"")
+   set(PALMTEST_RRTMG_LIBRARIES "rrtmg: \"\${RRTMG_ROOT}/lib/librrtmg.so\"")
 endif()
 
@@ -267,4 +323,11 @@
 configure_file(\${config_in} \${config} @ONLY)
 
+# configuring the palmtest.yml
+configure_file(\${palmtest_in} \${palmtest} @ONLY)
+
+if(RRTMG_ROOT)
+   # configuring the build_rrtmg
+   configure_file(\${build_rrtmg_in} \${build_rrtmg} @ONLY)
+endif()
 
 EOF
@@ -532,4 +595,35 @@
 
 EOF
+
+   cat > ${source_dir}/.palmtest.yml.in << EOF
+---
+# this is a palmtest environments file
+
+palm_config_template:
+
+environments:
+
+  @CMAKE_Fortran_COMPILER_ID@:
+    executable: @CMAKE_Fortran_COMPILER@
+    mpi_wrapper: @MPI_Fortran_COMPILER@
+    include:
+      @PALMTEST_NETCDF_INCLUDES@
+      @PALMTEST_FFTW_INCLUDES@
+      @PALMTEST_RRTMG_INCLUDES@
+    lib:
+      @PALMTEST_NETCDF_LIBRARIES@
+      @PALMTEST_FFTW_LIBRARIES@
+      @PALMTEST_RRTMG_LIBRARIES@
+
+EOF
+
+   cat > ${source_dir}/build_rrtmg.in << EOF
+#!/usr/bin/env bash
+
+make -f Makefile F90=@MPI_Fortran_COMPILER@  PROG=librrtmg F90FLAGS="@PALM_COMPILER_OPTIONS@"
+
+EOF
+
+
 }
 
