Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2012 19:59:32 GMT
From:      Anton Afanasyev <aasoft@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/170768: New port: lang/spidermonkey-185 A standalone JavaScript interpreter from the Mozilla project, version 1.8.5
Message-ID:  <201208191959.q7JJxWOH044702@red.freebsd.org>
Resent-Message-ID: <201208192000.q7JK0Mfp094292@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170768
>Category:       ports
>Synopsis:       New port: lang/spidermonkey-185 A standalone JavaScript interpreter from the Mozilla project, version 1.8.5
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 19 20:00:22 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Anton Afanasyev
>Release:        9.0-RELEASE-p2
>Organization:
>Environment:
FreeBSD machinename 9.0-RELEASE-p2 FreeBSD 9.0-RELEASE-p2 #0: Sun Jun  3 21:41:23 PDT 2012     root@:/usr/obj/usr/src/sys/MYKERN  i386
>Description:
Version 1.8.5 of the Spidermonkey JavaScript interpreter from the Mozilla project ( http://www.mozilla.org/js/spidermonkey/ )

A separate port is due to other ports depending on the current (1.7.0) version of the lang/spidermonkey port, and 1.8.5 breaks the ABI, so those ports would not build if lang/spidermonkey was updated.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	spidermonkey-1.8.5
#	spidermonkey-1.8.5/files
#	spidermonkey-1.8.5/files/patch-Makefile
#	spidermonkey-1.8.5/files/patch-jslock.cpp
#	spidermonkey-1.8.5/files/patch-jsopcode.cpp
#	spidermonkey-1.8.5/files/patch-config
#	spidermonkey-1.8.5/pkg-descr
#	spidermonkey-1.8.5/distinfo
#	spidermonkey-1.8.5/Makefile
#
echo c - spidermonkey-1.8.5
mkdir -p spidermonkey-1.8.5 > /dev/null 2>&1
echo c - spidermonkey-1.8.5/files
mkdir -p spidermonkey-1.8.5/files > /dev/null 2>&1
echo x - spidermonkey-1.8.5/files/patch-Makefile
sed 's/^X//' >spidermonkey-1.8.5/files/patch-Makefile << '610b519c5d8a361b4e371f536380810c'
X--- Makefile.ref.orig	2011-03-31 14:08:36.000000000 -0500
X+++ Makefile.ref	2011-08-11 19:46:02.000000000 -0500
X@@ -420,7 +420,7 @@
X 	link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
X else
X $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
X-	$(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
X+	$(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) -L$(OBJDIR) -ljs $(LDFLAGS) $(OTHER_LIBS) \
X 	    $(PROG_LIBS)
X endif
X 
610b519c5d8a361b4e371f536380810c
echo x - spidermonkey-1.8.5/files/patch-jslock.cpp
sed 's/^X//' >spidermonkey-1.8.5/files/patch-jslock.cpp << 'c2d258dccca4cd285942ecad1bfba41e'
X--- jslock.cpp.orig	2011-03-31 14:08:36.000000000 -0500
X+++ jslock.cpp	2011-08-11 19:55:57.000000000 -0500
X@@ -311,8 +311,10 @@
X 
X #define GLOBAL_LOCK_INDEX(id)   (((uint32)(jsuword)(id)>>2) & global_locks_mask)
X 
X+#ifndef NSPR_LOCK
X static void
X js_Dequeue(JSThinLock *);
X+#endif
X 
X static PRLock **global_locks;
X static uint32 global_lock_count = 1;
c2d258dccca4cd285942ecad1bfba41e
echo x - spidermonkey-1.8.5/files/patch-jsopcode.cpp
sed 's/^X//' >spidermonkey-1.8.5/files/patch-jsopcode.cpp << '6ea9595a334b952ed4fed8281f0e02d1'
X--- jsopcode.cpp.orig	2011-08-11 19:58:41.000000000 -0500
X+++ jsopcode.cpp	2011-08-11 19:59:16.000000000 -0500
X@@ -498,7 +498,7 @@
X         pc2 += jmplen;
X         npairs = GET_UINT16(pc2);
X         pc2 += UINT16_LEN;
X-        fprintf(fp, " offset %d npairs %u", (intN) off, (uintN) npairs);
X+        fprintf(fp, " offset %td npairs %u", (intN) off, (uintN) npairs);
X         while (npairs) {
X             uint16 constIndex = GET_INDEX(pc2);
X             pc2 += INDEX_LEN;
6ea9595a334b952ed4fed8281f0e02d1
echo x - spidermonkey-1.8.5/files/patch-config
sed 's/^X//' >spidermonkey-1.8.5/files/patch-config << '2b53f97d97d4351b7606fa8360338017'
X--- ref-config/Linux_All.mk	2011-03-31 12:08:36.000000000 -0700
X+++ ref-config/Linux_All.mk	2012-08-01 20:55:43.000000000 -0700
X@@ -41,7 +41,7 @@
X # Config for all versions of Linux
X #
X 
X-CC = gcc
X+CC ?= g++
X CCC = g++
X LD = g++
X CFLAGS +=  -Wall -Wno-format -MMD
X@@ -76,7 +76,7 @@
X 
X GFX_ARCH = x
X 
X-OS_LIBS = -lm -lc
X+OS_LIBS = -lm
X 
X ASFLAGS += -x assembler-with-cpp
X 
X@@ -90,16 +90,16 @@
X endif
X 
X # Use the editline library to provide line-editing support.
X-JS_EDITLINE = 1
X+JS_READLINE = 1
X 
X-ifeq ($(CPU_ARCH),x86_64)
X-# Use VA_COPY() standard macro on x86-64
X-# FIXME: better use it everywhere
X-OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy
X-endif
X+#ifeq ($(CPU_ARCH),x86_64)
X+## Use VA_COPY() standard macro on x86-64
X+## FIXME: better use it everywhere
X+#OS_CFLAGS += -DHAVE_VA_COPY -DVA_COPY=va_copy
X+#endif
X 
X-ifeq ($(CPU_ARCH),x86_64)
X-# We need PIC code for shared libraries
X-# FIXME: better patch rules.mk & fdlibm/Makefile*
X+ifeq ($(CPU_ARCH),sparc64)
X OS_CFLAGS += -DPIC -fPIC
X+else
X+OS_CFLAGS += -DPIC -fpic
X endif
2b53f97d97d4351b7606fa8360338017
echo x - spidermonkey-1.8.5/pkg-descr
sed 's/^X//' >spidermonkey-1.8.5/pkg-descr << 'c24b1ae6b2a7db984588814779cab3ba'
XSpidermonkey is the JavaScript interpreter from the Mozilla project.
XThis is version 1.8.5.
X
XWWW: http://www.mozilla.org/js/spidermonkey/
c24b1ae6b2a7db984588814779cab3ba
echo x - spidermonkey-1.8.5/distinfo
sed 's/^X//' >spidermonkey-1.8.5/distinfo << '74547e77c6d2e4348b2b97a27d0851fb'
XSHA256 (js185-1.0.0.tar.gz) = 5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687
XSIZE (js185-1.0.0.tar.gz) = 6164605
74547e77c6d2e4348b2b97a27d0851fb
echo x - spidermonkey-1.8.5/Makefile
sed 's/^X//' >spidermonkey-1.8.5/Makefile << 'b56ec66da257f386927d0ec774b986b7'
X# Ports collection makefile for:	spidermonkey-185
X# Date created:			Sat Aug 18, 2012
X# Whom:					Anton Afanasyev <aasoft@gmail.com>
X#
X# $FreeBSD:$
X
XPORTNAME=		spidermonkey-185
XPORTVERSION=	1.8.5
XCATEGORIES=		lang
X
X
XDISTVERSION=	1.8.5
XJS_VERSION=		${DISTVERSION:S/.//g}
XMASTER_SITES=	${MASTER_SITE_MOZILLA}
XMASTER_SITE_SUBDIR=	js
XDISTNAME=		js${JS_VERSION}-1.0.0
XEXTRACT_AFTER_ARGS=| ${TAR} -xf - --exclude js/jsd
X
X
XMAINTAINER=		aasoft@gmail.com
XCOMMENT=		A standalone JavaScript interpreter from the Mozilla project, version 1.8.5
X
X
XBUILD_DEPENDS=	zip:${PORTSDIR}/archivers/zip
XLIB_DEPENDS=	nspr4.1:${PORTSDIR}/devel/nspr
X
X
XCONFLICTS=		njs-[0-9]*
X
X
XUSE_AUTOTOOLS=	autoconf213:env libtool:env
XUSE_LDCONFIG=	yes
XGNU_CONFIGURE=	yes
XUSE_GMAKE=		yes
X
X
XSRC_DIR=	js-${DISTVERSION}/js/src
XWRKSRC=		${WRKDIR}/${SRC_DIR}
X
X
X# we build in a separate directory, so must change config path, location, and build location
XCONFIGURE_SCRIPT=	../configure
XCONFIGURE_WRKSRC=	${WRKSRC}/${OPSYS}`${UNAME} -r`_DBG.OBJ
XBUILD_WRKSRC=		${CONFIGURE_WRKSRC}
X
X
X# port options
XOPTIONS_DEFINE=		TSAFE DEBUG TRACEJIT METHODJIT
X
XOPTIONS_SINGLE=		OPTIM
X
X
X# can specify only one of these, and it is require only of the
XOPTIONS_SINGLE_OPTIM=		OPTIMIZE_DISABLE OPTIMIZE_O OPTIMIZE_O1 OPTIMIZE_O2 OPTIMIZE_O3
XOPTIMIZE_DISABLE_DESC=		Disable compiler optimization
XOPTIMIZE_O_DESC=			-O compiler optimization flags
XOPTIMIZE_O1_DESC=			-O1 compiler optimization flags
XOPTIMIZE_O2_DESC=			-O2 compiler optimization flags
XOPTIMIZE_O3_DESC=			-O3 compiler optimization flags
X
X
XTSAFE_DESC=			Enable support for multiple threads
XDEBUG_DESC=			Enable building with developer debug info
XTRACEJIT_DESC=		Enable tracing JIT support
XMETHODJIT_DESC=		Enable method JIT support
X
X# threads because they will become mandatory (i.e. wont be able to disable) in future releases 
X# method and trace jit because theyre enable by default, but you might want to turn them off
X# default optimization level also selected to be the default for SpiderMonkey's configure script
XOPTIONS_DEFAULT=	TSAFE TRACEJIT METHODJIT OPTIMIZE_O
X
X.include <bsd.port.options.mk>
X
X
XCONFIGURE_ENV=	CC="${CC}"
XCONFIGURE_ARGS=		--with-nspr --with-system-nspr --with-pthreads
X
X.ifndef(WITHOUT_X11)
XCONFIGURE_ARGS+=	--with-x
X.else
XCONFIGURE_ARGS+=	--without-x
X.endif
X
X
X
XOPTIM_FLAG_=
X.if ${PORT_OPTIONS:MOPTIMIZE_DISABLE}
XOPTIM_FLAG_=
X.elif ${PORT_OPTIONS:MOPTIMIZE_O}
XOPTIM_FLAG_=	--enable-optimize=-O
X.elif ${PORT_OPTIONS:MOPTIMIZE_O1}
XOPTIM_FLAG_=	--enable-optimize=-O1
X.elif ${PORT_OPTIONS:MOPTIMIZE_O2}
XOPTIM_FLAG_=	--enable-optimize=-O2
X.elif ${PORT_OPTIONS:MOPTIMIZE_O3}
XOPTIM_FLAG_=	--enable-optimize=-O3
X.endif
XCONFIGURE_ARGS+=	${OPTIM_FLAG_}
X
X
X.if ${PORT_OPTIONS:MTRACEJIT}
X#nada
X.else
XCONFIGURE_ARGS+=	--disable-tracejit
X.endif
X
X.if ${PORT_OPTIONS:MMETHODJIT}
X#nada
X.else
XCONFIGURE_ARGS+=	--disable-methodjit
X.endif
X
X.if ${PORT_OPTIONS:MDEBUG}
XCONFIGURE_ARGS+=	--enable-debug
X.else
X#nada
X.endif
X
X
X.if ${PORT_OPTIONS:MTSAFE}
XCONFIGURE_ARGS+=	--enable-threadsafe
X.endif
X
X
X
X# these includes are found in different locations, but must end up in the same
X# ${PREFIX}/include/, so split them into separate defines first
X# 	* please also note that mozilla's install system doesnt guarantee the
X#	  locations as written here - they're merely as I found them. Their system
X#	  looks for them across the source automatically.
X
X# the headers will end up here
XJSH_DESTINATION=	${PREFIX}/include/js/
X
XJSH_BUILD_DIR=		js-config.h jsautocfg.h jsautokw.h
X
XJSH_SRC_DIR=		js.msg jsanalyze.h jsapi.h jsarray.h jsarena.h jsatom.h \
X					jsbit.h jsbool.h jsclist.h jsclone.h jscntxt.h jscompat.h \
X					jsdate.h jsdbgapi.h jsdhash.h jsdtoa.h jsemit.h jsfun.h \
X					jsfriendapi.h jsgc.h jscell.h jsgcchunk.h jsgcstats.h \
X					jscompartment.h jshash.h jsinterp.h jsinttypes.h jsiter.h \
X					jslock.h jslong.h jsmath.h jsobj.h jsobjinlines.h json.h \
X					jsopcode.tbl jsopcode.h jsopcodeinlines.h jsotypes.h \
X					jsparse.h jsproxy.h jsprf.h jsprobes.h jspropertycache.h \
X					jspropertycacheinlines.h jspropertytree.h jsproto.tbl \
X					jsprvtd.h jspubtd.h jsreflect.h jsregexp.h jsscan.h \
X					jsscope.h jsscript.h jsscriptinlines.h jsstaticcheck.h \
X					jsstdint.h jsstr.h jstracer.h jshotloop.h jstypedarray.h \
X					jstypes.h jsutil.h jsvector.h jstl.h jshashtable.h \
X					jsversion.h jswrapper.h jsxdrapi.h jsxml.h jsval.h \
X					jsvalue.h prmjtime.h jsbuiltins.h
X
X.if ${PORT_OPTIONS:MTRACEJIT}
X# following logic for nanojit arch taken from ${WRKSRC}/ref-config/Linux_All.mk
X# update as necessary when that changes.
XCPU_ARCH!=	uname -m
X
X.	if ${CPU_ARCH} != x86_64
X.		if ${CPU_ARCH:M*86}
XNANOJIT_ARCH_ = i386
X.		endif # 86
X.	endif # !x86_64
X
X# no jitter on x64 yet present in sources
X#
X
X.	if ${CPU_ARCH} == arm
XNANOJIT_ARCH_ = ARM
X.	endif
X
X
X
XJSH_NANOJIT_DIR=	Assembler.h Allocator.h CodeAlloc.h Containers.h LIR.h \
X					LIRopcode.tbl avmplus.h Fragmento.h Native.h \
X					NativeCommon.h \
X					Native$(NANOJIT_ARCH_).h \
X					njconfig.h njcpudetect.h RegAlloc.h nanojit.h VMPI.h
X
XJSH_TRACEJIT_DIR=	Writer.h
X.endif
X
XJSH_PERF_DIR=		jsperf.h
X
X# get list of all the headers to be installed, without regard of where they are to be found
XJSH:=	${JSH_BUILD_DIR} ${JSH_SRC_DIR} ${JSH_NANOJIT_DIR} ${JSH_TRACEJIT_DIR} ${JSH_PERF_DIR}
X
XPLIST_FILES=	bin/js-config \
X				lib/libmozjs185-1.0.a \
X				lib/libmozjs185.so.1.0.0 lib/libmozjs185.so.1.0 lib/libmozjs185.so \
X				${JSH:S,^,include/js/,}
XPLIST_DIRS=		include/js
X
X
X
X
Xpost-patch: system-headers-fix make-target-extract
X
X# somehow, gcc (or whatever) does not find this header. this tells it that its a system header and does indeed exist. see bsd.gecko.mk gecko-post-patch target
Xsystem-headers-fix:
X	@if [ -f ${WRKSRC}/config/system-headers ] ; then \
X		${ECHO_CMD} "pthread_np.h" >> ${WRKSRC}/config/system-headers ; \
X	fi
X
Xmake-target-extract:
X	${CP} ${WRKSRC}/ref-config/Linux_All.mk ${WRKSRC}/ref-config/${OPSYS}`${UNAME} -r`.mk
X
X
Xpre-configure:
X	${MKDIR} -p ${CONFIGURE_WRKSRC}
X
X
X# the install plan is, as gathered from the nsinstall app in the sources:
X# - copy all headers (as in JSH_* defines) to ${PREFIX}/include/js/
X#	* because we have headers found in different dirs, will have a couple separate INSTALL_DATA statements
X# - copy js-config to ${PREFIX}/bin/
X# - copy libjs_static.a to ${PREFIX}/lib/libmozjs185-1.0.a
X# - copy libmozjs185.so to ${PREFIX}/lib/libmozjs185.so.1.0.0
X# 	- and then link to it from ${PREFIX}/lib/libmozjs185.so.1.0
X#		- and then link to it from ${PREFIX}/lib/libmozjs185.so
Xdo-install:
X	@${MKDIR} ${JSH_DESTINATION}
X	${INSTALL_DATA} ${JSH_BUILD_DIR:S,^,${BUILD_WRKSRC}/,} ${JSH_DESTINATION}
X	${INSTALL_DATA} ${JSH_SRC_DIR:S,^,${WRKSRC}/,} ${JSH_DESTINATION}
X.if ${PORT_OPTIONS:MTRACEJIT}
X		${INSTALL_DATA} ${JSH_NANOJIT_DIR:S,^,${WRKSRC}/nanojit/,} ${JSH_DESTINATION}
X		${INSTALL_DATA} ${JSH_TRACEJIT_DIR:S,^,${WRKSRC}/tracejit/,} ${JSH_DESTINATION}
X.endif
X	${INSTALL_DATA} ${JSH_PERF_DIR:S,^,${WRKSRC}/perf/,} ${JSH_DESTINATION}
X
X	${INSTALL_SCRIPT} ${BUILD_WRKSRC}/js-config ${PREFIX}/bin
X
X	${INSTALL_LIB} ${BUILD_WRKSRC}/libjs_static.a ${PREFIX}/lib
X	${MV} -f ${PREFIX}/lib/libjs_static.a ${PREFIX}/lib/libmozjs185-1.0.a
X
X	${INSTALL_LIB} ${BUILD_WRKSRC}/libmozjs185.so ${PREFIX}/lib
X	${MV} -f ${PREFIX}/lib/libmozjs185.so ${PREFIX}/lib/libmozjs185.so.1.0.0
X	${LN} -sf ${PREFIX}/lib/libmozjs185.so.1.0.0 ${PREFIX}/lib/libmozjs185.so.1.0
X	${LN} -sf ${PREFIX}/lib/libmozjs185.so.1.0 ${PREFIX}/lib/libmozjs185.so
X
X
X
X.include <bsd.port.mk>
b56ec66da257f386927d0ec774b986b7
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208191959.q7JJxWOH044702>