diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc844926b..eda5f51f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,14 +54,13 @@ jobs: - name: Setup Path shell: bash run: | - echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH + echo "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH - name: Build Sysroot if: steps.cache-sysroot.outputs.cache-hit != 'true' run: | brew uninstall cmake - brew install bison pkg-config nasm make meson glib-utils python3 - brew unlink python && brew link python@3.10 - pip3 install six pyparsing + brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson + pip3 install --user six pyparsing rm -f /usr/local/lib/pkgconfig/*.pc ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }} - name: Compress Sysroot diff --git a/Documentation/MacDevelopment.md b/Documentation/MacDevelopment.md index 134b07d37..5351be828 100644 --- a/Documentation/MacDevelopment.md +++ b/Documentation/MacDevelopment.md @@ -21,9 +21,10 @@ If you want to build the dependencies yourself, it is highly recommended that yo 1. Install Xcode command line and [Homebrew][1] 2. Install the following build prerequisites - `brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson` - Make sure to add `bison` and `gettext` to your `$PATH` environment variable! - `export PATH=/usr/local/opt/bison/bin:/usr/local/opt/gettext/bin:$PATH` + `brew install bison pkg-config gettext glib-utils libgpg-error nasm meson` + `pip3 install six pyparsing` + Make sure to add `bison` to your `$PATH` environment variable! + `export PATH=/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin:$PATH` 3. Run `./scripts/build_dependencies.sh -p macos -a ARCH` where `ARCH` is either `arm64` or `x86_64`. If you want to build universal binaries, you need to run `build_dependencies.sh` for both `arm64` and `x86_64` and then run diff --git a/Documentation/iOSDevelopment.md b/Documentation/iOSDevelopment.md index 8abe1a999..771459947 100644 --- a/Documentation/iOSDevelopment.md +++ b/Documentation/iOSDevelopment.md @@ -28,9 +28,10 @@ If you want to build the dependencies yourself, it is highly recommended that yo 1. Install Xcode command line and [Homebrew][1] 2. Install the following build prerequisites - `brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson` - Make sure to add `bison` and `gettext` to your `$PATH` environment variable! - `export PATH=/usr/local/opt/bison/bin:/usr/local/opt/gettext/bin:$PATH` + `brew install bison pkg-config gettext glib-utils libgpg-error nasm meson` + `pip3 install six pyparsing` + Make sure to add `bison` to your `$PATH` environment variable! + `export PATH=/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin:$PATH` 3. Run `./scripts/build_dependencies.sh -p PLATFORM -a ARCHITECTURE` where `ARCHITECTURE` is the last part of the table above (e.g. `x86_64`) and `PLATFORM` is the first part (e.g. `ios_simulator-tci`). 4. Repeat the above for any other platforms and architectures you wish to target. diff --git a/scripts/build_dependencies.sh b/scripts/build_dependencies.sh index 7fa99b5b1..20af09a4e 100755 --- a/scripts/build_dependencies.sh +++ b/scripts/build_dependencies.sh @@ -35,6 +35,10 @@ command -v realpath >/dev/null 2>&1 || realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } +version_check() { + [ "$1" = "$(echo "$1\n$2" | sort -V | head -n1)" ] +} + usage () { echo "Usage: [VARIABLE...] $(basename $0) [-p platform] [-a architecture] [-q qemu_path] [-d] [-r]" echo "" @@ -61,7 +65,6 @@ check_env () { command -v python3 >/dev/null 2>&1 || { echo >&2 "${RED}You must install 'python3' on your host machine.${NC}"; exit 1; } python_module_test six >/dev/null 2>&1 || { echo >&2 "${RED}'six' not found in your Python 3 installation.${NC}"; exit 1; } python_module_test pyparsing >/dev/null 2>&1 || { echo >&2 "${RED}'pyparsing' not found in your Python 3 installation.${NC}"; exit 1; } - command -v gmake >/dev/null 2>&1 || { echo >&2 "${RED}You must install GNU make on your host machine (and link it to 'gmake').${NC}"; exit 1; } command -v meson >/dev/null 2>&1 || { echo >&2 "${RED}You must install 'meson' on your host machine.${NC}"; exit 1; } command -v msgfmt >/dev/null 2>&1 || { echo >&2 "${RED}You must install 'gettext' on your host machine.\n\t'msgfmt' needs to be in your \$PATH as well.${NC}"; exit 1; } command -v glib-mkenums >/dev/null 2>&1 || { echo >&2 "${RED}You must install 'glib-utils' on your host machine.\n\t'glib-mkenums' needs to be in your \$PATH as well.${NC}"; exit 1; } @@ -69,7 +72,7 @@ check_env () { command -v xcrun >/dev/null 2>&1 || { echo >&2 "${RED}'xcrun' is not found. Make sure you are running on OSX."; exit 1; } command -v otool >/dev/null 2>&1 || { echo >&2 "${RED}'otool' is not found. Make sure you are running on OSX."; exit 1; } command -v install_name_tool >/dev/null 2>&1 || { echo >&2 "${RED}'install_name_tool' is not found. Make sure you are running on OSX."; exit 1; } - # TODO: check bison version >= 2.4 + version_check "2.4" "$(bison -V | head -1 | awk '{ print $NF }')" || { echo >&2 "${RED}'bison' >= 2.4 is required. Did you install from Homebrew and updated your \$PATH variable?"; exit 1; } } download () { @@ -204,6 +207,7 @@ generate_meson_cross() { echo "pkgconfig = ['$PREFIX/host/bin/pkg-config']" >> $cross echo "ranlib = [$(meson_quote $RANLIB)]" >> $cross echo "strip = [$(meson_quote $STRIP), '-x']" >> $cross + echo "python = ['$(which python3)']" >> $cross echo "[host_machine]" >> $cross case $PLATFORM in ios* ) @@ -464,18 +468,6 @@ build_qemu_dependencies () { meson_build $VIRGLRENDERER_REPO -Dtests=false } -build_qemu () { - pwd="$(pwd)" - cd "$QEMU_DIR" - echo "${GREEN}Configuring QEMU...${NC}" - ./configure --prefix="$PREFIX" --host="$CHOST" --cross-prefix="" $@ - echo "${GREEN}Building QEMU...${NC}" - gmake -j$NCPU - echo "${GREEN}Installing QEMU...${NC}" - gmake install - cd "$pwd" -} - build_spice_client () { meson_build "$QEMU_DIR/subprojects/libucontext" -Ddefault_library=static -Dfreestanding=true meson_build $JSON_GLIB_SRC -Dintrospection=disabled @@ -761,7 +753,7 @@ rm -f "$BUILD_DIR/meson.cross" copy_private_headers build_pkg_config build_qemu_dependencies -build_qemu $QEMU_PLATFORM_BUILD_FLAGS +build $QEMU_SRC --cross-prefix="" $QEMU_PLATFORM_BUILD_FLAGS build_spice_client fixup_all remove_shared_gst_plugins # another hack...