Improved setup scripts to auto-install curl and m4

This commit is contained in:
Anthony Scemama 2014-10-23 22:40:21 +02:00
parent 6f745a6e25
commit 5bbdbb6ec5
9 changed files with 130 additions and 36 deletions

View File

@ -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

0
bin/.empty Normal file
View File

1
data/.gitignore vendored
View File

@ -1,3 +1,4 @@
executables
cache/*
*.ezfio

View File

@ -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)

View File

@ -1,3 +1,3 @@
true: package(core,async)
true: package(core)
true: thread

20
scripts/install_curl.sh Executable file
View File

@ -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

20
scripts/install_m4.sh Executable file
View File

@ -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

20
scripts/install_ocaml.sh Executable file
View File

@ -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

View File

@ -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