CMake builds now install GMXRC* files.
authorRossen Apostolov <rossen@cbr.su.se>
Wed, 11 Aug 2010 11:38:04 +0000 (13:38 +0200)
committerRossen Apostolov <rossen@cbr.su.se>
Wed, 11 Aug 2010 11:38:04 +0000 (13:38 +0200)
CMakeLists.txt
scripts/CMakeLists.txt [new file with mode: 0644]
scripts/GMXRC.bash.cmakein [new file with mode: 0644]
scripts/GMXRC.cmakein [new file with mode: 0644]
scripts/GMXRC.csh.cmakein [new file with mode: 0644]
scripts/GMXRC.csh.in [changed mode: 0755->0644]
scripts/GMXRC.zsh.cmakein [new file with mode: 0644]
scripts/GMXRC.zsh.in [changed mode: 0755->0644]

index c9b2af63b397698133b0ba3da6cbe0d8e77fe5b7..f1a0dd703fb093bd3bd00e36b9e7ab5b92419520 100644 (file)
@@ -610,8 +610,8 @@ set(GMXLIBDIR        ${DATA_INSTALL_DIR}/top)
 add_subdirectory(share)
 add_subdirectory(include)
 add_subdirectory(man)
-
 add_subdirectory(src)
+add_subdirectory(scripts)
 
 #######################
 ## uninstall target
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ff61180
--- /dev/null
@@ -0,0 +1,14 @@
+configure_file(GMXRC.cmakein GMXRC @ONLY)
+configure_file(GMXRC.bash.cmakein GMXRC.bash @ONLY)
+configure_file(GMXRC.csh.cmakein GMXRC.csh @ONLY)
+configure_file(GMXRC.zsh.cmakein GMXRC.zsh @ONLY)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GMXRC DESTINATION ${BIN_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.bash DESTINATION ${BIN_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh DESTINATION ${BIN_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh DESTINATION ${BIN_INSTALL_DIR})
+
+file(GLOB EXTRA_SCRIPTS completion.* demux.pl xplor2gmx.pl)
+install(FILES ${EXTRA_SCRIPTS} DESTINATION ${BIN_INSTALL_DIR})
+
+
diff --git a/scripts/GMXRC.bash.cmakein b/scripts/GMXRC.bash.cmakein
new file mode 100644 (file)
index 0000000..293530b
--- /dev/null
@@ -0,0 +1,72 @@
+# zsh configuration file for Gromacs
+# First we remove old gromacs stuff from the paths
+# by selecting everything else.
+# This is not 100% necessary, but very useful when we
+# repeatedly switch between gmx versions in a shell.
+
+# First remove gromacs part of ld_library_path
+tmppath=""
+for i in `echo $LD_LIBRARY_PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXLDLIB"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+LD_LIBRARY_PATH=$tmppath
+
+# remove gromacs part of PKG_CONFIG_PATH
+tmppath=""
+for i in `echo $PKG_CONFIG_PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXLDLIB/pkgconfig"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+PKG_CONFIG_PATH=$tmppath
+
+# remove gromacs part of path
+tmppath=""
+for i in `echo $PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXBIN"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+PATH=$tmppath
+
+# and remove the gmx part of manpath
+tmppath=""
+for i in `echo $MANPATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXMAN"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+MANPATH=$tmppath
+
+##########################################################
+# This is the real configuration part. We save the Gromacs
+# things in separate vars, so we can remove them later.
+# If you move gromacs, change the next four line.
+##########################################################
+GMXBIN=@BIN_INSTALL_DIR@
+GMXLDLIB=@LIB_INSTALL_DIR@
+GMXMAN=@MAN_INSTALL_DIR@
+GMXDATA=@DATA_INSTALL_DIR@
+       
+# NB: The variables already begin with ':' now, or are empty
+LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH}
+PKG_CONFIG_PATH=${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH}
+PATH=${GMXBIN}${PATH}
+MANPATH=${GMXMAN}${MANPATH}
+
+# export should be separate, so /bin/sh understands it
+export GMXBIN GMXLDLIB GMXMAN GMXDATA LD_LIBRARY_PATH PATH MANPATH PKG_CONFIG_PATH
+
+# read bash completions if understand how to use them
+# and this shell supports extended globbing
+if (complete) > /dev/null 2>&1; then
+  if (shopt -s extglob) > /dev/null 2>&1; then
+    if [ -f $GMXBIN/completion.bash ]; then
+      source $GMXBIN/completion.bash; 
+    fi
+  fi
+fi
+
+
diff --git a/scripts/GMXRC.cmakein b/scripts/GMXRC.cmakein
new file mode 100644 (file)
index 0000000..de457e2
--- /dev/null
@@ -0,0 +1,63 @@
+# This is a convenience script to determine which
+# type of shell you have, and then run GMXRC.[csh|bash|zsh]
+# from the Gromacs binary directory.
+#
+# If you only use one shell you can copy that GMXRC.* instead.
+
+
+# only csh/tcsh understand 'set'
+set is_csh = 123
+test "$is_csh" = 123 && goto CSH
+
+# if we got here, shell is bsh/bash/zsh/ksh
+# bsh cannot remove part of a variable with %%
+shtst="A.B"
+if [ "`(echo ${shtst%%.*}) 2>/dev/null`" = A ]; then
+
+  # shell is bash/zsh/ksh
+  # bash/zsh use $[...] for arithmetic evaluation, ksh doesn't
+  if [ "`echo $[0+1]`" = 1 ]; then
+    
+    # shell is zsh/bash
+    # zsh can test if the variable shtst is set with ${+shtst}
+    if [ "`(echo ${+shtst}) 2>/dev/null`" = 1 ]; then
+      # shell is zsh
+      source @BIN_INSTALL_DIR@/GMXRC.zsh
+    else  
+      # shell is bash
+      source @BIN_INSTALL_DIR@/GMXRC.bash      
+    fi
+
+  else    
+    # shell is ksh - use bash setup, completions won't be read.
+     . @BIN_INSTALL_DIR@/GMXRC.bash
+  fi
+  return
+else
+  # shell is bsh - use bash setup, completions won't be read.
+  . @BIN_INSTALL_DIR@/GMXRC.bash
+  exit
+fi
+
+# csh/tcsh jump here
+
+CSH:
+source @BIN_INSTALL_DIR@/GMXRC.csh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/GMXRC.csh.cmakein b/scripts/GMXRC.csh.cmakein
new file mode 100644 (file)
index 0000000..ff9eba8
--- /dev/null
@@ -0,0 +1,73 @@
+# csh/tcsh configuration file for Gromacs.
+# First we remove previous Gromacs stuff from paths 
+# by selecting everything else. 
+# Removal is not 100% necessary, but very useful when we
+# repeatedly switch between gmx versions in a shell.
+
+# zero possibly unset vars to avoid warnings
+if (! $?LD_LIBRARY_PATH) setenv LD_LIBRARY_PATH ""
+if (! $?PKG_CONFIG_PATH) setenv PKG_CONFIG_PATH ""
+if (! $?PATH) setenv PATH ""
+if (! $?MANPATH) setenv MANPATH ""
+if (! $?GMXLDLIB) setenv GMXLDLIB ""
+if (! $?GMXBIN) setenv GMXBIN ""
+if (! $?GMXMAN) setenv GMXMAN ""
+
+# remove previous gromacs part from ld_library_path
+set tmppath = ""
+foreach i ( `echo $LD_LIBRARY_PATH | sed "s/:/ /g"` )
+  if ( "$i" != "$GMXLDLIB" ) set tmppath = "${tmppath}:$i"
+end
+setenv LD_LIBRARY_PATH $tmppath
+
+# remove previous gromacs part from PKG_CONFIG_PATH
+set tmppath = ""
+foreach i ( `echo $PKG_CONFIG_PATH | sed "s/:/ /g"` )
+  if ( "$i" != "$GMXLDLIB/pkgconfig" ) set tmppath = "${tmppath}:$i"
+end
+setenv PKG_CONFIG_PATH $tmppath
+
+# remove gromacs stuff from binary path
+set tmppath = ""
+foreach i ( `echo $PATH | sed "s/:/ /g"` )
+  if ( "$i" != "$GMXBIN" ) set tmppath = "${tmppath}:$i"
+end
+setenv PATH $tmppath
+
+# and remove stuff from manual path
+set tmppath = ""
+foreach i ( `echo $MANPATH | sed "s/:/ /g"` )
+  if ( "$i" != "$GMXMAN" ) set tmppath = "${tmppath}:$i"
+end
+setenv MANPATH $tmppath
+
+##########################################################
+# This is the real configuration part. We save the Gromacs
+# things in separate vars, so we can remove them later.
+# If you move gromacs, change the next four line.
+##########################################################
+setenv GMXBIN @BIN_INSTALL_DIR@
+setenv GMXLDLIB @LIB_INSTALL_DIR@
+setenv GMXMAN @MAN_INSTALL_DIR@
+setenv GMXDATA @DATA_INSTALL_DIR@
+
+# old variables begin with ':' now, or are empty.
+setenv PATH ${GMXBIN}${PATH}
+setenv LD_LIBRARY_PATH ${GMXLDLIB}${LD_LIBRARY_PATH}
+setenv PKG_CONFIG_PATH ${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH}
+setenv MANPATH ${GMXMAN}${MANPATH}
+
+setenv GMXFONT 10x20
+
+# Read completions if we understand it (i.e. have tcsh)
+if { complete >& /dev/null } then
+  if ( -f $GMXBIN/completion.csh ) source $GMXBIN/completion.csh
+endif
+
+
+
+
+
+
+
+
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/scripts/GMXRC.zsh.cmakein b/scripts/GMXRC.zsh.cmakein
new file mode 100644 (file)
index 0000000..fef4084
--- /dev/null
@@ -0,0 +1,65 @@
+# zsh configuration file for Gromacs
+# First we remove old gromacs stuff from the paths
+# by selecting everything else.
+# This is not 100% necessary, but very useful when we
+# repeatedly switch between gmx versions in a shell.
+
+# First remove gromacs part of ld_library_path
+tmppath=""
+for i in `echo $LD_LIBRARY_PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXLDLIB"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+LD_LIBRARY_PATH=$tmppath
+
+# First remove gromacs part of PKG_CONFIG_PATH
+tmppath=""
+for i in `echo $PKG_CONFIG_PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXLDLIB/pkgconfig"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+PKG_CONFIG_PATH=$tmppath
+
+# remove gromacs part of path
+tmppath=""
+for i in `echo $PATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXBIN"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+PATH=$tmppath
+
+# and remove the gmx part of manpath
+tmppath=""
+for i in `echo $MANPATH | sed "s/:/ /g"`; do
+  if test "$i" != "$GMXMAN"; then
+    tmppath=${tmppath}:$i
+  fi
+done
+MANPATH=$tmppath
+
+##########################################################
+# This is the real configuration part. We save the Gromacs
+# things in separate vars, so we can remove them later.
+# If you move gromacs, change the next four line.
+##########################################################
+export GMXBIN=@BIN_INSTALL_DIR@
+export GMXLDLIB=@LIB_INSTALL_DIR@
+export GMXMAN=@MAN_INSTALL_DIR@
+export GMXDATA=@DATA_INSTALL_DIR@
+       
+# NB: The variables already begin with ':' now, or are empty
+export LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH}
+export PKG_CONFIG_PATH=${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH}
+export PATH=${GMXBIN}${PATH}
+export MANPATH=${GMXMAN}${MANPATH}
+
+# read zsh completions if understand how to use them
+if compctl >& /dev/null; then
+  if [ -f $GMXBIN/completion.zsh ]; then
+    source $GMXBIN/completion.zsh; 
+  fi
+fi
+
old mode 100755 (executable)
new mode 100644 (file)