Skip to content

Commit

Permalink
build/pkgs/{cmake,ninja_build}/spkg-configure.m4: Reject installs in …
Browse files Browse the repository at this point in the history
…inaccessible user scheme
  • Loading branch information
mkoeppe committed Feb 28, 2024
1 parent a6fb894 commit a48773c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
24 changes: 14 additions & 10 deletions build/pkgs/cmake/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
SAGE_SPKG_CONFIGURE(
[cmake], [
AC_CACHE_CHECK([for cmake >= 3.11], [ac_cv_path_CMAKE], [
AC_PATH_PROGS_FEATURE_CHECK([CMAKE], [cmake], [
cmake_version=`$ac_path_CMAKE --version 2>&1 \
| $SED -n -e 's/cmake version *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'`
AS_IF([test -n "$cmake_version"], [
AX_COMPARE_VERSION([$cmake_version], [ge], [3.11], [
ac_cv_path_CMAKE="$ac_path_CMAKE"
ac_path_CMAKE_found=:
SAGE_SPKG_CONFIGURE([cmake], [dnl
AC_CACHE_CHECK([for cmake >= 3.11], [ac_cv_path_CMAKE], [dnl
dnl Do not accept cmake installed via https://pypi.org/project/cmake/
dnl in the default user scheme; it will not work in our venv because
dnl we set PYTHONUSERBASE in sage-env.
WITH_SAGE_PYTHONUSERBASE([dnl
AC_PATH_PROGS_FEATURE_CHECK([CMAKE], [cmake], [dnl
cmake_version=`$ac_path_CMAKE --version 2>&1 \
| $SED -n -e 's/cmake version *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'`
AS_IF([test -n "$cmake_version"], [dnl
AX_COMPARE_VERSION([$cmake_version], [ge], [3.11], [dnl
ac_cv_path_CMAKE="$ac_path_CMAKE"
ac_path_CMAKE_found=:
])
])
])
])
Expand Down
30 changes: 17 additions & 13 deletions build/pkgs/ninja_build/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
SAGE_SPKG_CONFIGURE(
[ninja_build], [
dnl meson_python needs 1.8.2 or later
AC_CACHE_CHECK([for ninja >= 1.8.2], [ac_cv_path_NINJA], [
AC_PATH_PROGS_FEATURE_CHECK([NINJA], [ninja], [
dnl support both two- and three-component version schemes
dnl since samurai (a ninja alternative) uses two
ninja_version=`$ac_path_NINJA --version 2>&1 \
| $SED -n -e 's/\([[0-9]]*\(\.[[0-9]]*\)\{1,2\}\).*/\1/p'`
AS_IF([test -n "$ninja_version"], [
AX_COMPARE_VERSION([$ninja_version], [ge], [1.8.2], [
ac_cv_path_NINJA="$ac_path_NINJA"
ac_path_NINJA_found=:
SAGE_SPKG_CONFIGURE([ninja_build], [dnl
dnl meson_python needs 1.8.2 or later
AC_CACHE_CHECK([for ninja >= 1.8.2], [ac_cv_path_NINJA], [dnl
dnl Do not accept ninja installed from https://pypi.org/project/ninja/
dnl in the default user scheme; it will not work in our venv because
dnl we set PYTHONUSERBASE in sage-env.
WITH_SAGE_PYTHONUSERBASE([dnl
AC_PATH_PROGS_FEATURE_CHECK([NINJA], [ninja], [dnl
dnl support both two- and three-component version schemes
dnl since samurai (a ninja alternative) uses two
ninja_version=`$ac_path_NINJA --version 2>&1 \
| $SED -n -e 's/\([[0-9]]*\(\.[[0-9]]*\)\{1,2\}\).*/\1/p'`
AS_IF([test -n "$ninja_version"], [dnl
AX_COMPARE_VERSION([$ninja_version], [ge], [1.8.2], [
ac_cv_path_NINJA="$ac_path_NINJA"
ac_path_NINJA_found=:
])
])
])
])
Expand Down

0 comments on commit a48773c

Please sign in to comment.