Backed out 5 changesets (bug 1748385, bug 513617) for bustages on pkg.configure . CLOSED TREE

Backed out changeset bc23b3cfb583 (bug 1748385)
Backed out changeset 53f3c4e3e600 (bug 1748385)
Backed out changeset 5c744edba720 (bug 1748385)
Backed out changeset ad23d3af4df6 (bug 1748385)
Backed out changeset 54e3431d9152 (bug 513617)
This commit is contained in:
Narcis Beleuzu 2022-01-05 01:23:29 +02:00
Родитель c602a78f33
Коммит 1b1effc9ba
6 изменённых файлов: 36 добавлений и 252 удалений

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

@ -10,14 +10,7 @@ def pkg_config(prefixes):
return tuple("{}pkg-config".format(p) for p in (prefixes or ()) + ("",))
pkg_config = check_prog(
"PKG_CONFIG",
pkg_config,
bootstrap="pkgconf",
allow_missing=True,
when=compile_environment
& depends(target.os)(lambda os: os not in ("WINNT", "OSX", "Android")),
)
pkg_config = check_prog("PKG_CONFIG", pkg_config, allow_missing=True)
@depends_if(pkg_config)
@ -26,41 +19,14 @@ def pkg_config_version(pkg_config):
return Version(check_cmd_output(pkg_config, "--version").rstrip())
@depends_if(pkg_config)
@checking("whether pkg-config is pkgconf")
def is_pkgconf(pkg_config):
return "pkgconf " in check_cmd_output(pkg_config, "--about", onerror=lambda: "")
@depends(is_pkgconf, pkg_config_version, target_sysroot.bootstrapped)
def pkg_config_base_flags(is_pkgconf, pkg_config_version, target_sysroot_bootstrapped):
# pkgconf 1.7.4 changed the default on Windows to use --static, but
# that doesn't work for us.
# Note: the --shared flag is not available before pkgconf 1.7
flags = []
if is_pkgconf and pkg_config_version >= "1.7.4":
flags.append("--shared")
# When pkg-config is in /usr things work fine by default, but when
# it is not, it defines prefix to be something else than /usr, which
# won't match what the .pc files actually say, and won't work in
# sysroots.
if target_sysroot_bootstrapped and (
(is_pkgconf and pkg_config_version >= "1.2.0")
or (not is_pkgconf and pkg_config_version >= "0.29.0")
):
flags.append("--dont-define-prefix")
return tuple(flags)
@depends(target, target_sysroot.path, target_multiarch_dir, when=pkg_config)
@imports(_from="os", _import="environ")
@imports(_from="os", _import="pathsep")
def pkg_config_vars(target, sysroot_path, multiarch_dir):
if sysroot_path and target.kernel != "Darwin":
return namespace(
PKG_CONFIG_PATH="",
PKG_CONFIG_SYSROOT_DIR=sysroot_path,
PKG_CONFIG_LIBDIR=pathsep.join(
PKG_CONFIG_LIBDIR=":".join(
os.path.join(sysroot_path, d)
for d in (
"usr/lib/pkgconfig",
@ -165,13 +131,10 @@ def pkg_check_modules(
if not allow_missing:
sys.exit(1)
@depends(
pkg_config, pkg_config_env, package_desc, pkg_config_base_flags, when=package
)
@depends(pkg_config, pkg_config_env, package_desc, when=package)
@checking("%s_CFLAGS" % var, callback=lambda t: " ".join(t))
def pkg_cflags(pkg_config, env, package_desc, base_flags):
args = list(base_flags) + ["--cflags", package_desc]
flags = check_cmd_output(pkg_config, *args, env=env)
def pkg_cflags(pkg_config, env, package_desc):
flags = check_cmd_output(pkg_config, "--cflags", package_desc, env=env)
return tuple(flags.split())
if cflags_only:
@ -182,17 +145,10 @@ def pkg_check_modules(
else:
@depends(
pkg_config,
pkg_config_env,
package_desc,
pkg_config_base_flags,
when=package,
)
@depends(pkg_config, pkg_config_env, package_desc, when=package)
@checking("%s_LIBS" % var, callback=lambda t: " ".join(t))
def pkg_libs(pkg_config, env, package_desc, base_flags):
args = list(base_flags) + ["--libs", package_desc]
libs = check_cmd_output(pkg_config, *args, env=env)
def pkg_libs(pkg_config, env, package_desc):
libs = check_cmd_output(pkg_config, "--libs", package_desc, env=env)
# Remove evil flags like -Wl,--export-dynamic
return tuple(libs.replace("-Wl,--export-dynamic", "").split())

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

@ -682,13 +682,7 @@ class TestChecksConfigure(unittest.TestCase):
mock_pkg_config_version = "0.10.0"
mock_pkg_config_path = mozpath.abspath("/usr/bin/pkg-config")
seen_flags = set()
def mock_pkg_config(_, args):
if "--dont-define-prefix" in args:
args = list(args)
seen_flags.add(args.pop(args.index("--dont-define-prefix")))
args = tuple(args)
if args[0:2] == ("--errors-to-stdout", "--print-errors"):
assert len(args) == 3
package = args[2]
@ -713,19 +707,9 @@ class TestChecksConfigure(unittest.TestCase):
return 0, "-l%s" % args[1], ""
if args[0] == "--version":
return 0, mock_pkg_config_version, ""
if args[0] == "--about":
return 1, "Unknown option --about", ""
self.fail("Unexpected arguments to mock_pkg_config: %s" % (args,))
def mock_pkgconf(_, args):
if args[0] == "--shared":
seen_flags.add(args[0])
args = args[1:]
if args[0] == "--about":
return 0, "pkgconf {}".format(mock_pkg_config_version), ""
return mock_pkg_config(_, args)
def get_result(cmd, args=[], bootstrapped_sysroot=False, extra_paths=None):
def get_result(cmd, args=[], extra_paths=None):
return self.get_result(
textwrap.dedent(
"""\
@ -733,23 +717,13 @@ class TestChecksConfigure(unittest.TestCase):
compile_environment = depends(when='--enable-compile-environment')(lambda: True)
toolchain_prefix = depends(when=True)(lambda: None)
target_multiarch_dir = depends(when=True)(lambda: None)
target_sysroot = depends(when=True)(lambda: %(sysroot)s)
target_sysroot = depends(when=True)(lambda: None)
target = depends(when=True)(lambda: None)
include('%(topsrcdir)s/build/moz.configure/util.configure')
include('%(topsrcdir)s/build/moz.configure/checks.configure')
# Skip bootstrapping.
@template
def check_prog(*args, **kwargs):
del kwargs["bootstrap"]
return check_prog(*args, **kwargs)
include('%(topsrcdir)s/build/moz.configure/pkg.configure')
"""
% {
"topsrcdir": topsrcdir,
"sysroot": "namespace(bootstrapped=True)"
if bootstrapped_sysroot
else "None",
}
% {"topsrcdir": topsrcdir}
)
+ cmd,
args=args,
@ -773,57 +747,31 @@ class TestChecksConfigure(unittest.TestCase):
),
)
for pkg_config, version, bootstrapped_sysroot, is_pkgconf in (
(mock_pkg_config, "0.10.0", False, False),
(mock_pkg_config, "0.30.0", False, False),
(mock_pkg_config, "0.30.0", True, False),
(mock_pkgconf, "1.1.0", True, True),
(mock_pkgconf, "1.6.0", False, True),
(mock_pkgconf, "1.8.0", False, True),
(mock_pkgconf, "1.8.0", True, True),
):
seen_flags = set()
mock_pkg_config_version = version
config, output, status = get_result(
"pkg_check_modules('MOZ_VALID', 'valid')",
bootstrapped_sysroot=bootstrapped_sysroot,
extra_paths={mock_pkg_config_path: pkg_config},
)
self.assertEqual(status, 0)
self.assertEqual(
output,
textwrap.dedent(
"""\
checking for pkg_config... %s
checking for pkg-config version... %s
checking whether pkg-config is pkgconf... %s
checking for valid... yes
checking MOZ_VALID_CFLAGS... -I/usr/include/valid
checking MOZ_VALID_LIBS... -lvalid
"""
% (
mock_pkg_config_path,
mock_pkg_config_version,
"yes" if is_pkgconf else "no",
)
),
)
self.assertEqual(
config,
{
"PKG_CONFIG": mock_pkg_config_path,
"MOZ_VALID_CFLAGS": ("-I/usr/include/valid",),
"MOZ_VALID_LIBS": ("-lvalid",),
},
)
if version == "1.8.0" and bootstrapped_sysroot:
self.assertEqual(seen_flags, set(["--shared", "--dont-define-prefix"]))
elif version == "1.8.0":
self.assertEqual(seen_flags, set(["--shared"]))
elif version in ("1.6.0", "0.30.0") and bootstrapped_sysroot:
self.assertEqual(seen_flags, set(["--dont-define-prefix"]))
else:
self.assertEqual(seen_flags, set())
config, output, status = get_result(
"pkg_check_modules('MOZ_VALID', 'valid')", extra_paths=extra_paths
)
self.assertEqual(status, 0)
self.assertEqual(
output,
textwrap.dedent(
"""\
checking for pkg_config... %s
checking for pkg-config version... %s
checking for valid... yes
checking MOZ_VALID_CFLAGS... -I/usr/include/valid
checking MOZ_VALID_LIBS... -lvalid
"""
% (mock_pkg_config_path, mock_pkg_config_version)
),
)
self.assertEqual(
config,
{
"PKG_CONFIG": mock_pkg_config_path,
"MOZ_VALID_CFLAGS": ("-I/usr/include/valid",),
"MOZ_VALID_LIBS": ("-lvalid",),
},
)
config, output, status = get_result(
"pkg_check_modules('MOZ_UKNOWN', 'unknown')", extra_paths=extra_paths
@ -835,7 +783,6 @@ class TestChecksConfigure(unittest.TestCase):
"""\
checking for pkg_config... %s
checking for pkg-config version... %s
checking whether pkg-config is pkgconf... no
checking for unknown... no
ERROR: Package unknown was not found in the pkg-config search path.
ERROR: Perhaps you should add the directory containing `unknown.pc'
@ -857,7 +804,6 @@ class TestChecksConfigure(unittest.TestCase):
"""\
checking for pkg_config... %s
checking for pkg-config version... %s
checking whether pkg-config is pkgconf... no
checking for new > 1.1... no
ERROR: Requested 'new > 1.1' but version of new is 1.1
"""
@ -885,7 +831,6 @@ class TestChecksConfigure(unittest.TestCase):
"""\
checking for pkg_config... %s
checking for pkg-config version... %s
checking whether pkg-config is pkgconf... no
checking for new > 1.1... no
WARNING: Requested 'new > 1.1' but version of new is 1.1
Module not found.
@ -905,8 +850,6 @@ class TestChecksConfigure(unittest.TestCase):
def mock_old_pkg_config(_, args):
if args[0] == "--version":
return 0, "0.8.10", ""
if args[0] == "--about":
return 1, "Unknown option --about", ""
self.fail("Unexpected arguments to mock_old_pkg_config: %s" % args)
extra_paths = {mock_pkg_config_path: mock_old_pkg_config}
@ -921,7 +864,6 @@ class TestChecksConfigure(unittest.TestCase):
"""\
checking for pkg_config... %s
checking for pkg-config version... 0.8.10
checking whether pkg-config is pkgconf... no
ERROR: *** Your version of pkg-config is too old. You need version 0.9.0 or newer.
"""
% mock_pkg_config_path

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

@ -586,14 +586,3 @@ msix-packaging:
type: git
repo: https://github.com/mozilla/msix-packaging
revision: 8164b7ac5a67688e18fa2497fb31ba13ce9bfb15
pkgconf:
description: pkgconf 1.8.0
fetch:
type: static-url
url: https://distfiles.dereferenced.org/pkgconf/pkgconf-1.8.0.tar.xz
sha256: ef9c7e61822b7cb8356e6e9e1dca58d9556f3200d78acab35e4347e9d4c2bbaf
size: 296304
artifact-name: pkgconf.tar.zst
strip-components: 1
add-prefix: pkgconf/

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

@ -43,7 +43,6 @@ jobs-from:
- misc.yml
- nasm.yml
- node.yml
- pkgconf.yml
- resourcemonitor.yml
- rust.yml
- rust-size.yml

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

@ -1,59 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
job-defaults:
attributes:
local-toolchain: true
description: "pkgconf toolchain build"
worker:
max-run-time: 1800
worker-type: b-linux
run-on-projects: [trunk]
run:
script: build-pkgconf.sh
toolchain-artifact: public/build/pkgconf.tar.zst
fetches:
fetch:
- pkgconf
linux64-pkgconf:
treeherder:
symbol: TL(pkgconf)
run:
arguments: ['x86_64-unknown-linux-gnu']
fetches:
toolchain:
- linux64-clang-13
- sysroot-x86_64-linux-gnu
macosx64-pkgconf:
treeherder:
symbol: TM(pkgconf)
run:
arguments: ['x86_64-apple-darwin']
fetches:
toolchain:
- linux64-clang-13
- linux64-cctools-port-clang-13
- macosx64-sdk-11.0
macosx64-aarch64-pkgconf:
treeherder:
symbol: TM(pkgconf-arm64)
run:
arguments: ['aarch64-apple-darwin']
fetches:
toolchain:
- linux64-clang-13
- linux64-cctools-port-clang-13
- macosx64-sdk-11.0
win64-pkgconf:
treeherder:
symbol: TW64(pkgconf)
run:
arguments: ['x86_64-pc-windows-gnu']
fetches:
toolchain:
- linux64-clang-mingw-x64

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

@ -1,43 +0,0 @@
#!/bin/bash
set -x -e -v
# This script is for building pkgconfs.
PROJECT=pkgconf
cd ${MOZ_FETCHES_DIR}/${PROJECT}
case "$1" in
x86_64-unknown-linux-gnu)
./configure --disable-shared CC="$MOZ_FETCHES_DIR/clang/bin/clang --sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu"
EXE=
;;
x86_64-apple-darwin)
export LD_LIBRARY_PATH="$MOZ_FETCHES_DIR/clang/lib"
export PATH="$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/cctools/bin:$PATH"
export MACOSX_DEPLOYMENT_TARGET=10.12
./configure --disable-shared CC="clang --target=x86_64-apple-darwin -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk" --host=x86_64-apple-darwin
EXE=
;;
aarch64-apple-darwin)
export LD_LIBRARY_PATH="$MOZ_FETCHES_DIR/clang/lib"
export PATH="$MOZ_FETCHES_DIR/clang/bin:$MOZ_FETCHES_DIR/cctools/bin:$PATH"
export MACOSX_DEPLOYMENT_TARGET=11.0
./configure --disable-shared CC="clang --target=aarch64-apple-darwin -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk" --host=aarch64-apple-darwin
EXE=
;;
x86_64-pc-windows-gnu)
export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH"
./configure --disable-shared CC=x86_64-w64-mingw32-clang AR=llvm-ar RANLIB=llvm-ranlib CPPFLAGS=-DPKGCONFIG_IS_STATIC=1 --host=x86_64-w64-mingw32
EXE=.exe
;;
esac
make -j$(nproc) V=1
mv ${PROJECT}${EXE} ${PROJECT}_tmp
mkdir ${PROJECT}
mv ${PROJECT}_tmp ${PROJECT}/pkg-config${EXE}
tar -acf ${PROJECT}.tar.zst ${PROJECT}
mkdir -p $UPLOAD_DIR
mv ${PROJECT}.tar.zst $UPLOAD_DIR