Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Moved the code that collects up SPKG info into a single SAGE_SPKG_COL…
Browse files Browse the repository at this point in the history
…LECT macro, along with additional documentation thereof.
  • Loading branch information
embray committed Mar 6, 2018
1 parent 6f99aab commit bb9ff43
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 169 deletions.
170 changes: 1 addition & 169 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -741,175 +741,7 @@ if test "$SAGE_INSTALL_CCACHE" = yes ; then
fi
AC_SUBST([SAGE_TOOLCHAIN])

# To deal with ABI incompatibilities when gcc is upgraded, every package
# (except gcc) should depend on gcc if gcc is already installed.
# See https://trac.sagemath.org/ticket/24703
if test x$SAGE_INSTALL_GCC = xexists; then
GCC_DEP=' $(SAGE_LOCAL)/bin/gcc'
else
GCC_DEP=''
fi

AC_MSG_CHECKING([package versions])
AC_MSG_RESULT([])

# Usage: newest_version $pkg
# Print version number of latest package $pkg
newest_version() {
PKG=$1
if test -f "$SAGE_ROOT/build/pkgs/$PKG/package-version.txt" ; then
cat "$SAGE_ROOT/build/pkgs/$PKG/package-version.txt"
else
echo "$PKG"
fi
}

# Lists of packages that are actually built/installed and dummy packages
SAGE_BUILT_PACKAGES='\
'
SAGE_DUMMY_PACKAGES='\
'
# List of all standard packages
SAGE_STANDARD_PACKAGES='\
'
# List of all currently installed optional packages
SAGE_OPTIONAL_INSTALLED_PACKAGES='\
'
# List of all packages that should be downloaded
SAGE_SDIST_PACKAGES='\
'
# Generate package version and dependency lists
SAGE_PACKAGE_VERSIONS=""
SAGE_PACKAGE_DEPENDENCIES=""
# Lists of packages categorized according to their build rules
SAGE_NORMAL_PACKAGES='\
'
SAGE_PIP_PACKAGES='\
'
SAGE_SCRIPT_PACKAGES='\
'

# for each package in pkgs/, add them to the SAGE_PACKAGE_VERSIONS and
# SAGE_PACKAGE_DEPENDENCIES lists, and to one or more of the above variables
# depending on the package type and other criteria (such as whether or not it
# needs to be installed)

for DIR in $SAGE_ROOT/build/pkgs/*; do
test -d "$DIR" || continue

PKG_TYPE_FILE="$DIR/type"
if test -f "$PKG_TYPE_FILE"; then
PKG_TYPE=`cat $PKG_TYPE_FILE`
else
AC_MSG_ERROR(["$PKG_TYPE_FILE" is missing.])
fi

PKG_NAME=$(basename $DIR)
PKG_VERSION=$(newest_version $PKG_NAME)

in_sdist=no

# Check consistency of 'DIR/type' file
case "$PKG_TYPE" in
base) ;;
standard)
SAGE_STANDARD_PACKAGES+=" $PKG_NAME \\"$'\n'
in_sdist=yes
;;
optional)
if test -f $SAGE_SPKG_INST/$PKG_NAME-*; then
SAGE_OPTIONAL_INSTALLED_PACKAGES+=" $PKG_NAME \\"$'\n'
fi;
;;
experimental) ;;
script) ;;
pip) ;;
*)
AC_MSG_ERROR([The content of "$PKG_TYPE_FILE" must be 'base', 'standard', 'optional', 'experimental', 'script', or 'pip'])
;;
esac

SAGE_PACKAGE_VERSIONS+="vers_$PKG_NAME = $PKG_VERSION"$'\n'

# If $need_to_install_{PKG_NAME} is set to no, then set inst_<pkgname> to
# some dummy file to skip the installation. Note that an explicit
# "./sage -i PKG_NAME" will still install the package.
if test "$PKG_NAME" != "$PKG_VERSION"; then
need_to_install="need_to_install_${PKG_NAME}"

if test "${!need_to_install}" != no ; then
SAGE_BUILT_PACKAGES+=" $PKG_NAME \\"$'\n'
AC_MSG_RESULT([ $PKG_NAME-$PKG_VERSION])
else
SAGE_DUMMY_PACKAGES+=" $PKG_NAME \\"$'\n'
AC_MSG_RESULT([ $PKG_NAME-$PKG_VERSION not installed (configure check)])
fi
fi

# Packages that should be included in the source distribution
# This includes all standard packages and two special cases
case "$PKG_NAME" in
mpir|python2)
in_sdist=yes
;;
esac

if test "$in_sdist" = yes; then
SAGE_SDIST_PACKAGES+=" $PKG_NAME \\"$'\n'
fi

# Determine package dependencies
DEP_FILE="$SAGE_ROOT/build/pkgs/$PKG_NAME/dependencies"
if test -f "$DEP_FILE"; then
# - the # symbol is treated as comment which is removed
DEPS=`sed 's/^ *//; s/ *#.*//; q' $DEP_FILE`
else
case "$PKG_TYPE" in
optional)
DEPS=' | $(STANDARD_PACKAGES)' # default for optional packages
;;
script)
DEPS=' | $(STANDARD_PACKAGES)' # default for script-only packages
;;
pip)
DEPS=' | pip'
;;
*)
DEPS=""
;;
esac
fi

# Special case for GCC; see definition of GCC_DEP above
test "$PKG_NAME" = gcc || DEPS="$GCC_DEP$DEPS"

SAGE_PACKAGE_DEPENDENCIES+="deps_$PKG_NAME = $DEPS"$'\n'

# Determine package build rules
case "$PKG_TYPE" in
pip)
SAGE_PIP_PACKAGES+=" $PKG_NAME \\"$'\n'
;;
script)
SAGE_SCRIPT_PACKAGES+=" $PKG_NAME \\"$'\n'
;;
*)
SAGE_NORMAL_PACKAGES+=" $PKG_NAME \\"$'\n'
;;
esac
done

AC_SUBST([SAGE_PACKAGE_VERSIONS])
AC_SUBST([SAGE_PACKAGE_DEPENDENCIES])
AC_SUBST([SAGE_NORMAL_PACKAGES])
AC_SUBST([SAGE_PIP_PACKAGES])
AC_SUBST([SAGE_SCRIPT_PACKAGES])
AC_SUBST([SAGE_BUILT_PACKAGES])
AC_SUBST([SAGE_DUMMY_PACKAGES])
AC_SUBST([SAGE_STANDARD_PACKAGES])
AC_SUBST([SAGE_OPTIONAL_INSTALLED_PACKAGES])
AC_SUBST([SAGE_SDIST_PACKAGES])

SAGE_SPKG_COLLECT()

# We need sage-env-config to exist before running this.
# TODO: fix this in Trac #21524
Expand Down
Loading

0 comments on commit bb9ff43

Please sign in to comment.