Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37839008
en ru br
Репозитории ALT

Группа :: Разработка/C
Пакет: zig

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

# SPDX-License-Identifier: GPL-2.0-only
%define _unpackaged_files_terminate_build 1
%define _stripped_files_terminate_build 1
%set_verify_elf_method rpath=relaxed

Name: zig
Version: 0.11.0
Release: alt1
Summary: General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software
# TODO: Zig lib is bundled with a lot of third party with other licenses.
License: MIT
Group: Development/C
Url: https://ziglang.org/
Vcs: https://github.com/ziglang/zig/
Requires: /proc

# https://ziglang.org/download/0.10.0/release-notes.html#Support-Table

# aarch64: OK  1:07:59
#    armh: UnknownArchitecture
#    i586: FileTooBig
# ppc64le: panic: reached unreachable code
#  x86-64: OK    29:00
ExclusiveArch: %zig_arches

Source: %name-%version.tar

%define llvm_ver 16
BuildRequires(pre): rpm-macros-cmake
BuildRequires(pre): rpm-macros-zig
# /proc is required or zig will output FileNotFound
BuildRequires: chrpath
BuildRequires: clang%llvm_ver.0-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
BuildRequires: libtinfo-devel
BuildRequires: libxml2-devel
BuildRequires: lld%llvm_ver.0-devel
BuildRequires: llvm%llvm_ver.0-devel
BuildRequires: /proc
BuildRequires: zlib-devel

%description
%summary.

%prep
%setup

%package checkinstall
Summary: CI test for zig
Group: Development/Other
Requires(pre): zig

%description checkinstall
%summary.

%build
%define optflags_lto %nil
export CC=clang-%llvm_ver CXX=clang++-%llvm_ver LDFLAGS="-fuse-ld=lld $LDFLAGS"
# https://github.com/ziglang/zig/issues/16800
#   i586: UnknownArchitecture
#     -DZIG_HOST_TARGET_TRIPLE=native: LibCRuntimeNotFound
#     -DZIG_HOST_TARGET_TRIPLE=x86-linux-gnu: error: cast increases pointer alignment
%cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DZIG_PREFER_CLANG_CPP_DYLIB=true \
-DZIG_SHARED_LLVM=ON \
-DZIG_TARGET_MCPU=baseline \
-DZIG_USE_LLVM_CONFIG=ON \
-DZIG_VERSION="%version"
grep ZIG %_cmake__builddir/CMakeCache.txt
%cmake_build

%install
export ZIG_VERBOSE_LINK=y ZIG_VERBOSE_CC=y
%cmake_install
chrpath -d %buildroot%_bindir/zig

%check
PATH=%buildroot%_bindir:$PATH
zig version
zig env
zig run test/standalone/hello_world/hello.zig
zig run test/standalone/hello_world/hello_libc.zig -lc
# Run upstream tests from ci/x86_64-linux-debug.sh
cd %_cmake__builddir
zig test ../test/behavior.zig -I../test

%pre checkinstall
set -exo pipefail
zig version
zig run %_defaultdocdir/%name/hello.zig
t=$(mktemp -d)
cd "$t"
%__zig init-exe
%zig_build run
%zig_test
rm -rf -- "$t"

%files
%define _customdocdir %_docdir/%name
%doc LICENSE README.md test/standalone/hello_world/*.zig doc/langref.html.in
%_bindir/zig
%_prefix/lib/zig

%files checkinstall

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin