summaryrefslogtreecommitdiff
path: root/regress/lib/libssl/rust-openssl/Makefile
blob: a243995f2041bba64069e434ba24120d7c53e0c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#	$OpenBSD: Makefile,v 1.4 2022/12/05 14:43:06 tb Exp $

RUST_OPENSSL_TESTS =	/usr/local/share/rust-openssl-tests
CARGO =			/usr/local/bin/cargo

.if !exists(${RUST_OPENSSL_TESTS}) || !exists(${CARGO})
regress:
	@echo packages rust-openssl-tests and rust are required for this regress
	@echo SKIPPED
.else

REGRESS_TARGETS +=	rust-openssl-test

WORKSPACE_LINKS = openssl openssl-errors openssl-macros openssl-sys systest

_WORKSPACE_COOKIE =	.workspace

${_WORKSPACE_COOKIE}:
. if ${.CURDIR} != ${.OBJDIR}
	cp ${.CURDIR}/Cargo.toml ${.OBJDIR}/
. endif
	mkdir -p .cargo
	cp ${.CURDIR}/config .cargo/
	cd ${.OBJDIR} && ln -sf ${WORKSPACE_LINKS:S,^,${RUST_OPENSSL_TESTS}/,} .
	touch $@

CLEANFILES += Cargo.lock

. if ${.CURDIR} != ${.OBJDIR}
CLEANFILES += Cargo.toml
. endif

# Force use of base-clang on sparc64 since the build with base-gcc fails with:
# error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" [...]
# did not execute successfully (status code exit status: 1).
. if "${MACHINE_ARCH}" == sparc64
CARGO_CC=/usr/bin/clang
. else
CARGO_CC=cc
. endif

rust-openssl-test: ${_WORKSPACE_COOKIE}
	cd ${.OBJDIR} && env CC=${CARGO_CC} \
		cargo test --offline --color=never -- --color=never

CLEANFILES +=	${_WORKSPACE_COOKIE} ${WORKSPACE_LINKS}

. if make(clean) || make(cleandir)
.  if exists(.cargo) || exists(target)
.BEGIN:
	rm -rf .cargo
	rm -rf target
.  endif
. endif

.endif

.include <bsd.regress.mk>