PORTNAME=	authenticator
DISTVERSION=	4.1.6
CATEGORIES=	security

MAINTAINER=	jbeich@FreeBSD.org
COMMENT=	Generate Two-Factor Codes
WWW=		https://gitlab.gnome.org/World/Authenticator

LICENSE=	GPLv3+
LICENSE_FILE=	${WRKSRC}/LICENSE

BUILD_DEPENDS=	llvm${LLVM_DEFAULT}>0:devel/llvm${LLVM_DEFAULT}
LIB_DEPENDS=	libgraphene-1.0.so:graphics/graphene \
		libzbar.so:graphics/zbar \
		libpipewire-0.3.so:multimedia/pipewire

USES=		cargo desktop-file-utils gettext gnome gstreamer meson pkgconfig sqlite ssl
USE_GITLAB=	yes
USE_GNOME=	gdkpixbuf2 gtk40 libadwaita
USE_GSTREAMER=	zbar # XXX gtk4paintablesink
GL_SITE=	https://gitlab.gnome.org
GL_ACCOUNT=	World
GL_PROJECT=	Authenticator
GL_COMMIT=	fc8624342b3b4aa599b4efdefdda84514c223b18
CARGO_ENV=	ZBAR_INCLUDE_DIRS="${LOCALBASE}/include" ZBAR_LIB_DIRS="${LOCALBASE}/lib"
MAKE_ENV=	${CARGO_ENV}
GLIB_SCHEMAS=	com.belmoussaoui.Authenticator.gschema.xml

CARGO_CRATES=	adler-1.0.2 \
		adler32-1.2.0 \
		aead-0.4.3 \
		aes-0.7.5 \
		aes-0.8.1 \
		aes-gcm-0.9.4 \
		aho-corasick-0.7.18 \
		ansi_term-0.12.1 \
		anyhow-1.0.57 \
		arrayref-0.3.6 \
		arrayvec-0.7.2 \
		ashpd-0.3.2 \
		async-broadcast-0.4.0 \
		async-channel-1.6.1 \
		async-executor-1.4.1 \
		async-io-1.7.0 \
		async-lock-2.5.0 \
		async-recursion-0.3.2 \
		async-task-4.2.0 \
		async-trait-0.1.56 \
		atty-0.2.14 \
		autocfg-1.1.0 \
		base64-0.13.0 \
		base64ct-1.5.0 \
		binascii-0.1.4 \
		bindgen-0.59.2 \
		bitflags-1.3.2 \
		blake2b_simd-1.0.0 \
		block-0.1.6 \
		block-buffer-0.10.2 \
		block-padding-0.3.2 \
		bumpalo-3.10.0 \
		bytemuck-1.9.1 \
		byteorder-1.4.3 \
		bytes-1.1.0 \
		cache-padded-1.2.0 \
		cairo-rs-0.15.11 \
		cairo-sys-rs-0.15.1 \
		cbc-0.1.2 \
		cc-1.0.73 \
		cexpr-0.6.0 \
		cfg-expr-0.10.3 \
		cfg-if-0.1.10 \
		cfg-if-1.0.0 \
		checked_int_cast-1.0.0 \
		chrono-0.4.19 \
		cipher-0.3.0 \
		cipher-0.4.3 \
		clang-sys-1.3.3 \
		clap-2.34.0 \
		color_quant-1.1.0 \
		concurrent-queue-1.2.2 \
		constant_time_eq-0.1.5 \
		cookie-factory-0.3.2 \
		core-foundation-0.9.3 \
		core-foundation-sys-0.8.3 \
		cpufeatures-0.2.2 \
		crc32fast-1.3.2 \
		crossbeam-utils-0.8.8 \
		crypto-common-0.1.3 \
		ctr-0.8.0 \
		deflate-1.0.0 \
		derivative-2.2.0 \
		diesel-1.4.8 \
		diesel_derives-1.4.1 \
		diesel_migrations-1.4.0 \
		digest-0.10.3 \
		dirs-4.0.0 \
		dirs-sys-0.3.7 \
		doc-comment-0.3.3 \
		easy-parallel-3.2.0 \
		either-1.6.1 \
		encoding_rs-0.8.31 \
		enum-ordinalize-3.1.11 \
		enumflags2-0.7.5 \
		enumflags2_derive-0.7.4 \
		env_logger-0.9.0 \
		errno-0.2.8 \
		errno-dragonfly-0.1.2 \
		event-listener-2.5.2 \
		fastrand-1.7.0 \
		field-offset-0.3.4 \
		fnv-1.0.7 \
		foreign-types-0.3.2 \
		foreign-types-shared-0.1.1 \
		form_urlencoded-1.0.1 \
		fragile-1.2.0 \
		futures-0.3.21 \
		futures-channel-0.3.21 \
		futures-core-0.3.21 \
		futures-executor-0.3.21 \
		futures-io-0.3.21 \
		futures-lite-1.12.0 \
		futures-macro-0.3.21 \
		futures-sink-0.3.21 \
		futures-task-0.3.21 \
		futures-util-0.3.21 \
		gdk-pixbuf-0.15.11 \
		gdk-pixbuf-sys-0.15.10 \
		gdk4-0.4.8 \
		gdk4-sys-0.4.8 \
		gdk4-wayland-0.4.8 \
		gdk4-wayland-sys-0.4.8 \
		gdk4-x11-0.4.8 \
		gdk4-x11-sys-0.4.8 \
		generic-array-0.14.5 \
		getrandom-0.2.6 \
		gettext-rs-0.7.0 \
		gettext-sys-0.21.3 \
		ghash-0.4.4 \
		gio-0.15.11 \
		gio-sys-0.15.10 \
		glib-0.15.11 \
		glib-macros-0.15.11 \
		glib-sys-0.15.10 \
		glob-0.3.0 \
		gobject-sys-0.15.10 \
		graphene-rs-0.15.1 \
		graphene-sys-0.15.10 \
		gsk4-0.4.8 \
		gsk4-sys-0.4.8 \
		gst-plugin-gtk4-0.1.1 \
		gst-plugin-version-helper-0.7.3 \
		gstreamer-0.18.8 \
		gstreamer-base-0.18.0 \
		gstreamer-base-sys-0.18.0 \
		gstreamer-sys-0.18.0 \
		gstreamer-video-0.18.7 \
		gstreamer-video-sys-0.18.3 \
		gtk-macros-0.3.0 \
		gtk4-0.4.8 \
		gtk4-macros-0.4.8 \
		gtk4-sys-0.4.8 \
		h2-0.3.13 \
		hashbrown-0.11.2 \
		heck-0.4.0 \
		hermit-abi-0.1.19 \
		hex-0.4.3 \
		hkdf-0.12.3 \
		hmac-0.12.1 \
		http-0.2.7 \
		http-body-0.4.5 \
		httparse-1.7.1 \
		httpdate-1.0.2 \
		humantime-2.1.0 \
		hyper-0.14.19 \
		hyper-tls-0.5.0 \
		idna-0.2.3 \
		image-0.23.14 \
		image-0.24.2 \
		indexmap-1.8.2 \
		inout-0.1.3 \
		instant-0.1.12 \
		ipnet-2.5.0 \
		itertools-0.10.3 \
		itoa-1.0.2 \
		js-sys-0.3.57 \
		lazy_static-1.4.0 \
		lazycell-1.3.0 \
		libadwaita-0.1.1 \
		libadwaita-sys-0.1.0 \
		libc-0.2.126 \
		libloading-0.7.3 \
		libspa-0.5.0 \
		libspa-sys-0.5.0 \
		libsqlite3-sys-0.22.2 \
		locale_config-0.3.0 \
		lock_api-0.4.7 \
		log-0.4.17 \
		malloc_buf-0.0.6 \
		matches-0.1.9 \
		memchr-2.5.0 \
		memoffset-0.6.5 \
		migrations_internals-1.4.1 \
		migrations_macros-1.4.2 \
		mime-0.3.16 \
		minimal-lexical-0.2.1 \
		miniz_oxide-0.5.3 \
		mio-0.8.3 \
		muldiv-1.0.0 \
		native-tls-0.2.10 \
		nix-0.14.1 \
		nix-0.23.1 \
		nom-7.1.1 \
		num-0.4.0 \
		num-bigint-0.4.3 \
		num-complex-0.4.1 \
		num-integer-0.1.45 \
		num-iter-0.1.43 \
		num-rational-0.3.2 \
		num-rational-0.4.0 \
		num-traits-0.2.15 \
		num_cpus-1.13.1 \
		objc-0.2.7 \
		objc-foundation-0.1.1 \
		objc_id-0.1.1 \
		once_cell-1.12.0 \
		oo7-0.1.0-alpha.5 \
		opaque-debug-0.3.0 \
		openssl-0.10.40 \
		openssl-macros-0.1.0 \
		openssl-probe-0.1.5 \
		openssl-sys-0.9.74 \
		option-operations-0.4.0 \
		ordered-stream-0.0.1 \
		pango-0.15.10 \
		pango-sys-0.15.10 \
		parking-2.0.0 \
		parking_lot-0.11.2 \
		parking_lot-0.12.1 \
		parking_lot_core-0.8.5 \
		parking_lot_core-0.9.3 \
		password-hash-0.4.1 \
		paste-1.0.7 \
		pbkdf2-0.11.0 \
		peeking_take_while-0.1.2 \
		percent-encoding-2.1.0 \
		pest-2.1.3 \
		pin-project-lite-0.2.9 \
		pin-utils-0.1.0 \
		pipewire-0.5.0 \
		pipewire-sys-0.5.0 \
		pkg-config-0.3.25 \
		png-0.17.5 \
		polling-2.2.0 \
		polyval-0.5.3 \
		ppv-lite86-0.2.16 \
		pretty-hex-0.3.0 \
		proc-macro-crate-1.1.3 \
		proc-macro-error-1.0.4 \
		proc-macro-error-attr-1.0.4 \
		proc-macro2-1.0.39 \
		prost-0.10.4 \
		prost-derive-0.10.1 \
		qrcode-0.12.0 \
		quick-xml-0.22.0 \
		quote-1.0.18 \
		r2d2-0.8.9 \
		rand-0.8.5 \
		rand_chacha-0.3.1 \
		rand_core-0.6.3 \
		redox_syscall-0.2.13 \
		redox_users-0.4.3 \
		regex-1.5.6 \
		regex-syntax-0.6.26 \
		remove_dir_all-0.5.3 \
		reqwest-0.11.10 \
		ring-0.16.20 \
		roxmltree-0.13.1 \
		rust-argon2-1.0.0 \
		rustc-hash-1.1.0 \
		rustc_version-0.3.3 \
		rustc_version-0.4.0 \
		ryu-1.0.10 \
		salsa20-0.10.2 \
		schannel-0.1.20 \
		scheduled-thread-pool-0.2.6 \
		scopeguard-1.1.0 \
		scrypt-0.10.0 \
		search-provider-0.3.0 \
		security-framework-2.6.1 \
		security-framework-sys-2.6.1 \
		semver-0.11.0 \
		semver-1.0.9 \
		semver-parser-0.10.2 \
		serde-1.0.137 \
		serde_derive-1.0.137 \
		serde_json-1.0.81 \
		serde_repr-0.1.8 \
		serde_urlencoded-0.7.1 \
		sha1-0.6.1 \
		sha1_smol-1.0.0 \
		sha2-0.10.2 \
		sharded-slab-0.1.4 \
		shlex-1.1.0 \
		signal-0.7.0 \
		slab-0.4.6 \
		smallvec-1.8.0 \
		socket2-0.4.4 \
		spin-0.5.2 \
		static_assertions-1.1.0 \
		strsim-0.8.0 \
		subtle-2.4.1 \
		svg_metadata-0.4.2 \
		syn-1.0.96 \
		synstructure-0.12.6 \
		system-deps-6.0.2 \
		temp-dir-0.1.11 \
		tempfile-3.3.0 \
		termcolor-1.1.3 \
		textwrap-0.11.0 \
		thiserror-1.0.31 \
		thiserror-impl-1.0.31 \
		thread_local-1.1.4 \
		tinyvec-1.6.0 \
		tinyvec_macros-0.1.0 \
		tokio-1.19.1 \
		tokio-macros-1.8.0 \
		tokio-native-tls-0.3.0 \
		tokio-util-0.7.3 \
		toml-0.5.9 \
		tower-service-0.3.1 \
		tracing-0.1.34 \
		tracing-attributes-0.1.21 \
		tracing-core-0.1.26 \
		tracing-log-0.1.3 \
		tracing-subscriber-0.3.11 \
		try-lock-0.2.3 \
		typenum-1.15.0 \
		ucd-trie-0.1.3 \
		uds_windows-1.0.2 \
		unicase-2.6.0 \
		unicode-bidi-0.3.8 \
		unicode-ident-1.0.0 \
		unicode-normalization-0.1.19 \
		unicode-width-0.1.9 \
		unicode-xid-0.2.3 \
		universal-hash-0.4.1 \
		untrusted-0.7.1 \
		url-2.2.2 \
		uuid-1.1.1 \
		valuable-0.1.0 \
		vcpkg-0.2.15 \
		vec_map-0.8.2 \
		version-compare-0.1.0 \
		version_check-0.9.4 \
		void-1.0.2 \
		waker-fn-1.1.0 \
		want-0.3.0 \
		wasi-0.10.2+wasi-snapshot-preview1 \
		wasi-0.11.0+wasi-snapshot-preview1 \
		wasm-bindgen-0.2.80 \
		wasm-bindgen-backend-0.2.80 \
		wasm-bindgen-futures-0.4.30 \
		wasm-bindgen-macro-0.2.80 \
		wasm-bindgen-macro-support-0.2.80 \
		wasm-bindgen-shared-0.2.80 \
		web-sys-0.3.57 \
		wepoll-ffi-0.1.2 \
		which-4.2.5 \
		winapi-0.3.9 \
		winapi-i686-pc-windows-gnu-0.4.0 \
		winapi-util-0.1.5 \
		winapi-x86_64-pc-windows-gnu-0.4.0 \
		windows-sys-0.36.1 \
		windows_aarch64_msvc-0.36.1 \
		windows_i686_gnu-0.36.1 \
		windows_i686_msvc-0.36.1 \
		windows_x86_64_gnu-0.36.1 \
		windows_x86_64_msvc-0.36.1 \
		winreg-0.10.1 \
		xmlparser-0.13.3 \
		zbar-rust-0.0.19 \
		zbus-2.2.0 \
		zbus_macros-2.2.0 \
		zbus_names-2.1.0 \
		zeroize-1.5.5 \
		zeroize_derive-1.3.2 \
		zvariant-3.2.1 \
		zvariant_derive-3.2.1
CARGO_BUILD=	no
CARGO_INSTALL=	no
CARGO_TEST=	no

post-patch:
	@${REINPLACE_CMD} -e 's,"llvm-config,&${LLVM_DEFAULT},' \
		${WRKSRC}/cargo-crates/clang-sys-*/build/common.rs \
		${WRKSRC}/cargo-crates/clang-sys-*/src/support.rs
	@${REINPLACE_CMD} -e '/gstreamer/s/1\.18/1.16/' \
		-e '/gstreamer.*bad/d' \
		${WRKSRC}/meson.build
# Make each cargo subcommand very verbose
# Add explicit <triple> subdir for --target from USES=cargo
	@${REINPLACE_CMD} -e "/cargo_options =/s/ '--/&verbose', &verbose', &/" \
		-e "/cp/s,'src',& / '${CARGO_BUILD_TARGET}'," \
		${WRKSRC}/src/meson.build

.include <bsd.port.mk>
