diff --git a/Makefile b/Makefile index 87436fc0..9910a0b3 100644 --- a/Makefile +++ b/Makefile @@ -3,29 +3,58 @@ IRPF90_TGZ = irpf90-latest-noarch-src.tar.gz EZFIO_TGZ = EZFIO.latest.tar.gz FETCH_FROM_WEB=./scripts/fetch_from_web.py -.PHONY: doc src +BLUE= +BLACK=(B + + +.PHONY: doc src curl m4 ocaml irpf90 default: ./setup_environment.sh -EZFIO: - $(info ===== Fetching EZFIO from the web =====) +curl: bin/curl +m4: bin/m4 +irpf90: bin/irpf90 + +EZFIO: irpf90 + $(info $(BLUE)===== Fetching EZFIO from the web ===== $(BLACK)) + @sleep 1 @$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(EZFIO_TGZ)" $(EZFIO_TGZ) || \ (echo Unable to download EZFIO : $(WWW_SERVER)/$(EZFIO_TGZ) ; exit 1) - @tar -zxf $(EZFIO_TGZ) && rm $(EZFIO_TGZ) + tar -zxf $(EZFIO_TGZ) && rm $(EZFIO_TGZ) -irpf90: - $(info ===== Fetching IRPF90 from the web =====) +bin/irpf90: + $(info $(BLUE)===== Fetching IRPF90 from the web ===== $(BLACK)) + @sleep 1 @$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \ (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1) - @tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ) - $(MAKE) -C irpf90 + tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ) + $(MAKE) -C irpf90 | tee install_irpf90.log + ln -s $$PWD/irpf90/bin/irpf90 $$PWD/bin/irpf90 + ln -s $$PWD/irpf90/bin/irpman $$PWD/bin/irpman doc: $(MAKE) -C doc -src: irpf90 EZFIO - export QPACKAGE_ROOT=$$PWD ; \ +src: irpf90 EZFIO ocaml + @export QPACKAGE_ROOT=$$PWD ; \ $(MAKE) -C src +bin/curl: + $(info $(BLUE)===== Installing curl =====$(BLACK)) + @sleep 1 + QPACKAGE_ROOT=$$PWD ./scripts/install_curl.sh | tee install_curl.log + +bin/m4: + $(info $(BLUE)===== Installing m4 =====$(BLACK)) + @sleep 1 + QPACKAGE_ROOT=$$PWD ./scripts/install_m4.sh | tee install_m4.log + + +ocaml: ocaml/Qptypes.ml curl m4 + +ocaml/Qptypes.ml: + $(info $(BLUE)===== Installing ocaml =====$(BLACK)) + @sleep 1 + QPACKAGE_ROOT=$$PWD ./scripts/install_ocaml.sh | tee install_ocaml.log diff --git a/bin/.empty b/bin/.empty new file mode 100644 index 00000000..e69de29b diff --git a/data/.gitignore b/data/.gitignore index 665b5714..bba6e406 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,3 +1,4 @@ +executables cache/* *.ezfio diff --git a/ocaml/Makefile b/ocaml/Makefile index 174e9ef3..1e9c514a 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -35,7 +35,7 @@ executables: $(ALL_EXE) $(OCAMLBUILD) $*.byte -use-ocamlfind $(PKGS) ln -s $*.byte $* -%.native: $(MLFILES) $(MLIFILES) +%.native: $(MLFILES) $(MLIFILES) executables rm -f -- $* $(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS) ln -s $*.native $* @@ -50,8 +50,8 @@ Qptypes.ml: qptypes_generator.byte ./qptypes_generator.byte > Qptypes.ml rm qptypes_generator.byte -${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml: +${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml: $(MAKE) -C ${QPACKAGE_ROOT}/src ezfio clean: - rm -rf _build *.native *.byte + rm -rf _build Qptypes.ml $(ALL_EXE) $(ALL_TESTS) diff --git a/ocaml/_tags b/ocaml/_tags index 6dc2a50c..55cb5085 100644 --- a/ocaml/_tags +++ b/ocaml/_tags @@ -1,3 +1,3 @@ -true: package(core,async) +true: package(core) true: thread diff --git a/scripts/install_curl.sh b/scripts/install_curl.sh new file mode 100755 index 00000000..2a899dc6 --- /dev/null +++ b/scripts/install_curl.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Installs curl for ocaml +# Thu Oct 23 22:02:08 CEST 2014 + +CURL_URL="http://curl.haxx.se/download/curl-7.38.0.tar.gz" + +CURL=$(which curl) +if [[ -z ${CURL} ]] +then + rm -f -- bin/curl + ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${CURL_URL} CURL.tar.gz + tar -zxf CURL.tar.gz && rm CURL.tar.gz ||exit 1 + cd curl* || exit 1 + ./configure && make || exit 1 + ln -s ${PWD}/src/curl ${QPACKAGE_ROOT}/bin +else + ln -s ${CURL} ${QPACKAGE_ROOT}/bin/curl +fi + diff --git a/scripts/install_m4.sh b/scripts/install_m4.sh new file mode 100755 index 00000000..10307f66 --- /dev/null +++ b/scripts/install_m4.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Installs m4 for ocaml +# Thu Oct 23 22:02:08 CEST 2014 + +M4_URL="http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz" + +M4=$(which m4) +if [[ -z ${M4} ]] +then + rm -f -- bin/m4 + ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${M4_URL} M4.tar.gz + tar -zxf M4.tar.gz && rm M4.tar.gz ||exit 1 + cd m4* || exit 1 + ./configure && make || exit 1 + ln -s ${PWD}/src/m4 ${QPACKAGE_ROOT}/bin +else + ln -s ${M4} ${QPACKAGE_ROOT}/bin/m4 +fi + diff --git a/scripts/install_ocaml.sh b/scripts/install_ocaml.sh new file mode 100755 index 00000000..aba33feb --- /dev/null +++ b/scripts/install_ocaml.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Downloads and installs ocaml, opam and core library +# Thu Oct 23 21:58:40 CEST 2014 + +QPACKAGE_ROOT=${PWD} + +make -C ocaml Qptypes.ml &> /dev/null +if [[ $? -ne 0 ]] +then + + scripts/fetch_from_web.py "https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install" ocamlbrew-install.sh + cat < ocamlbrew-install.sh | env OCAMLBREW_FLAGS="-r" bash + grep "source " ocaml_install.log | grep "etc/ocamlbrew.bashrc" >> quantum_package.rc + source quantum_package.rc + echo Y | opam install core +fi +make -C ocaml Qptypes.ml + + diff --git a/setup_environment.sh b/setup_environment.sh index e462b317..c2a5f8b7 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -1,22 +1,27 @@ #!/bin/bash # -# Setup script. Downloads IRPF90 and EZFIO if they are not already present in the current -# installation. -# Mon Apr 7 15:41:19 CEST 2014 +# Setup script. Downloads dependencies if they are not already present +# in the current installation. +# Thu Oct 23 22:02:08 CEST 2014 + +BLUE="" +RED="" +BLACK="(B" QPACKAGE_ROOT=${PWD} if [[ -z ${IRPF90} ]] ; then make irpf90 - IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90 - if [[ ! -x ${QPACKAGE_ROOT}/irpf90/bin/irpf90 ]] + IRPF90=${QPACKAGE_ROOT}/bin/irpf90 + if [[ ! -x ${IRPF90} ]] then - echo "Error in IRPF90 installation" + echo $RED "Error in IRPF90 installation" $BLACK exit 1 fi fi + cat << EOF > quantum_package.rc export IRPF90=${IRPF90} export QPACKAGE_ROOT=${QPACKAGE_ROOT} @@ -24,32 +29,31 @@ export PYTHONPATH=\${PYTHONPATH}:\${QPACKAGE_ROOT}/scripts export PATH=\${PATH}:\${QPACKAGE_ROOT}/scripts export PATH=\${PATH}:\${QPACKAGE_ROOT}/bin export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache" -export PATH=\${PATH}:\${QPACKAGE_ROOT}/irpf90/bin/ -source \${QPACKAGE_ROOT}/irpf90/bin/irpman > /dev/null +source \${QPACKAGE_ROOT}/bin/irpman > /dev/null EOF source quantum_package.rc -if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] -then make EZFIO -fi - if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] then - echo "Error in IRPF90 installation" + echo $RED "Error in IRPF90 installation" $BLACK exit 1 fi -# Ocaml installation -# Check if m4 and curl are OK -make -C ocaml Qptypes.ml -if [[ $? -ne 0 ]] +make ocaml +if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]] then - scripts/fetch_from_web.py "https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install" ocamlbrew-install.sh - cat < ocamlbrew-install.sh | env OCAMLBREW_FLAGS="-r" bash | tee ocaml_install.log - grep "source " ocaml_install.log | grep "etc/ocamlbrew.bashrc" >> quantum_package.rc - source quantum_package.rc - echo Y | opam install core async + echo $RED "Error in ocaml installation" $BLACK + exit 1 fi +echo $RED " +======================================================= +To complete the installation, add the following line to +your ~/.bashrc: + +source quantum_package.rc + +======================================================= +" $BLACK