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 fb33cb2
Show file tree
Hide file tree
Showing 4 changed files with 19 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
23 changes: 8 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 @@ -177,6 +180,7 @@ copy_private_headers() {
LC_ALL=C sed -i '' -e 's/#if !KERNEL_USER32/#if 1/g' $(find "$OUTPUT_INCLUDES/IOKit" -type f)
LC_ALL=C sed -i '' -e 's/#if KERNEL/#if 0/g' $(find "$OUTPUT_INCLUDES/IOKit" -type f)
LC_ALL=C sed -i '' -e 's/#if !KERNEL/#if 1/g' $(find "$OUTPUT_INCLUDES/IOKit" -type f)
LC_ALL=C sed -i '' -e 's/__UNAVAILABLE_PUBLIC_IOS;//g' $(find "$OUTPUT_INCLUDES/IOKit" -type f)
mkdir -p "$OUTPUT_INCLUDES/libkern"
cp -r "$OSTYPES_HEADERS_PATH/OSTypes.h" "$OUTPUT_INCLUDES/libkern/OSTypes.h"
}
Expand Down Expand Up @@ -204,6 +208,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 +469,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 +754,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 fb33cb2

Please sign in to comment.