aboutsummaryrefslogtreecommitdiff
path: root/games/xray_re-tools/Makefile
blob: 7e7458036f08f9dd85c91f0133c9717e2ecd75ec (plain) (blame)
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
59
60
61
62
63
64
65
66
67
PORTNAME=	xray_re-tools
DISTVERSION=	g20180902
CATEGORIES=	games converters

MAINTAINER=	danfe@FreeBSD.org
COMMENT=	X-Ray engine game asset converter (unofficial)

LIB_DEPENDS=	liblzo2.so:archivers/lzo2 \
		libvorbisfile.so:audio/libvorbis \
		libnvtt.so:graphics/nvidia-texture-tools

BROKEN=		does not link: ld: error: undefined symbol: nv::mem::malloc

USE_GITHUB=	yes
GH_ACCOUNT=	abramcumner
GH_TAGNAME=	52721d2

MAKEFILE=	${FILESDIR}/Makefile
BUILD_WRKSRC=	${WRKSRC}/sources
WITHOUT_FBSD10_FIX=	yes

PLIST_FILES=	bin/xr_converter

post-extract:
	@${MV} ${WRKSRC}/sources/3rd\ party ${WRKSRC}/sources/3rd-party
	@${MV} ${WRKSRC}/sources/utils/converter/opcode/Ice/IceTrilist.h \
		${WRKSRC}/sources/utils/converter/opcode/Ice/IceTriList.h
	@${LN} -s StdAfx.h ${WRKSRC}/sources/utils/converter/opcode/Stdafx.h

post-patch:
	@${REINPLACE_CMD} -e '/#include/s,Math,math,' \
	    -e '/#include/s,\.\\Ice\\,Ice/,' \
		${WRKSRC}/sources/utils/converter/opcode/OPC_IceHook.h
	@${REINPLACE_CMD} -e 's,string& version,string version,' \
		${WRKSRC}/sources/utils/converter/level_tools.cxx
	@${REINPLACE_CMD} -e '19s,attenuation1,attenuation2,' \
		${WRKSRC}/sources/xray_re/xr_d3d_light.cxx
	@${REINPLACE_CMD} -e '/OGF3_S_SMPARAMS_VERSION/s,||,\&\&,' \
		${WRKSRC}/sources/xray_re/xr_ogf_v3.cxx
	@${REINPLACE_CMD} -e 's,mP0,mP1,' \
		${WRKSRC}/sources/utils/converter/opcode/Ice/IceLSS.h
	@${REINPLACE_CMD} -e 's,} if,} else if,' \
		${WRKSRC}/sources/utils/converter/level_mesh_ladders.cxx
	@${REINPLACE_CMD} -e 's,push_back,this->&,' \
		${WRKSRC}/sources/xray_re/xr_influence.h
	@${REINPLACE_CMD} -e 's,type_info& type,std::&,' \
		${WRKSRC}/sources/xray_re/xr_scene.cxx
	@${REINPLACE_CMD} -e 's,sprintf_s,xr_snprintf,' \
		${WRKSRC}/sources/xray_re/xr_scene_ways.cxx
	@${REINPLACE_CMD} -e '/return/s,_stricmp,strcasecmp,' \
		${WRKSRC}/sources/xray_re/xr_string_utils.h
	@${REINPLACE_CMD} -e 's,MINGW32__),& || defined(__FreeBSD__),' \
		${WRKSRC}/sources/xray_re/xr_types.h

do-install:
	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/converter \
		${STAGEDIR}${PREFIX}/bin/xr_converter

# Alternative to DOS2UNIX_FILES that preserves original timestamps,
# to be used together with `-l' switch added to PATCH_ARGS below.
fixpatches:
	@${FIND} ${FILESDIR} -name patch-* | ${XARGS} ${SED} -i '' \
		-E 's,[[:cntrl:]]*$$,,'

.include <bsd.port.mk>

PATCH_ARGS+=	-l