summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/zig/Manifest1
-rw-r--r--dev-lang/zig/metadata.xml18
-rw-r--r--dev-lang/zig/zig-0.4.0.ebuild56
3 files changed, 75 insertions, 0 deletions
diff --git a/dev-lang/zig/Manifest b/dev-lang/zig/Manifest
new file mode 100644
index 000000000000..d5a4c7c3d611
--- /dev/null
+++ b/dev-lang/zig/Manifest
@@ -0,0 +1 @@
+DIST zig-0.4.0.tar.gz 8924757 BLAKE2B 5ca3377f205694ff02360900b49eee7347cdf1cdaef90f1be071eff2610425ed453dfb35928fbe65b25f151b7153ab838c887d362ed3cd746f07833ae42510fd SHA512 423915730bc4ae9a67db3731a96471467826d16e59b87b3541f3e8ed2436f941939f22ccbebdb9a958a195b05360eb65f5be1658b32a01cc8db55c6e581eb039
diff --git a/dev-lang/zig/metadata.xml b/dev-lang/zig/metadata.xml
new file mode 100644
index 000000000000..514f150afb0e
--- /dev/null
+++ b/dev-lang/zig/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>n@nirf.de</email>
+ <name>Nick Erdmann</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <use>
+ <flag name="experimental">Enable builds that do not support all of LLVM's target architectures</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">ziglang/zig</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-lang/zig/zig-0.4.0.ebuild b/dev-lang/zig/zig-0.4.0.ebuild
new file mode 100644
index 000000000000..5edf8df88870
--- /dev/null
+++ b/dev-lang/zig/zig-0.4.0.ebuild
@@ -0,0 +1,56 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-utils
+
+DESCRIPTION="A robust, optimal, and maintainable programming language"
+HOMEPAGE="https://ziglang.org/"
+LICENSE="MIT"
+SLOT="0"
+IUSE="+experimental"
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://github.com/ziglang/zig.git"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/ziglang/zig/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 NVPTX
+ PowerPC Sparc SystemZ WebAssembly X86 XCore )
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
+# According to zig's author, zig builds that do not support all targets are not
+# supported by the upstream project.
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]}
+
+RDEPEND="
+ =sys-devel/llvm-8*
+ !experimental? ( =sys-devel/llvm-8*[${LLVM_TARGET_USEDEPS// /,}] )
+"
+
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ if use experimental; then
+ sed -i '/^NEED_TARGET(/d' cmake/Findllvm.cmake || die "unable to modify cmake/Findllvm.cmake"
+ fi
+
+ sed -i '/^install(TARGETS zig_cpp/d' CMakeLists.txt || die "unable to modify CMakeLists.txt"
+ sed -i '/install(TARGETS embedded/d' CMakeLists.txt || die "unable to modify CMakeLists.txt"
+
+ # Suppress error messages
+ sed -i '/if(NOT(CMAKE_BUILD_TYPE/,/endif()/d' cmake/Findllvm.cmake || die "unable to modify cmake/Findllvm.cmake"
+
+ cmake-utils_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DBUILD_SHARED_LIBS=OFF
+ )
+
+ cmake-utils_src_configure
+}