Files
2026-05-17 22:51:57 +04:00

68 lines
2.6 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup cmake 1.1
PortGroup codeberg 1.0
PortGroup legacysupport 1.1
codeberg.setup ziglang zig 0.16.0
revision 1
categories lang
license MIT
maintainers nomaintainer
# Minimum OS version is macOS 13.0
# https://ziglang.org/download/0.16.0/release-notes.html#OS-Version-Requirements
platforms {darwin >= 22}
description Zig programming language
long_description Zig is a general-purpose programming language designed for \
robustness, optimality, and maintainability.
homepage https://ziglang.org/
checksums rmd160 ecede6fbf52ee0e8adc5e72ae51678c7f5452b22 \
sha256 095d7483008e885e65d8c6a57fb97c57344f995408a648b8d50f61278ad85d7f \
size 35262315
# macos stage3: add link support for system libc++: https://github.com/ziglang/zig/pull/23264
# improved patch from https://github.com/Homebrew/homebrew-core/pull/278854
patchfiles-append patch-macos-libc++-dynamic-link.diff
patch.args -p1
post-patch {
# stop zig from refusing to build on 7GB of RAM, that's all a macOS github runner has.
reinplace "s|max_rss = 8_000_000_000|max_rss = 7_500_000_000|g" ${worksrcpath}/build.zig
}
set llvm_version 21
depends_lib-append port:llvm-${llvm_version} \
port:clang-${llvm_version} \
port:ncurses \
port:libxml2 \
port:zlib \
port:zstd
set llvm_config LLVM_CONFIG=llvm-config-mp-${llvm_version}
compiler.whitelist macports-clang-${llvm_version}
legacysupport.use_static \
yes
cmake.prefix_path ${prefix}/libexec/llvm-${llvm_version}
cmake.install_rpath-append \
${prefix}/libexec/llvm-${llvm_version}/lib
platform darwin {
# due to the new linker (which was introduced in Xcode 15: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes),
# this port requires '-ld_classic' to build successfully with the toolchains from Xcode 15 or Command Line Tools 15.
#
# TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple.
if { ${os.major} == 23 && ( [vercmp ${xcodeversion} 15 ] >= 0 ) || ( [vercmp ${xcodecltversion} 15 ] >= 0 ) } {
configure.ldflags-append \
-Wl,-ld_classic
}
}