From 9fd9159f043dd9950786fba56bdfdcc90981507d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Nov 2014 01:03:50 +0100 Subject: [PATCH] Update scripts for irpf90 and ezfio --- Makefile | 1 + scripts/upgrade_ezfio.sh | 26 ++++++++++++++++++++++++++ scripts/upgrade_irpf90.sh | 25 +++++++++++++++++++++++++ src/Makefile.common | 28 +++++++++++++++++++++++++--- 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100755 scripts/upgrade_ezfio.sh create mode 100755 scripts/upgrade_irpf90.sh diff --git a/Makefile b/Makefile index 357eb4c7..bce7735c 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ bin/irpf90: (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1) tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ) $(MAKE) -C irpf90 | tee install_irpf90.log + rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman ln -s $$PWD/irpf90/bin/irpf90 $$PWD/bin/irpf90 ln -s $$PWD/irpf90/bin/irpman $$PWD/bin/irpman diff --git a/scripts/upgrade_ezfio.sh b/scripts/upgrade_ezfio.sh new file mode 100755 index 00000000..daa51405 --- /dev/null +++ b/scripts/upgrade_ezfio.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Upgrades the EZFIO library from the web. +# Tue Nov 4 00:53:13 CET 2014 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." +fi + +cd -- ${QPACKAGE_ROOT} +mv -- ${QPACKAGE_ROOT}/EZFIO ${QPACKAGE_ROOT}/EZFIO.old + +make EZFIO + +if [[ $? -eq 0 ]] +then + rm -rf -- ${QPACKAGE_ROOT}/EZFIO.old + echo "Successfully updated EZFIO" +else + rm -rf -- ${QPACKAGE_ROOT}/EZFIO + mv -- ${QPACKAGE_ROOT}/EZFIO.old ${QPACKAGE_ROOT}/EZFIO + echo "Failed to update EZFIO" +fi + diff --git a/scripts/upgrade_irpf90.sh b/scripts/upgrade_irpf90.sh new file mode 100755 index 00000000..a3aeac48 --- /dev/null +++ b/scripts/upgrade_irpf90.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Upgrades IRPF90 from the web. +# Tue Nov 4 00:53:13 CET 2014 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." +fi + +cd -- ${QPACKAGE_ROOT} +mv -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old + +make irpf90 + +if [[ $? -eq 0 ]] +then + rm -rf -- ${QPACKAGE_ROOT}/irpf90.old + echo "Successfully updated IRPF90" +else + rm -rf -- ${QPACKAGE_ROOT}/irpf90 + mv -- ${QPACKAGE_ROOT}/irpf90.old ${QPACKAGE_ROOT}/irpf90 + echo "Failed to update IRPF90" +fi diff --git a/src/Makefile.common b/src/Makefile.common index 0aa47245..5b6a53ce 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -1,3 +1,9 @@ +# Required EZFIO version +EZFIO_VERSION=1.1 + +# Required IRPF90 version +IRPF90_VERSION=1.4 + # Check if QPACKAGE_ROOT is defined ifndef QPACKAGE_ROOT @@ -28,10 +34,12 @@ include $(QPACKAGE_ROOT)/src/Makefile.config # Check the version of IRPF90 -IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= 1.3") +IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(IRPF90_VERSION)") ifeq ($(IRP_VERSION_OK),False) $(info -------------------- Error --------------------) -$(info IRPF90 version >= 1.3 is required) +$(info IRPF90 version >= $(IRPF90_VERSION) is required) +$(info To upgrade IRPF90, run : ) +$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh ) $(info -----------------------------------------------) $(error ) endif @@ -85,12 +93,26 @@ $(info -----------------------------------------------) endif -# Define the Makefile common variables and rules +# Define the Makefile common variables EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a INCLUDE_DIRS=$(NEEDED_MODULES) include +# Check EZFIO version + +EZFIO_VERSION_OK=$(shell cat $(EZFIO_DIR)/version | cut -d '=' -f 2 | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(EZFIO_VERSION)") +ifeq ($(EZFIO_VERSION_OK),False) +$(info -------------------- Error --------------------) +$(info EZFIO version >= $(EZFIO_VERSION) is required ) +$(info To upgrade EZFIO, run : ) +$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh ) +$(info -----------------------------------------------) +$(error ) +endif + +# Define the EZFIO rules + $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) @echo Building EZFIO library @cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config