diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index e82d1ea8a5a..e298620f2ea 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -158,7 +158,6 @@ $RUN ./bootstrap FROM bootstrapped as configured #:configuring: ADD src/bin src/bin -ADD src/Makefile.in src/Makefile.in RUN mkdir -p logs/pkgs; ln -s logs/pkgs/config.log config.log ARG EXTRA_CONFIGURE_ARGS="" EOF diff --git a/build/make/Makefile.in b/build/make/Makefile.in index a3d198be7ab..f17d4a49ab4 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -85,14 +85,12 @@ STANDARD_PACKAGE_INSTS = \ $(foreach pkgname,$(STANDARD_PACKAGES),$(inst_$(pkgname))) # All optional installed packages (triggers the auto-update) -OPTIONAL_INSTALLED_PACKAGES = \ -@SAGE_OPTIONAL_INSTALLED_PACKAGES@ +OPTIONAL_INSTALLED_PACKAGES = @SAGE_OPTIONAL_INSTALLED_PACKAGES@ OPTIONAL_INSTALLED_PACKAGE_INSTS = \ $(foreach pkgname,$(OPTIONAL_INSTALLED_PACKAGES),$(inst_$(pkgname))) # All previously installed optional packages that are to be uninstalled -OPTIONAL_CLEANED_PACKAGES = \ -@SAGE_OPTIONAL_CLEANED_PACKAGES@ +OPTIONAL_CLEANED_PACKAGES = @SAGE_OPTIONAL_CLEANED_PACKAGES@ OPTIONAL_CLEANED_PACKAGES_CLEANS = $(OPTIONAL_CLEANED_PACKAGES:%=%-clean) # All packages which should be downloaded @@ -495,14 +493,14 @@ endif # # $(INST)/-: # $(AM_V_at)cd '$SAGE_ROOT' && \\ -# source '$SAGE_ROOT/src/bin/sage-env' && \\ +# . '$SAGE_ROOT/src/bin/sage-env' && \\ # sage-logger -p '$SAGE_ROOT/build/pkgs//spkg-install' '$(SAGE_LOGS)/.log' # # : $(INST)/- # # -clean: # -$(AM_V_at)cd '$SAGE_ROOT' && \\ -# source '$SAGE_ROOT/src/bin/sage-env' && \\ +# . '$SAGE_ROOT/src/bin/sage-env' && \\ # '$SAGE_ROOT/build/pkgs/$PKG_NAME/spkg-uninstall' # Positional arguments: @@ -513,16 +511,16 @@ define SCRIPT_PACKAGE_templ $(1)-build-deps: $(3) $$(INST)/$(1)-$(2): $(3) - $(AM_V_at)cd '$$(SAGE_ROOT)' && \ - source '$$(SAGE_ROOT)/src/bin/sage-env' && source '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ + $(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ + . '$$(SAGE_ROOT)/src/bin/sage-env' && . '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' '$$(SAGE_LOGS)/$(1)-$(2).log' touch "$$@" $(1): $$(INST)/$(1)-$(2) $(1)-uninstall: - -$(AM_V_at)cd '$$(SAGE_ROOT)' && \ - source '$$(SAGE_ROOT)/src/bin/sage-env' && source '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ + -$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ + . '$$(SAGE_ROOT)/src/bin/sage-env' && . '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-uninstall' -rm -f "$$(INST)/$(1)-$(2)" diff --git a/build/pkgs/cvxopt/spkg-install.in b/build/pkgs/cvxopt/spkg-install.in index 980eddf1493..bed0f34ceee 100644 --- a/build/pkgs/cvxopt/spkg-install.in +++ b/build/pkgs/cvxopt/spkg-install.in @@ -1,20 +1,69 @@ cd src -# Stolen from Gentoo -pkg_libs() { - pkg-config --libs-only-l $* | \ - sed -e 's:[ ]-l*\(pthread\|m\)\([ ]\|$\)::g' -e 's:[ ]*$::' | \ - tr ' ' '\n' | sort -u | sed -e "s:^-l\(.*\):\1:g" | \ - tr '\n' ';' | sed -e 's:;$::' -} +# This is a POSIX (non-bash) compatible version of the same function +# in the Gentoo cvxopt package. It's more general than it needs to +# be right now because we may need to use the "L" and "I" modes in +# the future to support system installations of e.g. suitesparse. +# +# The BLAS_LIB and LAPACK_LIB variables (among others) in cvxopt's +# setup.py are passed in as colon-delimited strings. So, for example, +# if your blas "l" flags are "-lblas -lcblas", then cvxopt wants +# "blas;cblas" for BLAS_LIB. +# +# The following function takes a flag type ("l", "L", or "I") as its +# first argument and a list of packages as its remaining arguments. It +# outputs a list of libraries, library paths, or include paths, +# respectively, for the given packages, retrieved using pkg-config and +# deduplicated, in the appropriate format. +# +cvxopt_output() { + FLAGNAME="${1}" + shift + PACKAGES="${@}" + + case "${FLAGNAME}" in + l) PKGCONFIG_MODE="--libs-only-l";; + L) PKGCONFIG_MODE="--libs-only-L";; + I) PKGCONFIG_MODE="--cflags-only-I";; + *) echo "invalid flag name: ${FLAGNAME}"; exit 1;; + esac + + CVXOPT_OUTPUT="" + for PKGCONFIG_ITEM in $(pkg-config ${PKGCONFIG_MODE} ${PACKAGES}); do + # First strip off the leading "-l", "-L", or "-I", and replace + # it with a semicolon... + PKGCONFIG_ITEM=";${PKGCONFIG_ITEM#-${FLAGNAME}}" + # Now check to see if this element is already present in the + # list, and skip it if it is. This eliminates multiple entries + # from winding up in the list when multiple package arguments are + # passed to this function. + if [ "${CVXOPT_OUTPUT}" != "${CVXOPT_OUTPUT%${PKGCONFIG_ITEM}}" ] + then + # It was already the last entry in the list, so skip it. + continue + elif [ "${CVXOPT_OUTPUT}" != "${CVXOPT_OUTPUT%${PKGCONFIG_ITEM};*}" ] + then + # It was an earlier entry in the list. These two cases are + # separate to ensure that we can e.g. find ";m" at the end + # of the list, but that we don't find ";metis" in the process. + continue + fi + + # It isn't in the list yet, so append it. + CVXOPT_OUTPUT="${CVXOPT_OUTPUT}${PKGCONFIG_ITEM}" + done + + # Strip the leading ";" from ";foo;bar" before output. + echo "${CVXOPT_OUTPUT#;}" +} # configure cvxopt by variables # Note that *_INC_DIR variables have to be non-empty. # Compilers don't like "-I ". -export CVXOPT_BLAS_LIB="$(pkg_libs blas)" +export CVXOPT_BLAS_LIB="$(cvxopt_output l blas)" export CVXOPT_BLAS_LIB_DIR="$(pkg-config --variable=libdir blas)" -export CVXOPT_LAPACK_LIB="$(pkg_libs lapack)" +export CVXOPT_LAPACK_LIB="$(cvxopt_output l lapack)" if test "x$SAGE_SUITESPARSE_LOCALINSTALL" != "x"; then export CVXOPT_SUITESPARSE_LIB_DIR="${SAGE_LOCAL}" diff --git a/build/pkgs/fflas_ffpack/patches/fix-ksh-pkgconfig.patch b/build/pkgs/fflas_ffpack/patches/fix-ksh-pkgconfig.patch new file mode 100644 index 00000000000..fdaed2eebee --- /dev/null +++ b/build/pkgs/fflas_ffpack/patches/fix-ksh-pkgconfig.patch @@ -0,0 +1,28 @@ +From 33a5ec4977f36ce3a24c9ee824d9dd053b8cea04 Mon Sep 17 00:00:00 2001 +From: Dima Pasechnik +Date: Fri, 8 May 2020 15:55:27 +0100 +Subject: [PATCH 1/1] remove 1st and last file in .pc file + +this causes problem if building with ksh, as they remain, causing a broken .pc file. +--- + fflas-ffpack.pc.in | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/fflas-ffpack.pc.in b/fflas-ffpack.pc.in +index a2618d6..e34a744 100644 +--- a/fflas-ffpack.pc.in ++++ b/fflas-ffpack.pc.in +@@ -1,4 +1,3 @@ +-/------------------ fflas-ffpack.pc ------------------------ + prefix=@prefix@ + exec_prefix=@prefix@ + libdir=@prefix@/lib +@@ -11,4 +10,3 @@ Version: @VERSION@ + Requires: givaro >= 4.0.3 + Libs: @PARLIBS@ @PRECOMPILE_LIBS@ @BLAS_LIBS@ + Cflags: -I@includedir@ @BLAS_CFLAGS@ @PARFLAGS@ @PRECOMPILE_FLAGS@ @REQUIRED_FLAGS@ +-\------------------------------------------------------- +\ No newline at end of file +-- +2.26.2 + diff --git a/build/pkgs/givaro/patches/fix-ksh-pkgconfig.patch b/build/pkgs/givaro/patches/fix-ksh-pkgconfig.patch new file mode 100644 index 00000000000..28fd95088c8 --- /dev/null +++ b/build/pkgs/givaro/patches/fix-ksh-pkgconfig.patch @@ -0,0 +1,27 @@ +From 91dcba743e15288abe69966a5f71704d9adcc57c Mon Sep 17 00:00:00 2001 +From: Dima Pasechnik +Date: Fri, 8 May 2020 10:22:57 +0100 +Subject: [PATCH 1/1] remove 1st and last lines in givaro.pc.in + +--- + givaro.pc.in | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/givaro.pc.in b/givaro.pc.in +index 285b854..af38bf3 100644 +--- a/givaro.pc.in ++++ b/givaro.pc.in +@@ -1,4 +1,3 @@ +-/------------------ givaro.pc ------------------------ + prefix=@prefix@ + exec_prefix=@prefix@ + libdir=@prefix@/lib +@@ -11,4 +10,3 @@ Version: @VERSION@ + Requires: + Libs: -L@libdir@ -lgivaro @LIBS@ + Cflags: -I@includedir@ @REQUIRED_FLAGS@ +-\------------------------------------------------------- +\ No newline at end of file +-- +2.26.2 + diff --git a/build/pkgs/linbox/patches/fix-ksh-pkgconfig.patch b/build/pkgs/linbox/patches/fix-ksh-pkgconfig.patch new file mode 100644 index 00000000000..e0cb575b1a1 --- /dev/null +++ b/build/pkgs/linbox/patches/fix-ksh-pkgconfig.patch @@ -0,0 +1,28 @@ +From 52c78df67a08de074991a93b57946b7bd5ea7196 Mon Sep 17 00:00:00 2001 +From: Dima Pasechnik +Date: Fri, 8 May 2020 15:53:25 +0100 +Subject: [PATCH 1/1] remove redundant 1st and last lines + +they remain if the script is run under ksh, leading to broken .pc file +--- + linbox.pc.in | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/linbox.pc.in b/linbox.pc.in +index f54285e..eb6835b 100644 +--- a/linbox.pc.in ++++ b/linbox.pc.in +@@ -1,4 +1,3 @@ +-/------------------ linbox.pc ------------------------ + prefix=@prefix@ + exec_prefix=@prefix@ + libdir=@libdir@ +@@ -11,4 +10,4 @@ Version: @VERSION@ + Requires: fflas-ffpack >= 2.4.0, givaro >= 4.1.0 + Libs: -L${libdir} -llinbox @LINBOXSAGE_LIBS@ @NTL_LIBS@ @MPFR_LIBS@ @FPLLL_LIBS@ @IML_LIBS@ @FLINT_LIBS@ @OCL_LIBS@ + Cflags: @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR -I${includedir} @NTL_CFLAGS@ @MPFR_CFLAGS@ @FPLLL_CFLAGS@ @IML_CFLAGS@ @FLINT_CFLAGS@ +-\------------------------------------------------------- ++ +-- +2.26.2 + diff --git a/build/pkgs/lrcalc/spkg-install.in b/build/pkgs/lrcalc/spkg-install.in index 46b765298c6..d6665bfb427 100644 --- a/build/pkgs/lrcalc/spkg-install.in +++ b/build/pkgs/lrcalc/spkg-install.in @@ -1,7 +1,8 @@ cd src # Use newer version of config.guess and config.sub (see Trac #19725) -cp "$SAGE_ROOT"/config/config.* . +cp "$SAGE_ROOT"/config/config.guess . +cp "$SAGE_ROOT"/config/config.sub . sdh_configure sdh_make diff --git a/build/pkgs/mpc/spkg-configure.m4 b/build/pkgs/mpc/spkg-configure.m4 index 9ec14a7c980..32aca4ada1b 100644 --- a/build/pkgs/mpc/spkg-configure.m4 +++ b/build/pkgs/mpc/spkg-configure.m4 @@ -8,7 +8,7 @@ SAGE_SPKG_CONFIGURE([mpc], [ AC_MSG_RESULT([no]) AC_CHECK_HEADER(mpc.h, [], [sage_spkg_install_mpc=yes]) dnl mpc_cmp_abs appeared in MPC 1.1.0 - AC_SEARCH_LIBS([mpc_cmp_abs], [mpc], [break], [sage_spkg_install_mpc=yes]) + AC_SEARCH_LIBS([mpc_cmp_abs], [mpc], [], [sage_spkg_install_mpc=yes]) fi ], [], [], [ if test x$sage_spkg_install_mpc = xyes; then diff --git a/build/pkgs/mpfr/spkg-configure.m4 b/build/pkgs/mpfr/spkg-configure.m4 index 0d0ef933027..0c15b56df43 100644 --- a/build/pkgs/mpfr/spkg-configure.m4 +++ b/build/pkgs/mpfr/spkg-configure.m4 @@ -8,7 +8,7 @@ SAGE_SPKG_CONFIGURE([mpfr], [ AC_MSG_RESULT([no]) AC_CHECK_HEADER(mpfr.h, [], [sage_spkg_install_mpfr=yes]) dnl mpfr_free_pool appeared in r11922 (Dec 2017) on MPFR svn - AC_SEARCH_LIBS([mpfr_free_pool], [mpfr], [break], [sage_spkg_install_mpfr=yes]) + AC_SEARCH_LIBS([mpfr_free_pool], [mpfr], [], [sage_spkg_install_mpfr=yes]) fi ], [], [], [ if test x$sage_spkg_install_mpfr = xyes; then diff --git a/build/pkgs/mpir/spkg-configure.m4 b/build/pkgs/mpir/spkg-configure.m4 index c4f9c432e2a..01afff14621 100644 --- a/build/pkgs/mpir/spkg-configure.m4 +++ b/build/pkgs/mpir/spkg-configure.m4 @@ -5,7 +5,7 @@ dnl Implement cases for what to do on different options here AC_CHECK_HEADER(gmp.h, [], [sage_spkg_install_mpir=yes]) AC_CHECK_HEADER(gmpxx.h, [], [sage_spkg_install_mpir=yes]) dnl mpq_cmp_z appeared in GMP 6.1.0 and is used by pynac - AC_SEARCH_LIBS([__gmpq_cmp_z], [gmp], [break], + AC_SEARCH_LIBS([__gmpq_cmp_z], [gmp], [], [sage_spkg_install_mpir=yes]) SAGE_MP_LIBRARY=mpir ;; diff --git a/build/pkgs/ncurses/spkg-configure.m4 b/build/pkgs/ncurses/spkg-configure.m4 index 8fe619cbefd..c706d4091d5 100644 --- a/build/pkgs/ncurses/spkg-configure.m4 +++ b/build/pkgs/ncurses/spkg-configure.m4 @@ -2,8 +2,8 @@ SAGE_SPKG_CONFIGURE([ncurses], [ dnl First try checking for ncurses with pkg-config PKG_CHECK_MODULES([NCURSES], [ncurses >= 6.0], [], [AC_CHECK_HEADERS([ncurses.h], - [AC_SEARCH_LIBS([wresize], [ncurses tinfo], [break], - [sage_spkg_install_ncurses=yes])], + [AC_SEARCH_LIBS([wresize], [ncurses tinfo], [], + [sage_spkg_install_ncurses=yes])], [sage_spkg_install_ncurses=yes])], [sage_spkg_install_ncurses=yes]) ]) diff --git a/build/pkgs/readline/spkg-configure.m4 b/build/pkgs/readline/spkg-configure.m4 index 4d82c6d77be..68aab0a36ad 100644 --- a/build/pkgs/readline/spkg-configure.m4 +++ b/build/pkgs/readline/spkg-configure.m4 @@ -11,7 +11,7 @@ SAGE_SPKG_CONFIGURE([readline], [ [AC_CHECK_HEADERS([readline/readline.h], dnl rl_bind_keyseq is not present in macos's readline dnl and is not present in readline version 4 (the one in OpenBSD) - [AC_SEARCH_LIBS([rl_bind_keyseq], [readline], [break], + [AC_SEARCH_LIBS([rl_bind_keyseq], [readline], [], [sage_spkg_install_readline=yes])], [sage_spkg_install_readline=yes])], [sage_spkg_install_readline=yes]) diff --git a/build/pkgs/sage_conf/spkg-install b/build/pkgs/sage_conf/spkg-install index bdb5c41ac95..468970ba085 100755 --- a/build/pkgs/sage_conf/spkg-install +++ b/build/pkgs/sage_conf/spkg-install @@ -9,4 +9,4 @@ if [ $? -ne 0 ]; then echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" exit 1 fi -cd $SAGE_ROOT/build/pkgs/sage_conf/src && sdh_pip_install . +cd src && sdh_pip_install . diff --git a/build/pkgs/texlive/spkg-install b/build/pkgs/texlive/spkg-install index c78d70af19c..7291d2fcf0d 100755 --- a/build/pkgs/texlive/spkg-install +++ b/build/pkgs/texlive/spkg-install @@ -1 +1 @@ -exec sage-python23 build/pkgs/texlive/spkg-install.py +exec sage-python23 spkg-install.py diff --git a/configure.ac b/configure.ac index b32c2f42c2b..2b6977d0e62 100644 --- a/configure.ac +++ b/configure.ac @@ -28,31 +28,6 @@ AC_PREREQ([2.69]) AC_DEFUN([SAGE_VERSION], m4_esyscmd_s([. src/bin/sage-version.sh && echo $SAGE_VERSION])) AC_INIT([Sage], SAGE_VERSION, [sage-devel@googlegroups.com]) -# The following needs to be immediately after calling AC_INIT -#------------------------------------------------------------ -# We need to run this configure script with bash -if test -z "$BASH_VERSION" -then - CONFIG_SHELL=`command -v bash` - export CONFIG_SHELL - if $CONFIG_SHELL -c "exit 0" - then - exec $CONFIG_SHELL $0 "$@" - else - AC_MSG_NOTICE([The 'bash' shell is needed to build AC_PACKAGE_NAME]) - AC_MSG_NOTICE([All modern systems will have the 'bash' shell installed somewhere]) - if test -d /opt/OpenSource/bin - then - AC_MSG_NOTICE([On HP-UX you may try adding /opt/OpenSource/bin to your path]) - fi - if test -d /opt/pware/bin - then - AC_MSG_NOTICE([On AIX you may try adding /opt/pware/bin to your path]) - fi - AC_MSG_ERROR(['bash' not found]) - fi -fi - AC_COPYRIGHT([GPL version 3]) AC_CONFIG_SRCDIR([configure.ac]) @@ -447,13 +422,12 @@ SAGE_SPKG_COLLECT() # TODO: fix this in Trac #21524 touch "$SAGE_SRC/bin/sage-env-config" -SAGE_SCRIPTS='\ -' +SAGE_SCRIPTS='' for file in "$SAGE_SRC/bin/"*; do # Skip files with ".in" extension ext=${file##*.} if test "$ext" != in; then - SAGE_SCRIPTS+=" \$(SAGE_LOCAL)${file#$SAGE_SRC} \\"$'\n' + SAGE_SCRIPTS="${SAGE_SCRIPTS} \\$(printf '\n ')\$(SAGE_LOCAL)${file#$SAGE_SRC}" fi done diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 2a128e0b21b..762e4918283 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -100,34 +100,31 @@ newest_version() { # not required on this platform or that can be taken from the underlying system # installation. Note that this contains packages that are not actually going to # be installed by most users because they are optional/experimental. -SAGE_BUILT_PACKAGES='\ -' +SAGE_BUILT_PACKAGES='' + # The complement of SAGE_BUILT_PACKAGES, i.e., packages that are not required # on this platform or packages where we found a suitable package on the # underlying system. -SAGE_DUMMY_PACKAGES='\ -' +SAGE_DUMMY_PACKAGES='' + # Standard packages -SAGE_STANDARD_PACKAGES='\ -' +SAGE_STANDARD_PACKAGES='' + # List of currently installed and to-be-installed optional packages - filled in SAGE_SPKG_ENABLE #SAGE_OPTIONAL_INSTALLED_PACKAGES # List of optional packages to be uninstalled - filled in SAGE_SPKG_ENABLE #SAGE_OPTIONAL_CLEANED_PACKAGES # List of all packages that should be downloaded -SAGE_SDIST_PACKAGES='\ -' +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='\ -' +SAGE_NORMAL_PACKAGES='' +SAGE_PIP_PACKAGES='' +SAGE_SCRIPT_PACKAGES='' SAGE_NEED_SYSTEM_PACKAGES="" @@ -159,7 +156,7 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do message="came preinstalled with the SageMath tarball" ;; standard) - SAGE_STANDARD_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_STANDARD_PACKAGES="${SAGE_STANDARD_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" in_sdist=yes message="will be installed as an SPKG" ;; @@ -202,7 +199,7 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do uninstall_message="$SPKG_TYPE pip package (installed)" fi - SAGE_PACKAGE_VERSIONS+="vers_$SPKG_NAME = $SPKG_VERSION"$'\n' + SAGE_PACKAGE_VERSIONS="${SAGE_PACKAGE_VERSIONS}$(printf '\nvers_')${SPKG_NAME} = ${SPKG_VERSION}" AS_VAR_PUSHDEF([sage_spkg_install], [sage_spkg_install_${SPKG_NAME}])dnl AS_VAR_PUSHDEF([sage_require], [sage_require_${SPKG_NAME}])dnl @@ -213,13 +210,13 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do # "./sage -i SPKG_NAME" will still install the package. AS_VAR_IF([sage_spkg_install], [no], [ dnl We will use the system package (or not required for this platform.) - SAGE_DUMMY_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_DUMMY_PACKAGES="${SAGE_DUMMY_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" AS_VAR_IF([sage_require], [yes], [ message="using system package; SPKG will not be installed" ], [ message="not required on your platform; SPKG will not be installed" ]) ], [ dnl We won't use the system package. - SAGE_BUILT_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_BUILT_PACKAGES="${SAGE_BUILT_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" AS_VAR_SET_IF([sage_use_system], [ AS_VAR_COPY([reason], [sage_use_system]) AS_CASE([$reason], @@ -249,7 +246,7 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do esac if test "$in_sdist" = yes; then - SAGE_SDIST_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_SDIST_PACKAGES="${SAGE_SDIST_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" fi # Determine package source @@ -282,18 +279,18 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do fi fi - SAGE_PACKAGE_DEPENDENCIES+="deps_$SPKG_NAME = $DEPS"$'\n' + SAGE_PACKAGE_DEPENDENCIES="${SAGE_PACKAGE_DEPENDENCIES}$(printf '\ndeps_')${SPKG_NAME} = ${DEPS}" # Determine package build rules case "$SPKG_SOURCE" in pip) - SAGE_PIP_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_PIP_PACKAGES="${SAGE_PIP_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" ;; script) - SAGE_SCRIPT_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_SCRIPT_PACKAGES="${SAGE_SCRIPT_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" ;; normal) - SAGE_NORMAL_PACKAGES+=" $SPKG_NAME \\"$'\n' + SAGE_NORMAL_PACKAGES="${SAGE_NORMAL_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" ;; esac done diff --git a/m4/sage_spkg_enable.m4 b/m4/sage_spkg_enable.m4 index 820ff5cf3a5..c349aab5f9a 100644 --- a/m4/sage_spkg_enable.m4 +++ b/m4/sage_spkg_enable.m4 @@ -19,7 +19,8 @@ AS_HELP_STRING([--disable-]SPKG_NAME, AS_IF([test "$want_spkg" = if_installed], [AS_VAR_SET([want_spkg], $is_installed)]) - AS_VAR_SET([spkg_line], [" ]SPKG_NAME[ \\"$'\n']) + + spkg_line=" \\$(printf '\n ')SPKG_NAME" AS_CASE([$is_installed-$want_spkg], [*-yes], [AS_VAR_APPEND(SAGE_OPTIONAL_INSTALLED_PACKAGES, "$spkg_line")], [yes-no], [AS_VAR_APPEND(SAGE_OPTIONAL_CLEANED_PACKAGES, "$spkg_line")]) diff --git a/src/bin/sage-env b/src/bin/sage-env index 51beb29a090..f3a005f573a 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -44,12 +44,10 @@ resolvelinks() { # Move stuff from $in to $out while [ -n "$in" ]; do # Normalize $in by replacing consecutive slashes by one slash - while { in_single_slash=${in//\/\//\/}; [ "$in" != "$in_single_slash" ]; }; do - in=$in_single_slash - done + in=$(echo "${in}" | sed 's://*:/:g') # If $in starts with a slash, remove it and set $out to the root - in_without_slash=${in/#\//} + in_without_slash=${in#/} if [ "$in" != "$in_without_slash" ]; then in=$in_without_slash out="/" @@ -71,7 +69,7 @@ resolvelinks() { out="$out$f" # If the new $in starts with a slash, move it to $out - in_without_slash=${in/#\//} + in_without_slash=${in#/} if [ "$in" != "$in_without_slash" ]; then in=$in_without_slash out="$out/" @@ -103,7 +101,8 @@ resolvelinks() { fi # In $in, replace $f by $f_resolved (leave $out alone) - in=${in/#"$f"/"$f_resolved"} + in="${in#${f}}" + in="${f_resolved}${in}" done # Return $out @@ -463,7 +462,7 @@ unset R_PROFILE if [ -d "$SAGE_LOCAL/lib/R/share" ] ; then R_MAKEVARS_SITE="$SAGE_LOCAL/lib/R/share/Makevars.site" && export R_MAKEVARS_SITE if ! [ -f "$R_MAKEVARS_SITE" ] ; then - if ! [ -a "$R_MAKEVARS_SITE" ] ; then + if ! [ -e "$R_MAKEVARS_SITE" ] ; then echo "## Empty site-wide Makevars file for Sage's R" > "$R_MAKEVARS_SITE" else >&2 echo "Warning: $R_MAKEVARS_SITE exists and is not a file : trouble ahead..." @@ -472,7 +471,7 @@ if [ -d "$SAGE_LOCAL/lib/R/share" ] ; then fi if [ -d "$DOT_SAGE" ] ; then if ! [ -d "$DOT_SAGE/R" ] ; then - if ! [ -a "$DOT_SAGE/R" ] ; then + if ! [ -e "$DOT_SAGE/R" ] ; then mkdir -p "$DOT_SAGE/R" else >&2 echo "Warning: $DOT_SAGE/R exists and is not a directory : trouble ahead..." @@ -480,7 +479,7 @@ if [ -d "$DOT_SAGE" ] ; then fi R_MAKEVARS_USER="$DOT_SAGE/R/Makevars.user" && export R_MAKEVARS_USER if ! [ -f "$R_MAKEVARS_USER" ] ; then - if ! [ -a "$R_MAKEVARS_USER" ] ; then + if ! [ -e "$R_MAKEVARS_USER" ] ; then echo "## Empty user-specific Makevars file for Sage's R" > "$R_MAKEVARS_USER" else >&2 echo "Warning: $R_MAKEVARS_USER exists and is not a file : trouble ahead..." @@ -603,9 +602,10 @@ ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR # First, figure out the right values for SAGE_NUM_THREADS (default # number of threads) and SAGE_NUM_THREADS_PARALLEL (default number of # threads when parallel execution is asked explicitly). -sage_num_threads_array=(`sage-num-threads.py 2>/dev/null || echo 1 2 1`) -SAGE_NUM_THREADS=${sage_num_threads_array[0]} -SAGE_NUM_THREADS_PARALLEL=${sage_num_threads_array[1]} +sage_num_threads_array=$(sage-num-threads.py 2>/dev/null || echo 1 2 1) +sage_num_threads_array="${sage_num_threads_array% *}" # strip third item +SAGE_NUM_THREADS="${sage_num_threads_array% *}" # keep first item +SAGE_NUM_THREADS_PARALLEL="${sage_num_threads_array#* }" # keep second item export SAGE_NUM_THREADS export SAGE_NUM_THREADS_PARALLEL