Skip to content

Commit 01cc3ae

Browse files
Merge pull request #4 from MillerTechnologyPeru/trunk
Fixed Arm64 support
2 parents d3db75a + 24732b2 commit 01cc3ae

File tree

8 files changed

+111
-3
lines changed

8 files changed

+111
-3
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
4+
ARG VARIANT="ubuntu-20.04"
5+
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
6+
7+
# Install BitBake dependencies
8+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
&& apt-get -y install --no-install-recommends gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev xterm python3-subunit mesa-common-dev zstd liblz4-tool file
10+

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
8+
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
9+
"args": { "VARIANT": "ubuntu-20.04" }
10+
},
11+
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
// "forwardPorts": [],
14+
15+
// Use 'postCreateCommand' to run commands after the container is created.
16+
// "postCreateCommand": "uname -a",
17+
18+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
19+
"remoteUser": "vscode"
20+
}

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
container: colemancda/meta-swift
11+
strategy:
12+
matrix:
13+
machine: [beaglebone-yocto, qemuarm64]
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
- name: Build
18+
run: |
19+
export SRC_ROOT=$GITHUB_WORKSPACE
20+
export POKY_DIR=/tmp/poky
21+
export MACHINE=${{ matrix.machine }}
22+
cd /tmp/
23+
git clone --branch dunfell-23.0.20-cmake-3.22.3 https://github.com/MillerTechnologyPeru/poky.git
24+
cd $SRC_ROOT
25+
./build.sh

.gitlab-ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
stages:
2+
- build
3+
4+
build-armv7:
5+
image: colemancda/meta-swift
6+
stage: build
7+
script:
8+
- export SRC_ROOT=$(pwd)
9+
- export MACHINE=beaglebone-yocto
10+
- export POKY_DIR=/tmp/poky
11+
- cd /tmp/
12+
- git clone --branch dunfell-23.0.20-cmake-3.22.3 https://github.com/MillerTechnologyPeru/poky.git
13+
- cd $SRC_ROOT
14+
- ./build.sh
15+
tags:
16+
- bastion-c5d.9xl
17+
18+
build-arm64:
19+
image: colemancda/meta-swift
20+
stage: build
21+
script:
22+
- export SRC_ROOT=$(pwd)
23+
- export MACHINE=qemuarm64
24+
- export POKY_DIR=/tmp/poky
25+
- cd /tmp/
26+
- git clone --branch dunfell-23.0.20-cmake-3.22.3 https://github.com/MillerTechnologyPeru/poky.git
27+
- cd $SRC_ROOT
28+
- ./build.sh
29+
tags:
30+
- bastion-c5d.9xl

build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Configuration
5+
SRC_ROOT="${SRC_ROOT:=$(pwd)}"
6+
POKY_DIR="${POKY_DIR:=$SRC_ROOT/../poky}"
7+
MACHINE="${MACHINE:=beaglebone-yocto}"
8+
9+
# Build Yocto Poky
10+
cd $POKY_DIR
11+
source oe-init-build-env
12+
bitbake-layers add-layer $SRC_ROOT
13+
# Customize build
14+
touch conf/sanity.conf
15+
CONF_FILE=./conf/local.conf
16+
rm -rf $CONF_FILE
17+
echo "# Swift for Yocto" >> $CONF_FILE
18+
echo "MACHINE=\"${MACHINE}\"" >> $CONF_FILE
19+
#echo 'SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"' >> $CONF_FILE
20+
#echo "USER_CLASSES += \"buildstats buildstats-summary\"" >> $CONF_FILE
21+
22+
# build Swift
23+
bitbake swift-hello-world

classes/swift-cmake-base.bbclass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ inherit cmake
33
DEPENDS_append += " swift-native libgcc gcc glibc "
44

55
SWIFT_TARGET_ARCH = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7', 'aarch64', d)}"
6-
SWIFT_TARGET_NAME = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnueabi', d)}"
6+
SWIFT_TARGET_NAME = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnu', d)}"
77
TARGET_CPU_NAME = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7-a', 'aarch64', d)}"
88

99
HOST_CC_ARCH_prepend = "-target ${SWIFT_TARGET_NAME}"

classes/swift.bbclass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BUILD_MODE = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
1414
# Additional parameters to pass to SPM
1515
EXTRA_OESWIFT ?= ""
1616

17-
SWIFT_TARGET_NAME = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnueabi', d)}"
17+
SWIFT_TARGET_NAME = "${@oe.utils.conditional('TARGET_ARCH', 'arm', 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnu', d)}"
1818

1919
# Workaround complex macros that cannot be automatically imported by Swift.
2020
# https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/using_imported_c_macros_in_swift

recipes-devtools/swift/swift-stdlib.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ inherit swift-cmake-base
2424
SWIFT_GGC_VERSION = "9.3.0"
2525

2626
EXTRA_INCLUDE_FLAGS = "\
27-
-I${STAGING_DIR_TARGET}/usr/include/c++/${SWIFT_GGC_VERSION}/arm-poky-linux-gnueabi \
27+
-I${STAGING_DIR_TARGET}/usr/include/c++/${SWIFT_GGC_VERSION}/${TARGET_SYS} \
2828
-I${STAGING_DIR_TARGET}/usr/include/c++/${SWIFT_GGC_VERSION} \
2929
-I${STAGING_DIR_TARGET}"
3030

0 commit comments

Comments
 (0)