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

Linux arm64 #2

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bin/
build/
obj/
.vagrant/
*.log
13 changes: 13 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/bionic64"

config.vm.synced_folder ".", "/home/vagrant/shared/"

config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libgtk-3-dev
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
SHELL
end
9 changes: 6 additions & 3 deletions Webview.Batteries.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
</PropertyGroup>

<ItemGroup>
<!-- FIXME: Switch to multi-rid package with builds for x64, x86 & arm -->
<Content Include="build\linux\libwebview.so">
<PackagePath>runtimes\linux\native\libwebview.so</PackagePath>
<Content Include="build\linux-x64\libwebview.so">
<PackagePath>runtimes\linux-x64\native\libwebview.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\linux-arm64\libwebview.so">
<PackagePath>runtimes\linux-arm64\native\libwebview.so</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ image:
- Visual Studio 2017
- ubuntu
install:
- sh: sudo apt-get remove -f -y --allow-change-held-packages powershell
- sh: sudo apt-get install -y libwebkit2gtk-4.0-dev libgtk-3-dev
- sh: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- git submodule update --init --recursive
build_script:
- ps: .\ci_build.ps1
Expand Down
42 changes: 31 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,47 @@ set -e
# Work out the platform we are building on, and the RID which goes
# along with it.
case `uname` in
Darwin) rid="osx"
Darwin) rids=("osx-x64")
platform="Mac"
;;
# TODO: Linux needs more than one target RID
Linux) rid="linux"
Linux) rids=("linux-x64" "linux-arm64")
platform="Linux"
;;
*) echo "Unrecognised platform `uname`" 1>&2
exit 1;
;;
esac

# log out the RID decided on
echo "Compiling for $rid on $platform"
for rid in ${rids[@]}
do
# log out the RID decided on
echo "Compiling for $rid on $platform"

# Build the webview library
rm -rf build/$rid/
mkdir -p build/$rid
(cd build/$rid && \
cmake -D BUILD_SHARED_LIBS=ON ../../webview/ && \
make )
# If we have a custom install script then run that
if [ -f $rid-install.sh ]
then
bash $rid-install.sh || exit 1
fi

# Clean build directory
rm -rf build/$rid/
mkdir -p build/$rid
pushd build/$rid

# If we have a toolchain file, then use that
if [ -f ../../$rid.toolchain ]
then
cmake -DCMAKE_TOOLCHAIN_FILE=../../$rid.toolchain -D BUILD_SHARED_LIBS=ON ../../webview/ || exit 1
else
cmake -D BUILD_SHARED_LIBS=ON ../../webview/ || exit 1
fi

# Build the webview library
make || exit 1
file libwebview.*

popd
done

# Pack it all up
dotnet pack -c Release Webview.Batteries.$platform.csproj
2 changes: 1 addition & 1 deletion ci_build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# appropriate platform-specific build script.
if ($PSVersionTable.Platform -eq "Unix")
{
sh ./build.sh
bash ./build.sh
}
else
{
Expand Down
28 changes: 28 additions & 0 deletions linux-arm64-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /usr/bin/env bash

set -e

## CI Dependency install script for arm 64

# Remove the existing libraries, these conflict when instlaling
sudo apt-get purge --auto-remove -y libwebkit2gtk-4.0-dev libgtk-3-dev

# Add the arm64 architecture
cat > webview.list <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ bionic main restricted
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ bionic universe
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ bionic multiverse
deb [arch=arm64] http://ports.ubuntu.com/ bionic-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse
EOF
sudo sed -ibk /etc/apt/sources.list.d/*.list -e 's/deb http/deb [arch=amd64] http/g'
sudo sed -ibk /etc/apt/sources.list -e 's/deb http/deb [arch=amd64] http/g'
sudo mv webview.list /etc/apt/sources.list.d
sudo dpkg --add-architecture arm64

sudo apt-get update

# Add the dependencies for our chosen architecture
sudo apt-get install -y libwebkit2gtk-4.0-dev:arm64 libgtk-3-dev:arm64
10 changes: 10 additions & 0 deletions linux-arm64.toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)