summaryrefslogtreecommitdiff
path: root/lang/erlang/Makefile
blob: da053e9de40daab60857ee0f27a551aca8047d02 (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,v 1.94 2019/07/03 07:26:36 nia Exp $

DISTNAME=		OTP-${DIST_VERSION_MAJOR}.${DIST_VERSION_MINOR}${!empty(DIST_VERSION_PATCH):?.:}${DIST_VERSION_PATCH}
PKGNAME=		${DISTNAME:S/OTP-/erlang-/}
CATEGORIES=		lang
MASTER_SITES=		https://github.com/erlang/otp/archive/

MAINTAINER=		pkgsrc-users@NetBSD.org
HOMEPAGE=		https://www.erlang.org/
COMMENT=		Concurrent functional programming language
LICENSE=		apache-2.0

EXTRACT_USING=		bsdtar
DIST_SUBDIR=		erlang

WRKSRC=			${WRKDIR}/otp-${DISTNAME}
GNU_CONFIGURE=		yes
USE_GNU_CONFIGURE_HOST=	${USE_CROSS_COMPILE}
OVERRIDE_DIRDEPTH=	4
USE_TOOLS+=		autoconf awk gmake perl:run flex

CONFIGURE_ARGS+=	--with-ssl=${BUILDLINK_PREFIX.openssl}

PTHREAD_OPTS+=		require native
CONFIGURE_ARGS+=	--enable-threads

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

# have gcc without the necessary atomic ops?
.if !empty(MACHINE_PLATFORM:MNetBSD-[56].*)

# a machine without native ethread implementation?
.  if	empty(MACHINE_PLATFORM:M*i386)	&&\
	empty(MACHINE_PLATFORM:M*sparc)	&&\
	empty(MACHINE_PLATFORM:M*sparc64) &&\
	empty(MACHINE_PLATFORM:M*powerpc) &&\
	empty(MACHINE_PLATFORM:M*x86_64)

CONFIGURE_ARGS+=	--disable-native-ethr-impls\
			--disable-smp-require-native-atomics

.  endif
.endif

MAKE_ENV+=		DESTDIR=${DESTDIR}

do-configure-post-hook: replace-interpreter

REPLACE_INTERPRETER+=	escript
REPLACE.escript.old=	.*escript
REPLACE.escript.new=	${PREFIX}/bin/escript
REPLACE_FILES.escript=	\
	lib/diameter/bin/diameterc \
	lib/erl_docgen/priv/bin/codeline_preprocessing.escript \
	lib/erl_docgen/priv/bin/xml_from_edoc.escript \
	lib/reltool/examples/display_args \
	lib/reltool/examples/mnesia_core_dump_viewer \
	lib/snmp/bin/snmpc \
	lib/snmp/src/compile/snmpc.src

SUBST_CLASSES+=		target
SUBST_STAGE.target=	pre-configure
SUBST_FILES.target=	make/target.mk
SUBST_SED.target=	-e "s|=.*config.guess)|= ${MACHINE_GNU_PLATFORM}|"
SUBST_MESSAGE.target=	Fixing target name.

TEST_TARGET=		tests
TEST_MAKE_FLAGS=	ERL_TOP=${WRKSRC}
REPLACE_PERL+=		make/make_emakefile

SMF_NAME=		epmd

CONFIGURE_ARGS.DragonFly+=	--disable-sctp

###
### XXX There may be others here.
###
.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD" || ${OPSYS} == "Darwin"
CONFIGURE_ARGS+=	--enable-kernel-poll
.endif

CHECK_RELRO_SKIP+=	lib/erlang/lib/megaco-${VERSION.megaco}/priv/lib/megaco_flex_scanner_drv.so
CHECK_RELRO_SKIP+=	lib/erlang/lib/megaco-${VERSION.megaco}/priv/lib/megaco_flex_scanner_drv_mt.so

.include "options.mk"

pre-configure:
	cd ${WRKSRC} && ./otp_build autoconf

###
### Ensure this gets rebuilt.
###
pre-build:
	${RUN} ${RM} -f ${WRKSRC}/lib/stdlib/ebin/dets_v9.beam

###
### Generate a list of module versions.
###
.PHONY: versions
versions: do-extract
	@${ECHO} "# \$$NetBSD\$$" > ${.CURDIR}/versions.mk
	@${ECHO} "# Do not edit, regenerate using 'make versions'" >> ${.CURDIR}/versions.mk
	@${ECHO} "_VERSIONS= \\" >> ${.CURDIR}/versions.mk
	${AWK} -F: '/OTP-${PKGVERSION_NOREV} :/{print $$2}' ${WRKSRC}/otp_versions.table |\
		${SED} -e 's/# //g' -e 's/-/ /g' >> ${.CURDIR}/versions.mk

post-install:
	chmod -R go-w ${DESTDIR}${PREFIX}/lib/erlang/lib

.include "Makefile.versions"

.include "../../security/openssl/buildlink3.mk"
.include "../../mk/termcap.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"