Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64-linux build #55

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ jobs:
cmake_args: >-
-DDEBUG_ASSERTIONS_FATAL=ON
-DBATTERY=OFF
- name: Linux (arm64)
os: ubuntu-latest
triplet: arm64-linux-release
host_triplet: x64-linux-release
overlay_ports: vcpkg/overlay/ports
ccache_path: ~/.ccache
cpack_generator: TGZ
package_extension: tar.gz
cmake_args: >-
-DBATTERY=OFF

name: '${{ matrix.name }}'
runs-on: '${{ matrix.os }}'
Expand All @@ -100,7 +110,7 @@ jobs:
ARTIFACT_BASE_NAME: 'mixxx-${{ matrix.triplet }}${{ matrix.suffix }}'
VCPKG_DEFAULT_TRIPLET: '${{ matrix.triplet }}'
VCPKG_DEFAULT_HOST_TRIPLET: '${{ matrix.host_triplet }}'
VCPKG_OVERLAY_TRIPLETS: vcpkg/overlay/triplets
VCPKG_OVERLAY_TRIPLETS: overlay/triplets:vcpkg/overlay/triplets
VCPKG_OVERLAY_PORTS: '${{ matrix.overlay_ports }}'

steps:
Expand Down
11 changes: 11 additions & 0 deletions overlay/triplets/arm64-linux-release.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)

set(VCPKG_BUILD_TYPE release)

if("${PORT}" STREQUAL "benchmark")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DRUN_HAVE_POSIX_REGEX=0)
endif()
112 changes: 91 additions & 21 deletions scripts/install-ubuntu-deps
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,96 @@ if ! command -v apt-get >/dev/null; then
exit 1
fi

echo "==> Installing system dependencies with APT..."
triplet_to_deb_arch() {
if [ -n "$1" ]; then
case "$1" in
x64-*) echo amd64;;
arm64-*) echo arm64;;
*) echo "Unsupported triplet: $1"; return 1;;
esac
fi
}

triplet_to_gcc_arch() {
if [ -n "$1" ]; then
case "$1" in
x64-*) echo x86-64;;
arm64-*) echo aarch64;;
*) echo "Unsupported triplet: $1"; return 1;;
esac
fi
}

deb_arch_to_mirror() {
if [ -n "$1" ]; then
case "$1" in
amd64|i386) echo "http://archive.ubuntu.com/ubuntu";;
*) echo "http://ports.ubuntu.com/ubuntu-ports";;
esac
fi
}

echo "==> Updating APT..."
sudo apt-get update
sudo apt-get install -y \
autoconf-archive \
autotools-dev \
ccache \
cmake \
libasound2-dev \
'^libxcb.*-dev' \
libx11-xcb-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libsleef-dev \
libudev-dev \
libupower-glib-dev \
libtool \
libxrender-dev \
libxi-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
mesa-common-dev \
nasm \

echo "==> Installing host dependencies with APT..."
host_deps=(
autoconf-archive
autotools-dev
ccache
cmake
libtool
nasm
ninja-build
)
sudo apt-get install -y "${host_deps[@]}"

host="$VCPKG_DEFAULT_HOST_TRIPLET"
target="$VCPKG_DEFAULT_TRIPLET"

host_deb_arch="$(triplet_to_deb_arch "$host")"
target_deb_arch="$(triplet_to_deb_arch "$target")"
target_gcc_arch="$(triplet_to_gcc_arch "$target")"
target_mirror="$(deb_arch_to_mirror "$target_deb_arch")"

if [[ -n "$host" && -n "$target" && "$host" != "$target" ]]; then
echo "==> Installing cross-compilation tools with APT..."
sudo apt-get install -y "g++-$target_gcc_arch-linux-gnu"

if [ -z "$(dpkg --print-foreign-architectures | grep "$target_arch")" ]; then
echo "==> Adding target mirror to APT sources..."
ubuntu_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2-)"
sudo sed -i "s/deb \([a-z]\)/deb [arch=$host_deb_arch] \1/" /etc/apt/sources.list
sudo bash -c "{ for repo_suffix in '' '-updates'; do echo \"deb [arch=$target_deb_arch] $target_mirror $ubuntu_version\$repo_suffix main multiverse universe\"; done; cat /etc/apt/sources.list; } > /etc/apt/sources.list.new"
sudo mv /etc/apt/sources.list{.new,}
cat /etc/apt/sources.list

echo "==> Adding target architecture to APT..."
sudo dpkg --add-architecture "$target_deb_arch"
sudo apt-get update
fi
fi

echo "==> Installing target dependencies with APT..."
target_deps=(
libasound2-dev
'^libxcb.*-dev'
libx11-xcb-dev
libgl1-mesa-dev
libglu1-mesa-dev
libsleef-dev
libudev-dev
libupower-glib-dev
libxrender-dev
libxi-dev
libxkbcommon-dev
libxkbcommon-x11-dev
mesa-common-dev
)
if [ -n "$target_deb_arch" ]; then
# We need the packages for the host architecture too, since some packages
# (e.g. Qt) have to be built for the host too during cross compilation
sudo apt-get install -y "${target_deps[@]}" "${target_deps[@]/%/:$target_deb_arch}"
else
sudo apt-get install -y "${target_deps[@]}"
fi
2 changes: 1 addition & 1 deletion vars/vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if [ -z "$VCPKG_ROOT" ]; then
export VCPKG_ROOT="$rootdir/vcpkg"
fi

export VCPKG_OVERLAY_TRIPLETS="$VCPKG_ROOT/overlay/triplets"
export VCPKG_OVERLAY_TRIPLETS="$rootdir/overlay/triplets:$VCPKG_ROOT/overlay/triplets"
export VCPKG_OVERLAY_PORTS="$VCPKG_ROOT/overlay/osx:$VCPKG_ROOT/overlay/ports"
Loading