diff mbox series

[bug#71862] gnu: Add pharo.

Message ID 33ce0e5891298e45598489006595bd9bfc6d6685.1719773612.git.jacereda@gmail.com
State New
Headers show
Series [bug#71862] gnu: Add pharo. | expand

Commit Message

Jorge Acereda June 30, 2024, 6:53 p.m. UTC
I didn't realize there's already an ongoing issue (69918) by Daniel
Ziltener, but I had a 10.2.1 version floating around and I've updated
it to 0.13.0. I won't have much time to work on this for a while, so
anyone, feel free to grab bits if this isn't in good shape and
resubmit.

To test the VM, download a suitable image and run with:

pharo <image-path> --interactive

Thanks,
  Jorge Acereda


* gnu/packages/patches/pharo-install.patch (pharo): New variable.

Change-Id: I1618103786c6e1a8a5df924d1b1b1dea22db80cd
---
 gnu/packages/patches/pharo-install.patch | 81 ++++++++++++++++++++++++
 gnu/packages/smalltalk.scm               | 67 ++++++++++++++++++++
 2 files changed, 148 insertions(+)
 create mode 100644 gnu/packages/patches/pharo-install.patch


base-commit: f3689976da3d23b0a73cf1733da04add5e1035ee
prerequisite-patch-id: 5fde795662902a8e1c89f32da3570827179fa814
--
2.45.2

Comments

Jorge Acereda June 30, 2024, 7:06 p.m. UTC | #1
On Sun, Jun 30, 2024 at 8:54 PM Jorge Acereda <jacereda@gmail.com> wrote:
> I had a 10.2.1 version floating around and I've updated it to 0.13.0
I mean 10.3.0.
diff mbox series

Patch

diff --git a/gnu/packages/patches/pharo-install.patch b/gnu/packages/patches/pharo-install.patch
new file mode 100644
index 0000000000..cc9ce44780
--- /dev/null
+++ b/gnu/packages/patches/pharo-install.patch
@@ -0,0 +1,81 @@ 
+This patch just tweaks the cmake scripts to simplify the packaging.
+Probably not worth contributing.
+
+
+diff --git a/cmake/Linux.cmake b/cmake/Linux.cmake
+index 0b6b9d7c4..cedc1b743 100644
+--- a/cmake/Linux.cmake
++++ b/cmake/Linux.cmake
+@@ -1,4 +1,3 @@
+-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-rpath=.")
+ set(PHARO_BIN_LOCATION "default" CACHE STRING "The default location of the PHARO bin, used by the launch.sh.in")
+
+ if(${PHARO_BIN_LOCATION} STREQUAL "default")
+@@ -60,36 +59,29 @@ endmacro()
+
+
+ macro(configure_installables INSTALL_COMPONENT)
+-    set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/build/dist")
+-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/launch.sh.in
+-        ${CMAKE_CURRENT_BINARY_DIR}/build/packaging/linux/${VM_EXECUTABLE_NAME} @ONLY)
+-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/bin/launch.sh.in
+-        ${CMAKE_CURRENT_BINARY_DIR}/build/packaging/linux/bin/${VM_EXECUTABLE_NAME} @ONLY)
+-
+-
+     install(
+-      DIRECTORY "${CMAKE_BINARY_DIR}/build/packaging/linux/"
+-      DESTINATION "./"
++      DIRECTORY "${CMAKE_BINARY_DIR}/build/vm/"
++      DESTINATION "bin"
+       USE_SOURCE_PERMISSIONS
+-      COMPONENT ${INSTALL_COMPONENT})
++      COMPONENT ${INSTALL_COMPONENT}
++      FILES_MATCHING PATTERN pharo)
+     install(
+       DIRECTORY "${CMAKE_BINARY_DIR}/build/vm/"
+       DESTINATION "lib"
+       USE_SOURCE_PERMISSIONS
+-      COMPONENT ${INSTALL_COMPONENT})
+-	install(
+-		DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/libffi/install/lib/"
+-		DESTINATION "lib"
+-		USE_SOURCE_PERMISSIONS
+-		COMPONENT ${INSTALL_COMPONENT}
+-		FILES_MATCHING PATTERN ${DYLIB_EXT})
+-
+-
+-	install(
+-	    DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extracted/vm/include/unix/"
+-	    DESTINATION include/pharovm
+-	    COMPONENT include
+-	    FILES_MATCHING PATTERN *.h)
++      COMPONENT ${INSTALL_COMPONENT}
++      FILES_MATCHING PATTERN *.so)
++    install(
++      DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/libffi/install/lib/"
++      DESTINATION "lib"
++      USE_SOURCE_PERMISSIONS
++      COMPONENT ${INSTALL_COMPONENT}
++      FILES_MATCHING PATTERN ${DYLIB_EXT})
++    install(
++        DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extracted/vm/include/unix/"
++        DESTINATION include/pharovm
++        COMPONENT include
++        FILES_MATCHING PATTERN *.h)
+ endmacro()
+
+ macro(add_required_libs_per_platform)
+diff --git a/macros.cmake b/macros.cmake
+index 811e49687..53bb9133b 100644
+--- a/macros.cmake
++++ b/macros.cmake
+@@ -14,9 +14,6 @@ endmacro()
+
+ # Include a loose-dependency library in the project, but do not link it to the main library
+ macro(addIndependentLibraryWithRPATH NAME)
+-    SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+-    set(CMAKE_INSTALL_RPATH ${PHARO_LIBRARY_PATH})
+-
+     add_library(${NAME} SHARED ${ARGN})
+     set_target_properties(${NAME} PROPERTIES MACOSX_RPATH ON)
+     set_target_properties(${NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_DIRECTORY})
diff --git a/gnu/packages/smalltalk.scm b/gnu/packages/smalltalk.scm
index 64146813d1..49b93963d6 100644
--- a/gnu/packages/smalltalk.scm
+++ b/gnu/packages/smalltalk.scm
@@ -5,6 +5,7 @@ 
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2024 Jorge Acereda <jacereda@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,23 +28,89 @@  (define-module (gnu packages smalltalk)
   #:use-module (guix download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix gexp)
   #:use-module (gnu packages)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages image)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages libsigsegv)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
+  #:use-module (gnu packages sdl)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg))

+(define-public pharo
+  (package
+    (name "pharo")
+    (version "10.3.0-ce15171")
+    (synopsis "Clean and innovative Smalltalk-inspired environment")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://files.pharo.org/vm/pharo-spur64-headless/"
+             "Linux-x86_64/source/PharoVM-" version
+             "-Linux-x86_64-c-src.tar.gz"))
+       (sha256
+        (base32 "07pkxn0pl3mkbjcfskw94xc8vs74l5lmbslj57xlq6vpz1207ab0"))
+       (patches (search-patches "./pharo-install.patch"))))
+    (build-system cmake-build-system)
+    (inputs (list bash-minimal
+                  cairo
+                  freetype
+                  libffi
+                  libgit2
+                  libpng
+                  openssl
+                  pixman
+                  sdl2))
+    (home-page "https://pharo.org")
+    (arguments
+     (list
+      #:configure-flags #~(list "-DGENERATED_SOURCE_DIR=."
+                                "-DALWAYS_INTERACTIVE=ON"
+                                "-DBUILD_IS_RELEASE=ON"
+                                "-DGENERATE_SOURCES=OFF"
+                                "-DBUILD_BUNDLE=OFF"
+                                "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
+                                (string-append "-DCMAKE_BUILD_RPATH="
+                                               #$output "/lib")
+                                (string-append "-DPHARO_BIN_LOCATION="
+                                               #$output "/bin")
+                                (string-append "-DPHARO_LIBRARY_PATH="
+                                               #$output "/lib"))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'install 'wrapper
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (wrap-program (string-append (assoc-ref outputs "out")
+                                                    "/bin/pharo")
+                         `("LD_LIBRARY_PATH" ":" prefix
+                           ,(map (lambda (name)
+                                   (string-append (assoc-ref inputs name)
+                                                  "/lib"))
+                                 '("sdl2" "libgit2" "freetype" "cairo"
+                                   "pixman")))))))
+      #:tests? #f))
+    (description
+     "Pharo's goal is to deliver a clean, innovative, free open-source
+Smalltalk-inspired environment.  By providing a stable and small core
+system, excellent dev tools, and maintained releases, Pharo is an
+attractive platform to build and deploy mission critical applications.")
+    (license license:expat)))
+
 (define-public smalltalk
   (package
     (name "smalltalk")