Skip to content

Commit

Permalink
Bug 1641790 - Move --with-system-nss to python configure. r=firefox-b…
Browse files Browse the repository at this point in the history
…uild-system-reviewers,rstewart

Version of NSS >= 3.27 have a pkg-config file. We're now requiring 3.53,
so while moving, just use pkg-config, which is simpler.

The old-configure check that rejected some untested platforms for
in-tree NSS is actually rejecting none: the accepted platforms cover all
the supported ones, so we remove that check.

And because building with system NSS without system NSPR doesn't make
sense, imply the latter when the former is used.

Differential Revision: https://phabricator.services.mozilla.com/D77428
  • Loading branch information
glandium committed May 29, 2020
1 parent 1dd266a commit be0e03c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 126 deletions.
1 change: 0 additions & 1 deletion aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ builtin(include, build/autoconf/hotfixes.m4)dnl
builtin(include, build/autoconf/hooks.m4)dnl
builtin(include, build/autoconf/config.status.m4)dnl
builtin(include, build/autoconf/toolchain.m4)dnl
builtin(include, build/autoconf/nss.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
Expand Down
91 changes: 0 additions & 91 deletions build/autoconf/nss.m4

This file was deleted.

3 changes: 0 additions & 3 deletions build/moz.configure/old.configure
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,7 @@ def old_configure_options(*options):
'--with-branding',
'--with-distribution-id',
'--with-macbundlename-prefix',
'--with-nss-exec-prefix',
'--with-nss-prefix',
'--with-system-libevent',
'--with-system-nss',
'--with-system-png',
'--with-user-appdir',
'--x-includes',
Expand Down
7 changes: 4 additions & 3 deletions build/moz.configure/pkg.configure
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def pkg_config_version(pkg_config):

@template
def pkg_check_modules(var, package_desc, when=always,
allow_missing=False):
allow_missing=False, config=True):
if isinstance(package_desc, (tuple, list)):
package_desc = ' '.join(package_desc)
package_desc = dependable(package_desc)
Expand Down Expand Up @@ -93,7 +93,8 @@ def pkg_check_modules(var, package_desc, when=always,
def pkg_info(cflags, libs):
return namespace(cflags=cflags, libs=libs)

set_config('%s_CFLAGS' % var, pkg_cflags)
set_config('%s_LIBS' % var, pkg_libs)
if config:
set_config('%s_CFLAGS' % var, pkg_cflags)
set_config('%s_LIBS' % var, pkg_libs)

return pkg_info
28 changes: 0 additions & 28 deletions old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZPNG=10635
NSS_VERSION=3

dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
Expand Down Expand Up @@ -1435,31 +1434,6 @@ LIBS=$_SAVE_LIBS

AC_SUBST(MOZ_SYSTEM_LIBEVENT)

dnl ========================================================
dnl = If NSS was not detected in the system,
dnl = use the one in the source tree (mozilla/security/nss)
dnl ========================================================

MOZ_ARG_WITH_BOOL(system-nss,
[ --with-system-nss Use system installed NSS],
_USE_SYSTEM_NSS=1 )

if test -n "$_USE_SYSTEM_NSS"; then
AM_PATH_NSS(3.53, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi

NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
if test -z "$MOZ_SYSTEM_NSS"; then
case "${OS_ARCH}" in
# Only few platforms have been tested with GYP
WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
;;
*)
AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
;;
esac
fi

if test -z "$SKIP_LIBRARY_CHECKS"; then

dnl ========================================================
Expand Down Expand Up @@ -2852,8 +2826,6 @@ AC_SUBST(MOZ_SYSTEM_PNG)
AC_SUBST_LIST(MOZ_PNG_CFLAGS)
AC_SUBST_LIST(MOZ_PNG_LIBS)

AC_SUBST(MOZ_SYSTEM_NSS)

HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
Expand Down
23 changes: 23 additions & 0 deletions toolkit/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -2082,3 +2082,26 @@ def default_agent_flag(enabled):
return True

set_config('MOZ_DEFAULT_BROWSER_AGENT', default_agent_flag)

# NSS
# ===
option('--with-system-nss', help='Use system NSS')

imply_option('--with-system-nspr', True, when='--with-system-nss')

nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53', when='--with-system-nss', config=False)

set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss')

@depends(nss_pkg, check_build_environment)
def nss_config(nss_pkg, build_env):
cflags = ['-I%s' % os.path.join(build_env.dist, 'include', 'nss')]
libs = None
if nss_pkg:
cflags = list(nss_pkg.cflags) + cflags
libs = nss_pkg.libs
return namespace(cflags=cflags, libs=libs)

set_config('NSS_CFLAGS', nss_config.cflags)
set_config('NSS_LIBS', nss_config.libs)
add_old_configure_assignment('NSS_CFLAGS', nss_config.cflags)

0 comments on commit be0e03c

Please sign in to comment.