diff options
| author | stainer_t <thomas.stainer@oecd-nea.org> | 2025-09-08 13:48:49 +0200 |
|---|---|---|
| committer | stainer_t <thomas.stainer@oecd-nea.org> | 2025-09-08 13:48:49 +0200 |
| commit | 7dfcc480ba1e19bd3232349fc733caef94034292 (patch) | |
| tree | 03ee104eb8846d5cc1a981d267687a729185d3f3 /script | |
Initial commit from Polytechnique Montreal
Diffstat (limited to 'script')
| -rwxr-xr-x | script/find_pylib.py | 11 | ||||
| -rwxr-xr-x | script/install | 579 | ||||
| -rwxr-xr-x | script/instver5.bat | 122 | ||||
| -rwxr-xr-x | script/make_depend.py | 57 | ||||
| -rwxr-xr-x | script/make_depend_py3.py | 58 | ||||
| -rwxr-xr-x | script/post-commit | 54 | ||||
| -rwxr-xr-x | script/pre-commit | 46 | ||||
| -rwxr-xr-x | script/set_pythonpath.py | 26 |
8 files changed, 953 insertions, 0 deletions
diff --git a/script/find_pylib.py b/script/find_pylib.py new file mode 100755 index 0000000..3cb8420 --- /dev/null +++ b/script/find_pylib.py @@ -0,0 +1,11 @@ +#!/bin/env python3 +""" generation of pylib variable for use in Makefiles """ + +from sysconfig import get_config_var +pylib = get_config_var("LIBDIR") +if pylib.find('lib64') >= 0: + print('lib64') +elif pylib.find('lib') >= 0: + print('lib') +else: + raise RuntimeError("find_pylib: doesn't contains lib substring") diff --git a/script/install b/script/install new file mode 100755 index 0000000..47dde47 --- /dev/null +++ b/script/install @@ -0,0 +1,579 @@ +#!/bin/sh +# +# author : R. Roy (00-03-24) +# update : E. Varin (02-06-20) +# update : A. Hebert (06-06-12) +# use : install [<compiler>] [-debug] +# note : please install ganlib and utilib before dragon/donjon +# + +idebug=0 +mpi=0 +nbit=-m64 +optim=1 +compiler='custom' +FoptCPP='' + +for param in $* +do + case $param in + -debug) echo "Activate the debug environment variable" + idebug=1 + ;; + -m32) echo "Compile in 32 bits" + nbit=-m32 + ;; + -mpi) echo "Activate mpi" + mpi=1 + FoptCPP="-DMPI" + ;; + -noopt) echo "Avoid -O optimization flag" + optim=0 + ;; + *) compiler=$param + ;; + esac +done + +LocDir=`pwd` +Code=`basename "$LocDir"` +# +# Obtain system type: +# +System=`uname -s` +Sysx="`echo $System | cut -b -6`" +MACH=`uname -sm | sed 's/[ ]/_/'` +if [ $Sysx = "CYGWIN" ]; then + System=`uname -o` + MACH=$System +elif [ $Sysx = "AIX" ]; then + MACH=`uname -s` +fi +echo "System :" $System " MACH :" $MACH +if [ $System != "HP-UX" \ + -a $System != "AIX" \ + -a $System != "Darwin" \ + -a $System != "SunOS" \ + -a $System != "Linux" \ + -a $System != "Cygwin" ]; then + echo "Only Cygwin, Linux, AIX, Darwin, HP-UX and SunOS are allowed." + exit 1 +fi +echo 'Configure' $Code 'on ' $MACH 'with' $compiler 'compiler' + +HomeDev=`pwd`/.. +if [ $compiler = "custom" ]; then + if [ $System = "AIX" ]; then + PATH=$PATH:/usr/vac/bin; export PATH + TMPDIR=/usr/tmp; export TMPDIR + elif [ $System = "SunOS" ]; then + PATH=$PATH:/lib; export PATH + fi + LocLib=${LocDir}/lib/"$MACH" + LocBin=${LocDir}/bin/"$MACH" + LocGanLib=$HomeDev/Ganlib/lib/"$MACH" + LocUtiLib=$HomeDev/Utilib/lib/"$MACH" + LocDrgLib=$HomeDev/Dragon/lib/"$MACH" + LocTriLib=$HomeDev/Trivac/lib/"$MACH" + LocDonLib=$HomeDev/Donjon/lib/"$MACH" + LocSkinLib=$HomeDev/Skin++/lib/"$MACH" +else + if [ $System = "Linux" -a $compiler = 'absoft' ]; then + . /usr/local/absoft/bin/absoft.sh + fi + LocLib=${LocDir}/lib/"$MACH"'_'$compiler + LocBin=${LocDir}/bin/"$MACH"'_'$compiler + LocGanLib=$HomeDev/Ganlib/lib/"$MACH"'_'$compiler + LocUtiLib=$HomeDev/Utilib/lib/"$MACH"'_'$compiler + LocDrgLib=$HomeDev/Dragon/lib/"$MACH"'_'$compiler + LocTriLib=$HomeDev/Trivac/lib/"$MACH"'_'$compiler + LocDonLib=$HomeDev/Donjon/lib/"$MACH"'_'$compiler + LocSkinLib=$HomeDev/Skin++/lib/"$MACH"'_'$compiler +fi +# +# Set compiler name +# +TOOLF="f77" # Fortran 77 compiler +TOOLC="cc" # ANSI C compiler +# +# Set code name +# +Library=lib$Code.a +Lnolib=`echo $Code | tr "[:lower:]" "[:upper:]"`.f +Lnoobj=`echo $Code | tr "[:lower:]" "[:upper:]"`.o +echo '--------------------' +echo '--> Install' $Code +echo '--------------------' +echo 'Library =' $Library +# +# Make directories ./bin ./lib ./bin/"$MACH" and ./lib/"$MACH" if necessary +# +if [ $Code != "Utilib" ]; then +if [ ! -d bin ]; then + mkdir bin + chmod 755 bin + mkdir "$LocBin" + chmod 755 "$LocBin" +else + if [ ! -d "$LocBin" ]; then + mkdir "$LocBin" + chmod 755 "$LocBin" + else + if [ -f "$LocBin"/$Code ]; then + /bin/rm "$LocBin"/$Code + fi + fi +fi +fi +if [ ! -d lib ]; then + mkdir lib + chmod 755 lib + mkdir "$LocLib" + chmod 755 "$LocLib" +else + if [ ! -d "$LocLib" ]; then + mkdir "$LocLib" + chmod 755 "$LocLib" + else + if [ -f "$LocLib"/$Library ]; then + /bin/rm "$LocLib"/$Library + fi + fi +fi +if [ $Code = "Trivac" ]; then + echo "Installing Trivac" + if [ ! -f "$LocUtiLib"/libUtilib.a ]; then + echo "Please install Utilib first" + exit 1 + fi + if [ ! -f "$LocGanLib"/libGanlib.a ]; then + echo "Please install Ganlib first" + exit 1 + fi +elif [ $Code = "Dragon" ]; then + echo "Installing Dragon" + if [ ! -f "$LocTriLib"/libTrivac.a ]; then + echo "Please install Trivac first" + exit 1 + fi + if [ -d "$LocLib"/modules ]; then + /bin/rm "$LocLib"/modules/* + else + mkdir "$LocLib"/modules + chmod 755 "$LocLib"/modules + fi +elif [ $Code = "Donjon" ]; then + echo "Installing Donjon" + if [ ! -f "$LocDrgLib"/libDragon.a ]; then + echo "Please install Dragon first" + exit 1 + fi +elif [ $Code = "Optex" ]; then + echo "Installing Optex" + if [ ! -f "$LocDonLib"/libDonjon.a ]; then + echo "Please install Donjon first" + exit 1 + fi +elif [ $Code = "Skin++" ]; then + echo "Installing Skin++" + Lnolib=`echo $Code.cxx` + Lnoobj=`echo $Code.o` + if [ -z "$BOOST_ROOT" ]; then + echo "Need to install Boost and to set BOOST_ROOT" + exit 1 + elif [ ! -f "$LocDonLib"/libDonjon.a ]; then + echo "Please install Donjon first" + exit 1 + fi +elif [ $Code = "Yacs++" ]; then + echo "Installing Yacs++" + Lnolib=`echo $Code.cxx` + Lnoobj=`echo $Code.o` + if [ -z "$BOOST_ROOT" ]; then + echo "Need to install Boost and to set BOOST_ROOT" + exit 1 + elif [ -z "$SALOME_KERNEL" ]; then + echo "Need to set SALOME_KERNEL" + exit 1 + elif [ ! -f "$LocSkinLib"/libSkin++.a ]; then + echo "Please install Skin++ first" + exit 1 + fi +elif [ $Code = "Utilib" ]; then + echo "Installing Utilib" +elif [ $Code = "Ganlib" ]; then + echo "Installing Ganlib" + if [ -d "$LocGanLib"/modules ]; then + /bin/rm "$LocGanLib"/modules/* + else + mkdir "$LocGanLib"/modules + chmod 755 "$LocGanLib"/modules + fi +else + echo "Installing specific code " $Code + if [ ! -f "$LocDrgLib"/libDragon.a ]; then + echo "Please install Dragon first" + exit 1 + fi + if [ -d "$LocLib"/modules ]; then + /bin/rm "$LocLib"/modules/* + else + mkdir "$LocLib"/modules + chmod 755 "$LocLib"/modules + fi +fi +echo 'Lnolib =' $Lnolib 'Lnoobj =' $Lnoobj +# +# Set cpp variables for Fortran and C +# +if [ $compiler = 'absoft' ]; then + FoptCPP="$FoptCPP -Dabsoft -DUnix" + CoptCPP="-Dabsoft" +elif [ $compiler = 'g95' ]; then + FoptCPP="$FoptCPP -DLinux -DUnix -Dg95" + CoptCPP="-DLinux" +elif [ $System = "HP-UX" ]; then + FoptCPP="$FoptCPP -DHPUX -DUnix" + CoptCPP="-DHPUX" +elif [ $System = "AIX" ]; then + FoptCPP="$FoptCPP -DAIX -DUnix" + CoptCPP="-DAIX" +elif [ $System = "SunOS" ]; then + FoptCPP="$FoptCPP -DF90 -DSunOS -DUnix" + CoptCPP="-DSunOS" +else + FoptCPP="$FoptCPP -DLinux -DUnix" + CoptCPP="-DLinux" +fi +echo 'FoptCPP=' $FoptCPP +echo 'CoptCPP=' $CoptCPP +# +# Lnoopt= list the non-optimized routines +# +Lnoopt= +CoptF="-c -Wall $nbit -fPIC" +CoptL="$nbit" +CoptC="-c -Wall $nbit -fPIC" +CAddoptF=' ' +CAoptF90=' ' +CXXLINK="-lstdc++" +if [ $compiler = 'absoft' ]; then + CoptF="-c -fPIC" + CoptL="$nbit" + TOOLF="f90" + TOOLC="gcc -fPIC" + TOOLCXX="g++" + CAddoptF="-f" + CAoptF90="-c -f free" + if [ "`uname -m`" = "i386" -o "`uname -m`" = "x86_64" ]; then + CAoptF90="-c $nbit -f free" + CAddoptF="$nbit -f" + CoptC="-c $nbit" + fi +elif [ $compiler = 'g95' ]; then + CoptF="-c" + TOOLF="g95" + TOOLC="gcc" + TOOLCXX="g++" + CAddoptF="-ffixed-line-length-80 -fsloppy-char -Wno-globals" + CoptC="-c -fPIC" + CAoptF90="-c -fsloppy-char -Wno-globals" +elif [ $compiler = 'intel' ]; then + FoptCPP="$FoptCPP -Difort" + CoptL="$nbit" + CoptF="-c -fPIC" + TOOLF="ifort" + TOOLC="gcc" + TOOLCXX="g++" + CAoptF90="-c" + CoptC="-c $nbit -fPIC" + CXXLINK="-lstdc++ -nofor_main" +elif [ $System = "HP-UX" ]; then + Cnoopt="-c +Onolimit" + CAoptF90="+source=free" +elif [ $System = "AIX" ]; then + TOOLF="xlf90" + CoptF="-c" + CoptC="-c" + CoptL="-bmaxdata:0x80000000 -qipa" + CAddoptF="-qmaxmem=-1 -qxlf77=leadzero -qfixed" + CAoptF90="-qmaxmem=-1 -qsuffix=f=f90" +elif [ $System = "SunOS" ]; then + TOOLF="f90" + TOOLC="cc" + CoptF="-c -m64" + CoptC="-c -m64" + CAddoptF="-s -ftrap=%none" + CAoptF90="-s -ftrap=%none" +else + if [ $mpi = 1 ]; then + TOOLF="mpif90" + TOOLC="mpicc" + else + TOOLF="gfortran" + TOOLC="gcc" + fi + TOOLCXX="g++" + CAddoptF="-frecord-marker=4" + CAoptF90=" " + vers=$(uname -r | cut -d"." -f1) + if [ "$MACH" = "Darwin_i386" ]; then + gccrel=`g++ --version | head -1 | sed -e 's/i686-apple-darwin\([0-9]*\).*/\1/'` + gccfullV=`g++ --version | head -1 | sed -e '1 s/.*\([0-9]\.[0-9]\.[0-9]\).*/\1/'` + CXXLINK="-L/usr/lib/gcc/i686-apple-darwin$gccrel/$gccfullV -lstdc++" + echo "reset CXXLINK to" $CXXLINK + elif [ "$MACH" = "Darwin_x86_64" -a "$vers" -gt 15 ]; then + CXXLINK="-lc++" + echo "reset CXXLINK to" $CXXLINK + fi +fi +# +# Set debug flag +# +if [ $idebug = 1 ]; then + CoptF=`echo $CoptF -g` + FoptCPP=`echo $FoptCPP -g` + CoptCPP=`echo $CoptCPP -g` +fi +# +# Set optimization +# +if [ $optim = 1 -a $idebug = 0 ]; then + if [ $System = "AIX" ]; then + CoptF=`echo $CoptF -O4 -qstrict` + CoptC=`echo $CoptC -O4 -qstrict` + else + CoptF=`echo $CoptF -O` + CoptC=`echo $CoptC -O` + fi + CoptL=`echo $CoptL -O` +fi +# +Directory=src +echo "Directory:" $Directory +cd $Directory +if [ $Code = "Ganlib" ]; then + command -v python3 + OUT=$? + if [ $OUT -eq 0 ]; then + echo "use python3" + L90="`python3 ../../script/make_depend_py3.py` `*.F90`" + else + echo "use python2" + L90="`python ../../script/make_depend.py` `*.F90`" + fi + liste="$L90 `ls *.f` `ls *.F` `ls *.c`" + LF="`ls *.F`" + LF90="`ls *.F90`" + Lcc="`ls *.c`" + echo "cc rout :" $Lcc + echo "F rout :" $LF + echo "F90 rout :" $LF90 +elif [ $Code = "Utilib" -o $Code = "Donjon" -o $Code = "Trivac" -o $Code = "Dragon" -o $Code = "Optex" ]; then + command -v python3 + OUT=$? + if [ $OUT -eq 0 ]; then + echo "use python3" + L90="`python3 ../../script/make_depend_py3.py`" + else + echo "use python2" + L90="`python ../../script/make_depend.py`" + fi + liste="$L90 `ls *.f` `ls *.F` `ls *.c`" + Lcc="`ls *.c`" + echo "cc rout :" $Lcc +elif [ $Code = "Skin++" -o $Code = "Yacs++" ]; then + Lcxx="`ls *.cxx`" + liste="$Lcxx" + echo "c++ rout :" $Lcxx +else + echo "Unknown code :" $Code +fi +echo "No opti :" $Lnoopt +echo "--------- " +Lo= +Lon= +for routname in $liste; do + InLib="Yes" + for routnolib in $Lnolib; do + if [ $routname = $routnolib ]; then + Nlib="`echo $routname | cut -d. -f 1`.o" + Lon="$Lon $Nlib" + InLib="No" + fi + done + OptIt="Yes" + for routnoopt in $Lnoopt; do + if [ $routname = $routnoopt ]; then + OptIt="No" + echo "Compilei :" $TOOLF $Cnoopt $routnoopt -I"$LocGanLib"/modules/ + $TOOLF $Cnoopt $routnoopt -I"$LocGanLib"/modules/ + fi + done + for routcc in $Lcc; do + if [ $routname = $routcc ]; then + OptIt="No" + echo "Compile :" $TOOLC $CoptC $CoptCPP $routcc + $TOOLC $CoptC $CoptCPP $routcc + fi + done + for routF in $LF; do + if [ $routname = $routF ]; then + OptIt="No" + if [ $mpi = 0 -a $routname = 'DRVMPI.F' ]; then + InLib="No" + continue ; + elif [ $mpi = 0 -a $routname = 'SNDMPI.F' ]; then + InLib="No" + continue ; + fi + echo "cpp+Compile :" $TOOLF $CoptF $FoptCPP $CAddoptF $routF -I"$LocGanLib"/modules/ + objname="`echo $routF | cut -d. -f 1`.o" + cpp -P -W -traditional $FoptCPP -I/usr/local/include $routF temp.f + $TOOLF $CoptF $CAddoptF temp.f -I"$LocGanLib"/modules/ -o $objname + /bin/rm temp.f + fi + done + for routF90 in $LF90; do + if [ $routname = $routF90 ]; then + OptIt="No" + echo "cpp+Compile :" $TOOLF $CoptF $FoptCPP $CAoptF90 $routF90 -I"$LocGanLib"/modules/ + objname="`echo $routF90 | cut -d. -f 1`.o" + cpp -P -W -traditional $FoptCPP -I/usr/local/include $routF90 temp.f90 + $TOOLF $CoptF $CAoptF90 temp.f90 -I"$LocGanLib"/modules/ -o $objname + /bin/rm temp.f90 + fi + done + if [ $OptIt = "Yes" ]; then + for rout90 in $L90; do + if [ $routname = $rout90 ]; then + OptIt="No" + echo "Compile :" $TOOLF $CoptF $CAoptF90 $rout90 -I"$LocGanLib"/modules/ + $TOOLF $CoptF $CAoptF90 $rout90 -I"$LocGanLib"/modules/ + fi + done + fi + for routcc in $Lcxx; do + if [ $routname = $routcc -a $Code = "Yacs++" ]; then + OptIt="No" + echo "Compile :" $TOOLCXX $CoptC $CoptCPP $routcc -I$BOOST_ROOT -I"$HomeDev"/Ganlib/src/ \ + -I"$HomeDev"/Skin++/src/ -I"$SALOME_KERNEL"/include/salome/ + $TOOLCXX $CoptC $CoptCPP $routcc -I$BOOST_ROOT -I"$HomeDev"/Ganlib/src/ \ + -I"$HomeDev"/Skin++/src/ -I"$SALOME_KERNEL"/include/salome/ + elif [ $routname = $routcc ]; then + OptIt="No" + echo "Compile :" $TOOLCXX $CoptC $CoptCPP $routcc -I$BOOST_ROOT -I"$HomeDev"/Ganlib/src/ + $TOOLCXX $CoptC $CoptCPP $routcc -I$BOOST_ROOT -I"$HomeDev"/Ganlib/src/ + fi + done + if [ $OptIt = "Yes" ]; then + echo "Compile :" $TOOLF $CoptF $CAddoptF $routname -I"$LocGanLib"/modules/ + $TOOLF $CoptF $CAddoptF $routname -I"$LocGanLib"/modules/ + fi + if [ $InLib = "Yes" ]; then + Nlib="`echo $routname | cut -d. -f 1`.o" + Lo="$Lo $Nlib" + fi +done +echo "--------- " +if [ $System = "SunOS" ]; then + /usr/ccs/bin/ar cr $Library $Lo +else + ar cr $Library $Lo + ranlib $Library +fi +for routnolib in $Lon; do + cp $routnolib "$LocLib"/$routnolib + chmod 644 "$LocLib"/$routnolib + echo "Install : File " "$LocLib"/$routnolib "was produced" +done +if [ -f $Library ]; then + echo "Install : Library" "$LocLib"/$Library "was produced" + mv $Library "$LocLib" + chmod 644 "$LocLib"/$Library + if [ $Code = "Utilib" ]; then + echo "No link performed for Utilib" + elif [ $Code = "Ganlib" ]; then + Lnoobj="GANMAIN.o" + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " -o "$LocBin"/$Code + $TOOLF $CoptL GANMAIN.o "$LocLib"/$Library -o "$LocBin"/$Code + mv *.mod "$LocLib"/modules + chmod 644 "$LocLib"/modules/*.mod + elif [ $Code = "Trivac" ]; then + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " "$LocUtiLib"/libUtilib.a + echo " " "$LocGanLib"/libGanlib.a + echo " " -o "$LocBin"/$Code + $TOOLF $CoptL $Lnoobj "$LocLib"/$Library "$LocUtiLib"/libUtilib.a "$LocGanLib"/libGanlib.a \ + -o "$LocBin"/$Code + elif [ $Code = "Dragon" ]; then + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " "$LocTriLib"/libTrivac.a + echo " " "$LocUtiLib"/libUtilib.a + echo " " "$LocGanLib"/libGanlib.a + echo " " -o "$LocBin"/$Code + $TOOLF $CoptL $Lnoobj "$LocLib"/$Library "$LocTriLib"/libTrivac.a "$LocUtiLib"/libUtilib.a \ + "$LocGanLib"/libGanlib.a -o "$LocBin"/$Code + mv *.mod "$LocLib"/modules + chmod 644 "$LocLib"/modules/*.mod + elif [ $Code = "Donjon" ]; then + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " "$LocTriLib"/libTrivac.a + echo " " "$LocDrgLib"/libDragon.a + echo " " "$LocUtiLib"/libUtilib.a + echo " " "$LocGanLib"/libGanlib.a + echo " " -o "$LocBin"/$Code + $TOOLF $CoptL $Lnoobj "$LocLib"/$Library "$LocDrgLib"/libDragon.a "$LocTriLib"/libTrivac.a \ + "$LocDrgLib"/libDragon.a "$LocUtiLib"/libUtilib.a "$LocGanLib"/libGanlib.a -o "$LocBin"/$Code + elif [ $Code = "Optex" ]; then + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " "$LocTriLib"/libTrivac.a + echo " " "$LocDrgLib"/libDragon.a + echo " " "$LocDonLib"/libDonjon.a + echo " " "$LocUtiLib"/libUtilib.a + echo " " "$LocGanLib"/libGanlib.a + echo " " -o "$LocBin"/$Code + $TOOLF $CoptL $Lnoobj "$LocLib"/$Library "$LocDonLib"/libDonjon.a "$LocDrgLib"/libDragon.a \ + "$LocTriLib"/libTrivac.a "$LocDrgLib"/libDragon.a "$LocUtiLib"/libUtilib.a "$LocGanLib"/libGanlib.a \ + -o "$LocBin"/$Code + elif [ $Code = "Skin++" ]; then + echo "Link :" $TOOLF $CoptL $Lnoobj + echo " " "$LocLib"/$Library + echo " " "$LocDonLib"/libDonjon.a + echo " " "$LocDrgLib"/libDragon.a + echo " " "$LocTriLib"/libTrivac.a + echo " " "$LocUtiLib"/libUtilib.a + echo " " "$LocGanLib"/libGanlib.a + echo " " $CXXLINK -o "$LocBin"/$Code + $TOOLF $CoptL $Lnoobj "$LocLib"/$Library "$LocDonLib"/libDonjon.a "$LocDrgLib"/libDragon.a \ + "$LocTriLib"/libTrivac.a "$LocDrgLib"/libDragon.a "$LocUtiLib"/libUtilib.a "$LocGanLib"/libGanlib.a \ + $CXXLINK -o "$LocBin"/$Code + elif [ $Code = "Yacs++" ]; then + echo "No link performed for Yacs++" + else + echo "Unknown code" $Code + fi + if [ $Code = "Utilib" -o $Code = "Yacs++" ]; then + /bin/rm *.o + else + if [ -x "$LocBin"/$Code ]; then + echo "Install : Exec " "$LocBin"/$Code "was produced" + /bin/rm *.o + chmod 755 "$LocBin"/$Code + echo "Install : DONE" + else + echo "Install : Exec " "$LocBin"/$Code "was NOT produced" + echo "Install : ERROR" + fi + fi +else + echo "Install : Library" "$LocLib"/$Library "was NOT produced" + echo "Install : ERROR" +fi +cd "$LocDir" diff --git a/script/instver5.bat b/script/instver5.bat new file mode 100755 index 0000000..544c89f --- /dev/null +++ b/script/instver5.bat @@ -0,0 +1,122 @@ +rem *********************************************************************************
+rem Script to compile and link Version4 components on MS-DOS
+rem compile with intel Fortran and intel C++
+rem run the script in Dos windows from Visual studio command prompt
+rem execute script from Version4 directory as .\script\instver5
+rem base on a script created by E. Varin for Dragon 3.06
+rem *********************************************************************************
+rem ----compile utilib----
+cd Utilib
+md lib\ms-dos
+copy src\*.* lib\ms-dos\
+cd lib\ms-dos\
+ifort /c /assume:byterecl /warn:nofileopt *.f 1>OUT 2>&1
+rem make utilib library
+lib /nologo /out:utilib.lib *.obj
+del *.obj *.f
+cd ..\..\..
+rem ----------------------
+rem ----compile ganlib----
+cd Ganlib
+md lib\ms-dos
+copy src\*.* lib\ms-dos\
+cd lib\ms-dos\
+rem ren KDRCPU.F KDRCPU.fpp
+rem ren KDROPN.F KDROPN.fpp
+rem ren KDRSTD.F KDRSTD.fpp
+ren DRVMPI.F DRVMPI.fpp
+ren SNDMPI.F SNDMPI.fpp
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt FILMODx.f90 1>XOUT0 2>&1
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt GANLIBx.f90 1>XOUT1 2>&1
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt *.f *.fpp *.f90 1>XOUT2 2>&1
+cl /c /DMSDOS *.c
+rem make ganlib library
+move ganmain.obj ..\
+lib /nologo /out:ganlib.lib *.obj
+del *.obj *.f *.f90 *.fpp *.c *.h
+move ..\ganmain.obj .
+cd ..\..
+rem make ganlib executable
+md bin\ms-dos
+cd bin\ms-dos\
+rem
+ifort -o ganlib.exe ..\..\lib\ms-dos\ganmain.obj ..\..\lib\ms-dos\ganlib.lib ^
+ ..\..\..\Utilib\lib\ms-dos\utilib.lib 1>XOUT3 2>&1
+cd ..\..\..
+rem ----------------------
+rem ----compile trivac----
+cd Trivac
+md lib\ms-dos
+copy src\*.* lib\ms-dos\
+cd lib\ms-dos\
+copy ..\..\..\ganlib\src\filmod.f90 filmod.f90
+copy ..\..\..\ganlib\src\ganlib.f90 ganlib.f90
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt filmod.f90 1>OUT0 2>&1
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt ganlib.f90 1>OUT1 2>&1
+ifort /c /assume:byterecl /warn:nofileopt *.f90 *.f 1>OUT2 2>&1
+rem make trivac library
+move trivac.obj ..\
+lib /nologo /out:trivac.lib *.obj >OUT3
+del *.obj *.f *.f90
+move ..\trivac.obj .
+cd ..\..
+rem make trivac executable
+md bin\ms-dos
+cd bin\ms-dos\
+ifort -o trivac.exe ..\..\lib\ms-dos\trivac.obj ..\..\lib\ms-dos\trivac.lib ^
+ ..\..\..\Ganlib\lib\ms-dos\ganlib.lib ..\..\..\Utilib\lib\ms-dos\utilib.lib ^
+ 1>OUT3 2>&1
+cd ..\..\..
+rem ----------------------
+rem ----compile dragon----
+cd Dragon
+md lib\ms-dos
+copy src\*.* lib\ms-dos\
+cd lib\ms-dos\
+copy ..\..\..\ganlib\src\filmod.f90 filmod.f90
+copy ..\..\..\ganlib\src\ganlib.f90 ganlib.f90
+rem ren DRAGON.F DRAGON.fpp
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt filmod.f90 1>OUT0 2>&1
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt ganlib.f90 1>OUT1 2>&1
+ifort /c /assume:byterecl /warn:nofileopt *.f90 *.f 1>OUT2 2>&1
+cl /c /DMSDOS *.c 1>OUT3 2>&1
+rem make dragon library
+move dragon.obj ..\
+lib /nologo /out:dragon.lib *.obj 1>OUT4 2>&1
+del *.obj *.f90 *.f *.c *.h
+move ..\dragon.obj .
+cd ..\..
+rem make dragon executable
+md bin\ms-dos
+cd bin\ms-dos\
+ifort -o dragon.exe ..\..\lib\ms-dos\dragon.obj ..\..\lib\ms-dos\dragon.lib ^
+ ..\..\..\Trivac\lib\ms-dos\trivac.lib ..\..\..\Ganlib\lib\ms-dos\ganlib.lib ^
+ ..\..\..\Utilib\lib\ms-dos\utilib.lib 1>OUT4 2>&1
+cd ..\..\..
+rem ----------------------
+rem ----compile donjon----
+cd Donjon
+md lib\ms-dos
+copy src\*.* lib\ms-dos\
+cd lib\ms-dos\
+rem ren DONJON.F DONJON.fpp
+copy ..\..\..\ganlib\src\filmod.f90 filmod.f90
+copy ..\..\..\ganlib\src\ganlib.f90 ganlib.f90
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt filmod.f90 1>OUT0 2>&1
+ifort /c /DMSDOS /assume:byterecl /warn:nofileopt ganlib.f90 1>OUT1 2>&1
+ifort /c /assume:byterecl /warn:nofileopt *.f90 *.f 1>OUT2 2>&1
+cl /c /DMSDOS *.c 1>OUT3 2>&1
+rem make donjon library
+move donjon.obj ..\
+lib /nologo /out:donjon.lib *.obj 1>OUT4 2>&1
+del *.obj *.f90 *.f *.c *.h
+move ..\donjon.obj .
+cd ..\..
+rem make donjon executable
+md bin\ms-dos
+cd bin\ms-dos\
+ifort -o donjon.exe ..\..\lib\ms-dos\donjon.obj ..\..\lib\ms-dos\donjon.lib ^
+ ..\..\..\Dragon\lib\ms-dos\dragon.lib ..\..\..\Trivac\lib\ms-dos\trivac.lib ^
+ ..\..\..\Ganlib\lib\ms-dos\ganlib.lib ..\..\..\Utilib\lib\ms-dos\utilib.lib ^
+ 1>OUT4 2>&1
+cd ..\..\..
diff --git a/script/make_depend.py b/script/make_depend.py new file mode 100755 index 0000000..15c656e --- /dev/null +++ b/script/make_depend.py @@ -0,0 +1,57 @@ +#!/bin/env python +""" generation of module dependances for a xxx.f90 or xxx.F90 file """ + +import string,sys +from subprocess import Popen, PIPE + +def noComment(mot): + """ remove comment characters in a word """ + ind= string.find(mot,'!') + if ind != -1: + mot= mot[:ind] + return mot + +class md9: + """ a file, its module and its dependances """ + def __init__(self,fic): + self.name= fic + self.used= [] + #find all module dependances + listeLignes= open(self.name,'r').readlines() + self.module= "dummy" + for ligne in listeLignes: + ligne= string.lower(ligne) + if string.count(ligne,'use'): + ligne= string.replace(ligne,',',' ') + listeMots= string.split(ligne) + if listeMots[0] == 'use': + mod= noComment(listeMots[1]) + if mod not in self.used and mod != 'intrinsic': + self.used.append(mod) + elif string.count(ligne,'module'): + listeMots= string.split(ligne) + if listeMots[0] == 'module' and \ + noComment(listeMots[1]) != 'procedure': + self.module= listeMots[1] + def utilise(self,other): + return (other.module in self.used) + +listeClasse= list() +for x in sys.argv[1:]: + if x.endswith('.f90') or x.endswith('.F90') : listeClasse.append(md9(x)) +#sort the file list +listeRes= [] +while listeClasse: + lgav= len(listeClasse) + for fic in listeClasse: + if len(filter(lambda x,y=fic:y.utilise(x),listeClasse)) == 0: + listeRes.append(fic) + listeClasse.remove(fic) + lgap= len(listeClasse) + if lgav == lgap and lgap != 0: + raise RuntimeError("make_depend: cross-references found") +#result output +resstr='' +for fic in listeRes: + resstr=resstr+fic.name+' ' +print resstr diff --git a/script/make_depend_py3.py b/script/make_depend_py3.py new file mode 100755 index 0000000..a47d7fb --- /dev/null +++ b/script/make_depend_py3.py @@ -0,0 +1,58 @@ +#!/bin/env python3 +""" generation of module dependances for a xxx.f90 or xxx.F90 file """ + +import string,sys +from subprocess import Popen, PIPE + +def noComment(mot): + """ remove comment characters in a word """ + ind= mot.find('!') + if ind != -1: + mot= mot[:ind] + return mot + +class md9: + """ a file, its module and its dependances """ + def __init__(self,fic): + self.name= fic + self.used= [] + #find all module dependances + listeLignes= open(self.name,'r',encoding='utf8',errors='ignore').readlines() + self.module= "dummy" + for ligne in listeLignes: + ligne= ligne.lower() + if ligne.count('use'): + ligne= ligne.replace(',',' ') + listeMots= ligne.split() + if listeMots[0] == 'use': + mod= noComment(listeMots[1]) + if mod not in self.used and mod != 'intrinsic': + self.used.append(mod) + elif ligne.count('module'): + listeMots= ligne.split() + if listeMots[0] == 'module' and \ + noComment(listeMots[1]) != 'procedure': + self.module= listeMots[1] + def utilise(self,other): + return (other.module in self.used) + +#list the file names +listeClasse= list() +for x in sys.argv[1:]: + if x.endswith('.f90') or x.endswith('.F90'): listeClasse.append(md9(x)) +#sort the file list +listeRes= [] +while listeClasse: + lgav= len(listeClasse) + for fic in listeClasse: + if len(list(filter(lambda x,y=fic:y.utilise(x),listeClasse))) == 0: + listeRes.append(fic) + listeClasse.remove(fic) + lgap= len(listeClasse) + if lgav == lgap and lgap != 0: + raise RuntimeError("make_depend: cross-references found") +#result output +resstr='' +for fic in listeRes: + resstr=resstr+fic.name+' ' +print(resstr) diff --git a/script/post-commit b/script/post-commit new file mode 100755 index 0000000..41fe508 --- /dev/null +++ b/script/post-commit @@ -0,0 +1,54 @@ +#!/usr/bin/python3 +""" +Subversion post-commit hook which copy (append) the issue-tracking information +to a new (or existing) card-index in the /issues/ directory. A commit of this +information is performed. +""" +#Author: Alain Hebert, Ecole Polytechnique, 2006. + +import os, sys, pysvn, time + +def main(repos, rev): + # Recover the revision data: + client = pysvn.Client() + log_message=client.log('file://' + repos + '', discover_changed_paths=True, \ + revision_end=pysvn.Revision(pysvn.opt_revision_kind.number, rev)) + message = str(log_message[0]['message']) + if message[11:] != ': Issue-tracking commit' and message[11:] != ':': + # Recover the existing card-index + fileName = str(log_message[0]['message'])[:11] + if os.path.isdir('/tmp/post-issues'): + os.system("chmod -R 777 /tmp/post-issues/") + os.system("rm -r /tmp/post-issues/") + myls = client.ls('file://'+repos+'/'+'/issues/') + myls2 = [] + for k in range(len(myls)): + myls2.append(str(myls[k]['name']).split('/')[-1]) + client.checkout('file://'+repos+'/'+'/issues/','/tmp/post-issues/',recurse=False) + if fileName in myls2: + # Recover the existing card-index and open it + f = open('/tmp/post-issues/'+fileName, 'a') + else: + # Create a new card-index + f = open('/tmp/post-issues/'+fileName, 'w') + f.write('Card-index: '+fileName+'\n') + f.write('---------------------------------------------------------\n') + client.add('/tmp/post-issues/'+fileName) + f.write(str(log_message[0]['author'])+'\n') + f.write(time.ctime(log_message[0]['date'])+'\n') + f.write('subversion revision=%d\n'%log_message[0]['revision'].number) + f.write(message+'\n') + for cpath in log_message[0]['changed_paths']: + f.write(cpath['action']+' '+cpath['path']+'\n') + f.write('---------------------------------------------------------\n') + f.close() + #committing the issue-tracking card-index to the repository + client.cleanup('/tmp/post-issues/') + client.checkin(['/tmp/post-issues/'], fileName+': Issue-tracking commit') + os.system("rm -r -f /tmp/post-issues/") + +if __name__ == '__main__': + if len(sys.argv) < 3: + sys.stderr.write("Usage: %s repos rev\n" % (sys.argv[0])) + else: + main(sys.argv[1], sys.argv[2]) diff --git a/script/pre-commit b/script/pre-commit new file mode 100755 index 0000000..2d9e8b9 --- /dev/null +++ b/script/pre-commit @@ -0,0 +1,46 @@ +#!/usr/bin/python3 +""" +Subversion pre-commit hook which currently checks that the card-index +information is consistent and correctly given. +""" +#Author: Alain Hebert, Ecole Polytechnique, 2006. + +import os, sys, pysvn + +def main(repos, txn): + # Recover the transaction data: + print("pre-commit: repos=",repos) + t = pysvn.Transaction( repos, txn ) + all_props = t.revproplist() + message = t.revproplist()['svn:log'] + # + # Validate the commit message: + if message[:5] != 'issue': + sys.stderr.write ("Please begin your commit message with 'issue' characters. message=%s...\n"% \ + message[:15]) + sys.exit(1) + try: + cardIndexNumber = int(message[5:11]) + except: + sys.stderr.write ("Please begin your commit message with 'issue' characters followed" \ + +" by a six-digit index. message=%s...\n"%message[:15]) + sys.exit(1) + fileName = message[:11] + # + # List of card-index + client = pysvn.Client() + myls = client.ls('file://'+repos+'/'+'/issues/') + maxIssue = -1 + for k in range(len(myls)): + maxIssue=max(maxIssue, int(myls[k]['name'].split('/')[-1][5:])) + if int(fileName[5:]) > maxIssue+1: + sys.stderr.write ("The six-digit index (%d) must be <= %d. message=%s...\n"% \ + (int(fileName[5:]), maxIssue+1, message[:15])) + sys.exit(1) + sys.exit(0) + +if __name__ == '__main__': + if len(sys.argv) < 3: + sys.stderr.write("Usage: %s repos txn\n" % (sys.argv[0])) + else: + main(sys.argv[1], sys.argv[2]) diff --git a/script/set_pythonpath.py b/script/set_pythonpath.py new file mode 100755 index 0000000..3fddc37 --- /dev/null +++ b/script/set_pythonpath.py @@ -0,0 +1,26 @@ +#!/bin/env python3 +""" generation of PYTHONPATH environment variable for PyGan using pth file""" + +import os, sys +mach=os.environ['MACH'] +Compiler = os.environ.get("COMPILER", None) # Compiler selection +if Compiler == "NVTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_nvidia" + "/python" +elif Compiler == "LLVMTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_llvm" + "/python" +elif Compiler == "INTELTOOLS": + name=os.getcwd() + "/../PyGan/lib/" + mach+"_intel" + "/python" +else: + name=os.getcwd() + "/../PyGan/lib/" + mach + "/python" +if os.path.isfile(name + "/easy-install.pth"): + pythonpath = "" + count = 0 + f = open(name + "/easy-install.pth", 'r') + for line in f: + count += 1 + location = "{}".format(name + line.strip()[1:]) + pythonpath = pythonpath + location + ":" + f.close() +else: + pythonpath = name +print(pythonpath) |
