[BACK]Return to Makefile CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / lang / mozjs78

File: [cvs.NetBSD.org] / pkgsrc / lang / mozjs78 / Makefile (download)

Revision 1.21, Mon Jun 14 22:07:35 2021 UTC (4 months ago) by gutteridge
Branch: MAIN
CVS Tags: pkgsrc-2021Q2-base, pkgsrc-2021Q2
Changes since 1.20: +12 -1 lines

mozjs78: fix NetBSD i386 builds with Rust >= 1.50

The NetBSD i386 Rust 1.50 builds introduced two different targets (i586
and i686), where previously there was only one (i686). Unfortunately,
the upstream mozjs78 configuration script that narrows to the
appropriate compiler target is confused by this, since it was receiving
"i486" from pkgsrc tooling and didn't know how to pick from more than
one potential approximate match. I'm addressing it this (kludgy) way
for now, as I don't have time to go through Mozilla's scripting and
make adjustments, and I would like this building in the 2021Q2 branch.
If someone else feels there's a better way, please have at it. With
this tweak in place, I'm able to build the xfce4 meta package for
NetBSD/i386 9.2.

# $NetBSD: Makefile,v 1.21 2021/06/14 22:07:35 gutteridge Exp $

DISTNAME=	mozjs78_78.4.0.orig
PKGNAME=	${DISTNAME:S/_/-/:S/.orig//}
PKGREVISION=	3
CATEGORIES=	lang
MASTER_SITES=	http://deb.debian.org/debian/pool/main/m/mozjs78/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	https://spidermonkey.dev/
COMMENT=	SpiderMonkey JavaScript library (78.x branch)
LICENSE=	mpl-1.1

WRKSRC=		${WRKDIR}/firefox-${PKGVERSION_NOREV}
USE_TOOLS+=	autoconf213 gmake perl pkg-config
USE_LANGUAGES=	c c++

# "ERROR: Only GCC 7.1 or newer is supported"
GCC_REQD+=	7

CONFIGURE_DIRS=	js/src/build
BUILD_DIRS=	js/src/build

HAS_CONFIGURE=		yes
CONFIGURE_SCRIPT=	../configure
CONFIGURE_ARGS+=	--prefix=${PREFIX}
CONFIGURE_ARGS+=	--disable-debug
CONFIGURE_ARGS+=	--with-system-icu
CONFIGURE_ARGS+=	--with-system-zlib
CONFIGURE_ARGS+=	--enable-readline
CONFIGURE_ARGS+=	--disable-jemalloc
CONFIGURE_ARGS+=	--disable-debug-symbols
CONFIGURE_ARGS+=	--enable-strip
CONFIGURE_ARGS+=	--with-intl-api
# --disable-optimize

# For rustc/cargo detection
.include "../../mk/bsd.prefs.mk"

# This is to work around build failures where an upstream configuration script
# is confused by having more than one approximate match to MACHINE_GNU_PLATFORM
# "i486" when attempting to select the Rust compiler target.
.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386)
CONFIGURE_ARGS+=	--target=i586-unknown-netbsd
CONFIGURE_ARGS+=	--host=i586-unknown-netbsd
.else
CONFIGURE_ARGS+=	--target=${MACHINE_GNU_PLATFORM}
CONFIGURE_ARGS+=	--host=${MACHINE_GNU_PLATFORM}
.endif

BUILDLINK_TRANSFORM.SunOS+=	rm:-pie

SUBST_CLASSES+=		conf
SUBST_STAGE.conf=	pre-configure
SUBST_MESSAGE.conf=	Set variables in configuration file.
SUBST_FILES.conf+=	js/moz.configure
SUBST_VARS.conf=	PREFIX

PKGCONFIG_OVERRIDE+=	js/src/build/js.pc.in
PKGCONFIG_OVERRIDE+=	js/src/ctypes/libffi/libffi.pc.in

PYTHON_VERSIONS_INCOMPATIBLE=	27
PYTHON_FOR_BUILD_ONLY=		tool
TOOL_DEPENDS+=			${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat

TEST_DEPENDS+=			${PYPKGPREFIX}-six-[0-9]*:../../lang/py-six

TEST_TARGET=			check-jstests

pre-configure:
	cd ${WRKSRC}/js/src && \
	    autoconf-2.13 old-configure.in > old-configure && autoconf-2.13
	${MKDIR} ${WRKSRC}/js/src/build && \
	    ${TOUCH} ${WRKSRC}/js/src/build/old-configure.vars

post-install:
	cd ${DESTDIR}${PREFIX}/lib && \
		${MV} libmozjs-78.so libmozjs-78.so.0.0.0 && \
		${LN} -s libmozjs-78.so.0.0.0 libmozjs-78.so.0 && \
		${LN} -s libmozjs-78.so.0 libmozjs-78.so
	${RM} -f ${DESTDIR}${PREFIX}/lib/libjs_static.ajs
	${CHMOD} -x ${DESTDIR}${PREFIX}/include/mozjs-78/js-config.h
	${CHMOD} -x ${DESTDIR}${PREFIX}/lib/pkgconfig/mozjs-78.pc

BUILDLINK_DEPMETHOD.clang=	build
.include "../../lang/clang/buildlink3.mk"
RUST_REQ=	1.41.0
.include "../../lang/rust/rust.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../textproc/icu/buildlink3.mk"
.include "../../mk/readline.buildlink3.mk"
# XXX This does not work entirely correctly at present. There are
# 26 atomic type test failures on powerpc, where these pass on i386.
.include "../../mk/atomic64.mk"
.include "../../mk/bsd.pkg.mk"