aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt/pkg_install-devel/Makefile
blob: 61694bf2f49124ee4575d8652e814d7ec4e572e0 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# New ports collection makefile for:    pkg_install
# Date created:             25 Jan 2004
# Whom:                 Oliver Eikemeier
#
# $FreeBSD$
#

PORTNAME=       pkg_install
PORTVERSION=        20040811
CATEGORIES=     sysutils
MASTER_SITES=       ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= eik
PKGNAMESUFFIX=      -devel

MAINTAINER=     eik@FreeBSD.org
COMMENT=        Development version of the FreeBSD 5.x package tools

CONFLICTS=      pkg_install-[0-9]*

MANCOMPRESSED=      yes

MAN1=           pkg_add.1 pkg_create.1 pkg_delete.1 \
            pkg_info.1 pkg_version.1

PKGREQ=         ${WRKDIR}/pkg-req

.if defined(PREFIX)
.if ${PREFIX} == "/usr"
PKGNAMESUFFIX=      -base-devel
.endif
.endif

BACKUPDIR?=     /var/backups

.if !defined(NOCRYPT) && !defined(NO_OPENSSL)
USE_OPENSSL=        yes
MAN1+=          pkg_check.1 pkg_sign.1
PLIST_SUB+=     OPENSSL=""
.else
MAKE_ARGS=      -DNO_OPENSSL
PLIST_SUB+=     OPENSSL="@comment "
.endif

.include <bsd.port.pre.mk>

.if defined(DFOSVERSION)
PKG_OSVERSION=      ${DFOSVERSION}
SED_SCRIPT=     -e 's/%%OSVERSIONCHK%%/"$$OSVERSION" -ge 110000/g'
.else
PKG_OSVERSION=      ${OSVERSION}
SED_SCRIPT=     -e 's/%%OSVERSIONCHK%%/"$$OSVERSION" -ge 491101 -a "$$OSVERSION" -lt 500000 -o "$$OSVERSION" -ge 502120/g'
.endif

pre-everything::
    @${ECHO} "======================================================================================="
    @${ECHO}
    @${ECHO} "Build ${PKGNAME} with PREFIX=/usr to replace the base package tools"
    @${ECHO}
    @${ECHO} "======================================================================================="

.if !defined(DFOSVERSION) && ${OSVERSION} < 460102
check-already-installed:
.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
    @if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
        ${ECHO_CMD} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
        ${ECHO_CMD} "      If so, you may wish to \`\`make deinstall'' and install"; \
        ${ECHO_CMD} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
        ${ECHO_CMD} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
        ${ECHO_CMD} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
        ${ECHO_CMD} "      in your environment or the \"make install\" command line."; \
        exit 1; \
    fi
.else
    @${DO_NADA}
.endif
.endif

pre-configure:
    @${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
        -e 's|%%MANPREFIX%%|${MANPREFIX}|g' \
        ${FILESDIR}/Makefile.inc > ${WRKDIR}/Makefile.inc

# __FBSDID is undefied for old FreeBSD versions and DragonFlyBSD
.if defined(DFOSVERSION) || ${OSVERSION} < 440001 || ${OSVERSION} >= 500000 && ${OSVERSION} < 500024
post-patch:
    @${FIND} ${WRKSRC} -name '*.c' \
        | ${XARGS} ${PERL} -pi.orig -e 's/__FBSDID\(("[^"]*")\)/static const char rcsid[] = $$1/'
.endif

post-build:
    @${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-req >${WRKDIR}/pkg-req

.if !defined(PACKAGE_BUILDING)
pre-install:
    @${SETENV} PKG_PREFIX=${PREFIX:Q} OSVERSION=${PKG_OSVERSION:Q} ${SH} ${PKGREQ} ${PKGNAME} INSTALL
.endif

# Call pkg-install in `do-install:' instead of `pre-install:' because it might
# deinstall pkg_info, which is fatal during `check-already-installed:'.
do-install:
    ${SETENV} PKG_PREFIX=${PREFIX:Q} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
    @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})

test: build
    @(cd ${BUILD_WRKSRC}/version && ${SH} test-pkg_version.sh)

.include <bsd.port.post.mk>