Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] zig: enable cross-compile support
@ 2020-09-21  1:45 jjsullivan5196
  2020-09-21  1:49 ` [PR REVIEW] " ericonr
                   ` (50 more replies)
  0 siblings, 51 replies; 52+ messages in thread
From: jjsullivan5196 @ 2020-09-21  1:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

There is a new pull request by jjsullivan5196 against master on the void-packages repository

https://github.com/jjsullivan5196/void-packages zig-cross
https://github.com/void-linux/void-packages/pull/25004

zig: enable cross-compile support
Closes #24959 

A patch file from https://github.com/void-linux/void-packages/pull/25004.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-zig-cross-25004.patch --]
[-- Type: text/x-diff, Size: 3676 bytes --]

From 7daed9ea34206df6f4c0b6d05e2e38624947586c Mon Sep 17 00:00:00 2001
From: John Sullivan <jsullivan@csumb.edu>
Date: Thu, 17 Sep 2020 14:14:59 -0700
Subject: [PATCH] zig: enable cross-compile support

---
 ...-to-use-llvm-config-to-find-cross-ta.patch | 39 +++++++++++++++++++
 srcpkgs/zig/template                          | 31 +++++++++++++--
 2 files changed, 67 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/zig/patches/0001-cmake-add-option-to-use-llvm-config-to-find-cross-ta.patch

diff --git a/srcpkgs/zig/patches/0001-cmake-add-option-to-use-llvm-config-to-find-cross-ta.patch b/srcpkgs/zig/patches/0001-cmake-add-option-to-use-llvm-config-to-find-cross-ta.patch
new file mode 100644
index 00000000000..525c46b67d7
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-cmake-add-option-to-use-llvm-config-to-find-cross-ta.patch
@@ -0,0 +1,39 @@
+From 35e2d40ac60034e0e3fbcad44d3c11769567c5cf Mon Sep 17 00:00:00 2001
+From: John Sullivan <jsullivan@csumb.edu>
+Date: Sun, 20 Sep 2020 14:55:43 -0700
+Subject: [PATCH] cmake: add option to use llvm-config to find cross-target
+ llvm deps
+
+---
+ CMakeLists.txt       | 1 +
+ cmake/Findllvm.cmake | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 27bc6a04f..b7c1dc047 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -66,6 +66,7 @@ option(ZIG_FORCE_EXTERNAL_LLD "does nothing" OFF)
+ set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for")
+ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries for")
+ set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
++set(ZIG_FORCE_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies")
+ 
+ find_package(llvm)
+ find_package(clang)
+diff --git a/cmake/Findllvm.cmake b/cmake/Findllvm.cmake
+index 7d6a4b04d..3cbd7fd9c 100644
+--- a/cmake/Findllvm.cmake
++++ b/cmake/Findllvm.cmake
+@@ -7,7 +7,7 @@
+ # LLVM_LIBRARIES
+ # LLVM_LIBDIRS
+ 
+-if("${ZIG_TARGET_TRIPLE}" STREQUAL "native")
++if(("${ZIG_TARGET_TRIPLE}" STREQUAL "native") OR ZIG_FORCE_LLVM_CONFIG)
+   find_program(LLVM_CONFIG_EXE
+       NAMES llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config10 llvm-config
+       PATHS
+-- 
+2.28.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index c3ab8e62a11..b02dd5f239c 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,8 +1,8 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.6.0
-revision=1
-archs="x86_64*"
+revision=2
+archs="x86_64* aarch64*"
 build_style=cmake
 makedepends="clang llvm10 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
@@ -11,9 +11,34 @@ license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+patch_args="-Np1"
 nopie=yes
-nocross=yes
+
+if [ "${CROSS_BUILD}" ]; then
+	hostmakedepends="zig llvm10"
+	configure_args+="
+	-DZIG_FORCE_LLVM_CONFIG=on
+	-DZIG_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET}
+	-DZIG_EXECUTABLE='/usr/bin/zig'"
+fi
+
+pre_configure() {
+	local _llvm_config
+
+	# When cross-compiling, need to re-write the host root provided by llvm-config
+	# to the cross-target root
+	if [ "${CROSS_BUILD}" ]; then
+		_llvm_config="${XBPS_WRAPPERDIR}/llvm-config"
+
+		cat > "${_llvm_config}" <<-EOF
+		#!/bin/sh
+		/usr/bin/llvm-config "\$@" | sed 's,/usr,${XBPS_CROSS_BASE}/usr,g'
+		EOF
+		chmod +x "${_llvm_config}"
+	fi
+}
 
 post_install() {
+	# vmove zig for great justice
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2021-08-03  4:22 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21  1:45 [PR PATCH] zig: enable cross-compile support jjsullivan5196
2020-09-21  1:49 ` [PR REVIEW] " ericonr
2020-09-21  1:55 ` jjsullivan5196
2020-09-21  1:56 ` jjsullivan5196
2020-09-21  2:29 ` ericonr
2020-09-21  9:38 ` [PR PATCH] [Updated] " jjsullivan5196
2020-09-21  9:39 ` [PR REVIEW] " jjsullivan5196
2020-09-21  9:57 ` jjsullivan5196
2020-09-21 10:14 ` [PR PATCH] [Updated] " jjsullivan5196
2020-09-21 12:43 ` ericonr
2020-09-21 14:28 ` ericonr
2020-09-21 14:29 ` ericonr
2020-09-21 19:07 ` ericonr
2020-09-21 19:16 ` ericonr
2020-09-21 19:21 ` [PR REVIEW] " ericonr
2020-09-21 19:32 ` ericonr
2020-09-21 19:35 ` ericonr
2020-09-21 20:31 ` jjsullivan5196
2020-09-21 20:34 ` [PR REVIEW] " jjsullivan5196
2020-09-21 20:35 ` jjsullivan5196
2020-09-21 20:43 ` jjsullivan5196
2020-09-21 22:16 ` ericonr
2020-09-21 22:40 ` [PR REVIEW] " ericonr
2020-09-21 22:52 ` ericonr
2020-09-21 23:10 ` jjsullivan5196
2020-09-22  2:01 ` [PR PATCH] [Updated] " jjsullivan5196
2020-09-22  2:04 ` jjsullivan5196
2020-09-22  2:05 ` [PR REVIEW] " jjsullivan5196
2020-09-22  2:07 ` ericonr
2020-09-22  2:23 ` jjsullivan5196
2020-09-28 21:24 ` pullmoll
2020-09-30  5:25 ` jjsullivan5196
2020-09-30  6:26 ` ericonr
2020-10-02 16:36 ` Piraty
2020-10-02 16:39 ` Piraty
2020-10-02 16:44 ` q66
2020-10-02 16:47 ` Piraty
2020-10-02 16:55 ` jjsullivan5196
2020-10-02 16:56 ` jjsullivan5196
2020-10-02 22:04 ` jjsullivan5196
2020-10-03 16:15 ` Piraty
2020-10-03 16:50 ` jjsullivan5196
2020-10-03 16:50 ` jjsullivan5196
2020-10-03 16:51 ` jjsullivan5196
2020-10-03 17:01 ` jjsullivan5196
2020-10-03 17:07 ` jjsullivan5196
2020-10-03 17:17 ` Piraty
2021-01-21 17:44 ` ericonr
2021-01-22  2:16 ` jjsullivan5196
2021-08-03  3:02 ` ericonr
2021-08-03  4:22 ` jjsullivan5196
2021-08-03  4:22 ` [PR PATCH] [Closed]: " jjsullivan5196

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).