File: build_macos.sh

package info (click to toggle)
mfgtools 1.5.243-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,296 kB
  • sloc: cpp: 10,100; javascript: 546; python: 335; sh: 85; xml: 53; makefile: 18
file content (55 lines) | stat: -rwxr-xr-x 1,211 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -euo pipefail

ARCH="${1:-x86_64}"

# Source common functions (same dump_logs function)
source "$(dirname "$0")/common_functions.sh"

main() {
    log_and_run "Installing pytest" \
        python -m pip install pytest

    # Install build dependencies
    log_and_run "Installing build dependencies" \
        brew install ninja cmake autoconf automake libtool

    export PROJECT_DIR=$(pwd)

    # Setup vcpkg
    log_and_run "Setting up vcpkg" setup_vcpkg

    # Build libuuu
    log_and_run "Building libuuu for $ARCH" build_libuuu "$ARCH"

    # Copy artifacts
    log_and_run "Copying artifacts" copy_artifacts "$ARCH"
}

setup_vcpkg() {
    cd /tmp
    git clone https://github.com/microsoft/vcpkg.git
    cd vcpkg
    ./bootstrap-vcpkg.sh || {
        echo "VCPKG BOOTSTRAP FAILED"
        dump_logs
        exit 1
    }
    export VCPKG_ROOT=/tmp/vcpkg
    export PATH=$VCPKG_ROOT:$PATH
    cd "$PROJECT_DIR/wrapper"
}

build_libuuu() {
    local arch="$1"
    cmake --preset=unix -DCMAKE_OSX_ARCHITECTURES="$arch"
    cmake --build build
}

copy_artifacts() {
    local arch="$1"
    mkdir -p "libuuu/lib/darwin/$arch/"
    cp build/libuuu.dylib "libuuu/lib/darwin/$arch/"
}

main "$@"