aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.pbi.mk
blob: 22e3c5d7efb0bf8c2390c67563383e31ced6b6f6 (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
# $FreeBSD$
#
# Creates a PBI file from a port with just 'make pbi'
#
.if !defined(_INCLUDE_PBI_MK)

_INCLUDE_PBI_MK=    yes
PBI_MAINTAINER=     kmoore@FreeBSD.org

_PBIMAKEPORT=   pbi_makeport
_PBICREATE= pbi_create
_PBIDIR=    pbi
_PBICONF=   ${_PBIDIR}/pbi.conf

.PHONY: check-pbimanager pbi pbi-makeport pbi-generate pbi-create \
    clean-pbi clean-pbibuild

check-pbimanager:

    @set -- chk=""; \
    if [ -z "`which pbi_info`" ] ; then \
        cd ${PORTSDIR}/ports-mgmt/pbi-manager && make install clean; \
    fi

pbi: pbi-generate

pbi-generate: check-pbimanager
    @_PBIPORT=`pwd | cut -d "/" -f4-`; \
    if [ ! -d ${PWD}/pbi ] ; then                   \
        ${ECHO_MSG} "===> Generating meta-data for ${PORTNAME}";    \
        ${MKDIR} ${_PBIDIR};                    \
        ${MKDIR} ${_PBIDIR}/resources ${_PBIDIR}/scripts    \
            ${_PBIDIR}/xdg-desktop ${_PBIDIR}/xdg-menu  \
            ${_PBIDIR}/xgd-mime;                \
        ${ECHO_CMD} "PBI_PROGNAME=\"${PORTNAME}\"" > ${_PBICONF};\
        ${ECHO_CMD} "PBI_MAKEPORT=\"$${_PBIPORT}\"" >> ${_PBICONF};\
        PROGWEB=`cat ${DESCR} | awk '/^WWW:/ { print $$2; }'`;  \
        ${ECHO_CMD} "PBI_PROGWEB=\"$${PROGWEB}\"" >> ${_PBICONF};\
        ${ECHO_CMD} "PBI_PROGAUTHOR=\"The ${PORTNAME} team\""   \
             >> ${_PBICONF};                \
        ${ECHO_CMD} "PBI_UPDATEURL=\"http://update.pbidir.com\""\
             >> ${_PBICONF};                \
        ${ECHO_CMD} "export PBI_PROGNAME PBI_MAKEPORT "     \
            "PBI_PROGWEB "                  \
            "PBI_PROGAUTHOR PBI_UPDATEURL " \
            "PBI_MKPORTBEFORE PBI_MKPORTAFTER PBI_MAKEOPTS" \
             >> ${_PBICONF};                \
    fi
    @${ECHO_MSG} "==> Generating PBI file"
    @${_PBIMAKEPORT} -c ${PWD}/pbi -o ${PWD} $${_PBIPORT}

clean-pbi:
    @${ECHO_MSG} "===> Cleaning PBI for ${PORTNAME}"
    @${RM} -rf ${_PBIDIR}

.endif