summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/build-pkgconf.sh
blob: bc4ec7d4bbacaa90ef9694a1d0d55b08669a01fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -x -e -v

# This script is for building pkgconfs.
PROJECT=pkgconf

cd ${MOZ_FETCHES_DIR}/${PROJECT}

export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH"

case "$1" in
x86_64-unknown-linux-gnu)
    CC="clang --sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu"
    EXE=
    ;;
x86_64-apple-darwin)
    export MACOSX_DEPLOYMENT_TARGET=10.12
    TARGET=$1
    CC="clang --target=$TARGET -isysroot $MOZ_FETCHES_DIR/MacOSX13.3.sdk"
    EXE=
    ;;
aarch64-apple-darwin)
    export MACOSX_DEPLOYMENT_TARGET=11.0
    TARGET=$1
    CC="clang --target=$TARGET -isysroot $MOZ_FETCHES_DIR/MacOSX13.3.sdk"
    EXE=
    ;;
x86_64-pc-windows-gnu)
    TARGET=x86_64-w64-mingw32
    CC="x86_64-w64-mingw32-clang -DPKGCONFIG_IS_STATIC=1"
    EXE=.exe
    ;;
esac

./configure --disable-shared CC="$CC" AR=llvm-ar RANLIB=llvm-ranlib LDFLAGS=-fuse-ld=lld ${TARGET:+--host=$TARGET}
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