pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pharo-vm: Import pharo-vm-9.0.9 as wip/pharo-vm



Module Name:	pkgsrc-wip
Committed By:	Atsushi Toyokura <asteria.at%gmail.com@localhost>
Pushed By:	steleto
Date:		Thu Nov 4 23:56:04 2021 +0900
Changeset:	31fdf9eeb6fe7e3769a81e240c904ad8e7fed507

Modified Files:
	Makefile
Added Files:
	pharo-vm/DESCR
	pharo-vm/Makefile
	pharo-vm/PLIST
	pharo-vm/distinfo
	pharo-vm/patches/patch-CMakeLists.txt
	pharo-vm/patches/patch-generated_64_vm_src_gcc3x-cointerp.c
	pharo-vm/patches/patch-include_pharovm_debug.h
	pharo-vm/patches/patch-packaging_linux_bin_launch.sh.in
	pharo-vm/patches/patch-plugins.cmake
	pharo-vm/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c
	pharo-vm/patches/patch-src_debugUnix.c

Log Message:
pharo-vm: Import pharo-vm-9.0.9 as wip/pharo-vm

This is the branch of the Headless VM used for Pharo. This branch has
the modifications required to run Pharo in a true headless
environment. The image running on the VM is responsible of handling
the UI and the events.

The image includes a default implementation of the handling of UI
through the use of SDL2.

For more details about the whole Pharo VM project refer to our wiki.

This is a fork of OpenSmalltalk-vm. We are doing our best to keep
compatibility and contribute back, as long as it fits the objective of
Pharo community.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=31fdf9eeb6fe7e3769a81e240c904ad8e7fed507

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 pharo-vm/DESCR                                     | 13 +++++
 pharo-vm/Makefile                                  | 57 ++++++++++++++++++++++
 pharo-vm/PLIST                                     | 21 ++++++++
 pharo-vm/distinfo                                  | 12 +++++
 pharo-vm/patches/patch-CMakeLists.txt              | 34 +++++++++++++
 .../patch-generated_64_vm_src_gcc3x-cointerp.c     | 50 +++++++++++++++++++
 pharo-vm/patches/patch-include_pharovm_debug.h     | 14 ++++++
 .../patches/patch-packaging_linux_bin_launch.sh.in | 17 +++++++
 pharo-vm/patches/patch-plugins.cmake               | 15 ++++++
 .../patch-plugins_UUIDPlugin_common_UUIDPlugin.c   | 16 ++++++
 pharo-vm/patches/patch-src_debugUnix.c             | 50 +++++++++++++++++++
 12 files changed, 300 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index da21916889..5b76569a8f 100644
--- a/Makefile
+++ b/Makefile
@@ -3122,6 +3122,7 @@ SUBDIR+=	phaethon
 SUBDIR+=	phalanx
 SUBDIR+=	phantomjs
 SUBDIR+=	phantomjs2
+SUBDIR+=	pharo-vm
 SUBDIR+=	pheanstalk
 SUBDIR+=	phonon-backend-xine
 SUBDIR+=	phoronix-test-suite
diff --git a/pharo-vm/DESCR b/pharo-vm/DESCR
new file mode 100644
index 0000000000..8ee83e6fd6
--- /dev/null
+++ b/pharo-vm/DESCR
@@ -0,0 +1,13 @@
+This is the branch of the Headless VM used for Pharo. This branch has
+the modifications required to run Pharo in a true headless
+environment. The image running on the VM is responsible of handling
+the UI and the events.
+
+The image includes a default implementation of the handling of UI
+through the use of SDL2.
+
+For more details about the whole Pharo VM project refer to our wiki.
+
+This is a fork of OpenSmalltalk-vm. We are doing our best to keep
+compatibility and contribute back, as long as it fits the objective of
+Pharo community.
diff --git a/pharo-vm/Makefile b/pharo-vm/Makefile
new file mode 100644
index 0000000000..b0f6a09870
--- /dev/null
+++ b/pharo-vm/Makefile
@@ -0,0 +1,57 @@
+# $NetBSD$
+
+PHAROVM_VER=	9.0.9
+PHAROVM_HASH=	220ee65
+
+DISTNAME=	PharoVM-${PHAROVM_VER}-${PHAROVM_HASH}-Linux-x86_64-c-src
+PKGNAME=	pharo-vm-${PHAROVM_VER}
+CATEGORIES=	lang
+MASTER_SITES=	http://files.pharo.org/vm/pharo-spur64-headless/Linux-x86_64/source/
+EXTRACT_SUFX=	.zip
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://pharo.org/
+COMMENT=	VM used by Pharo
+LICENSE=	mit
+
+ONLY_FOR_PLATFORM=	NetBSD-[0-9]*-x86_64
+
+WRKSRC=		${WRKDIR}/pharo-vm
+USE_LANGUAGES=	c c++
+USE_CMAKE=	yes
+
+CMAKE_ARGS+=	-DFLAVOUR=CoInterpreter
+CMAKE_ARGS+=	-DALWAYS_INTERACTIVE=1
+CMAKE_ARGS+=	-DGENERATE_SOURCES=OFF
+CMAKE_ARGS+=	-DPHARO_BIN_LOCATION=${PREFIX}/lib/pharo
+
+SUBST_CLASSES+=			fix-paths
+SUBST_STAGE.fix-paths=		pre-build
+SUBST_MESSAGE.fix-paths=	Fixing absolute paths.
+SUBST_FILES.fix-paths=		packaging/linux/bin/launch.sh.in
+SUBST_SED.fix-paths=		-e "s,@pkglibdir@,${PREFIX}/lib,g"
+
+NOT_PAX_MPROTECT_SAFE+=	lib/pharo/pharo
+
+INSTALLATION_DIRS=	bin lib/pharo
+
+pre-configure:
+	${CP} ${WRKSRC}/cmake/OpenBSD.cmake ${WRKSRC}/cmake/NetBSD.cmake
+
+do-install:
+	cd ${WRKSRC}/build/packaging/linux/bin && \
+		${INSTALL_SCRIPT} pharo ${DESTDIR}${PREFIX}/bin
+	cd ${WRKSRC}/build/vm/ && \
+		${INSTALL_PROGRAM} pharo ${DESTDIR}${PREFIX}/lib/pharo
+	cd ${WRKSRC}/build/vm/ && find . -type f -name "*.so" | while read file; do \
+		${INSTALL_LIB} $$file ${DESTDIR}${PREFIX}/lib/pharo; \
+	done
+
+.include "../../devel/SDL2/buildlink3.mk"
+.include "../../devel/libffi/buildlink3.mk"
+.include "../../devel/libgit2/buildlink3.mk"
+.include "../../graphics/cairo/buildlink3.mk"
+.include "../../graphics/freetype2/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/pharo-vm/PLIST b/pharo-vm/PLIST
new file mode 100644
index 0000000000..4c07806d2a
--- /dev/null
+++ b/pharo-vm/PLIST
@@ -0,0 +1,21 @@
+@comment $NetBSD$
+bin/pharo
+lib/pharo/libB2DPlugin.so
+lib/pharo/libBitBltPlugin.so
+lib/pharo/libDSAPrims.so
+lib/pharo/libFileAttributesPlugin.so
+lib/pharo/libFilePlugin.so
+lib/pharo/libJPEGReadWriter2Plugin.so
+lib/pharo/libJPEGReaderPlugin.so
+lib/pharo/libLargeIntegers.so
+lib/pharo/libLocalePlugin.so
+lib/pharo/libMiscPrimitivePlugin.so
+lib/pharo/libPharoVMCore.so
+lib/pharo/libSocketPlugin.so
+lib/pharo/libSqueakSSL.so
+lib/pharo/libSurfacePlugin.so
+lib/pharo/libTestLibrary.so
+lib/pharo/libUUIDPlugin.so
+lib/pharo/libUnixOSProcessPlugin.so
+lib/pharo/pharo
+@pkgdir pharo/lib
diff --git a/pharo-vm/distinfo b/pharo-vm/distinfo
new file mode 100644
index 0000000000..691cb0c4a5
--- /dev/null
+++ b/pharo-vm/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+BLAKE2s (PharoVM-9.0.9-220ee65-Linux-x86_64-c-src.zip) = ad0a4f2a49e88292d27f03642209004429231b8c418adccb324052a58fb07687
+SHA512 (PharoVM-9.0.9-220ee65-Linux-x86_64-c-src.zip) = f718b9c2aead39252fabfa99f663e49535742c705451219a542ffcff7bf94ab7a97550fff96b2de8559fedb2032be79c6795d2d855073e68f1a06ace46c703ba
+Size (PharoVM-9.0.9-220ee65-Linux-x86_64-c-src.zip) = 4675437 bytes
+SHA1 (patch-CMakeLists.txt) = 8e864b7f32c3ce775446f1c37ec206aac585b971
+SHA1 (patch-generated_64_vm_src_gcc3x-cointerp.c) = 29920ef6e43f21e762a615c3ab4379eca822c5c7
+SHA1 (patch-include_pharovm_debug.h) = a305dc8b2915bd457df3b76053a5072c1c2f8228
+SHA1 (patch-packaging_linux_bin_launch.sh.in) = 116b5151e0bd58558a1af3691d1f546437d94eae
+SHA1 (patch-plugins.cmake) = b8eb5ad47d505c0b52a7601f86109cf8f6ccae40
+SHA1 (patch-plugins_UUIDPlugin_common_UUIDPlugin.c) = 20b9e7f850d662a8d79dc025e5d991b47358e3ad
+SHA1 (patch-src_debugUnix.c) = 5db80b0d0083cd1d4c471fe877ca7d65e69b97be
diff --git a/pharo-vm/patches/patch-CMakeLists.txt b/pharo-vm/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..51d107339f
--- /dev/null
+++ b/pharo-vm/patches/patch-CMakeLists.txt
@@ -0,0 +1,34 @@
+$NetBSD$
+
+- backtrace(3) requires libexecinfo
+- use uuidgen(2)
+
+--- CMakeLists.txt.orig	2021-08-13 21:08:14.000000000 +0000
++++ CMakeLists.txt
+@@ -367,13 +367,14 @@ check_include_files(dlfcn.h HAVE_DLFCN_H
+ check_library_exists(dl dlopen "" HAVE_LIBDL)
+ check_library_exists(dyld dlopen "" HAVE_DYLD)
+ check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
++check_library_exists(execinfo backtrace "" HAVE_EXECINFO)
+ 
+ #Required by the UUID Plugin
+ 
+ check_include_files(sys/uuid.h HAVE_SYS_UUID_H)
+ check_include_files(uuid/uuid.h HAVE_UUID_UUID_H)
+ check_include_files(uuid.h HAVE_UUID_H)
+-check_library_exists(uuid uuidgen "" HAVE_UUIDGEN)
++check_function_exists(uuidgen HAVE_UUIDGEN)
+ check_library_exists(uuid uuid_generate "" HAVE_UUID_GENERATE)
+ 
+ 
+@@ -451,6 +452,10 @@ set(VM_SOURCES
+ add_executable(${VM_EXECUTABLE_NAME} ${VM_FRONTEND_APPLICATION_TYPE} ${VM_FRONTEND_SOURCES})
+ addLibraryWithRPATH(${VM_LIBRARY_NAME} ${VM_SOURCES})
+ 
++if(${HAVE_EXECINFO})
++	target_link_libraries(${VM_LIBRARY_NAME} execinfo)
++endif()
++
+ #
+ # LibFFI
+ #
diff --git a/pharo-vm/patches/patch-generated_64_vm_src_gcc3x-cointerp.c b/pharo-vm/patches/patch-generated_64_vm_src_gcc3x-cointerp.c
new file mode 100644
index 0000000000..efb2fa93d0
--- /dev/null
+++ b/pharo-vm/patches/patch-generated_64_vm_src_gcc3x-cointerp.c
@@ -0,0 +1,50 @@
+$NetBSD$
+
+Avoid conflict with clone(2)
+
+--- generated/64/vm/src/gcc3x-cointerp.c.orig	2021-10-11 14:05:24.000000000 +0000
++++ generated/64/vm/src/gcc3x-cointerp.c
+@@ -1068,7 +1068,7 @@ extern sqInt classTagForClass(sqInt clas
+ extern sqInt classUnsafeAlien(void);
+ static void clearLeakMapAndMapAccessibleFreeSpace(void);
+ static sqInt NoDbgRegParms cloneInOldSpaceforPinning(sqInt objOop, sqInt forPinning);
+-extern sqInt clone(sqInt objOop);
++extern sqInt sqClone(sqInt objOop);
+ extern sqInt compactClassIndexOf(sqInt objOop);
+ static sqInt NoDbgRegParms copyObjtoAddrstopAtsavedFirstFieldsindex(sqInt objOop, sqInt segAddr, sqInt endSeg, sqInt savedFirstFields, sqInt i);
+ extern void countMarkedAndUnmarkdObjects(sqInt printFlags);
+@@ -46834,7 +46834,7 @@ cloneInOldSpaceforPinning(sqInt objOop, 
+ 
+ 	/* SpurMemoryManager>>#clone: */
+ sqInt
+-clone(sqInt objOop)
++sqClone(sqInt objOop)
+ {   DECL_MAYBE_SQ_GLOBAL_STRUCT
+     sqInt classIndex;
+     sqInt classIndex1;
+@@ -54408,14 +54408,14 @@ outOfPlaceBecomeandcopyHashFlag(sqInt ob
+ 
+ 	clone1 = (((longAt(obj1)) & (classIndexMask())) == ClassMethodContextCompactIndex
+ 		? cloneContext(obj1)
+-		: clone(obj1));
++		: sqClone(obj1));
+ 	if (!(clone1)) {
+ 		error("Not enough space to copy the objects in two-way become. This should have been detected before");
+ 		return;
+ 	}
+ 	clone2 = (((longAt(obj2)) & (classIndexMask())) == ClassMethodContextCompactIndex
+ 		? cloneContext(obj2)
+-		: clone(obj2));
++		: sqClone(obj2));
+ 	if (!(clone2)) {
+ 		error("Not enough space to copy the objects in two-way become. This should have been detected before");
+ 		return;
+@@ -75825,7 +75825,7 @@ primitiveClone(void)
+ 		else {
+ 			if ((GIV(argumentCount) == 0)
+ 			 || (!(((longAt(rcvr)) & ((classIndexMask()) - (isForwardedObjectClassIndexPun()))) == 0))) {
+-				newCopy = clone(rcvr);
++				newCopy = sqClone(rcvr);
+ 			}
+ 			else {
+ 				newCopy = 0;
diff --git a/pharo-vm/patches/patch-include_pharovm_debug.h b/pharo-vm/patches/patch-include_pharovm_debug.h
new file mode 100644
index 0000000000..873a854a72
--- /dev/null
+++ b/pharo-vm/patches/patch-include_pharovm_debug.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Need stdarg.h for va_list
+
+--- include/pharovm/debug.h.orig	2021-11-04 14:38:36.845945841 +0000
++++ include/pharovm/debug.h
+@@ -46,6 +46,7 @@ EXPORT(int) isLogDebug();
+ EXPORT(void) logMessageFromErrno(int level, const char* msg, const char* fileName, const char* functionName, int line);
+ 
+ #include <stdio.h>
++#include <stdarg.h>
+ 
+ int vm_printf(const char * format, ... );
+ void vm_setVMOutputStream(FILE * stream);
diff --git a/pharo-vm/patches/patch-packaging_linux_bin_launch.sh.in b/pharo-vm/patches/patch-packaging_linux_bin_launch.sh.in
new file mode 100644
index 0000000000..2fbae4c7ee
--- /dev/null
+++ b/pharo-vm/patches/patch-packaging_linux_bin_launch.sh.in
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Add pkglibdir to LD_LIBRARY_PATH
+
+--- packaging/linux/bin/launch.sh.in.orig	2021-08-13 21:08:15.000000000 +0000
++++ packaging/linux/bin/launch.sh.in
+@@ -18,8 +18,8 @@ case "$BIN" in
+ *) PLUGINS="`pwd`/$BIN"
+ esac
+ 
+-if [ $(uname -s) = "OpenBSD" ]; then
+-  LD_LIBRARY_PATH="$PLUGINS:${LD_LIBRARY_PATH}" exec $GDB "$BIN/@VM_EXECUTABLE_NAME@" "$@"
++if [ $(uname -s) = "OpenBSD" -o $(uname -s) = "NetBSD" ]; then
++  LD_LIBRARY_PATH="$PLUGINS:@pkglibdir@:${LD_LIBRARY_PATH}" exec $GDB "$BIN/@VM_EXECUTABLE_NAME@" "$@"
+ fi
+ 
+ # On some linuxes there multiple versions of the C library.  If the image uses
diff --git a/pharo-vm/patches/patch-plugins.cmake b/pharo-vm/patches/patch-plugins.cmake
new file mode 100644
index 0000000000..194e1b6291
--- /dev/null
+++ b/pharo-vm/patches/patch-plugins.cmake
@@ -0,0 +1,15 @@
+$NetBSD$
+
+use uuidgen(2)
+
+--- plugins.cmake.orig	2021-08-13 21:08:15.000000000 +0000
++++ plugins.cmake
+@@ -77,7 +77,7 @@ if(NOT OPENBSD)
+     addLibraryWithRPATH(UUIDPlugin ${UUIDPlugin_SOURCES})
+     if(WIN)
+         target_link_libraries(UUIDPlugin PRIVATE "-lole32")
+-    elseif(UNIX AND NOT OSX)
++    elseif(UNIX AND NOT OSX AND HAVE_UUID_GENENATE)
+        #find_path(LIB_UUID_INCLUDE_DIR uuid.h PATH_SUFFIXES uuid)
+         find_library(LIB_UUID_LIBRARY uuid)
+         message(STATUS "Using uuid library:" ${LIB_UUID_LIBRARY})
diff --git a/pharo-vm/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c b/pharo-vm/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c
new file mode 100644
index 0000000000..cbb4e6ada8
--- /dev/null
+++ b/pharo-vm/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+fix compatibility between uuidgen(2) and uuid_generate
+
+--- plugins/UUIDPlugin/common/UUIDPlugin.c.orig	2021-08-15 10:24:33.887097903 +0000
++++ plugins/UUIDPlugin/common/UUIDPlugin.c
+@@ -41,6 +41,9 @@ struct VirtualMachine* interpreterProxy;
+ 
+ 	#if defined(HAVE_UUIDGEN)
+ 	  uuidgen(&uuid, 1);
++	  uuid.time_low = htobe32(uuid.time_low);
++	  uuid.time_mid = htobe16(uuid.time_mid);
++	  uuid.time_hi_and_version = htobe16(uuid.time_hi_and_version);
+ 	#else
+ 	  uuid_generate(uuid);
+ 	#endif
diff --git a/pharo-vm/patches/patch-src_debugUnix.c b/pharo-vm/patches/patch-src_debugUnix.c
new file mode 100644
index 0000000000..e8ce5fbe39
--- /dev/null
+++ b/pharo-vm/patches/patch-src_debugUnix.c
@@ -0,0 +1,50 @@
+$NetBSD$
+
+support NetBSD/amd64
+
+--- src/debugUnix.c.orig	2021-10-11 14:02:52.000000000 +0000
++++ src/debugUnix.c
+@@ -17,6 +17,12 @@
+ 
+ #endif
+ 
++#if __NetBSD__
++
++#include <ucontext.h>
++
++#endif
++
+ 
+ #ifdef HAVE_EXECINFO_H
+ # include <execinfo.h>
+@@ -267,6 +273,20 @@ void * printRegisterState(ucontext_t *ua
+ 			regs->mc_edi, regs->mc_edi, regs->mc_ebp, regs->mc_esp,
+ 			regs->mc_eip);
+ 	return regs->mc_eip;
++#elif __NetBSD__ && __x86_64__
++	__greg_t *regs = &uap->uc_mcontext.__gregs;
++	fprintf_impl(output,
++			"\trax 0x%08llx rbx 0x%08llx rcx 0x%08llx rdx 0x%08llx\n"
++			"\trdi 0x%08llx rsi 0x%08llx rbp 0x%08llx rsp 0x%08llx\n"
++			"\tr8  0x%08llx r9  0x%08llx r10 0x%08llx r11 0x%08llx\n"
++			"\tr12 0x%08llx r13 0x%08llx r14 0x%08llx r15 0x%08llx\n"
++			"\trip 0x%08llx\n",
++			regs[_REG_RAX], regs[_REG_RBX], regs[_REG_RCX], regs[_REG_RDX],
++			regs[_REG_RDI], regs[_REG_RSI], regs[_REG_RBP], regs[_REG_RSP],
++			regs[_REG_R8 ], regs[_REG_R9 ], regs[_REG_R10], regs[_REG_R11],
++			regs[_REG_R12], regs[_REG_R13], regs[_REG_R14], regs[_REG_R15],
++			regs[_REG_RIP]);
++	return (void *)regs[_REG_RIP];
+ #elif __linux__ && __x86_64__
+ 	greg_t *regs = uap->uc_mcontext.gregs;
+ 	fprintf_impl(output,
+@@ -427,6 +447,9 @@ void reportStackState(const char *msg, c
+ # elif __FreeBSD__ && __i386__
+ 			void *fp = (void *)(uap ? uap->uc_mcontext.mc_ebp: 0);
+ 			void *sp = (void *)(uap ? uap->uc_mcontext.mc_esp: 0);
++#elif __NetBSD__
++			void *fp = (void *)(uap ? _UC_MACHINE_FP(uap) : 0);
++			void *sp = (void *)(uap ? _UC_MACHINE_SP(uap) : 0);
+ # elif __OpenBSD__
+ 			void *fp = (void *)(uap ? uap->sc_rbp: 0);
+ 			void *sp = (void *)(uap ? uap->sc_rsp: 0);


Home | Main Index | Thread Index | Old Index