Skip to content

Commit

Permalink
build: updated dependency build requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Aug 9, 2022
1 parent 5e4531c commit 3260ced
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
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
Expand Down
7 changes: 4 additions & 3 deletions Documentation/MacDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Documentation/iOSDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
22 changes: 7 additions & 15 deletions scripts/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -61,15 +65,14 @@ 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; }
command -v gpg-error-config >/dev/null 2>&1 || { echo >&2 "${RED}You must install 'libgpg-error' on your host machine.\n\t'gpg-error-config' needs to be in your \$PATH as well.${NC}"; exit 1; }
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 () {
Expand Down Expand Up @@ -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* )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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...
Expand Down

0 comments on commit 3260ced

Please sign in to comment.