Skip to content

Commit 8e15c6b

Browse files
committed
Update swift-native for Swift 6.1.2
1 parent d6b5d6c commit 8e15c6b

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed
Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,58 @@
1-
SUMMARY = "Swift toolchain for Linux"
2-
HOMEPAGE = "https://swift.org/download/#releases"
1+
SUMMARY = "Swift native toolchain for Linux"
2+
HOMEPAGE = "https://swift.org/install/"
33

44
LICENSE = "Apache-2.0"
55
LIC_FILES_CHKSUM = "file://${S}/usr/share/swift/LICENSE.txt;md5=f6c482a0548ea60d6c2e015776534035"
66

77
require swift-version.inc
88
PV = "${SWIFT_VERSION}"
99

10-
SRC_DIR = "swift-${PV}-RELEASE-ubuntu20.04"
11-
SRC_URI = "https://download.swift.org/swift-${PV}-release/ubuntu2004/swift-${PV}-RELEASE/swift-${PV}-RELEASE-ubuntu20.04.tar.gz"
12-
SRC_URI[sha256sum] = "b014975844beac5ab3a7f71420181f45d0a93243f9ea4853e6588c05cad1e363"
10+
def swift_native_arch_suffix(d):
11+
host_arch = d.getVar('HOST_ARCH')
12+
if host_arch == 'x86_64':
13+
return ''
14+
else:
15+
return f'-{host_arch}'
16+
17+
def swift_native_arch_checksum(d):
18+
sha256 = {
19+
"x86_64": "d749d5fe2d6709ee988e96b16f02bca7b53304d09925e31063fd5ec56019de9f",
20+
"aarch64": "0be937ec11860cad109ab422541643f7c6b1156daa91c9e2c70d8f03ce245cb6"
21+
}
22+
23+
host_arch = d.getVar('HOST_ARCH')
24+
return sha256[host_arch]
25+
26+
SWIFT_ARCH_SUFFIX = "${@swift_native_arch_suffix(d)}"
27+
28+
SRC_DIR = "swift-${SWIFT_VERSION}-RELEASE-ubuntu24.04${SWIFT_ARCH_SUFFIX}"
29+
SRC_URI = "https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2404${SWIFT_ARCH_SUFFIX}/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu24.04${SWIFT_ARCH_SUFFIX}.tar.gz"
30+
SRC_URI[sha256sum] = "${@swift_native_arch_checksum(d)}"
1331

1432
DEPENDS = "curl"
15-
RDEPENDS = "ncurses-native"
16-
33+
RDEPENDS:${PN} = "ncurses-native"
34+
1735
S = "${WORKDIR}/${SRC_DIR}"
1836

1937
inherit native
2038

2139
########################################################################
2240
# This informs bitbake that we want to install a non-default directory #
2341
# in the native sysroot. #
24-
# #
25-
# We install the swift toolchain into opt to avoid conflicts with #
26-
# other packages when installing. Ex: #
27-
# #
28-
# The file /usr/include/unicode/sortkey.h is installed by both #
29-
# swift-native and icu-native, aborting #
30-
# #
3142
########################################################################
32-
SYSROOT_DIRS_NATIVE += "${base_prefix}/opt"
33-
34-
do_install_append () {
35-
install -d ${D}${base_prefix}/opt/usr/bin/
36-
cp -r ${S}/usr/bin/* ${D}${base_prefix}/opt/usr/bin/
3743

38-
install -d ${D}${bindir}/
39-
ln -s ../../opt/usr/bin ${D}${bindir}/swift-tools
44+
do_install:append () {
45+
install -d ${D}${bindir}
46+
cp -r ${S}/usr/bin/* ${D}${bindir}
4047

41-
install -d ${D}${base_prefix}/opt/usr/lib/
42-
cp -r ${S}/usr/lib/* ${D}${base_prefix}/opt/usr/lib/
48+
install -d ${D}${libdir}
49+
cp -rd ${S}/usr/lib/* ${D}${libdir}
4350

44-
install -d ${D}${base_prefix}/opt/usr/include/
45-
cp -r ${S}/usr/include/* ${D}${base_prefix}/opt/usr/include/
51+
install -d ${D}${includedir}
52+
cp -rd ${S}/usr/include/* ${D}${includedir}
4653

47-
install -d ${D}${base_prefix}/opt/usr/share/
48-
cp -r ${S}/usr/share/* ${D}${base_prefix}/opt/usr/share/
54+
install -d ${D}${datadir}
55+
cp -rd ${S}/usr/share/* ${D}${datadir}
4956
}
5057

51-
FILES_${PN} += "${base_prefix}/opt/*"
58+
FILES:${PN} += "${base_prefix}/*"

0 commit comments

Comments
 (0)