pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

starship: Fix build on NetBSD



Module Name:	pkgsrc-wip
Committed By:	pin <voidpin%protonmail.com@localhost>
Pushed By:	pin
Date:		Wed Jul 7 15:01:07 2021 +0200
Changeset:	37d288cbfa0d735faa61508812ad7535a9ed763b

Modified Files:
	starship/Makefile
	starship/cargo-depends.mk
	starship/distinfo
Added Files:
	starship/patches/patch-Cargo.toml
Removed Files:
	starship/NOTES

Log Message:
starship: Fix build on NetBSD

Major hacks by mjturner with some minor hacks by myself.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=37d288cbfa0d735faa61508812ad7535a9ed763b

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 starship/Makefile                 | 30 +++++++++++++++++++++++++++---
 starship/NOTES                    |  6 ------
 starship/cargo-depends.mk         |  3 ++-
 starship/distinfo                 |  9 +++++----
 starship/patches/patch-Cargo.toml | 22 ++++++++++++++++++++++
 5 files changed, 56 insertions(+), 14 deletions(-)

diffs:
diff --git a/starship/Makefile b/starship/Makefile
index 77677fb9e4..c3b0998f13 100644
--- a/starship/Makefile
+++ b/starship/Makefile
@@ -11,17 +11,41 @@ COMMENT=	Fast, customizable cross-shell prompt
 LICENSE=	isc
 
 # The libc and rust-battery crates currently have limited platform support
-ONLY_FOR_PLATFORM=Darwin-*-* DragonFly-*-* FreeBSD-*-* Linux-*-* 
+ONLY_FOR_PLATFORM=	Darwin-*-* DragonFly-*-* FreeBSD-*-* Linux-*-* NetBSD-*-*
 
-USE_LANGUAGES=	c
-RUST_REQ?=	1.51.0
+LIBC_REV=	c4ae71f5e120336e50c84dbc80523efa3883d29e
+DISTFILES=	${DEFAULT_DISTFILES}
+DISTFILES+=	libc-${LIBC_REV}.tar.gz
+SITES.libc-${LIBC_REV}.tar.gz+=	-${MASTER_SITE_GITHUB:=rust-lang/}libc/archive/${LIBC_REV}.tar.gz
+
+USE_LANGUAGES=			c
+USE_TOOLS+=			pkg-config
+
+MAKE_ENV+=	OPENSSL_DIR=${BUILDLINK_PREFIX.openssl:Q}
+RUSTFLAGS+=	-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
+MAKE_ENV+=	RUSTFLAGS=${RUSTFLAGS:Q}
+
+# Disable rust-battery crate on NetBSD
+# See https://github.com/svartalf/rust-battery/issues/20
+CARGO_NO_DEFAULT_FEATURES=	YES
+CARGO_FEATURES+=		http
+.include "../../mk/bsd.prefs.mk"
+.if ${OPSYS} == "Darwin" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "Linux"
+CARGO_FEATURES+=	battery
+.endif
 
 .include "cargo-depends.mk"
 
 INSTALLATION_DIRS=	bin
 
+post-extract:
+	mv ${WRKDIR}/libc-* ${WRKSRC}
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/target/release/starship ${DESTDIR}${PREFIX}/bin
 
+DEPENDS+=		git-base-[0-9]*:../../devel/git-base
+
 .include "../../lang/rust/cargo.mk"
+.include "../../security/openssl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/starship/NOTES b/starship/NOTES
deleted file mode 100644
index 8aa7287ad1..0000000000
--- a/starship/NOTES
+++ /dev/null
@@ -1,6 +0,0 @@
-This package doesn't /yet/ build on NetBSD due to the following:
-* https://github.com/rust-lang/libc/issues/2243
-* https://github.com/svartalf/rust-battery/issues/20
-
-See https://github.com/starship/starship/issues/2690 for more information.
-
diff --git a/starship/cargo-depends.mk b/starship/cargo-depends.mk
index 7f84e5cd97..f802688a53 100644
--- a/starship/cargo-depends.mk
+++ b/starship/cargo-depends.mk
@@ -83,7 +83,8 @@ CARGO_CRATE_DEPENDS+=	jobserver-0.1.22
 CARGO_CRATE_DEPENDS+=	lazy_static-1.4.0
 CARGO_CRATE_DEPENDS+=	lazycell-1.3.0
 CARGO_CRATE_DEPENDS+=	lexical-core-0.7.6
-CARGO_CRATE_DEPENDS+=	libc-0.2.95
+# Disabled as we need newer version containing NetBSD fix
+#CARGO_CRATE_DEPENDS+=	libc-0.2.95
 CARGO_CRATE_DEPENDS+=	libgit2-sys-0.12.21+1.1.0
 CARGO_CRATE_DEPENDS+=	libz-sys-1.1.3
 CARGO_CRATE_DEPENDS+=	linked-hash-map-0.5.4
diff --git a/starship/distinfo b/starship/distinfo
index 685497aa6e..1035784723 100644
--- a/starship/distinfo
+++ b/starship/distinfo
@@ -332,10 +332,10 @@ SHA1 (lexical-core-0.7.6.crate) = 2f3fdb37b0eaead5a53f90aaee83a03528021fc9
 RMD160 (lexical-core-0.7.6.crate) = 6cf77e9763b54ae04af64d096151ad4bb41368ac
 SHA512 (lexical-core-0.7.6.crate) = fcd7e4e073e6440183284f20a6305bbe4aafb5513a20b8ed793439e4b5a5519532a0605f31e42539f3e6236003254812b459a9b9c47b3c449f5c582dd62c3172
 Size (lexical-core-0.7.6.crate) = 494385 bytes
-SHA1 (libc-0.2.95.crate) = abecf169af963c0b298b2e7c0b58fdecec79cf35
-RMD160 (libc-0.2.95.crate) = c365a9aa18cb4d78aa0a059fd3358654fb1ffce6
-SHA512 (libc-0.2.95.crate) = 40ba9908c202f3d40c1bd7d7bf516f3b236e7751020bad0007f185802fada64fc5e959b68a33aa1f59de76d5a649f62bcce7eea671fd420852e0bb902544ebbf
-Size (libc-0.2.95.crate) = 515341 bytes
+SHA1 (libc-c4ae71f5e120336e50c84dbc80523efa3883d29e.tar.gz) = f04d4c9e84443c814ecc8d60177340b20217eb4f
+RMD160 (libc-c4ae71f5e120336e50c84dbc80523efa3883d29e.tar.gz) = 7b52c6a6c2d048dd38944ec0a91b0d25b3a67641
+SHA512 (libc-c4ae71f5e120336e50c84dbc80523efa3883d29e.tar.gz) = b0098621e5d2e81d2de2901d526185d52c50c12dc48a6af24b95a112b8b693674af74767b71ec1c46136b0cea4f8bcde29e6eb4be16b57f7405f21d58e3a5d72
+Size (libc-c4ae71f5e120336e50c84dbc80523efa3883d29e.tar.gz) = 652019 bytes
 SHA1 (libgit2-sys-0.12.21+1.1.0.crate) = 3411afbebe922f5ae1304f09571a055b60d63889
 RMD160 (libgit2-sys-0.12.21+1.1.0.crate) = ec40c809112a873bf1377a674925f163c8cdfd23
 SHA512 (libgit2-sys-0.12.21+1.1.0.crate) = fd6acaaec704fb2d159cbaf0bd1b81c7afe4d22aecd836b174001b017ed8421507739fd99da968cfb1d46db16a64fe6568f53e872aa5f9a9dd7fb2cb51b02d74
@@ -892,3 +892,4 @@ SHA1 (zvariant_derive-2.6.0.crate) = 39e523fb60ebf8766bbfcb88abae52206fc08eef
 RMD160 (zvariant_derive-2.6.0.crate) = 9755915cda745c91f0b8106d8fdcfbe46f4f46c3
 SHA512 (zvariant_derive-2.6.0.crate) = 5392e9b27ea685e4ce0c76a92e03b3e9c85c81f6f7b117ad65365ebe8f11ab394e790776f448fc35c1c62c3b3b25826fc8609e62a275ada97524f3b97e57189c
 Size (zvariant_derive-2.6.0.crate) = 6857 bytes
+SHA1 (patch-Cargo.toml) = 3d6dd4a41151f40684dffe3fa97799be34c0012f
diff --git a/starship/patches/patch-Cargo.toml b/starship/patches/patch-Cargo.toml
new file mode 100644
index 0000000000..351a6b2fe2
--- /dev/null
+++ b/starship/patches/patch-Cargo.toml
@@ -0,0 +1,22 @@
+$NetBSD$
+
+Use libc that contains improved NetBSD support
+
+--- Cargo.toml.orig	2021-06-20 18:25:33.000000000 +0000
++++ Cargo.toml
+@@ -30,6 +30,7 @@ tls-vendored = ["native-tls/vendored"]
+ 
+ 
+ [dependencies]
++libc = "0.2.97"
+ clap = "2.33.3"
+ ansi_term = "0.12.1"
+ dirs-next = "2.0.0"
+@@ -102,3 +103,7 @@ lto = true
+ [[bin]]
+ name = "starship"
+ path = "src/main.rs"
++
++[patch.crates-io]
++libc = { path = 'libc-c4ae71f5e120336e50c84dbc80523efa3883d29e' }
++


Home | Main Index | Thread Index | Old Index