|
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/" |
3 | 3 |
|
4 | 4 | LICENSE = "Apache-2.0" |
5 | 5 | LIC_FILES_CHKSUM = "file://${S}/usr/share/swift/LICENSE.txt;md5=f6c482a0548ea60d6c2e015776534035" |
6 | 6 |
|
7 | 7 | require swift-version.inc |
8 | 8 | PV = "${SWIFT_VERSION}" |
9 | 9 |
|
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)}" |
13 | 31 |
|
14 | 32 | DEPENDS = "curl" |
15 | | -RDEPENDS = "ncurses-native" |
16 | | - |
| 33 | +RDEPENDS:${PN} = "ncurses-native" |
| 34 | + |
17 | 35 | S = "${WORKDIR}/${SRC_DIR}" |
18 | 36 |
|
19 | 37 | inherit native |
20 | 38 |
|
21 | 39 | ######################################################################## |
22 | 40 | # This informs bitbake that we want to install a non-default directory # |
23 | 41 | # 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 | | -# # |
31 | 42 | ######################################################################## |
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/ |
37 | 43 |
|
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} |
40 | 47 |
|
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} |
43 | 50 |
|
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} |
46 | 53 |
|
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} |
49 | 56 | } |
50 | 57 |
|
51 | | -FILES_${PN} += "${base_prefix}/opt/*" |
| 58 | +FILES:${PN} += "${base_prefix}/*" |
0 commit comments