Created
March 29, 2024 15:15
-
-
Save yak1ex/c8cb865a449977e2ad63b6e4c8e49a48 to your computer and use it in GitHub Desktop.
A patch for rust-1.77 in FreeBSD ports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can find a base patch at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274743 | |
Adjustment for rust-1.77 is based on https://issues.guix.gnu.org/69981 | |
diff --git a/lang/rust/Makefile b/lang/rust/Makefile | |
index d7568c882d81..5cf93ef01275 100644 | |
--- a/lang/rust/Makefile | |
+++ b/lang/rust/Makefile | |
@@ -22,19 +22,28 @@ LICENSE_COMB= dual | |
LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE | |
LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT | |
+EXTRACT_AFTER_ARGS= --exclude libssh2 --exclude libgit2 \ | |
+ --exclude nghttp2 --exclude curl-sys/curl \ | |
+ --exclude include/curl --exclude "curl-sys-*/curl" \ | |
+ --exclude openssl-src/openssl \ | |
+ --exclude "libz-sys/src/libz*" | |
+ | |
ONLY_FOR_ARCHS?= aarch64 amd64 armv7 i386 powerpc64 powerpc64le powerpc \ | |
riscv64 | |
ONLY_FOR_ARCHS_REASON?= requires prebuilt bootstrap compiler | |
BUILD_DEPENDS= cmake:devel/cmake-core | |
-LIB_DEPENDS= libcurl.so:ftp/curl | |
+LIB_DEPENDS= libcurl.so:ftp/curl \ | |
+ libgit2.so:devel/libgit2 \ | |
+ libssh2.so:security/libssh2 | |
-USES= cpe ninja:build pkgconfig python:build ssl tar:xz | |
+USES= cpe localbase ninja:build pkgconfig python:build ssl tar:xz | |
CPE_VENDOR= rust-lang | |
MAKE_ENV= DESTDIR=${STAGEDIR} \ | |
- LIBGIT2_NO_PKG_CONFIG=1 \ | |
+ LIBSSH2_SYS_USE_PKG_CONFIG=yes \ | |
+ LIBGIT2_NO_VENDOR=1 \ | |
OPENSSL_DIR="${OPENSSLBASE}" | |
TEST_ENV= ${MAKE_ENV} \ | |
ALLOW_NONZERO_RLIMIT_CORE=1 | |
@@ -99,9 +108,14 @@ _COMPONENTS+= cargo-${_PACKAGE_VERS}-${_RUST_TARGET} \ | |
IGNORE= is only for FreeBSD | |
.endif | |
+.if ${PORT_OPTIONS:MPORT_LLVM} | |
+# We still must have llvm-project/libunwind at this time: | |
+EXTRACT_AFTER_ARGS+= --exclude llvm-project/ll* --exclude llvm-project/c* --exclude llvm-project/r* | |
+.endif | |
+ | |
.if ${ARCH} == powerpc | |
LIB_DEPENDS+= libatomic.so:lang/gcc${GCC_DEFAULT} | |
-MAKE_ENV+= RUSTFLAGS="-L/usr/local/lib/gcc${GCC_DEFAULT}" | |
+MAKE_ENV+= RUSTFLAGS="-L${LOCALBASE}/lib/gcc${GCC_DEFAULT}" | |
.else | |
MAKE_ENV+= RUST_BACKTRACE=1 | |
.endif | |
@@ -156,6 +170,11 @@ do-configure: | |
.endfor | |
@${ECHO_CMD} 'changelog-seen=2' > ${WRKSRC}/config.toml | |
@${ECHO_CMD} '[build]' >> ${WRKSRC}/config.toml | |
+.if ${PORT_OPTIONS:MPORT_LLVM} | |
+# Without llvm-project/compiler-rt, need to set this flag to false | |
+# see https://issues.guix.gnu.org/69981 | |
+ @${ECHO_CMD} 'optimized-compiler-builtins=false' >> ${WRKSRC}/config.toml | |
+.endif | |
@${ECHO_CMD} 'build-dir="${WRKDIR}/_build"' >> ${WRKSRC}/config.toml | |
@${ECHO_CMD} 'build-stage=2' >> ${WRKSRC}/config.toml | |
@${ECHO_CMD} 'doc-stage=2' >> ${WRKSRC}/config.toml | |
diff --git a/lang/rust/files/patch-sys-nghttp2 b/lang/rust/files/patch-sys-nghttp2 | |
new file mode 100644 | |
index 000000000000..c136da6c7007 | |
--- /dev/null | |
+++ b/lang/rust/files/patch-sys-nghttp2 | |
@@ -0,0 +1,8 @@ | |
+--- vendor/libnghttp2-sys/build.rs 2023-12-04 16:32:19.000000000 -0500 | |
++++ vendor/libnghttp2-sys/build.rs 2023-12-12 15:18:42.431611000 -0500 | |
+@@ -6,4 +6,5 @@ | |
+ | |
+ fn main() { | |
++ return; | |
+ let target = env::var("TARGET").unwrap(); | |
+ let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment