Preliminary recipe for V8

This commit is contained in:
Chris Roberts
2013-10-28 20:00:14 -06:00
parent 05699503b4
commit b12de3de28
3 changed files with 257 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
Index: pylib/gyp/haiku_tool.py
===================================================================
--- pylib/gyp/haiku_tool.py (revision 0)
+++ pylib/gyp/haiku_tool.py (revision 0)
@@ -0,0 +1,49 @@
+#!python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""These functions are executed via gyp-haiku-tool when using the Makefile
+generator."""
+
+import fcntl
+import os
+import struct
+import subprocess
+import sys
+
+
+def main(args):
+ executor = HaikuTool()
+ executor.Dispatch(args)
+
+
+class HaikuTool(object):
+ """This class performs all the Haiku tooling steps. The methods can either be
+ executed directly, or dispatched from an argument list."""
+
+ def Dispatch(self, args):
+ """Dispatches a string command to a method."""
+ if len(args) < 1:
+ raise Exception("Not enough arguments")
+
+ method = "Exec%s" % self._CommandifyName(args[0])
+ getattr(self, method)(*args[1:])
+
+ def _CommandifyName(self, name_string):
+ """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
+ return name_string.title().replace('-', '')
+
+ def ExecFlock(self, lockfile, *cmd_list):
+ """Emulates the most basic behavior of Linux's flock(1)."""
+ # Rely on exception handling to report errors.
+ fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
+ fcntl.flock(fd, fcntl.LOCK_EX)
+ ret = subprocess.call(cmd_list)
+ # Haiki bug -- lock is not released on file close?
+ fcntl.flock(fd, fcntl.LOCK_UN)
+ return ret
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
Property changes on: pylib/gyp/haiku_tool.py
___________________________________________________________________
Added: svn:executable
+ *
Index: pylib/gyp/generator/make.py
===================================================================
--- pylib/gyp/generator/make.py (revision 1773)
+++ pylib/gyp/generator/make.py (working copy)
@@ -497,6 +497,13 @@
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
"""
+SHARED_HEADER_HAIKU_COMMANDS = """
+# gyp-haiku-tool is written next to the root Makefile by gyp.
+# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
+# already.
+quiet_cmd_haiku_tool = HAIKUTOOL $(4) $<
+cmd_haiku_tool = ./gyp-haiku-tool $(4) $< "$@"
+"""
def WriteRootHeaderSuffixRules(writer):
extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower)
@@ -2010,6 +2017,12 @@
'flock': './gyp-flock-tool flock',
'flock_index': 2,
})
+ elif flavor == 'haiku':
+ header_params.update({
+ 'flock': './gyp-haiku-tool flock',
+ 'flock_index': 2,
+ 'extra_commands': SHARED_HEADER_HAIKU_COMMANDS,
+ })
header_params.update({
'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'),
Index: pylib/gyp/common.py
===================================================================
--- pylib/gyp/common.py (revision 1773)
+++ pylib/gyp/common.py (working copy)
@@ -411,12 +411,14 @@
return 'openbsd'
if sys.platform.startswith('aix'):
return 'aix'
+ if sys.platform.startswith('haiku'):
+ return 'haiku'
return 'linux'
def CopyTool(flavor, out_path):
- """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
+ """Finds (flock|mac|win|haiku)_tool.gyp in the gyp directory and copies it
to |out_path|."""
# aix and solaris just need flock emulation. mac and win use more complicated
# support scripts.
@@ -424,7 +426,8 @@
'aix': 'flock',
'solaris': 'flock',
'mac': 'mac',
- 'win': 'win'
+ 'win': 'win',
+ 'haiku': 'haiku',
}.get(flavor, None)
if not prefix:
return
Index: gyptest.py
===================================================================
--- gyptest.py (revision 1773)
+++ gyptest.py (working copy)
@@ -225,6 +225,7 @@
'linux2': ['make', 'ninja'],
'linux3': ['make', 'ninja'],
'darwin': ['make', 'ninja', 'xcode'],
+ 'haiku1': ['make'],
}[sys.platform]
for format in format_list:

View File

@@ -0,0 +1,14 @@
diff --git a/src/platform.h b/src/platform.h
index 0b327a3..306154f 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -96,9 +96,6 @@ int random();
#endif // WIN32
-#ifdef __HAIKU__
-#define isless(x, y) __builtin_isless(x, y)
-#endif // __HAIKU__
#include "atomicops.h"
#include "lazy-instance.h"

View File

@@ -0,0 +1,110 @@
SUMMARY="V8 is Google's open source JavaScript engine."
DESCRIPTION="
V8 is Google's open source JavaScript engine. V8 is written in C++
and is used in Google Chrome, the open source browser from Google. V8
implements ECMAScript as specified in ECMA-262, 5th edition, and runs
on Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems
that use IA-32, x64, or ARM processors. V8 can run standalone, or can
be embedded into any C++ application.
"
LICENSE="BSD (3-clause)"
COPYRIGHT="2006-2012 The V8 Project Authors"
HOMEPAGE="https://code.google.com/p/v8/"
SRC_URI="git+https://github.com/hamishm/v8.git#5698a30"
SRC_URI_2="svn+http://gyp.googlecode.com/svn/trunk#1773"
REVISION="1"
ARCHITECTURES="?x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES ?x86_gcc2"
else
ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="?x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
v8$secondaryArchSuffix = $portVersion
cmd:d8$commandSuffix = $portVersion
lib:libv8$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix >= $haikuVersion
"
BUILD_REQUIRES=""
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
cmd:g++$secondaryArchSuffix
cmd:make
cmd:python
cmd:which
cmd:ar$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
"
PROVIDES_devel="
v8${secondaryArchSuffix}_devel = $portVersion
devel:libv8$secondaryArchSuffix
"
REQUIRES_devel="
v8$secondaryArchSuffix == $portVersion
"
PATCHES="v8-3.16.1.patch"
PATCH()
{
cd $sourceDir2
patch -p0 -i $(haikuporter -t)/dev-lang/v8/patches/gyp-r1773.patch
}
SOURCE_DIR="v8"
SOURCE_DIR_2="gyp"
BUILD()
{
ln -sfn $sourceDir2 build/gyp
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=ia32 \
-S.ia32 \
-Dcomponent=shared_library \
-Dv8_enable_backtrace=1 \
-Dv8_can_use_vfp2_instructions=true \
-Dv8_can_use_vfp3_instructions=true
# enable these in the future?
#-Duse_system_icu=1 \
#-Dconsole=readline
make library=shared ia32.release $jobArgs
}
INSTALL()
{
mkdir $commandBinDir
cp -af out/ia32.release/d8 ${commandBinDir}
mkdir -p ${includeDir}/v8
cp -af include/* ${includeDir}/v8
mkdir -p ${libDir}
cp -af out/ia32.release/lib.target/libv8.so ${libDir}
prepareInstalledDevelLibs libv8
packageEntries devel $developDir
}