####################################################################################
#
-# Sphinx version
+# Sphinx and prereqs versions
#
-SPHINX_VERSION=1.1.3
-SETUPTOOLS_VERSION=0.6c11
-JINJA2_VERSION=2.6
-PYGMENTS_VERSION=1.5
+VERSION_SPHINX=1.1.3
+VERSION_DOCUTILS=0.10
+VERSION_SETUPTOOLS=0.6c11
+VERSION_JINJA2=2.6
+VERSION_PYGMENTS=1.5
check_version(){
# It is not necessary to check version!
print_env_bin(){
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
-#$DELIM ${PRODUCT_TYPE} $DELIM
-export SPHINX_ROOT=\${INST_ROOT}/${SINGLE_DIR:-${PRODUCT}}
-export SPHINX_ROOT_DIR=\${SPHINX_ROOT}
-export PYTHONPATH=\${SPHINX_ROOT}/lib/python\${PYTHON_VERSION}/site-packages:\${PYTHONPATH}
-export PATH=\${SPHINX_ROOT}/bin:\${PATH}
+#${DELIM} ${PRODUCT_TYPE} ${DELIM}
+export SPHINX_ROOT_DIR=\${INST_ROOT}/${SINGLE_DIR:-${PRODUCT}}
+export PYTHONPATH=\${SPHINX_ROOT_DIR}/lib/python\${PYTHON_VERSION}/site-packages:\${PYTHONPATH}
+export PATH=\${SPHINX_ROOT_DIR}/bin:\${PATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
print_env_src()
{
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
-#$DELIM ${PRODUCT_TYPE}_src $DELIM
+#${DELIM} ${PRODUCT_TYPE}_src ${DELIM}
# nothing to do
##
EOF
install_source()
{
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
-source ${INSTALL_WORK}/$SHRC
+source ${INSTALL_WORK}/${SHRC}
makedir ${PRODUCT_SRC_DIR}
# unpack
-check_jb tar xfz ${SOURCE_DIR}/Sphinx-${SPHINX_VERSION}.tar.gz -C ${PRODUCT_SRC_DIR}
-check_jb tar xfz ${SOURCE_DIR}/setuptools-${SETUPTOOLS_VERSION}.tar.gz -C ${PRODUCT_SRC_DIR}
-check_jb tar xfz ${SOURCE_DIR}/Jinja2-${JINJA2_VERSION}.tar.gz -C ${PRODUCT_SRC_DIR}
-check_jb tar xfz ${SOURCE_DIR}/Pygments-${PYGMENTS_VERSION}.tar.gz -C ${PRODUCT_SRC_DIR}
+check_jb tar xfz ${SOURCE_DIR}/Sphinx-${VERSION_SPHINX}.tar.gz -C ${PRODUCT_SRC_DIR}
+check_jb tar xfz ${SOURCE_DIR}/docutils-${VERSION_DOCUTILS}.tar.gz -C ${PRODUCT_SRC_DIR}
+check_jb tar xfz ${SOURCE_DIR}/setuptools-${VERSION_SETUPTOOLS}.tar.gz -C ${PRODUCT_SRC_DIR}
+check_jb tar xfz ${SOURCE_DIR}/Jinja2-${VERSION_JINJA2}.tar.gz -C ${PRODUCT_SRC_DIR}
+check_jb tar xfz ${SOURCE_DIR}/Pygments-${VERSION_PYGMENTS}.tar.gz -C ${PRODUCT_SRC_DIR}
# to generate environment scripts
try_preinstalled
GCC=`which gcc`
cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
-used gcc=$GCC
+used gcc=${GCC}
EOF
+# install docutils
+cd ${PRODUCT_SRC_DIR}/docutils-${VERSION_DOCUTILS}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
+cd ${PRODUCT_DIR}/bin
+for f in X `find . -name "*.py" -exec basename {} ";" | awk -F. '{print $1}'` ; do
+ case ${f} in
+ X ) ;;
+ * ) ln -sf ${f}.py ${f} ;;
+ esac
+done
+
# install setuptools
-cd ${PRODUCT_SRC_DIR}/setuptools-${SETUPTOOLS_VERSION}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
+cd ${PRODUCT_SRC_DIR}/setuptools-${VERSION_SETUPTOOLS}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
+
# install Pygments
-cd ${PRODUCT_SRC_DIR}/Pygments-${PYGMENTS_VERSION}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
-# install Jinja2
-cd ${PRODUCT_SRC_DIR}/Jinja2-${JINJA2_VERSION}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
-# install Sphinx
-cd ${PRODUCT_SRC_DIR}/Sphinx-${SPHINX_VERSION}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
+cd ${PRODUCT_SRC_DIR}/Pygments-${VERSION_PYGMENTS}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
-cd ${PRODUCT_DIR}/bin;
+# install Jinja2
+cd ${PRODUCT_SRC_DIR}/Jinja2-${VERSION_JINJA2}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
-scripts=`find . -type f`
-for f in X ${scripts} ; do
- if test "${f}" == "X" ; then continue ; fi
- sed -i "s%#\!.*python%#\!/usr/bin/env python%" ${f}
+# install Sphinx
+cd ${PRODUCT_SRC_DIR}/Sphinx-${VERSION_SPHINX}_SRC ; check_job ${PRODUCT_DIR}/MAKE.LOG python ./setup.py install --prefix=${PRODUCT_DIR}
+
+# fix Python exec path
+cd ${PRODUCT_DIR}/bin
+for f in X `find . -type f` ; do
+ case ${f} in
+ X ) ;;
+ * ) sed -i "s%#\!.*python%#\!/usr/bin/env python%" ${f} ;;
+ esac
done
cd ${PRODUCT_DIR}
# remove sources and temporary files after building
-if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
+if [ ${REMOVE_SRC_TMP} = "TRUE" ] ; then
test -d ${PRODUCT_SRC_DIR} && rm -fr ${PRODUCT_SRC_DIR}
fi
install_binary()
{
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
-source ${INSTALL_WORK}/$SHRC
+source ${INSTALL_WORK}/${SHRC}
# create a product directory
test -z ${SINGLE_DIR} && makedir ${PRODUCT_DIR} || mkdir -p ${PRODUCT_DIR}
export INSTALL_PRODUCTS=$7;
shift
REMOVE_SRC_TMP=$8;
-test $# == 10 && shift && SINGLE_DIR=$9
-export PRODUCT="Sphinx-${SPHINX_VERSION}"
+test $# = 10 && shift && SINGLE_DIR=$9
+export PRODUCT="Sphinx-${VERSION_SPHINX}"
export PRODUCT_DIR=${INST_ROOT}/${SINGLE_DIR:-${PRODUCT}}
export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
export PRODUCT_SRC_DIR=${INST_ROOT}/${PRODUCT}_SRC
source ./common.sh
-$PROCEDURE
+${PROCEDURE}