Bug 1745838 - Move MOZJS_*_VERSION and MOZJS_ALPHA to python configure. r=firefox-build-system-reviewers,andi

Differential Revision: https://phabricator.services.mozilla.com/D133701
This commit is contained in:
Mike Hommey 2021-12-16 07:37:34 +00:00
parent b85103fd64
commit dd2dc0cb11
2 changed files with 16 additions and 21 deletions

View File

@ -1220,3 +1220,19 @@ def enable_new_set_methods(value):
set_config("ENABLE_NEW_SET_METHODS", enable_new_set_methods)
set_define("ENABLE_NEW_SET_METHODS", enable_new_set_methods)
@depends(milestone.version)
def js_version(version):
return Version(version)
set_config("MOZJS_MAJOR_VERSION", depends(js_version.major)(lambda m: str(m)))
set_define("MOZJS_MAJOR_VERSION", js_version.major)
set_config("MOZJS_MINOR_VERSION", depends(js_version.minor)(lambda m: str(m)))
set_define("MOZJS_MINOR_VERSION", js_version.minor)
set_config("MOZJS_PATCH_VERSION", depends(js_version.patch)(lambda p: str(p)))
set_config(
"MOZJS_ALPHA",
depends(js_version)(lambda x: x.version[-2] if x.version[-2] in "ab" else None),
)

View File

@ -186,27 +186,6 @@ fi # COMPILE_ENVIRONMENT
AC_SUBST(GNU_CC)
AC_SUBST(GNU_CXX)
# Separate version into components for use in shared object naming etc
changequote(,)
MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
changequote([,])
if test -n "$IS_ALPHA"; then
changequote(,)
MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
changequote([,])
fi
AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION)
AC_SUBST(MOZJS_MAJOR_VERSION)
AC_SUBST(MOZJS_MINOR_VERSION)
AC_SUBST(MOZJS_PATCH_VERSION)
AC_SUBST(MOZJS_ALPHA)
dnl ========================================================
dnl set the defaults first
dnl ========================================================