Bug 1748385 - Add a pkgconf toolchain and use it. r=firefox-build-system-reviewers,mhentges

pkgconf is an alternative implementation of pkg-config that is more
cross-platform. It has also become the default on Fedora, so it's not
some random project.

Differential Revision: https://phabricator.services.mozilla.com/D135009
This commit is contained in:
Mike Hommey 2022-01-05 00:02:41 +00:00
Родитель 4433dc7410
Коммит e1c71aa04b
6 изменённых файлов: 120 добавлений и 0 удалений

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

@ -13,6 +13,7 @@ def pkg_config(prefixes):
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")),

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

@ -721,6 +721,11 @@ class TestChecksConfigure(unittest.TestCase):
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}

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

@ -586,3 +586,14 @@ 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,6 +43,7 @@ jobs-from:
- misc.yml
- nasm.yml
- node.yml
- pkgconf.yml
- resourcemonitor.yml
- rust.yml
- rust-size.yml

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

@ -0,0 +1,59 @@
# 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

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

@ -0,0 +1,43 @@
#!/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