From 880429309eec9fbc93219ea7c6f7287e501dd356 Mon Sep 17 00:00:00 2001 From: abieber Date: Sat, 13 Oct 2012 15:09:58 +0000 Subject: [PATCH] import lang/libv8 - a javascript engine for clients and servers OK jeremy@, sthen@ --- lang/libv8/Makefile | 68 ++++++++++++++++++++++ lang/libv8/distinfo | 2 + lang/libv8/patches/patch-Makefile | 20 +++++++ lang/libv8/patches/patch-build_common_gypi | 22 +++++++ lang/libv8/patches/patch-src_heap_cc | 33 +++++++++++ lang/libv8/patches/patch-tools_gyp_v8_gyp | 14 +++++ lang/libv8/pkg/DESCR | 2 + lang/libv8/pkg/PLIST | 13 +++++ 8 files changed, 174 insertions(+) create mode 100644 lang/libv8/Makefile create mode 100644 lang/libv8/distinfo create mode 100644 lang/libv8/patches/patch-Makefile create mode 100644 lang/libv8/patches/patch-build_common_gypi create mode 100644 lang/libv8/patches/patch-src_heap_cc create mode 100644 lang/libv8/patches/patch-tools_gyp_v8_gyp create mode 100644 lang/libv8/pkg/DESCR create mode 100644 lang/libv8/pkg/PLIST diff --git a/lang/libv8/Makefile b/lang/libv8/Makefile new file mode 100644 index 00000000000..2621d82f3ed --- /dev/null +++ b/lang/libv8/Makefile @@ -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 + +# 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 diff --git a/lang/libv8/distinfo b/lang/libv8/distinfo new file mode 100644 index 00000000000..a62d246fb8f --- /dev/null +++ b/lang/libv8/distinfo @@ -0,0 +1,2 @@ +SHA256 (v8-3.14.0.tar.gz) = A4jRXQpW28KDnDOhWWyrmMUgzjgLnrwBKXBpgT3/7ME= +SIZE (v8-3.14.0.tar.gz) = 11666075 diff --git a/lang/libv8/patches/patch-Makefile b/lang/libv8/patches/patch-Makefile new file mode 100644 index 00000000000..73f91263228 --- /dev/null +++ b/lang/libv8/patches/patch-Makefile @@ -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: diff --git a/lang/libv8/patches/patch-build_common_gypi b/lang/libv8/patches/patch-build_common_gypi new file mode 100644 index 00000000000..3d0071634a4 --- /dev/null +++ b/lang/libv8/patches/patch-build_common_gypi @@ -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' ], diff --git a/lang/libv8/patches/patch-src_heap_cc b/lang/libv8/patches/patch-src_heap_cc new file mode 100644 index 00000000000..9f8f4b89337 --- /dev/null +++ b/lang/libv8/patches/patch-src_heap_cc @@ -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(paged_space_count * diff --git a/lang/libv8/patches/patch-tools_gyp_v8_gyp b/lang/libv8/patches/patch-tools_gyp_v8_gyp new file mode 100644 index 00000000000..a2db2dac3c7 --- /dev/null +++ b/lang/libv8/patches/patch-tools_gyp_v8_gyp @@ -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}', + }], + ], + }, diff --git a/lang/libv8/pkg/DESCR b/lang/libv8/pkg/DESCR new file mode 100644 index 00000000000..79d7d231f7d --- /dev/null +++ b/lang/libv8/pkg/DESCR @@ -0,0 +1,2 @@ +The V8 JavaScript Engine is an open source JavaScript engine developed +by Google. diff --git a/lang/libv8/pkg/PLIST b/lang/libv8/pkg/PLIST new file mode 100644 index 00000000000..2d5996f2387 --- /dev/null +++ b/lang/libv8/pkg/PLIST @@ -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}