Bug 1746085 - Move --with-system-png to python configure. r=firefox-build-system-reviewers,andi

Like with e.g. --with-system-zlib in bug 1641760, all supported versions
of libpng now have a pkg-config file, so use that instead of the manual
checks.

Differential Revision: https://phabricator.services.mozilla.com/D133796
This commit is contained in:
Mike Hommey 2021-12-15 07:10:09 +00:00
Родитель 667224045f
Коммит e21f091a6d
3 изменённых файлов: 31 добавлений и 59 удалений

Просмотреть файл

@ -117,7 +117,6 @@ def old_configure_options(*options):
"--with-distribution-id",
"--with-macbundlename-prefix",
"--with-system-libevent",
"--with-system-png",
"--with-user-appdir",
"--x-includes",
"--x-libraries",

Просмотреть файл

@ -43,10 +43,6 @@ _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
_SUBDIR_CONFIG_ARGS="$ac_configure_args"
dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZPNG=10635
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
GLIB_VERSION=2.42
@ -1306,55 +1302,6 @@ LIBS=$_SAVE_LIBS
AC_SUBST(MOZ_SYSTEM_LIBEVENT)
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl ========================================================
dnl system PNG Support
dnl ========================================================
MOZ_ARG_WITH_STRING(system-png,
[ --with-system-png[=PFX]
Use system libpng [installed at prefix PFX]],
PNG_DIR=$withval)
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
CFLAGS="-I${PNG_DIR}/include $CFLAGS"
LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
fi
if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
MOZ_SYSTEM_PNG=
else
AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
AC_CHECK_LIB(png, png_get_acTL, ,
AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
fi
if test "$MOZ_SYSTEM_PNG" = 1; then
AC_TRY_COMPILE([ #include <stdio.h>
#include <sys/types.h>
#include <png.h> ],
[ #if PNG_LIBPNG_VER < $MOZPNG
#error "Insufficient libpng version ($MOZPNG required)."
#endif
#ifndef PNG_UINT_31_MAX
#error "Insufficient libpng version."
#endif ],
MOZ_SYSTEM_PNG=1,
AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
fi
fi # SKIP_LIBRARY_CHECKS
dnl ========================================================
dnl =
dnl = Application
@ -2416,11 +2363,6 @@ HOST_CXXFLAGS=`echo \
$_COMPILATION_HOST_CXXFLAGS \
$HOST_CXXFLAGS`
AC_SUBST(MOZ_SYSTEM_PNG)
AC_SUBST_LIST(MOZ_PNG_CFLAGS)
AC_SUBST_LIST(MOZ_PNG_LIBS)
HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"

Просмотреть файл

@ -1904,6 +1904,37 @@ with only_when(compile_environment):
)
# PNG
# ===
with only_when(compile_environment):
system_lib_option(
"--with-system-png",
nargs="?",
help="Use system libpng",
)
@depends("--with-system-png")
def deprecated_system_png_path(value):
if len(value) == 1:
die(
"--with-system-png=PATH is not supported anymore. Please use "
"--with-system-png and set any necessary pkg-config environment variable."
)
png = pkg_check_modules("MOZ_PNG", "libpng >= 1.6.35", when="--with-system-png")
check_symbol(
"png_get_acTL",
flags=png.libs,
onerror=lambda: die(
"--with-system-png won't work because the system's libpng doesn't have APNG support"
),
when="--with-system-png",
)
set_config("MOZ_SYSTEM_PNG", True, when="--with-system-png")
# FFmpeg's ffvpx configuration
# ==============================================================
with only_when(compile_environment):