PORTNAME=	rustdesk-server
DISTVERSION=	1.1.7-3
PORTREVISION=	1
CATEGORIES=	net

MAINTAINER=	madpilot@FreeBSD.org
COMMENT=	Self hosted RustDesk server
WWW=		https://rustdesk.com/server/

LICENSE=	AGPLv3
LICENSE_FILE=	${WRKSRC}/LICENSE

BROKEN_aarch64=	fails to build

USES=		cargo
GROUPS=		rustdesk
USERS=		rustdesk
USE_RC_SUBR=	rustdesk-hbbr rustdesk-hbbs

USE_GITHUB=	yes
GH_ACCOUNT=	rustdesk

CARGO_CRATES=	ahash-0.7.6 \
		aho-corasick-0.7.20 \
		android_system_properties-0.1.5 \
		ansi_term-0.12.1 \
		anyhow-1.0.70 \
		arrayvec-0.5.2 \
		async-trait-0.1.68 \
		atoi-1.0.0 \
		atty-0.2.14 \
		autocfg-1.1.0 \
		axum-0.5.17 \
		axum-core-0.2.9 \
		base64-0.13.1 \
		base64-0.21.0 \
		bcrypt-0.13.0 \
		bitflags-1.3.2 \
		block-buffer-0.10.4 \
		blowfish-0.9.1 \
		bumpalo-3.12.0 \
		byteorder-1.4.3 \
		bytes-1.4.0 \
		cc-1.0.79 \
		cfg-if-1.0.0 \
		chrono-0.4.24 \
		cipher-0.4.4 \
		clap-2.34.0 \
		codespan-reporting-0.11.1 \
		config-0.11.0 \
		core-foundation-0.9.3 \
		core-foundation-sys-0.8.3 \
		cpufeatures-0.2.6 \
		crc-3.0.1 \
		crc-catalog-2.2.0 \
		crossbeam-channel-0.5.7 \
		crossbeam-queue-0.3.8 \
		crossbeam-utils-0.8.15 \
		crypto-common-0.1.6 \
		cxx-1.0.94 \
		cxx-build-1.0.94 \
		cxxbridge-flags-1.0.94 \
		cxxbridge-macro-1.0.94 \
		deadpool-0.8.2 \
		digest-0.10.6 \
		directories-next-2.0.0 \
		dirs-next-2.0.0 \
		dirs-sys-next-0.1.2 \
		dlv-list-0.3.0 \
		dns-lookup-1.0.8 \
		dotenvy-0.15.7 \
		ed25519-1.5.3 \
		either-1.8.1 \
		env_logger-0.9.3 \
		errno-0.2.8 \
		errno-dragonfly-0.1.2 \
		event-listener-2.5.3 \
		fastrand-1.9.0 \
		filetime-0.2.20 \
		flexi_logger-0.22.6 \
		flume-0.10.14 \
		fnv-1.0.7 \
		form_urlencoded-1.1.0 \
		futures-0.3.27 \
		futures-channel-0.3.27 \
		futures-core-0.3.27 \
		futures-executor-0.3.27 \
		futures-intrusive-0.4.2 \
		futures-io-0.3.27 \
		futures-macro-0.3.27 \
		futures-sink-0.3.27 \
		futures-task-0.3.27 \
		futures-timer-3.0.2 \
		futures-util-0.3.27 \
		fxhash-0.2.1 \
		generic-array-0.14.7 \
		getrandom-0.2.8 \
		glob-0.3.1 \
		hashbrown-0.12.3 \
		hashlink-0.8.1 \
		headers-0.3.8 \
		headers-core-0.2.0 \
		heck-0.4.1 \
		hermit-abi-0.1.19 \
		hermit-abi-0.2.6 \
		hermit-abi-0.3.1 \
		hex-0.4.3 \
		http-0.2.9 \
		http-body-0.4.5 \
		http-range-header-0.3.0 \
		httparse-1.8.0 \
		httpdate-1.0.2 \
		humantime-2.1.0 \
		hyper-0.14.25 \
		iana-time-zone-0.1.54 \
		iana-time-zone-haiku-0.1.1 \
		idna-0.3.0 \
		indexmap-1.9.3 \
		inout-0.1.3 \
		instant-0.1.12 \
		io-lifetimes-1.0.9 \
		ipnetwork-0.20.0 \
		itertools-0.10.5 \
		itoa-1.0.6 \
		jobserver-0.1.26 \
		js-sys-0.3.61 \
		jsonwebtoken-8.3.0 \
		lazy_static-1.4.0 \
		lexical-core-0.7.6 \
		libc-0.2.140 \
		libsodium-sys-0.2.7 \
		libsqlite3-sys-0.24.2 \
		link-cplusplus-1.0.8 \
		linux-raw-sys-0.1.4 \
		local-ip-address-0.5.1 \
		lock_api-0.4.9 \
		log-0.4.17 \
		mac_address-1.1.4 \
		machine-uid-0.2.0 \
		matchit-0.5.0 \
		memchr-2.5.0 \
		memoffset-0.6.5 \
		mime-0.3.17 \
		mime_guess-2.0.4 \
		minimal-lexical-0.2.1 \
		minreq-2.7.0 \
		mio-0.8.6 \
		neli-0.5.3 \
		nix-0.23.2 \
		nom-5.1.2 \
		nom-7.1.3 \
		num-bigint-0.4.3 \
		num-integer-0.1.45 \
		num-traits-0.2.15 \
		num_cpus-1.15.0 \
		num_threads-0.1.6 \
		once_cell-1.17.1 \
		openssl-probe-0.1.5 \
		ordered-multimap-0.4.3 \
		parking_lot-0.11.2 \
		parking_lot-0.12.1 \
		parking_lot_core-0.8.6 \
		parking_lot_core-0.9.7 \
		paste-1.0.12 \
		pem-1.1.1 \
		percent-encoding-2.2.0 \
		pin-project-1.0.12 \
		pin-project-internal-1.0.12 \
		pin-project-lite-0.2.9 \
		pin-utils-0.1.0 \
		ping-0.4.0 \
		pkg-config-0.3.26 \
		ppv-lite86-0.2.17 \
		proc-macro2-1.0.54 \
		protobuf-3.2.0 \
		protobuf-codegen-3.2.0 \
		protobuf-parse-3.2.0 \
		protobuf-support-3.2.0 \
		punycode-0.4.1 \
		quinn-0.8.5 \
		quinn-proto-0.8.4 \
		quinn-udp-0.1.4 \
		quote-1.0.26 \
		rand-0.8.5 \
		rand_chacha-0.3.1 \
		rand_core-0.6.4 \
		redox_syscall-0.2.16 \
		redox_users-0.4.3 \
		regex-1.7.3 \
		regex-syntax-0.6.29 \
		ring-0.16.20 \
		rust-ini-0.18.0 \
		rustix-0.36.11 \
		rustls-0.20.8 \
		rustls-native-certs-0.6.2 \
		rustls-pemfile-0.2.1 \
		rustls-pemfile-1.0.2 \
		rustversion-1.0.12 \
		ryu-1.0.13 \
		same-file-1.0.6 \
		schannel-0.1.21 \
		scopeguard-1.1.0 \
		scratch-1.0.5 \
		sct-0.7.0 \
		security-framework-2.8.2 \
		security-framework-sys-2.8.0 \
		serde-1.0.159 \
		serde_derive-1.0.159 \
		serde_json-1.0.95 \
		serde_urlencoded-0.7.1 \
		sha-1-0.10.1 \
		sha1-0.10.5 \
		sha2-0.10.6 \
		signal-hook-registry-1.4.1 \
		signature-1.6.4 \
		simple_asn1-0.6.2 \
		slab-0.4.8 \
		smallvec-1.10.0 \
		socket2-0.3.19 \
		socket2-0.4.9 \
		sodiumoxide-0.2.7 \
		spin-0.5.2 \
		spin-0.9.7 \
		sqlformat-0.2.1 \
		sqlx-0.6.3 \
		sqlx-core-0.6.3 \
		sqlx-macros-0.6.3 \
		sqlx-rt-0.6.3 \
		static_assertions-1.1.0 \
		stringprep-0.1.2 \
		strsim-0.8.0 \
		syn-1.0.109 \
		syn-2.0.11 \
		sync_wrapper-0.1.2 \
		tempfile-3.4.0 \
		termcolor-1.2.0 \
		textwrap-0.11.0 \
		thiserror-1.0.40 \
		thiserror-impl-1.0.40 \
		time-0.1.45 \
		time-0.3.9 \
		time-macros-0.2.4 \
		tinyvec-1.6.0 \
		tinyvec_macros-0.1.1 \
		tokio-1.27.0 \
		tokio-macros-2.0.0 \
		tokio-rustls-0.23.4 \
		tokio-stream-0.1.12 \
		tokio-tungstenite-0.17.2 \
		tokio-util-0.7.7 \
		toml-0.5.11 \
		tower-0.4.13 \
		tower-http-0.3.5 \
		tower-layer-0.3.2 \
		tower-service-0.3.2 \
		tracing-0.1.37 \
		tracing-attributes-0.1.23 \
		tracing-core-0.1.30 \
		try-lock-0.2.4 \
		tungstenite-0.17.3 \
		typenum-1.16.0 \
		unicase-2.6.0 \
		unicode-bidi-0.3.13 \
		unicode-ident-1.0.8 \
		unicode-normalization-0.1.22 \
		unicode-segmentation-1.10.1 \
		unicode-width-0.1.10 \
		unicode_categories-0.1.1 \
		untrusted-0.7.1 \
		url-2.3.1 \
		utf-8-0.7.6 \
		uuid-1.3.0 \
		vcpkg-0.2.15 \
		vec_map-0.8.2 \
		version_check-0.9.4 \
		walkdir-2.3.3 \
		want-0.3.0 \
		wasi-0.10.0+wasi-snapshot-preview1 \
		wasi-0.11.0+wasi-snapshot-preview1 \
		wasm-bindgen-0.2.84 \
		wasm-bindgen-backend-0.2.84 \
		wasm-bindgen-macro-0.2.84 \
		wasm-bindgen-macro-support-0.2.84 \
		wasm-bindgen-shared-0.2.84 \
		web-sys-0.3.61 \
		webpki-0.22.0 \
		webpki-roots-0.22.6 \
		which-4.4.0 \
		whoami-1.4.0 \
		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-0.46.0 \
		windows-sys-0.42.0 \
		windows-sys-0.45.0 \
		windows-targets-0.42.2 \
		windows_aarch64_gnullvm-0.42.2 \
		windows_aarch64_msvc-0.42.2 \
		windows_i686_gnu-0.42.2 \
		windows_i686_msvc-0.42.2 \
		windows_x86_64_gnu-0.42.2 \
		windows_x86_64_gnullvm-0.42.2 \
		windows_x86_64_msvc-0.42.2 \
		winreg-0.6.2 \
		zeroize-1.6.0 \
		zstd-0.9.2+zstd.1.5.1 \
		zstd-safe-4.1.3+zstd.1.5.1 \
		zstd-sys-1.6.2+zstd.1.5.1 \
		async-speed-limit@git+https://github.com/open-trade/async-speed-limit\#8d1851d967b1014eb263bae23053a0e513431a9f \
		confy@git+https://github.com/open-trade/confy\#630cc28a396cb7d01eefdd9f3824486fe4d8554b \
		tokio-socks@git+https://github.com/open-trade/tokio-socks\#7034e79263ce25c348be072808d7601d82cd892d

post-install:
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/syslog.d
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	${INSTALL_DATA} ${FILESDIR}/rustdesk-server.newsyslog ${STAGEDIR}${EXAMPLESDIR}/newsyslog.sample
	${INSTALL_DATA} ${FILESDIR}/rustdesk-server.syslog ${STAGEDIR}${EXAMPLESDIR}/syslog.sample

.include <bsd.port.mk>
