0
0
Fork 0
haikuports/dev-lang/swift_lang/swift_lang-4.1.0~git.recipe

185 lines
6.7 KiB
Bash

SUMMARY="A modern high performance safe general-purpose programming language"
DESCRIPTION="Swift is a general-purpose programming language built using a \
modern approach to safety, performance, and software design patterns. \
The goal of the Swift project is to create the best available \
language for uses ranging from systems programming to mobile \
and desktop apps, scaling up to cloud services. Most importantly, \
Swift is designed to make writing and maintaining correct programs \
easier for the developer."
HOMEPAGE="https://swift.org"
COPYRIGHT="2017 Apple Inc"
LICENSE="Apache v2"
REVISION="2"
srcGitRev="2ee9fdff636f17aa6ee749050ce373a3ecdc7b78"
SOURCE_URI="https://github.com/apple/swift/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="fcbe48372b783d30b3de30b184d5e70103edcf11c92579dd7451a00279413b97"
SOURCE_DIR="swift-$srcGitRev"
srcGitRev_2="81aea9ea0d003bfa139cc800e0ba4eeb720580f2"
SOURCE_URI_2="https://github.com/apple/swift-clang/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="c99f546cb15d62193fa266212793e2585e676a372d66fb6d8615d94944af6e4a"
SOURCE_DIR_2="swift-clang-$srcGitRev_2"
srcGitRev_3="b6505f158283ca5d1ed0409243132b0667d79b7e"
SOURCE_URI_3="https://github.com/apple/swift-llvm/archive/$srcGitRev_3.tar.gz"
CHECKSUM_SHA256_3="48f4d2a79a0fed160decc00c0826900aefd08621205c078e76e89f483aa26c6a"
SOURCE_DIR_3="swift-llvm-$srcGitRev_3"
srcGitRev_4="d875488a6a95d5487b7c675f79a8dafef210a65f"
SOURCE_URI_4="https://github.com/apple/swift-cmark/archive/$srcGitRev_4.tar.gz"
CHECKSUM_SHA256_4="19247cd75daacb77937a480aa6b552d47b4735f93b659a429a0e1d854579d05d"
SOURCE_DIR_4="swift-cmark-$srcGitRev_4"
srcGitRev_5="31635ece3ab71eecbcbc795275cb267d55c38040"
SOURCE_URI_5="https://github.com/apple/swift-compiler-rt/archive/$srcGitRev_5.tar.gz"
CHECKSUM_SHA256_5="6e9a2c9e240ec96fc28a5085b48a8a8ee0e426e57af067cf15f714002b996ebd"
SOURCE_DIR_5="swift-compiler-rt-$srcGitRev_5"
PATCHES="swift_lang-$portVersion.patchset"
PATCHES_2="swift_clang-$portVersion.patchset"
PATCHES_3="swift_llvm-$portVersion.patchset"
ARCHITECTURES="?all !x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="!x86"
PROVIDES="
swift_lang$secondaryArchSuffix = $portVersion
cmd:lldb_moduleimport_test$secondaryArchSuffix = $portVersion
cmd:sil_func_extractor$secondaryArchSuffix = $portVersion
cmd:sil_llvm_gen$secondaryArchSuffix = $portVersion
cmd:sil_nm$secondaryArchSuffix = $portVersion
cmd:sil_opt$secondaryArchSuffix = $portVersion
cmd:sil_passpipeline_dumper$secondaryArchSuffix = $portVersion
cmd:swift$secondaryArchSuffix = $portVersion
cmd:swift_api_digester$secondaryArchSuffix = $portVersion
cmd:swift_api_dump.py$secondaryArchSuffix = $portVersion
cmd:swift_autolink_extract$secondaryArchSuffix = $portVersion
cmd:swift_demangle$secondaryArchSuffix = $portVersion
cmd:swift_format$secondaryArchSuffix = $portVersion
cmd:swift_ide_test$secondaryArchSuffix = $portVersion
cmd:swift_llvm_opt$secondaryArchSuffix = $portVersion
cmd:swift_refactor$secondaryArchSuffix = $portVersion
cmd:swift_reflection_dump$secondaryArchSuffix = $portVersion
cmd:swift_reflection_test_haiku_x86_64$secondaryArchSuffix = $portVersion
cmd:swift_remoteast_test$secondaryArchSuffix = $portVersion
cmd:swift_syntax_test$secondaryArchSuffix = $portVersion
cmd:swiftc$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
llvm$secondaryArchSuffix >= 5.0.0
lib:libatomic$secondaryArchSuffix
lib:libcharset$secondaryArchSuffix
lib:libedit$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libicudata$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libuuid$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
gcc_syslibs$secondaryArchSuffix_devel
devel:libcharset$secondaryArchSuffix
devel:libedit$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
devel:libgcc$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix
devel:libicui18n$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libuuid$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:clang$secondaryArchSuffix
cmd:clang++$secondaryArchSuffix
cmd:cmake
cmd:diff
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:groff
cmd:ld$secondaryArchSuffix
cmd:libtool$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:python2
cmd:sed
cmd:swig
cmd:which
"
BUILD()
{
cd ..
mkdir -p swift clang llvm cmark compiler-rt
# Copy all the source files
cp -rd $sourceDir/* swift
cp -rd $sourceDir2/* clang
cp -rd $sourceDir3/* llvm
cp -rd $sourceDir4/* cmark
cp -rd $sourceDir5/* compiler-rt
# Fix permisssions for build-script.
chmod +x ./swift/utils/build-script ./swift/utils/build-script-impl
chmod -R 755 ./swift/utils
export HOST_CC="/bin/clang"
export HOST_CXX="/bin/clang++"
# Build faster by building only for X86
python2 ./swift/utils/build-script -R -m \
--extra-cmake-options='-DLLVM_ENABLE_ASSERTIONS=TRUE \
-DCMAKE_SKIP_RPATH=FALSE -DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_THREADS=YES \
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC' \
--stdlib-deployment-targets=haiku-x86_64 $jobArgs
}
INSTALL()
{
mkdir -p $binDir $libDir/swift $libDir/swift/shims \
$libDir/swift/haiku/x86_64 $libDir/swift/clang/include
cd ../build/Unix_Makefiles-ReleaseAssert/swift-haiku-x86_64
# Copy the executables into the binDir.
cp ./bin/* $binDir
cd ./lib/swift/
# Symlink and copy the clang headers.
ln -sfn ../../../llvm-haiku-x86_64/lib/clang/5.0.0/include/ clang
cp -R ./clang/* $libDir/swift/clang/include
cp -R ./shims/* $libDir/swift/shims
# Copy the specific library files.
cp ./haiku/libswiftCore.so $libDir/swift/haiku
cp ./haiku/libswiftGlibc.so $libDir/swift/haiku
cp ./haiku/libswiftRemoteMirror.so $libDir/swift/haiku
cp ./haiku/libswiftSwiftOnoneSupport.so $libDir/swift/haiku
# Copy the essential swiftmodule files.
cp ./haiku/x86_64/SwiftOnoneSupport.swiftmodule $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Glibc.swiftmodule $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Swift.swiftmodule $libDir/swift/haiku/x86_64
# Copy the essential swiftdoc files.
cp ./haiku/x86_64/SwiftOnoneSupport.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Glibc.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Swift.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/glibc.modulemap $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/swift_begin.o $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/swift_end.o $libDir/swift/haiku/x86_64
}
TEST()
{
python2 utils/build-script -R -t
}