pkgsrc-WIP-changes archive

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

pharo-vm10: Import pharo-vm 10.0.1 as wip/pharo-vm10



Module Name:	pkgsrc-wip
Committed By:	Atsushi Toyokura <asteria.at%gmail.com@localhost>
Pushed By:	steleto
Date:		Sat Mar 18 19:17:17 2023 +0900
Changeset:	13a76e3aaf1e661933a42bb6385e0a3bb9d39e67

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

Log Message:
pharo-vm10: Import pharo-vm 10.0.1 as wip/pharo-vm10

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=13a76e3aaf1e661933a42bb6385e0a3bb9d39e67

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

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

diffs:
diff --git a/Makefile b/Makefile
index 424b3011eb..d4c2661892 100644
--- a/Makefile
+++ b/Makefile
@@ -3126,6 +3126,7 @@ SUBDIR+=	phantomjs
 SUBDIR+=	phantomjs2
 SUBDIR+=	pharo
 SUBDIR+=	pharo-vm
+SUBDIR+=	pharo-vm10
 SUBDIR+=	pharo10
 SUBDIR+=	pheanstalk
 SUBDIR+=	phonon-backend-xine
diff --git a/pharo-vm10/DESCR b/pharo-vm10/DESCR
new file mode 100644
index 0000000000..8ee83e6fd6
--- /dev/null
+++ b/pharo-vm10/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-vm10/Makefile b/pharo-vm10/Makefile
new file mode 100644
index 0000000000..6a0a1e31af
--- /dev/null
+++ b/pharo-vm10/Makefile
@@ -0,0 +1,57 @@
+# $NetBSD$
+
+PHAROVM_VER=	10.0.1
+PHAROVM_HASH=	f928dd9
+
+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-vm10/PLIST b/pharo-vm10/PLIST
new file mode 100644
index 0000000000..8e7cfd1fc0
--- /dev/null
+++ b/pharo-vm10/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/libFloatArrayPlugin.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
diff --git a/pharo-vm10/distinfo b/pharo-vm10/distinfo
new file mode 100644
index 0000000000..214e2cf1ab
--- /dev/null
+++ b/pharo-vm10/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+BLAKE2s (PharoVM-10.0.1-f928dd9-Linux-x86_64-c-src.zip) = cb5a2fd01278f3c54ff0378ab435a385955e4057062e40aa542494cf358bec80
+SHA512 (PharoVM-10.0.1-f928dd9-Linux-x86_64-c-src.zip) = cd1b8975bc5f31f2831b0afce8d8829ad2e708bb3e9c21d0e13203aee0c2a8922f1f7416f243d2e21921c1733d5331c996a656af504f2feb47e227e3c543d0f4
+Size (PharoVM-10.0.1-f928dd9-Linux-x86_64-c-src.zip) = 4019205 bytes
+SHA1 (patch-CMakeLists.txt) = 533049079f0d8db0584c8ba590150436cdc84a95
+SHA1 (patch-cmake_importCairo.cmake) = 0e90fbbcdebb4b0aa994be74737fa7d6462e253c
+SHA1 (patch-include_pharovm_debug.h) = a806f34f443b0d7907983d0d4f20fc121b7dfb65
+SHA1 (patch-packaging_linux_bin_launch.sh.in) = 116b5151e0bd58558a1af3691d1f546437d94eae
+SHA1 (patch-plugins.cmake) = b8eb5ad47d505c0b52a7601f86109cf8f6ccae40
+SHA1 (patch-plugins_UUIDPlugin_common_UUIDPlugin.c) = ebed390cdfd0817c3d2e5fa5f1642d6a7226d10e
+SHA1 (patch-src_debugUnix.c) = 68f2c801cda9ba010134d778f8b32060d2bc9d8a
diff --git a/pharo-vm10/patches/patch-CMakeLists.txt b/pharo-vm10/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..082f8e8933
--- /dev/null
+++ b/pharo-vm10/patches/patch-CMakeLists.txt
@@ -0,0 +1,45 @@
+$NetBSD$
+
+- define NETBSD
+- backtrace(3) requires libexecinfo
+- use uuidgen(2)
+
+--- CMakeLists.txt.orig	2023-03-10 09:04:12.000000000 +0000
++++ CMakeLists.txt
+@@ -266,6 +266,9 @@ elseif(UNIX)
+     elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+         set(OPENBSD 1)
+         set(VM_TARGET_OS "openbsd")
++    elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
++        set(NETBSD 1)
++        set(VM_TARGET_OS "netbsd")
+     else()
+         set(VM_TARGET_OS "${CMAKE_SYSTEM_NAME}")
+     endif()
+@@ -415,13 +418,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)
+ 
+ 
+@@ -499,6 +503,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-vm10/patches/patch-cmake_importCairo.cmake b/pharo-vm10/patches/patch-cmake_importCairo.cmake
new file mode 100644
index 0000000000..55e73a3dca
--- /dev/null
+++ b/pharo-vm10/patches/patch-cmake_importCairo.cmake
@@ -0,0 +1,15 @@
+$NetBSD$
+
+use system library
+
+--- cmake/importCairo.cmake.orig	2022-12-25 04:16:41.697240255 +0000
++++ cmake/importCairo.cmake
+@@ -22,6 +22,8 @@ if (BUILD_BUNDLE)
+       add_third_party_dependency("cairo-1.17.4")
+       add_third_party_dependency("libpng-1.6.37")
+     endif()
++  elseif(NETBSD)
++    # use system library
+   else() #Linux
+     If(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l" OR (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64"))
+       add_third_party_dependency("pixman-0.40.0")
diff --git a/pharo-vm10/patches/patch-include_pharovm_debug.h b/pharo-vm10/patches/patch-include_pharovm_debug.h
new file mode 100644
index 0000000000..e791ae664c
--- /dev/null
+++ b/pharo-vm10/patches/patch-include_pharovm_debug.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Need stdarg.h for va_list
+
+--- include/pharovm/debug.h.orig	2023-03-18 09:15:22.487573163 +0000
++++ include/pharovm/debug.h
+@@ -49,6 +49,7 @@ void error(char* aMessage);
+ 
+ 
+ #include <stdio.h>
++#include <stdarg.h>
+ 
+ int vm_printf(const char * format, ... );
+ void vm_setVMOutputStream(FILE * stream);
diff --git a/pharo-vm10/patches/patch-packaging_linux_bin_launch.sh.in b/pharo-vm10/patches/patch-packaging_linux_bin_launch.sh.in
new file mode 100644
index 0000000000..2fbae4c7ee
--- /dev/null
+++ b/pharo-vm10/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-vm10/patches/patch-plugins.cmake b/pharo-vm10/patches/patch-plugins.cmake
new file mode 100644
index 0000000000..194e1b6291
--- /dev/null
+++ b/pharo-vm10/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-vm10/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c b/pharo-vm10/patches/patch-plugins_UUIDPlugin_common_UUIDPlugin.c
new file mode 100644
index 0000000000..d721a496ed
--- /dev/null
+++ b/pharo-vm10/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	2023-03-10 09:04:12.000000000 +0000
++++ plugins/UUIDPlugin/common/UUIDPlugin.c
+@@ -41,6 +41,9 @@ struct VirtualMachine* interpreterProxy;
+ 
+ 	#if defined(HAVE_UUIDGEN) || __FreeBSD__
+ 	  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-vm10/patches/patch-src_debugUnix.c b/pharo-vm10/patches/patch-src_debugUnix.c
new file mode 100644
index 0000000000..59fab3d929
--- /dev/null
+++ b/pharo-vm10/patches/patch-src_debugUnix.c
@@ -0,0 +1,50 @@
+$NetBSD$
+
+support NetBSD/amd64
+
+--- src/debugUnix.c.orig	2023-03-10 09:04:12.000000000 +0000
++++ src/debugUnix.c
+@@ -23,6 +23,12 @@
+ 
+ #endif
+ 
++#if __NetBSD__
++
++#include <ucontext.h>
++
++#endif
++
+ #ifdef HAVE_EXECINFO_H
+ # include <execinfo.h>
+ #endif
+@@ -272,6 +278,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,
+@@ -435,6 +455,9 @@ void reportStackState(const char *msg, c
+ # elif __FreeBSD__ && __x86_64__
+ 			void *fp = (void *)(uap ? uap->uc_mcontext.mc_rbp: 0);
+ 			void *sp = (void *)(uap ? uap->uc_mcontext.mc_rsp: 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