import lang/libv8 - a javascript engine for clients and servers

OK jeremy@, sthen@
This commit is contained in:
abieber 2012-10-13 15:09:58 +00:00
parent 93a4d727a6
commit 880429309e
8 changed files with 174 additions and 0 deletions

68
lang/libv8/Makefile Normal file
View File

@ -0,0 +1,68 @@
# $OpenBSD: Makefile,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
ONLY_FOR_ARCHS= amd64 i386
COMMENT= V8 JavaScript for clients and servers
V8_VERSION= 3.14.0
V8_ARCH= ${PKG_ARCH:S/amd64/x64/:S/i386/ia32/}
V8_RELEASE= release
DISTNAME= v8-${V8_VERSION}
PKGNAME= lib${DISTNAME}
CATEGORIES= lang
SHARED_LIBS= v8 0.0
HOMEPAGE= http://code.google.com/p/v8/
MAINTAINER= Aaron Bieber <abieber@openbsd.org>
# BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= http://deftly.net/
VMEM_WARNING= Yes
BUILD_DEPENDS= devel/gyp
LIB_DEPENDS= devel/libexecinfo
WANTLIB += c execinfo m pthread ssl stdc++
USE_GMAKE= Yes
CONFIGURE_STYLE= python.port.mk
MODULES= lang/python
SUBST_VARS+= WRKDIR
SUBST_VARS+= V8_ARCH
MAKE_FLAGS+= library=shared ARCHES=${V8_ARCH} MODES=${V8_RELEASE} \
DEFAULT_ARCHES=${V8_ARCH}
MAKE_ENV+= V=1 CXX=c++ CCFLAGS+="${CFLAGS}" \
CXXFLAGS="${CXXFLAGS} -I${WRKSRC}/src -I${LOCALBASE}/include" \
PATH=${WRKSRC}/bin:${PATH}
NO_CCACHE= Yes
REGRESS_TARGET= check
pre-configure:
@# Bad practice, but prevents a whole stack of patches.
ln -sf ${LOCALBASE}/bin/python${MODPY_VERSION} ${WRKDIR}/bin/python
${SUBST_CMD} ${WRKDIST}/tools/gyp/v8.gyp ${WRKDIST}/Makefile
do-install:
cp -p ${WRKSRC}/include/*.h ${PREFIX}/include/
cp -p ${WRKSRC}/out/${V8_ARCH}.${V8_RELEASE}/d8 ${PREFIX}/bin
cp -p ${WRKSRC}/out/${V8_ARCH}.${V8_RELEASE}/lib.target/libv8.so.* \
${PREFIX}/lib/
.include <bsd.port.mk>

2
lang/libv8/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (v8-3.14.0.tar.gz) = A4jRXQpW28KDnDOhWWyrmMUgzjgLnrwBKXBpgT3/7ME=
SIZE (v8-3.14.0.tar.gz) = 11666075

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
--- Makefile.orig Tue Oct 9 07:14:31 2012
+++ Makefile Tue Oct 9 17:41:07 2012
@@ -250,14 +250,14 @@ clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)
OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
GYP_GENERATORS=make \
- build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
+ gyp --generator-output="$(OUTDIR)" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=$(subst .,,$(suffix $@)) \
-S.$(subst .,,$(suffix $@)) $(GYPFLAGS)
$(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
GYP_GENERATORS=make \
- build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
+ gyp --generator-output="$(OUTDIR)" build/all.gyp \
-Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-build_common_gypi,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
--- build/common.gypi.orig Tue Oct 9 07:14:31 2012
+++ build/common.gypi Tue Oct 9 15:51:53 2012
@@ -90,7 +90,7 @@
'v8_use_snapshot%': 'true',
'host_os%': '<(OS)',
'v8_use_liveobjectlist%': 'false',
- 'werror%': '-Werror',
+ 'werror%': '',
# With post mortem support enabled, metadata is embedded into libv8 that
# describes various parameters of the VM for use by debuggers. See
@@ -313,6 +313,9 @@
}],
['OS=="freebsd" or OS=="openbsd"', {
'cflags': [ '-I/usr/local/include' ],
+ 'libraries': [
+ '-L/usr/local/lib -lexecinfo',
+ ]
}],
['OS=="netbsd"', {
'cflags': [ '-I/usr/pkg/include' ],

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-src_heap_cc,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
--- src/heap.cc.orig Tue Oct 9 08:34:36 2012
+++ src/heap.cc Tue Oct 9 08:34:45 2012
@@ -5873,6 +5873,29 @@ bool Heap::ConfigureHeap(int max_semispace_size,
initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_);
external_allocation_limit_ = 16 * max_semispace_size_;
+ intptr_t max_virtual = OS::MaxVirtualMemory();
+
+ if (max_virtual > 0) {
+ intptr_t half = max_virtual >> 1;
+ intptr_t quarter = max_virtual >> 2;
+ // If we have limits on the amount of virtual memory we can use then we may
+ // be forced to lower the allocation limits. We reserve one quarter of the
+ // memory for young space and off-heap data. The rest is distributed as
+ // described below.
+ if (code_range_size_ > 0) {
+ // Reserve a quarter of the memory for the code range. The old space
+ // heap gets the remaining half. There is some unavoidable double
+ // counting going on here since the heap size is measured in committed
+ // virtual memory and the code range is only reserved virtual memory.
+ code_range_size_ = Min(code_range_size_, quarter);
+ max_old_generation_size_ = Min(max_old_generation_size_, half);
+ } else {
+ // Reserve three quarters of the memory for the old space heap including
+ // the executable code.
+ max_old_generation_size_ = Min(max_old_generation_size_, half + quarter);
+ }
+ }
+
// The old generation is paged and needs at least one page for each space.
int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count *

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-tools_gyp_v8_gyp,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
--- tools/gyp/v8.gyp.orig Wed Oct 10 13:52:30 2012
+++ tools/gyp/v8.gyp Wed Oct 10 13:53:11 2012
@@ -74,8 +74,8 @@
'OTHER_LDFLAGS': ['-dynamiclib', '-all_load']
},
}],
- ['soname_version!=""', {
- 'product_extension': 'so.<(soname_version)',
+ ['soname_version!="-1"', {
+ 'product_extension': 'so.${LIBv8_VERSION}',
}],
],
},

2
lang/libv8/pkg/DESCR Normal file
View File

@ -0,0 +1,2 @@
The V8 JavaScript Engine is an open source JavaScript engine developed
by Google.

13
lang/libv8/pkg/PLIST Normal file
View File

@ -0,0 +1,13 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/10/13 15:09:58 abieber Exp $
@owner root
@group wheel
@bin bin/d8
include/v8-debug.h
include/v8-preparser.h
include/v8-profiler.h
include/v8-testing.h
include/v8.h
include/v8stdint.h
@owner root
@group bin
@lib lib/libv8.so.${LIBv8_VERSION}