# $OpenBSD: Makefile,v 1.11 2020/12/17 07:41:42 thfr Exp $
V =		16.0.2
REVISION =	0
COMMENT =	unofficial improved version of X-Ray Engine

PKGNAME =	openxray-${V}

GH_ACCOUNT =	OpenXRay
GH_PROJECT =	xray-16
GH_TAGNAME =	822-december-preview

MASTER_SITES0 =	https://github.com/

DIST_SUBDIR =	openxray
DISTFILES =	${DISTNAME}${EXTRACT_SUFX}
.for A N C in \
	GPUOpen-LibrariesAndSDKs AGS_SDK dbeff30568aa1494d6f520232ea79cdaa1a2398f \
	OpenXRay BugTrap	c619077b40ee6e7ad6ffc5a194a5d3583af8f78e \
	OpenXRay FreeMagic	ba39f90bef46fd79166ccdb661e902f45d48560e \
	OpenXRay GameSpy	5cd0fcdfd301e7e81d3da48717cf0bb55c59349c \
	OpenXRay LuaJIT		c114e08f1a15599102ff86afc7239de5c3231db8 \
	OpenXRay OpenAutomate	9ee089894c6d403aba5968ce1c8c26578b8e2b0a \
	g-truc	 gli		30808550a20ca53a255e6e1e77070493eda7b736 \
	OpenXRay luabind-deboostified 70ef64fee4a9e41fb6ac540938311fc80a52d976 \
	OpenXRay mimalloc	a43a51ad21e1620a14eae041d8c6b8badd01d2a3
DISTFILES +=	$N-{$A/$N/archive/}$C.tar.gz:0
.endfor

SHARED_LIBS +=  mimalloc                  1.6 # 1.6 autogenerated, change later

CATEGORIES =	games

HOMEPAGE =	https://github.com/OpenXRay/xray-16

MAINTAINER =	Eugene Moz. <mozhaaak@schizoden.xyz>

# openxray: "commercial GSC Game World proprietary code"
# AGS_SDK, BugTrap, LuaJIT, gli, luabind, mimalloc: MIT/similar
# FreeMagic: likely free but "see some license pdf on a website which
#   no longer exists"
# OpenAutomate: NVIDIA license in Externals/OpenAutomate/LICENSE;
#   revocable(sic), renewable on 1 year terms, confidentiality clauses,
#   can only be distributed in unmodified form, etc
PERMIT_PACKAGE =	license problems
PERMIT_DISTFILES =	license problems

# lockfile
WANTLIB += ${COMPILER_LIBCXX} SDL2 freeimage cryptopp
WANTLIB += tbb pthread ogg lzo m xcb-glx xcb-dri3 xcb-present
WANTLIB += xcb-sync xcb-xfixes xshmfence c drm expat glapi xcb xcb-dri2 GL GLU X11
WANTLIB += X11-xcb Xdamage Xext Xfixes Xxf86vm

COMPILER =	ports-clang ports-gcc

MODULES =	devel/cmake

LIB_DEPENDS =	archivers/lzo \
		devel/cryptopp \
		devel/sdl2 \
		devel/tbb \
		graphics/freeimage

DEBUG_PACKAGES= ${BUILD_PACKAGES}

post-extract:
.for D in AGS_SDK BugTrap FreeMagic GameSpy LuaJIT OpenAutomate \
    gli luabind mimalloc
	rmdir ${WRKSRC}/Externals/$D
	mv ${WRKDIR}/$D* ${WRKSRC}/Externals/$D
.endfor

USE_CCACHE =	Yes

.include <bsd.port.mk>
