commit:     01327ee8db1a1e7d88849498264988031bc4d552
Author:     Nick Erdmann <n <AT> nirf <DOT> de>
AuthorDate: Sun May 26 06:22:57 2019 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 08:37:35 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01327ee8

dev-lang/zig: new package

Zig is an open-source programming language designed for robustness,
optimality, and maintainability.

Feature Highlights
- Manual memory management. Memory allocation failure is handled correctly.
  Edge cases matter!
- Zig competes with C instead of depending on it. The Zig Standard Library
  does not depend on libc.
- Small, simple language. Focus on debugging your application rather than
  debugging your knowledge of your programming language.
- A fresh take on error handling that resembles what well-written C error
  handling looks like, minus the boilerplate and verbosity.
- Debug mode optimizes for fast compilation time and crashing with a stack
  trace when undefined behavior would happen.
- ReleaseFast mode produces heavily optimized code. What other projects call
  "Link Time Optimization" Zig does automatically.
- ReleaseSafe mode produces optimized code but keeps safety checks enabled.
  Disable safety checks in the bottlenecks of your code.
- Generic data structures and functions.
- Compile-time reflection and compile-time code execution. No preprocessor.
- Concurrency via coroutines. Async/await is thread-safe, non-blocking, and
  makes no syscalls, and therefore available in freestanding mode. You can
  multiplex coroutines onto a thread pool in userland for M:N concurrency.
- Import .h files and directly use C types, variables, and functions.
- Export functions, variables, and types for C code to depend on.
  Automatically generate .h files.
- Optional type instead of null pointers.
- Order independent top level declarations.
- Friendly toward package maintainers. Reproducible build, 3-step
  bootstrapping process.
- Cross-compiling is a first-class use case.

Package-Manager: portage-2.3.66
Closes: https://bugs.gentoo.org/683386
Signed-off-by: Nick Erdmann <n <AT> nirf.de>
Closes: https://github.com/gentoo/gentoo/pull/12110
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-lang/zig/Manifest         |  1 +
 dev-lang/zig/metadata.xml     | 18 ++++++++++++++
 dev-lang/zig/zig-0.4.0.ebuild | 56 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+)

diff --git a/dev-lang/zig/Manifest b/dev-lang/zig/Manifest
new file mode 100644
index 00000000000..d5a4c7c3d61
--- /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 00000000000..514f150afb0
--- /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>[email protected]</email>
+               <name>Nick Erdmann</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</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 00000000000..5edf8df8887
--- /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
+}

Reply via email to