aboutsummaryrefslogtreecommitdiffstats
path: root/games/glest-data/Makefile
blob: c58b875f45a6b0797f11a75b6d04fa82b7c2589f (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
68
69
# Created by: Jose Alonso Cardenas Marquez <acardenas@bsd.org.pe>
# $FreeBSD$

PORTNAME=   data
PORTVERSION=    3.2.1
CATEGORIES= games
MASTER_SITES=   SF/glest/glest%20${PORTNAME}/${PORTVERSION}
PKGNAMEPREFIX=  glest-
DISTNAME=   glest_${PORTNAME}_${PORTVERSION}
DIST_SUBDIR=    glest

MAINTAINER= acm@FreeBSD.org
COMMENT=    Glest data files

USES=       dos2unix zip
DOS2UNIX_GLOB=  *.log *.ini *.html *.txt *.lng
NO_BUILD=   yes

PLIST=      ${WRKDIR}/pkg-plist
WRKSRC=     ${WRKDIR}/glest_game

DATADIR=    share/${PKGNAMEPREFIX:S/-//}
DOCSDIR=    share/doc/${PKGNAMEPREFIX:S/-//}
GLESTDATADIRE=  data maps scenarios techs tilesets tutorials

NO_STAGE=   yes
post-extract:
    @${MV} ${WRKSRC}/docs/license.txt ${WRKSRC}/docs/license-data.txt
    @${RMDIR} ${WRKSRC}/screens

pre-install:
    @${RM} -f ${PLIST}

.   for FILE in glest.ico servers.ini
        @${ECHO_CMD} "%%DATADIR%%/${FILE}" >> ${PLIST}
.   endfor

.   for DIRE in ${GLESTDATADIRE}
        @cd ${WRKSRC} && \
            ${FIND} ${DIRE} -type f | ${SORT} | ${SED} -e 's|^|%%DATADIR%%/|' >> ${PLIST} && \
                ${FIND} ${DIRE} -type d | ${SORT} -r | ${SED} -e 's|^|@dirrm %%DATADIR%%/|' >> ${PLIST}
.   endfor
    @${ECHO_CMD} "@dirrmtry %%DATADIR%%" >> ${PLIST}

.   if !defined(NOPORTDOCS)
        @cd ${WRKSRC}/docs && \
            ${FIND} * -type f | ${SORT} | ${SED} -e 's|^|%%PORTDOCS%%%%DOCSDIR%%/|' >> ${PLIST} && \
                ${FIND} * -type d | ${SORT} -r | ${SED} -e 's|^|%%PORTDOCS%%@dirrm %%DOCSDIR%%/|' >> ${PLIST}
    @${ECHO_CMD} "%%PORTDOCS%%@dirrmtry %%DOCSDIR%%" >> ${PLIST}
.   endif

do-install:
.if !defined(NOPORTDOCS)
    @${MKDIR} ${PREFIX}/${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/docs/license-data.txt ${PREFIX}/${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/docs/readme.txt ${PREFIX}/${DOCSDIR}
.endif
    @${MKDIR} ${PREFIX}/${DATADIR}
.for FILE in glest.ico servers.ini
    ${INSTALL_DATA} ${WRKSRC}/${FILE} ${PREFIX}/${DATADIR}
.endfor

.for DIRE in ${GLESTDATADIRE}
    @cd ${WRKSRC} && \
        ${FIND} ${DIRE} -type d -exec ${MKDIR} "${PREFIX}/${DATADIR}/{}" \; && \
            ${FIND} ${DIRE} -type f -exec ${INSTALL_DATA} "{}" "${PREFIX}/${DATADIR}/{}" \;
.endfor

.include <bsd.port.mk>