Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 567514 - dev-lang/swift: high-performance system programming language by Apple
Summary: dev-lang/swift: high-performance system programming language by Apple
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-04 02:34 UTC by Seong-ho Cho
Modified: 2022-02-03 05:47 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-libs/cmark-9999.ebuild (cmark-9999.ebuild,747 bytes, text/plain)
2015-12-05 17:16 UTC, LE GARREC Vincent
Details
=dev-lang/swift-2.2 (dev-lang-swift.tar.gz,5.10 KB, application/gzip)
2016-02-23 03:46 UTC, Andrey Ovcharov
Details
Improved Swift ebuild for version 2.2 (swift-2.2.ebuild,7.05 KB, text/plain)
2016-02-26 14:45 UTC, Anselm Busse
Details
build-swift-2.2.log.xz (build-swift-2.2.log.xz,37.88 KB, application/x-xz)
2016-02-27 21:22 UTC, LE GARREC Vincent
Details
Improved Swift ebuild for version 2.2, <dev-python/sphinx-1.3.5 required (swift-2.2.ebuild,7.06 KB, text/plain)
2016-02-28 16:05 UTC, Anselm Busse
Details
build-swift-2.2_2.log.xz (build-swift-2.2_2.log.xz,68.46 KB, application/x-tar)
2016-02-29 18:11 UTC, LE GARREC Vincent
Details
swift-3.0.2.ebuild (swift-3.0.2.ebuild,5.74 KB, text/plain)
2016-12-16 06:51 UTC, LE GARREC Vincent
Details
swift-3.0-script-impl.patch (swift-3.0-script-impl.patch,535 bytes, patch)
2016-12-16 06:53 UTC, LE GARREC Vincent
Details | Diff
build-3.0.2.log.xz (build-3.0.2.log.xz,43.67 KB, application/x-xz)
2016-12-16 07:02 UTC, LE GARREC Vincent
Details
build-log.3.1.1.xz (build.log-3.1.1.xz,74.32 KB, application/x-xz)
2017-08-20 15:15 UTC, LE GARREC Vincent
Details
swift-3.1.1-ebuild.tar.xz (swift-3.1.1-ebuild.tar.xz,3.20 KB, application/x-xz)
2017-08-20 15:17 UTC, LE GARREC Vincent
Details
swift-9999 ebuild (swift-9999.ebuild,6.29 KB, text/plain)
2021-01-01 16:46 UTC, Rullie
Details
build-9999.log.gz (build.log.gz,125.13 KB, application/gzip)
2021-02-14 13:19 UTC, LE GARREC Vincent
Details
swift-bin-5.5.2 (swift-bin-5.5.2.ebuild,4.30 KB, text/plain)
2022-01-30 19:36 UTC, Rullie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Seong-ho Cho 2015-12-04 02:34:16 UTC
as we know, apple opens swift compiler, library, and any other things useful to program by using swift language.

so I suggest to add dev-lang/swift-9999 from github.com/apple/swift to the official gentoo portage tree.
Comment 1 LE GARREC Vincent 2015-12-05 07:33:11 UTC
I'm actually trying to write an ebuild and I have two problems:

1) EGIT_REPO_URI does not looks to support multiples repositories. Does it mean that I will need to write one ebuild for each source ? The main script of swift needs all repositories. Is it possible, at first, to create fake ebuilds just to download the source in "egit-src", then a true one that compile all source ?

2) Apple have its own repository for llvm. Should I use this one or force to use the one from llvm.org ? Does someone knows if there is a difference between those two ?
Comment 2 LE GARREC Vincent 2015-12-05 17:16:20 UTC
Created attachment 418608 [details]
dev-libs/cmark-9999.ebuild

The first dependency not in the tree. Also, my first ebuild. Tell me if there is a problem.
Next ebuild (swift) will take few time too.
Comment 3 LE GARREC Vincent 2015-12-05 21:23:49 UTC
I had a look inside tĥe ebuild of llvm and I found answer for all my questions from comment #2.

But my last question is: does swift really need an ebuild or just an USE flag ? I'm asking because lldb is already an USE flag of llvm, so swift should be too, no ? Maybe llvm's mainteners could do it ?
Comment 4 Chloe Stars 2016-01-25 00:52:11 UTC
AUR has a PKGBUILD (https://aur.archlinux.org/packages/swift/). Could look at that for example usage.
Comment 5 Andrey Ovcharov 2016-02-23 03:46:11 UTC
Created attachment 426280 [details]
=dev-lang/swift-2.2

=dev-lang/swift-2.2 translated from PKGBUILD.
src_prepare work fine else not so.
Comment 6 Anselm Busse 2016-02-26 14:45:35 UTC
Created attachment 426644 [details]
Improved Swift ebuild for version 2.2
Comment 7 Anselm Busse 2016-02-26 14:46:19 UTC
> =dev-lang/swift-2.2 translated from PKGBUILD.
> src_prepare work fine else not so.

I modified the ebuild and it builds for me now; however I've only tested a "hello world" Swift program both with the compiler and interpreter. The claim by the arch guys that Swift has no installer is not entirely accurate, but it seems to be broken and ongoing work. So I stayed with the "manual" installation. I also made the lldb part depend on a flag. Unfortunately, this part is also broken in the ebuild because it uses the swift installer as well. So far I have no idea how the PKGBUILD works with it.
Comment 8 LE GARREC Vincent 2016-02-27 21:22:46 UTC
Created attachment 426808 [details]
build-swift-2.2.log.xz

I just tried the second ebuild (too much troubles with the fisrt one sorry), it compiles well but it does not install swift. Please find enclosed the log. At the very end, it looks like there's troubles :

QA Notice: Symbolic link /usr/bin/swiftc points to /usr/bin/swift which does not exist.

and during installation :
>>> Install swift-2.2 into /home/legarrec/info/portage/dev-lang/swift-2.2/image/ category dev-lang
/usr/bin/install: cannot stat 'bin/swift': No such file or directory
/home/legarrec/info/portage/dev-lang/swift-2.2/temp/environment: line 3689: cd: llbuild-linux-x86_64: No such file or directory
/usr/bin/install: cannot stat 'bin/swift-build-tool': No such file or directory
/home/legarrec/info/portage/dev-lang/swift-2.2/temp/environment: line 3691: cd: swiftpm-linux-x86_64: No such file or directory
/usr/bin/install: cannot stat 'debug/swift-build': No such file or directory
/usr/bin/install: cannot stat 'lib/swift/pm/libPackageDescription.so': No such file or directory
/usr/bin/install: cannot stat 'lib/swift/pm/PackageDescription.swiftmodule': No such file or directory
/home/legarrec/info/portage/dev-lang/swift-2.2/temp/environment: line 3696: cd: foundation-linux-x86_64: No such file or directory
/usr/bin/install: cannot stat 'Foundation/libFoundation.so': No such file or directory
/usr/bin/install: cannot stat 'Foundation/Foundation.swiftdoc': No such file or directory
/usr/bin/install: cannot stat 'Foundation/Foundation.swiftmodule': No such file or directory
cp: cannot stat 'Foundation/usr/lib/swift/CoreFoundation': No such file or directory
/home/legarrec/info/portage/dev-lang/swift-2.2/temp/environment: line 3702: cd: xctest-linux-x86_64: No such file or directory
/usr/bin/install: cannot stat 'libXCTest.so': No such file or directory
/usr/bin/install: cannot stat 'XCTest.swiftdoc': No such file or directory
/usr/bin/install: cannot stat 'XCTest.swiftmodule': No such file or directory
/home/legarrec/info/portage/dev-lang/swift-2.2/temp/environment: line 3707: cd: lldb-linux-x86_64: No such file or directory
ninja: error: loading 'build.ninja': No such file or directory
>>> Completed installing swift-2.2 into /home/legarrec/info/portage/dev-lang/swift-2.2/image/

When you build your application, does swift is compiled after the line ?
[473/509] Building HTML documentation FAILED
Comment 9 Anselm Busse 2016-02-28 15:47:21 UTC
Ok, looks like you have the problem with Sphinx not knowing about Swift highlighting. The Arch guys have a patch for that, but because it worked for me, I assumed it was just a problem for them with some outdated software. What version of dev-python/pygments do you have on your system?

The installation just starts because the compile phase does not fail properly. I will fix that, but first have a look at the Sphinx problem.
Comment 10 LE GARREC Vincent 2016-02-28 15:56:47 UTC
I will try to apply the patch for sphinx but be patient, every compilation failure takes about 6 hours of my computer.

Portage 2.2.27 (python 3.4.3-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-5.3.0, glibc-2.22-r2, 4.4.0-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.0-gentoo-r1-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:     8128816 total,    306264 free
KiB Swap:    9767516 total,   9766176 free
Timestamp of repository gentoo: Sun, 28 Feb 2016 07:30:01 +0000
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r2::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/cmake:           3.4.3::gentoo
dev-util/pkgconfig:       0.29::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.5::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.6.4::gentoo, 4.7.4::gentoo, 4.8.5::gentoo, 4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

crossdev
    location: /home/legarrec/info/overlay
    masters: gentoo
    priority: 0

gentoo-zh
    location: /var/lib/layman/gentoo-zh
    masters: gentoo
    priority: 50

kde
    location: /var/lib/layman/kde
    masters: gentoo
    priority: 50

science
    location: /var/lib/layman/science
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j9 --load-average=9"
FCFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news noclean parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="fr_FR.UTF-8"
LDFLAGS="-Wl,--as-needed -Wl,-O0"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/home/legarrec/info"
USE="X a52 aac accessibility acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli colord cracklib crypt cuda cups cxx dbus declarative dhcpcd dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gtk3 iconv introspection ipv6 jpeg kde kipi lcms ldap libav libnotify libsecret mad mmx mmxext mng modules mp3 mp4 mpeg multilib nautilus ncurses nls nptl ogg opencl opengl openmp pam pango pcre pdf phonon plasma png policykit ppds pulseaudio qml qt3support qt4 qt5 readline sdl seccomp semantic-desktop session spell sse sse2 ssl startup-notification svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vorbis widgets wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver" LINGUAS="fr en ja" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

dev-python/sphinx-1.3.5::gentoo was built with the following:
USE="-doc -latex -test" ABI_X86="64" PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_3 -python3_5"
dev-python/pygments-2.1.1::gentoo was built with the following:
USE="-doc -test" ABI_X86="64" PYTHON_TARGETS="python2_7 python3_4 -pypy -pypy3 -python3_3 -python3_5"
Comment 11 Anselm Busse 2016-02-28 16:00:07 UTC
No need, I already figured out the problem. You have the unstable version of Sphinx 1.3.5 while I have the stable 1.3.1-r1. 1.3.5 introduced the problem (see https://bugs.swift.org/browse/SR-620). So basically we now have two possibilities, stay with Sphinx <1.3.5 until it the mentioned bug is fixed or go with the Arch patch. I would prefer the former one.
Comment 12 Anselm Busse 2016-02-28 16:05:18 UTC
Created attachment 426906 [details]
Improved Swift ebuild for version 2.2, <dev-python/sphinx-1.3.5 required

As just mentioned <dev-python/sphinx-1.3.5 breaks the build process right now. Please see if this ebuild works.
Comment 13 LE GARREC Vincent 2016-02-29 18:11:15 UTC
Created attachment 427022 [details]
build-swift-2.2_2.log.xz

This is working better with sphinx-1.3.4.
I was be able to run swift.

swift without args :
"LLVM ERROR: Compiler-internal integrated REPL unimplemented for this platform; use the LLDB-enhanced REPL instead."

but :

echo 'print("Hello World")' > swifthello.swift
swift swifthello.swift

is working well and :

swiftc swifthello.swift -o mypro
./mypro

is working too.

But in my log, I have :


-- Installing: /home/legarrec/info/portage/dev-lang/swift-2.2/image/usr/include/lldb/lldb-private-enumerations.h
CMake Error at scripts/cmake_install.cmake:36 (file):
  file INSTALL cannot find
  "/home/legarrec/info/portage/dev-lang/swift-2.2/work/build/Ninja-ReleaseAssert/lldb-linux-x86_64/lib/python2.7".
Call Stack (most recent call first):
  cmake_install.cmake:42 (include)

The truth is that I don't have …lldb-linux-x86_64/lib/python2.7 but I have …lldb-linux-x86_64/lib64/python2.7

Do you think that cmake_install.cmake should be patch depend on the platform or the modification should be done somewhere else ?
Comment 14 Anselm Busse 2016-03-01 19:22:26 UTC
Yes, I know that this doesn't work as I have indicated in a previous post. The installation process of Swift seems to be ongoing work and as I have already stated none of the installation scripts are working. That's why the Arch guys are doing a "manual" installation, and that's why I adopted it.

Unfortunately, the lldb part is an exception in the PKGBUILD. It uses the installation routine of Swift, which is currently failing on Gentoo as you have experienced. I haven't figured out yet, why it seems to work on Arch but not on Gentoo. Does anyone have an idea whats going wrong, except the obvious that the path doesn't match?
Comment 16 Andrey Ovcharov 2016-09-15 03:26:40 UTC
swift-3.0 is out https://swift.org/blog/swift-3-0-released/
Comment 17 Amy Liffey gentoo-dev 2016-12-12 13:43:29 UTC
Hello,
Would you be willing to maintain this package through Proxy Maintainers project?

https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers
Comment 18 Anselm Busse 2016-12-12 14:47:35 UTC
Are you refering to me or Andrey?
Comment 19 Amy Liffey gentoo-dev 2016-12-12 16:03:16 UTC
(In reply to Anselm Busse from comment #18)
> Are you refering to me or Andrey?

Anyone who would be willing to take care about this ebuild or you can also both work on it :)
Comment 20 Seong-ho Cho 2016-12-14 14:28:54 UTC
telling overlay containing swift ebuild seems to encourage us to participate test aggressively.

we're not late ;-) but, i don't know and i'm not sure it's ok now.
Comment 21 LE GARREC Vincent 2016-12-16 06:51:44 UTC
Created attachment 456358 [details]
swift-3.0.2.ebuild

I tried to convert swift-2.2 to swift 3.0.2. (python 2 => python 3)
Comment 22 LE GARREC Vincent 2016-12-16 06:53:17 UTC
Created attachment 456360 [details, diff]
swift-3.0-script-impl.patch

but it required a new patch file
Comment 23 LE GARREC Vincent 2016-12-16 07:02:05 UTC
Created attachment 456362 [details]
build-3.0.2.log.xz

unfortunately, compilation fails (swift crashes) and I still have the problem during installation :

cp: cannot stat 'lib64/swift/clang': No such file or directory
Comment 24 LE GARREC Vincent 2017-08-20 15:14:14 UTC
I worked again with swift.

Now all compile well, all install well but I can't figure what's the problem about the final message : 

Files matching a file type that is not allowed:
   usr/lib/libcmark.so.0.22.0
   usr/lib/liblldb.so.4.0.0
 * ERROR: dev-lang/swift-3.1.1::crossdev failed:
 *   multilib-strict check failed!


If i'm right, that's because there's file in …/dev-lang/swift-3.1.1/image/usr/lib  instead of …/usr/lib64 ? Do I have to patch the install so it install in /usr/lib64 instead of /usr/lib (in 64-bit arch) ?
Comment 25 LE GARREC Vincent 2017-08-20 15:15:32 UTC
Created attachment 489784 [details]
build-log.3.1.1.xz
Comment 26 LE GARREC Vincent 2017-08-20 15:17:28 UTC
Created attachment 489786 [details]
swift-3.1.1-ebuild.tar.xz
Comment 27 Rullie 2021-01-01 16:46:30 UTC
Created attachment 680533 [details]
swift-9999 ebuild

I've been tinkering with this and got 9999 to work on amd64, though swift-5.3 branch didn't compile. Overlay is here https://github.com/luliu/swift-overlay

Attached the ebuild as well.
Comment 28 LE GARREC Vincent 2021-02-14 13:18:15 UTC
Thanks for your work. I tried you new ebuild. I compiled with success but I have a sandbox violation.

F: open_wr
S: deny
P: /dev/nvidiactl
A: /dev/nvidiactl
R: /dev/nvidiactl
C: /home/legarrec/info/portage/dev-lang/swift-9999/work/build/Ninja-ReleaseAssert/llvm-linux-x86_64/CMakeFiles/CMakeTmp/cmTC_897ea
Comment 29 LE GARREC Vincent 2021-02-14 13:19:37 UTC
Created attachment 686688 [details]
build-9999.log.gz
Comment 30 Rullie 2022-01-30 19:36:49 UTC
Created attachment 764005 [details]
swift-bin-5.5.2
Comment 31 Rullie 2022-01-30 19:37:33 UTC
Dialed back on ambition and just tried to work with Apple's official released bin variant. Had some moderate success with latest 5.5.2 release.

See swift-bin-5.5.2 in https://github.com/luliu/swift-overlay

Ran into some trouble with LLDB support for Swift REPL. The LLDB from portage seems different from the one Apple ships in their tar file.  So to use REPL you can't have lldb on your system.
Comment 32 Rullie 2022-01-30 19:43:40 UTC
Comment on attachment 764005 [details]
swift-bin-5.5.2

># Copyright 2020 Gentoo Authors
># Distributed under the terms of the GNU General Public License v2
>
>EAPI=7
>
>inherit multilib-minimal
>
>DESCRIPTION="Swift programming language from Apple"
>HOMEPAGE="www.swift.org"
>
>SRC_URI="https://download.swift.org/swift-${PV}-release/amazonlinux2/swift-${PV}-RELEASE/swift-${PV}-RELEASE-amazonlinux2.tar.gz"
>
>S=${WORKDIR}
>
>LICENSE=""
>SLOT="0"
>KEYWORDS="~amd64 ~x86"
>
>REQUIRED_USE="clang? ( !repl )"
>IUSE="repl icu clang"
>RESTRICT="repl? ( strip )"
>
>DEPEND="${PYTHON_DEPS}
>		!!sys-devel/clang:10
>		!!dev-lang/swift
>		"
>RDEPEND="${DEPEND}
>		clang? ( sys-devel/clang:13 )
>		repl? ( !!dev-util/lldb 
>                        dev-libs/libedit )
>		dev-lang/python:3.7
>		sys-devel/lld
>		icu? ( dev-libs/icu-layoutex )
>		dev-util/systemtap
>		"
>
>src_install() {
>	ZIPDIR=swift-${PV}-RELEASE-amazonlinux2
>	if ! use clang; then
>		dobin ${WORKDIR}/${ZIPDIR}/usr/bin/clang-10
>		dobin ${WORKDIR}/${ZIPDIR}/usr/bin/clangd
>
>		dosym clang-10 /usr/bin/clang
>		dosym clang /usr/bin/clang++
>		dosym clang /usr/bin/clang-cl
>		dosym clang /usr/bin/clang-cpp
>	fi
>
>	#dobin ${WORKDIR}/${ZIPDIR}/usr/bin/lld
>	if use repl; then
>		dobin ${WORKDIR}/${ZIPDIR}/usr/bin/lldb
>		dobin ${WORKDIR}/${ZIPDIR}/usr/bin/lldb-argdumper
>		dobin ${WORKDIR}/${ZIPDIR}/usr/bin/lldb-server
>	fi
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/plutil
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/repl_swift
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/sourcekit-lsp
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-api-checker.py
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-build
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-build-sdk-interfaces
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-build-tool
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-demangle
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-driver
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-frontend
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-help
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-package
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-package-collection
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-run
>	dobin ${WORKDIR}/${ZIPDIR}/usr/bin/swift-test
>
>	#dosym lld /usr/bin/ld64.lld
>	#dosym lld /usr/bin/ld64.lld.darwinnew
>	#dosym lld /usr/bin/ld.lld
>	#dosym lld /usr/bin/lld-link
>	#dosym lld /usr/bin/wasm-ld
>	dosym swift-frontend /usr/bin/swift
>	dosym swift-frontend /usr/bin/swift-api-digester
>	dosym swift-frontend /usr/bin/swift-api-extract
>	dosym swift-frontend /usr/bin/swift-autolink-extract
>	dosym swift-frontend /usr/bin/swiftc
>	dosym swift-frontend /usr/bin/swift-symbolgraph-extract
>	dosym swift-frontend /usr/bin/swift-symbolgraph-extract
>
>	doheader -r ${WORKDIR}/${ZIPDIR}/usr/include
>
>	dolib.so ${WORKDIR}/${ZIPDIR}/usr/lib/libIndexStore.so.10git
>	dolib.so ${WORKDIR}/${ZIPDIR}/usr/lib/libsourcekitdInProc.so
>	dolib.so ${WORKDIR}/${ZIPDIR}/usr/lib/libswiftDemangle.so
>	if use repl; then
>		dolib.so ${WORKDIR}/${ZIPDIR}/usr/lib/liblldb.so.10.0.0git
>	fi
>
>	insinto /usr/lib
>	doins -r ${WORKDIR}/${ZIPDIR}/usr/lib/swift
>	doins -r ${WORKDIR}/${ZIPDIR}/usr/lib/swift_static
>
>	dosym libIndexStore.so.10git /usr/lib64/libIndexStore.so
>	if use repl; then
>		dosym liblldb.so.10.0.0git /usr/lib64/liblldb.so.10git
>		dosym liblldb.so.10git /usr/lib64/liblldb.so
>	fi
>
>	dosym ../lib64/libIndexStore.so /usr/lib/libIndexStore.so
>	dosym ../lib64/libIndexStore.so.10git /usr/lib/libIndexStore.so.10git
>	if use repl; then
>		dosym ../lib64/liblldb.so /usr/lib/liblldb.so
>		dosym ../lib64/liblldb.so.10.0.0git /usr/lib/liblldb.so.10.0.0git
>		dosym ../lib64/liblldb.so.10git /usr/lib/liblldb.so.10git
>	fi
>	dosym ../lib64/libsourcekitdInProc.so /usr/lib/libsourcekitdInProc.so
>	dosym ../lib64/libswiftDemangle.so /usr/lib/libswiftDemangle.so
>
>	if use clang; then
>		# We need to fix symlink path to clang
>		CLANG_VERSION=`clang --version | grep "clang version"`
>		CLANG_VERSION_TOKEN=($CLANG_VERSION)
>		dosym ../../lib/clang/${CLANG_VERSION_TOKEN[2]} /usr/lib64/swift/clang
>		dosym ../../lib/clang/${CLANG_VERSION_TOKEN[2]} /usr/lib64/swift_static/clang
>		# Hard coded to 13 for now
>		dosym ../lib/llvm/13/bin/clang /usr/bin/clang
>	else
>		# Or use use Apple's built in Clang 10.0.0
>		insinto /usr/lib/clang/
>		doins -r ${WORKDIR}/${ZIPDIR}/usr/lib/clang/10.0.0
>	fi
>
>	insinto /usr/local
>	doins -r ${WORKDIR}/${ZIPDIR}/usr/local/include
>
>	dodoc -r ${WORKDIR}/${ZIPDIR}/usr/share/doc/swift
>
>	insinto /usr/share
>	doins -r ${WORKDIR}/${ZIPDIR}/usr/share/icuswift
>	doins -r ${WORKDIR}/${ZIPDIR}/usr/share/swift
>
>	doman ${WORKDIR}/${ZIPDIR}/usr/share/man/man1/*.1
>}
>