aboutsummaryrefslogtreecommitdiff
path: root/lang/hermes
diff options
context:
space:
mode:
Diffstat (limited to 'lang/hermes')
-rw-r--r--lang/hermes/Makefile39
-rw-r--r--lang/hermes/distinfo3
-rw-r--r--lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp54
-rw-r--r--lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp11
-rw-r--r--lang/hermes/pkg-descr4
-rw-r--r--lang/hermes/pkg-plist29
6 files changed, 140 insertions, 0 deletions
diff --git a/lang/hermes/Makefile b/lang/hermes/Makefile
new file mode 100644
index 000000000000..079f4662bb1b
--- /dev/null
+++ b/lang/hermes/Makefile
@@ -0,0 +1,39 @@
+# $FreeBSD$
+
+PORTNAME= hermes
+DISTVERSIONPREFIX= v
+DISTVERSION= 0.5.2-rc1
+CATEGORIES= lang
+PKGNAMESUFFIX= -javascript-engine
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= JavaScript engine
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+LIB_DEPENDS= libicui18n.so:devel/icu
+TEST_DEPENDS= zip:archivers/zip
+
+USES= cmake compiler:c++11-lang python:test
+USE_GITHUB= yes
+GH_ACCOUNT= facebook
+USE_LDCONFIG= yes
+
+CMAKE_OFF= HERMES_ENABLE_TEST_SUITE
+
+BINARY_ALIAS= python=${PYTHON_CMD} python3=${PYTHON_CMD}
+
+.include <bsd.port.options.mk>
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1201518
+BROKEN= missing pthread_getname_np
+.endif
+
+do-test: # some tests are known to fail: https://github.com/facebook/hermes/issues/347
+ @cd ${BUILD_WRKSRC} && \
+ ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DHERMES_ENABLE_TEST_SUITE:BOOL=ON ${CMAKE_SOURCE_PATH} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} check-hermes
+
+.include <bsd.port.mk>
diff --git a/lang/hermes/distinfo b/lang/hermes/distinfo
new file mode 100644
index 000000000000..4362f088f883
--- /dev/null
+++ b/lang/hermes/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1599791135
+SHA256 (facebook-hermes-v0.5.2-rc1_GH0.tar.gz) = d384bcac5985f11b92ff03a14b1ea393c5b4f804d0236e7884e408b626495aed
+SIZE (facebook-hermes-v0.5.2-rc1_GH0.tar.gz) = 6912229
diff --git a/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp b/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp
new file mode 100644
index 000000000000..1ec6a303b9a4
--- /dev/null
+++ b/lang/hermes/files/patch-lib_Support_OSCompatPosix.cpp
@@ -0,0 +1,54 @@
+--- lib/Support/OSCompatPosix.cpp.orig 2020-08-03 19:19:06 UTC
++++ lib/Support/OSCompatPosix.cpp
+@@ -23,6 +23,11 @@
+ #endif
+ #endif // __linux__
+
++#if defined(__FreeBSD__)
++#include <pthread.h>
++#include <pthread_np.h>
++#endif
++
+ #include <sys/types.h>
+ #include <unistd.h>
+
+@@ -213,7 +218,7 @@ void vm_unused(void *p, size_t sz) {
+ /// the process's physical footprint.
+ #define MADV_UNUSED MADV_FREE
+
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(__FreeBSD__)
+
+ /// On linux, telling the OS that we \p MADV_DONTNEED some pages will cause it
+ /// to immediately deduct their size from the process's resident set.
+@@ -414,6 +419,12 @@ uint64_t thread_id() {
+ return syscall(__NR_gettid);
+ }
+
++#elif defined(__FreeBSD__)
++
++uint64_t thread_id() {
++ return reinterpret_cast<uint64_t>(pthread_self());
++}
++
+ #else
+ #error "Thread ID not supported on this platform"
+ #endif
+@@ -443,7 +454,7 @@ std::chrono::microseconds thread_cpu_time() {
+ return microseconds(total);
+ }
+
+-#elif defined(__linux__) // !(__APPLE__ && __MACH__)
++#elif defined(__linux__) || defined(__FreeBSD__) // !(__APPLE__ && __MACH__)
+
+ std::chrono::microseconds thread_cpu_time() {
+ using namespace std::chrono;
+@@ -480,7 +491,7 @@ bool thread_page_fault_count(int64_t *outMinorFaults,
+ return kr == KERN_SUCCESS;
+ }
+
+-#elif defined(__linux__) // !(__APPLE__ && __MACH__)
++#elif defined(__linux__) || defined(__FreeBSD__) // !(__APPLE__ && __MACH__)
+
+ bool thread_page_fault_count(int64_t *outMinorFaults, int64_t *outMajorFaults) {
+ struct rusage stats = {};
diff --git a/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp b/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp
new file mode 100644
index 000000000000..584ac722c250
--- /dev/null
+++ b/lang/hermes/files/patch-lib_VM_Instrumentation_ProcessStats.cpp
@@ -0,0 +1,11 @@
+--- lib/VM/Instrumentation/ProcessStats.cpp.orig 2020-09-11 02:29:31 UTC
++++ lib/VM/Instrumentation/ProcessStats.cpp
+@@ -69,6 +69,8 @@ ProcessStats::Info getProcessStatSnapshot() {
+ va *= PS / 1024;
+ #elif defined(__EMSCRIPTEN__)
+ rss = va = 0;
++#elif defined(__FreeBSD__)
++ rss = va = 0; // TODO implement getProcessStatSnapshot
+ #else
+ #error "Unsupported platform"
+ #endif
diff --git a/lang/hermes/pkg-descr b/lang/hermes/pkg-descr
new file mode 100644
index 000000000000..d12fc9733fc9
--- /dev/null
+++ b/lang/hermes/pkg-descr
@@ -0,0 +1,4 @@
+Hermes is a JavaScript engine optimized for fast start-up of React Native apps
+on Android. It features ahead-of-time static optimization and compact bytecode.
+
+WWW: https://github.com/facebook/hermes
diff --git a/lang/hermes/pkg-plist b/lang/hermes/pkg-plist
new file mode 100644
index 000000000000..e4ace98ea8d9
--- /dev/null
+++ b/lang/hermes/pkg-plist
@@ -0,0 +1,29 @@
+bin/hbcdump
+bin/hdb
+bin/hermes
+bin/hermesc
+bin/hvm
+include/hermes/CompileJS.h
+include/hermes/DebuggerAPI.h
+include/hermes/Public/Buffer.h
+include/hermes/Public/CrashManager.h
+include/hermes/Public/CtorConfig.h
+include/hermes/Public/DebuggerTypes.h
+include/hermes/Public/GCConfig.h
+include/hermes/Public/GCTripwireContext.h
+include/hermes/Public/MemoryEventTracker.h
+include/hermes/Public/RuntimeConfig.h
+include/hermes/SynthTrace.h
+include/hermes/SynthTraceParser.h
+include/hermes/TraceInterpreter.h
+include/hermes/TracingRuntime.h
+include/hermes/hermes.h
+include/hermes/hermes_tracing.h
+include/jsi/JSIDynamic.h
+include/jsi/decorator.h
+include/jsi/instrumentation.h
+include/jsi/jsi-inl.h
+include/jsi/jsi.h
+include/jsi/jsilib.h
+include/jsi/threadsafe.h
+lib/libhermes.so