summaryrefslogtreecommitdiff
path: root/editors/emacs/Makefile.common
blob: a382403c0e56b891c26e99335da8b22c9ce7b2d3 (plain)
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
108
109
110
111
112
113
114
115
116
117
118
# $NetBSD: Makefile.common,v 1.46 2022/04/07 10:35:28 ryoon Exp $
#
# used by editors/emacs/Makefile
# used by editors/emacs-nox11/Makefile

CATEGORIES=	editors
MASTER_SITES=	# empty
DISTFILES=	# empty

MAINTAINER=	dholland@NetBSD.org
COMMENT=	Meta-package for installing the preferred Emacs version

META_PACKAGE=	yes

.include "../../mk/bsd.prefs.mk"

#
# 1. Depend on the right emacs using ${EMACS_TYPE}. We don't have to
# (and in fact shouldn't) depend on the exact version, just *a*
# version. Do *not* include modules.mk as that will get us a tighter
# pattern than we want, as well as other problematic effects.
#
# XXX: it would be better to split modules.mk and share the logic
# that can be shared.
#

MY_EMACS_TYPE?=		${EMACS_TYPE}
EMACS_BASE_TYPE=	${MY_EMACS_TYPE:S/nox//}
EMACS_MAJOR=		${EMACS_BASE_TYPE:S/emacs//}

# Sigh.
.if ${MY_EMACS_TYPE} == "emacs20nox"
MY_EMACS_TYPE:=		emacs20
.endif

.if !empty(MY_EMACS_TYPE:Mxemacs*)
PKG_FAIL_REASON+=	"EMACS_TYPE is xemacs."
# (Set these to avoid crashing out below.)
EMACS_PKGDIR=		../../editors/xemacs
EMACS_PACKAGE=		xemacs
.elif ${MY_EMACS_TYPE} == "emacs28"
EMACS_PKGDIR=		../../editors/emacs28
EMACS_PACKAGE=		${EMACS_BASE_TYPE}
.elif !empty(MY_EMACS_TYPE:M*nox)
EMACS_PKGDIR=		../../editors/${EMACS_BASE_TYPE}-nox11
EMACS_PACKAGE=		${EMACS_BASE_TYPE}-nox11
.else
EMACS_PKGDIR=		../../editors/${EMACS_BASE_TYPE}
EMACS_PACKAGE=		${EMACS_BASE_TYPE}
.endif

DEPENDS+=	${EMACS_PACKAGE}>=${EMACS_MAJOR}:${EMACS_PKGDIR}

#
# 2. Now it gets gross. Before this meta-package was introduced, the
# emacs packages all had PKGNAME set to "emacs". Now the meta-package
# is called "emacs" and the emacs packages themselves have the emacs
# major version in them. But in order to make updates work properly,
# the version of the package called "emacs" cannot go down. We need to
# set MY_EMACS_VERSION accordingly. The following were the versions at
# the time the renaming was done:
#   emacs20		20.7nb16
#   emacs21		21.4anb26
#   emacs21-nox11	21.4anb13
#   emacs25+		n/a
#
# Set VER to the version from the above table, and REV to the
# PKGREVISION value.
#

.if ${MY_EMACS_TYPE} == "emacs20"
VER=	20.7
REV=	16
.elif ${MY_EMACS_TYPE} == "emacs21"
VER=	21.4
REV=	26
.elif ${MY_EMACS_TYPE} == "emacs21nox"
VER=	21.4
REV=	13
.else
VER=	${_EMACS_VERSION_MAJOR}
REV=	0
.endif

#
# Get the actual version from version.mk.
#

.include "${EMACS_PKGDIR}/version.mk"

MY_EMACS_VERSION=	${_EMACS_VERSION_MAJOR}.${_EMACS_VERSION_MINOR}
.if defined(_EMACS_VERSION_MICRO)
MY_EMACS_VERSION:=	${MY_EMACS_VERSION}.${_EMACS_VERSION_MICRO}
.endif

#
# Compute PKGREVISION.
#
# If we are on the same version as VER, we need PKGREVISION to be at
# least REV + 1. Otherwise, it can start at 0.
#
# Use MYPKGREVISION (defined at the top of this file) to bump the
# version if that should become necessary.
#

.if ${MY_EMACS_VERSION} != ${VER}
PKGREVISION=	${MYPKGREVISION}
.else
PKGREVISION!=	expr 1 + ${REV} + ${MYPKGREVISION}
.endif

# This doesn't work; fortunately it appears to be unnecessary.
#
#.if ${PKGREVISION} == "0"
#.unset PKGREVISION
#.endif

.include "../../mk/bsd.pkg.mk"