Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c4d03e2
feat: initial 32 bit support
iamwacko Apr 27, 2023
fabe787
chore: cleaned up ci.yml
iamwacko Apr 27, 2023
c9ebfcc
fix: typos in ci.yml
iamwacko Apr 27, 2023
fb93a17
fix: should be the last typo
iamwacko Apr 27, 2023
1d73dae
fix: target to targets
iamwacko Apr 27, 2023
6e60de5
chore: install gcc-multilib
iamwacko Apr 27, 2023
e51dc78
chore: install openssl
iamwacko Apr 27, 2023
11a9d12
fix: add sudo where needed
iamwacko Apr 27, 2023
cd3d3bf
fix: more openssl fixes
iamwacko Apr 27, 2023
43e5c9a
fix: satisfy lints by removing uneeded returns
iamwacko Apr 27, 2023
a696e0b
fix: typo
iamwacko Apr 27, 2023
31c0e68
fix: even more typos in ci.yml
iamwacko Apr 27, 2023
9e66362
fix: don't need different llvm
iamwacko Apr 27, 2023
b292f33
fix: libssl for 32 bit
iamwacko Apr 28, 2023
b7bd57b
fix: more ssl stuff
iamwacko Apr 28, 2023
f5613b9
fix: more ssl stuff
iamwacko Apr 29, 2023
58f2ad7
fix: more ssl
iamwacko Apr 29, 2023
1eeb1da
fix: install i686 at the right time
iamwacko Apr 29, 2023
844708a
chore: make sure right software is running on the right hosts
iamwacko Apr 29, 2023
92ef8b7
fix: pkg config weirdness
iamwacko Apr 29, 2023
167077a
fix: gcc-multilib
iamwacko Apr 29, 2023
10402ee
fix: libglib install
iamwacko Apr 29, 2023
193a008
fix: this should fix the rest of the problems
iamwacko Apr 29, 2023
2e18d0e
fix: set PKG_CONFIG_SYSROOT_DIR
iamwacko Apr 30, 2023
1d52b22
fix: typo
iamwacko Apr 30, 2023
4523168
fix: stop building when it isn't supposed to
iamwacko May 1, 2023
8261002
fix: stop running on macos-latest
iamwacko May 1, 2023
00461f8
fix: make ci.yml valid
iamwacko May 1, 2023
77a6f34
fix: make ci.yml run
iamwacko May 1, 2023
b9b4bb5
fix: typo
iamwacko May 1, 2023
2d4cad1
Formatting from code review
MarijnS95 Dec 22, 2024
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
58 changes: 53 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ jobs:
name: ${{ matrix.host }}-x
path: bin/x${{ matrix.host == 'windows-latest' && '.exe' || '' }}

# Github doesn't have runners for anything but 64 bit
build-32bit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
targets: "i686-unknown-linux-gnu"
- name: multilib
run: sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install gcc-multilib libssl-dev:i386
- run: cargo install --path xbuild --root . --target i686-unknown-linux-gnu
env:
OPENSSL_LIB_DIR: /usr/lib/i386-linux-gnu/
OPENSSL_INCLUDE_DIR: /usr/include/openssl/

- uses: actions/upload-artifact@v3
with:
name: i686-x
path: bin/x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to add the .exe suffix for Windows... And add a 32-bit Windows build?


build-template:
strategy:
fail-fast: false
Expand All @@ -40,10 +60,15 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
host-arch:
- x86
- x64
opt:
- debug
- release
target:
- platform: linux
arch: x86
- platform: linux
arch: x64
- platform: macos
Expand All @@ -56,22 +81,38 @@ jobs:
arch: arm64

runs-on: ${{ matrix.host }}
needs: build
needs: [build, build-32bit]
steps:
- name: install rust
if: ${{ matrix.target.arch == 'x64'}}
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- name: install rust i686
if: ${{ matrix.target.arch == 'x86' }}
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
targets: "i686-unknown-linux-gnu"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be necessary. xbuild automatically downloads the required targets using rustup

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is supposed to, but

error[E0463]: can't find crate for `core`
  |
  = note: the `i686-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add i686-unknown-linux-gnu`

says otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe something is missing somewhere...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be hardcoded but should be fixed now since #139. @iamwacko can you rebase, remove this setup from the CI (because xbuild must do it to provide a more-or-less out-of-the-box experience), and retest?


- name: install x
if: ${{ matrix.host-arch == 'x64'}}
uses: actions/download-artifact@v3
with:
name: ${{ matrix.host }}-x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not change the name of the artifact so that we can reuse this step?


- name: install x i686
if: ${{ matrix.host-arch == 'x86'}}
uses: actions/download-artifact@v3
with:
name: i686-x

- run: chmod +x ./x
if: ${{ matrix.host == 'ubuntu-latest' || matrix.host == 'macos-latest' }}

- name: install llvm ubuntu
if: ${{ matrix.host == 'ubuntu-latest' }}
if: ${{ matrix.host == 'ubuntu-latest'}}
run: sudo apt-get update && sudo apt-get install llvm

- name: install llvm macos
Expand All @@ -87,18 +128,25 @@ jobs:
java-version: 11

- name: install linux dependencies
if: ${{ matrix.host == 'ubuntu-latest' }}
if: ${{ matrix.host == 'ubuntu-latest'}}
run: sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev squashfs-tools

- name: install dependencies for i686
if: ${{ matrix.host == 'ubuntu-latest'}}
run: sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev:i386 libgtk-3-dev:i386 squashfs-tools:i386 libssl3:i386 gcc-multilib libglib2.0-0:i386

- name: create project
if: ${{ !((matrix.host == 'macos-latest' || matrix.host == 'windows-latest' )&& matrix.host.arch == 'x86')}}
run: ./x new template

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please trim (don't add) unnecessary whitespace.

# only linux can target linux as it is not clear what that even is exactly
# glibc/musl gtk/qt x11/wayland
# windows doesn't support posix symlinks so can't cross compile to macos/ios
- name: build project
if: >
!(matrix.host == 'macos-latest' && matrix.target.platform == 'linux' ||
!(matrix.host == 'macos-latest' && matrix.arch-host == 'x86' ||
matrix.host == 'windows-latest' && matrix.arch-host == 'x86' ||
matrix.host == 'macos-latest' && matrix.target.platform == 'linux' ||
matrix.host == 'windows-latest' && contains(fromJson('["linux", "macos", "ios"]'), matrix.target.platform))
run: ../x build --platform ${{ matrix.target.platform }} --arch ${{ matrix.target.arch }} --${{ matrix.opt }}
working-directory: template
Binary file added appimage/assets/runtime-i686
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the source of this file?

Binary file not shown.
4 changes: 4 additions & 0 deletions appimage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use xcommon::Signer;

#[cfg(target_arch = "x86_64")]
static RUNTIME: &[u8] = include_bytes!("../assets/runtime-x86_64");

#[cfg(target_arch = "x86")]
static RUNTIME: &[u8] = include_bytes!("../assets/runtime-i686");

pub struct AppImage {
appdir: PathBuf,
name: String,
Expand Down
2 changes: 1 addition & 1 deletion xbuild/src/devices/adb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl Adb {
"arm64-v8a" => Arch::Arm64,
//"armeabi-v7a" => Arch::Arm,
"x86_64" => Arch::X64,
//"x86" => Arch::X86,
"x86" => Arch::X86,
abi => anyhow::bail!("unrecognized abi {}", abi),
};
Ok(arch)
Expand Down
20 changes: 15 additions & 5 deletions xbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub enum Arch {
//Arm,
Arm64,
X64,
//X86,
X86,
}

impl Arch {
Expand All @@ -104,6 +104,8 @@ impl Arch {
Ok(Arch::X64)
} else if cfg!(target_arch = "aarch64") {
Ok(Arch::Arm64)
} else if cfg!(target_arch = "x86") {
Ok(Arch::X86)
} else {
anyhow::bail!("unsupported host");
}
Expand All @@ -116,7 +118,7 @@ impl std::fmt::Display for Arch {
//Self::Arm => write!(f, "arm"),
Self::Arm64 => write!(f, "arm64"),
Self::X64 => write!(f, "x64"),
//Self::X86 => write!(f, "x86"),
Self::X86 => write!(f, "x86"),
}
}
}
Expand All @@ -129,7 +131,7 @@ impl std::str::FromStr for Arch {
//"arm" => Self::Arm,
"arm64" => Self::Arm64,
"x64" => Self::X64,
//"x86" => Self::X86,
"x86" => Self::X86,
_ => anyhow::bail!("unsupported arch {}", arch),
})
}
Expand Down Expand Up @@ -283,6 +285,7 @@ impl CompileTarget {
match self.arch() {
Arch::Arm64 => apk::Target::Arm64V8a,
Arch::X64 => apk::Target::X86_64,
Arch::X86 => apk::Target::X86,
}
}

Expand All @@ -292,7 +295,7 @@ impl CompileTarget {
match self.arch() {
Arch::Arm64 => "aarch64-linux-android",
//Arch::Arm => "arm-linux-androideabi",
//Arch::X86 => "i686-linux-android",
Arch::X86 => "i686-linux-android",
Arch::X64 => "x86_64-linux-android",
}
}
Expand All @@ -307,6 +310,7 @@ impl CompileTarget {
(Arch::X64, Platform::Linux) => "x86_64-unknown-linux-gnu",
(Arch::X64, Platform::Macos) => "x86_64-apple-darwin",
(Arch::X64, Platform::Windows) => "x86_64-pc-windows-msvc",
(Arch::X86, Platform::Linux) => "i686-unknown-linux-gnu",
(arch, platform) => anyhow::bail!(
"unsupported arch/platform combination {} {}",
arch,
Expand All @@ -316,7 +320,13 @@ impl CompileTarget {
}

pub fn is_host(self) -> Result<bool> {
Ok(self.platform() == Platform::host()? && self.arch() == Arch::host()?)
// 32 bit binaries can run on 64 bit hardware, of particular use for testing
// This way 32 bit xbuild will produce 32 bit binaries, unless commanded otherwise
if cfg!(target_arch = "x86") {
Ok(false)
Comment on lines +323 to +326
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow. This doesn't seem correct as you might be breaking fully-native builds here? That's where xbuild should return true for this function.

} else {
Ok(self.platform() == Platform::host()? && self.arch() == Arch::host()?)
}
}
}

Expand Down