summaryrefslogtreecommitdiff
path: root/editors/emacs21/Makefile.common
blob: c92869c5922f3d5e3dfb0d659947ae5c6136f872 (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
# $NetBSD: Makefile.common,v 1.18 2019/06/08 10:40:54 rillig Exp $
#
# used by editors/emacs21/Makefile
# used by editors/emacs21-nox11/Makefile

DISTNAME=	emacs-${EMACSVERSION}a
PKGNAME?=	emacs21-${EMACSVERSION}a

MASTER_SITES=	${MASTER_SITE_GNU:=emacs/}
MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	http://www.gnu.org/software/emacs/emacs.html
COMMENT=	GNU editing macros (editor)

CONFLICTS=	mule-[0-9]*

USE_TOOLS+=		gmake perl:run
GNU_CONFIGURE=		yes

PATCHDIR=	${.CURDIR}/../../editors/emacs21/patches
FILESDIR=	${.CURDIR}/../../editors/emacs21/files
DISTINFO_FILE=	${.CURDIR}/../../editors/emacs21/distinfo
PLIST_SRC=	${.CURDIR}/../../editors/emacs21/PLIST

# needed for 21.4a, can probably go away on next update
EMACSVERSION=	21.4
WRKSRC=		${WRKDIR}/emacs-${EMACSVERSION}
PLIST_SUBST+=	EMACSVERSION=${EMACSVERSION:Q}

MAKEFLAGS+=	EMACSLOADPATH=${WRKSRC}/lisp

# build PATH in the dumped emacs is not a problem
CHECK_WRKREF_SKIP+=	bin/emacs
CHECK_WRKREF_SKIP+=	bin/emacs-${EMACSVERSION}

CONFIGURE_ARGS+=	--srcdir=${WRKSRC}
INSTALL_MAKE_FLAGS+=	prefix=${DESTDIR}${PREFIX}
INSTALL_MAKE_FLAGS+=	mandir=${DESTDIR}${PREFIX}/${PKGMANDIR}
INSTALL_MAKE_FLAGS+=	infodir=${DESTDIR}${PREFIX}/${PKGINFODIR}

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

# If using GNU ld 2.13.2.1 or later, avoid creating combined reloc
# sections and .data reloc sections, both of which Emacs can't handle
# properly.  Analyzed by Stephen Ma.
LDFLAGS+=	-Wl,-z,nocombreloc

# Use terminfo on NetBSD-6.
# We cannot use terminfo.*.mk as emacs WILL force a link to termcap,
# but this is fine for us.
.if (${OPSYS} == "NetBSD") && exists(/usr/include/term.h)
CPPFLAGS+=	-DTERMINFO
.endif

.if (${OPSYS} == "DragonFly") && exists(/usr/lib/crtn.o)
CPPFLAGS+=	-DDFLY_CRT_USRLIB
.endif

PLIST_VARS+=	fns.el
.if ${OPSYS} == "Darwin"
PLIST_SUBST+=	DOCTAIL=""
.else
PLIST.fns.el=	yes
PLIST_SUBST+=	DOCTAIL="-${EMACSVERSION}.1"
.endif

# Disable W^X.
LDFLAGS.OpenBSD+=	-Z

.include "../../mk/compiler.mk"
.if !empty(CC_VERSION:Mgcc-3.*)
CFLAGS+=	-fno-zero-initialized-in-bss
.endif

.if !empty(PKGSRC_COMPILER:Mclang)
TOOL_DEPENDS+=	tradcpp-[0-9]*:../../devel/tradcpp
TRADCPP=	${PREFIX}/bin/tradcpp
.else
TRADCPP=	${CPP} -traditional-cpp
.endif
ALL_ENV+=	TRADCPP=${TRADCPP:Q}

.if (${OPSYS} == "NetBSD") && \
    !exists(/usr/lib/libgcc_s.so) && !exists(/usr/lib/libgcc.a)
# NetBSD with native Clang doesn't provide libgcc, everything is in libc.
pre-configure: fake-libgcc

fake-libgcc:
	${AR} q ${BUILDLINK_DIR}/lib/libgcc.a
.endif

INFO_FILES=	yes
REPLACE_PERL=	lib-src/grep-changelog

post-extract:
	${CP} ${FILESDIR}/site-init.el ${WRKSRC}/lisp
	${CP} ${FILESDIR}/amd64.h ${WRKSRC}/src/m
	${CP} ${FILESDIR}/powermac.h ${WRKSRC}/src/m
	${CP} ${FILESDIR}/darwin.h ${WRKSRC}/src/s
	${CP} ${FILESDIR}/dragonfly.h ${WRKSRC}/src/s
	${CP} ${FILESDIR}/unexmacosx.c ${WRKSRC}/src
	${CP} ${FILESDIR}/sh3el.h ${WRKSRC}/src/m

# for patch-ba
post-build:
	cd ${WRKSRC}/lisp && \
	   rm sort.elc && ${MAKE_PROGRAM} sort.elc && \
	   rm mail/smtpmail.elc && ${MAKE_PROGRAM} mail/smtpmail.elc && \
	   rm fast-lock.elc && ${MAKE_PROGRAM} fast-lock.elc

pre-install:
	@${FIND} ${WRKSRC} -type f -name "*.orig" -print | ${XARGS} ${RM} -f

post-install:
	${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${DESTDIR}${PREFIX}/share/emacs
	${CHMOD} -R go-w ${DESTDIR}${PREFIX}/share/emacs