Unverified Commit 9aabdcf4 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #237892 from jthulhu/update-pharo

pharo: old -> 10.0.5
parents 69a89860 e8522876
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@

- The default `kops` version is now 1.27.0 and support for 1.24 and older has been dropped.

- `pharo` has been updated to latest stable (PharoVM 10.0.5), which is compatible with the latest stable and oldstable images (Pharo 10 and 11). The VM in question is the 64bit Spur. The 32bit version has been dropped due to lack of maintenance. The Cog VM has been deleted because it is severily outdated. Finally, the `pharo-launcher` package has been deleted because it was not compatible with the newer VM, and due to lack of maintenance.

## Other Notable Changes {#sec-release-23.11-notable-changes}

- The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration.
+99 −0
Original line number Diff line number Diff line
{ cairo
, cmake
, fetchurl
, freetype
, gcc
, git
, gnumake
, lib
, libffi
, libgit2
, libpng
, libuuid
, makeBinaryWrapper
, openssl
, pixman
, runtimeShell
, SDL2
, stdenv
, unzip
}:
let
  inherit (lib.strings) makeLibraryPath;
  pharo-sources = fetchurl {
    # It is necessary to download from there instead of from the repository because that archive
    # also contains artifacts necessary for the bootstrapping.
    url = "https://files.pharo.org/vm/pharo-spur64-headless/Linux-x86_64/source/PharoVM-10.0.5-2757766-Linux-x86_64-c-src.zip";
    hash = "sha256-i6WwhdVdyzmqGlx1Fn12mCq5+HnRORT65HEiJo0joCE=";
  };
  library_path = makeLibraryPath [
    libgit2
    SDL2
    cairo
    "$out"
  ];
in
stdenv.mkDerivation {
  pname = "pharo";
  version = "10.0.5";
  src = pharo-sources;

  buildInputs = [
    cairo
    libgit2
    libpng
    pixman
    SDL2
  ];

  nativeBuildInputs = [
    cmake
    freetype
    gcc
    git
    gnumake
    libffi
    libuuid
    makeBinaryWrapper
    openssl
    pixman
    SDL2
    unzip
  ];

  cmakeFlags = [
    # Necessary to perform the bootstrapping without already having Pharo available.
    "-DGENERATED_SOURCE_DIR=."
    "-DGENERATE_SOURCES=OFF"
    # Prevents CMake from trying to download stuff.
    "-DBUILD_BUNDLE=OFF"
  ];

  installPhase = ''
    runHook preInstall

    cmake --build . --target=install
    mkdir -p "$out/lib"
    mkdir "$out/bin"
    cp build/vm/*.so* "$out/lib/"
    cp build/vm/pharo "$out/bin/pharo"
    patchelf --allowed-rpath-prefixes /nix/store --shrink-rpath "$out/bin/pharo"
    wrapProgram "$out/bin/pharo" --set LD_LIBRARY_PATH "${library_path}"

    runHook postInstall
  '';

  meta = with lib; {
    description = "Clean and innovative Smalltalk-inspired environment";
    homepage = "https://pharo.org";
    license = licenses.mit;
    longDescription = ''
      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.
    '';
    maintainers = [ ];
    platforms = lib.platforms.linux;
  };
}
+0 −83
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, bash, pharo, unzip, makeDesktopItem }:

stdenv.mkDerivation rec {
  version = "2017.02.28";
  pname = "pharo-launcher";
  src = fetchurl {
    url = "http://files.pharo.org/platform/launcher/PharoLauncher-user-stable-${version}.zip";
    sha256 = "1hfwjyx0c47s6ivc1zr2sf5mk1xw2zspsv0ns8mj3kcaglzqwiq0";
  };

  executable-name = "pharo-launcher";

  desktopItem = makeDesktopItem {
    name = "Pharo";
    exec = executable-name;
    icon = "pharo";
    comment = "Launcher for Pharo distributions";
    desktopName = "Pharo";
    genericName = "Pharo";
    categories = [ "Development" ];
  };

  # because upstream tarball has no top-level directory.
  sourceRoot = ".";

  nativeBuildInputs = [ unzip ];
  buildInputs = [ bash pharo ];

  installPhase = ''
    mkdir -p $prefix/share/pharo-launcher
    mkdir -p $prefix/bin

    mv PharoLauncher.image $prefix/share/pharo-launcher/pharo-launcher.image
    mv PharoLauncher.changes $prefix/share/pharo-launcher/pharo-launcher.changes

    mkdir -p $prefix/share/applications
    cp "${desktopItem}/share/applications/"* $out/share/applications

    cat > $prefix/bin/${executable-name} <<EOF
    #!${bash}/bin/bash
    exec "${pharo}/bin/pharo" $prefix/share/pharo-launcher/pharo-launcher.image
    EOF
    chmod +x $prefix/bin/${executable-name}
  '';

  doCheck = true;

  checkPhase = ''
    # Launcher should be able to run for a few seconds without crashing.
    (set +e
     export HOME=. # Pharo will try to create files here
     secs=5
     echo -n "Running headless Pharo for $secs seconds to check for a crash... "
     timeout $secs \
       "${pharo}/bin/pharo" --nodisplay PharoLauncher.image --no-quit eval 'true'
     test "$?" == 124 && echo "ok")
  '';

  meta = with lib; {
    description = "Launcher for Pharo distributions";
    homepage = "https://pharo.org";
    longDescription = ''
      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.

      The Pharo Launcher is a cross-platform application that
        - lets you manage your Pharo images (launch, rename, copy and delete);
        - lets you download image templates (i.e., zip archives) from many
          different sources (e.g., Jenkins, files.pharo.org);
        - lets you create new images from any template.

      The idea behind the Pharo Launcher is that you should be able to
      access it very rapidly from your OS application launcher. As a
      result, launching any image is never more than 3 clicks away.
    '';
    license = licenses.mit;
    maintainers = [ ];
    platforms = pharo.meta.platforms;
  };
}
+0 −104
Original line number Diff line number Diff line
{ lib, stdenv
, fetchurl
, cmake
, bash
, unzip
, glibc
, openssl
, gcc
, libGLU
, libGL
, freetype
, xorg
, alsa-lib
, cairo
, libuuid
, libnsl
, makeWrapper
, ... }:

{ name, src, ... }:

stdenv.mkDerivation rec {

  inherit name src;

  pharo-share = import ./share.nix { inherit lib stdenv fetchurl unzip; };

  hardeningDisable = [ "format" "pic" ];

  nativeBuildInputs = [ unzip cmake gcc makeWrapper ];

  buildInputs = [ bash glibc openssl libGLU libGL freetype
                  xorg.libX11 xorg.libICE xorg.libSM alsa-lib cairo pharo-share libnsl ];

  LD_LIBRARY_PATH = lib.makeLibraryPath
    [ cairo libGLU libGL freetype openssl libuuid alsa-lib
      xorg.libICE xorg.libSM ];

  preConfigure = ''
    cd build/
  '';

  # -fcommon is a workaround build failure on -fno-common toolchains like upstream
  # gcc-10. Otherwise build fails as:
  #   ld: CMakeFiles/pharo.dir/build/pharo-vm-2016.02.18/src/vm/gcc3x-cointerp.c.o:(.bss+0x88): multiple definition of
  #     `sendTrace'; CMakeFiles/pharo.dir/build/pharo-vm-2016.02.18/src/vm/cogit.c.o:(.bss+0x84): first defined here
  env.NIX_CFLAGS_COMPILE = "-fcommon";

  installPhase = ''
    mkdir -p "$prefix/lib/$name"

    cd ../../results

    mv vm-display-null vm-display-null.so
    mv vm-display-X11 vm-display-X11.so
    mv vm-sound-null vm-sound-null.so
    mv vm-sound-ALSA vm-sound-ALSA.so
    mv pharo pharo-vm

    cp * "$prefix/lib/$name"

    mkdir $prefix/bin

    chmod u+w $prefix/bin
    cat > $prefix/bin/pharo-cog <<EOF
    #!${bash}/bin/bash
    # disable parameter expansion to forward all arguments unprocessed to the VM
    set -f
    exec $prefix/lib/$name/pharo-vm "\$@"
    EOF

    chmod +x $prefix/bin/pharo-cog

    # Add cairo library to the library path.
    wrapProgram $prefix/bin/pharo-cog --prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH}

    ln -s "${pharo-share}/lib/"*.sources $prefix/lib/$name
  '';

  meta = with lib; {
    description = "Clean and innovative Smalltalk-inspired environment";
    homepage = "https://pharo.org";
    longDescription = ''
      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.

      This package provides the executable VM. You should probably not care
      about this package (which represents a packaging detail) and have a
      look at the pharo-vm-core package instead.

      Please fill bug reports on http://bugs.pharo.org under the 'Ubuntu
      packaging (ppa:pharo/stable)' project.
    '';
    license = licenses.mit;
    maintainers = [ maintainers.lukego ];
    # Pharo VM sources are packaged separately for darwin (OS X)
    platforms = lib.filter
      (system: with lib.systems.elaborate { inherit system; };
         isUnix && !isDarwin)
      lib.platforms.mesaPlatforms;
  };
}
+0 −179
Original line number Diff line number Diff line
{ lib, stdenv
, fetchurl
, bash
, unzip
, glibc
, openssl
, libgit2
, libGLU, libGL
, freetype
, xorg
, alsa-lib
, cairo
, libuuid
, autoreconfHook
, gcc48
, runtimeShell
, ... }:

{ name, src, version, source-date, source-url, ... }:

# Build the Pharo VM
stdenv.mkDerivation rec {
  inherit name src;

  # Command line invocation name.
  # Distinct name for 64-bit builds because they only work with 64-bit images.
  cmd = if stdenv.is64bit then "pharo-spur64" else "pharo-spur";

  # Choose desired VM sources. Separate for 32-bit and 64-bit VM.
  # (Could extent to building more VM variants e.g. SpurV3, Sista, etc.)
  vm = if stdenv.is64bit then "spur64src" else "spursrc";

  # Choose target platform name in the format used by the vm.
  flavor =
    if      stdenv.isLinux && stdenv.isi686    then "linux32x86"
    else if stdenv.isLinux && stdenv.isx86_64  then "linux64x64"
    else if stdenv.isDarwin && stdenv.isi686   then "macos32x86"
    else if stdenv.isDarwin && stdenv.isx86_64 then "macos64x64"
    else throw "Unsupported platform: only Linux/Darwin x86/x64 are supported.";

  # Shared data (for the sources file)
  pharo-share = import ./share.nix { inherit lib stdenv fetchurl unzip; };

  # Note: -fPIC causes the VM to segfault.
  hardeningDisable = [ "format" "pic"
                       # while the VM depends on <= gcc48:
                       "stackprotector" ];

  # gcc 4.8 used for the build:
  #
  # gcc5 crashes during compilation; gcc >= 4.9 produces a
  # binary that crashes when forking a child process. See:
  # http://forum.world.st/OSProcess-fork-issue-with-Debian-built-VM-td4947326.html
  #
  # (stack protection is disabled above for gcc 4.8 compatibility.)
  nativeBuildInputs = [ autoreconfHook unzip ];
  buildInputs = [
    bash
    glibc
    openssl
    gcc48
    libGLU libGL
    freetype
    xorg.libX11
    xorg.libICE
    xorg.libSM
    alsa-lib
    cairo
    pharo-share
    libuuid
  ];

  enableParallelBuilding = true;

  # Regenerate the configure script.
  # Unnecessary? But the build breaks without this.
  autoreconfPhase = ''
    pushd platforms/unix/config
    make
    popd
  '';

  # Configure with options modeled on the 'mvm' build script from the vm.
  configureScript = "platforms/unix/config/configure";
  configureFlags = [ "--without-npsqueak"
                     "--with-vmversion=5.0"
                     "--with-src=${vm}" ];

  # -fcommon is a workaround build failure on -fno-common toolchains like upstream
  # gcc-10. Otherwise build fails as:
  #   ld: vm/vm.a(cogit.o):/build/source/spur64src/vm/cointerp.h:358: multiple definition of `checkAllocFiller';
  #     vm/vm.a(gcc3x-cointerp.o):/build/source/spur64src/vm/cointerp.h:358: first defined here
  env.NIX_CFLAGS_COMPILE = "-fcommon";

  CFLAGS = "-DPharoVM -DIMMUTABILITY=1 -msse2 -D_GNU_SOURCE -DCOGMTVM=0 -g -O2 -DNDEBUG -DDEBUGVM=0";
  LDFLAGS = "-Wl,-z,now";

  # VM sources require some patching before build.
  prePatch = ''
    patchShebangs build.${flavor}
    # Fix hard-coded path to /bin/rm in a script
    sed -i -e 's:/bin/rm:rm:' platforms/unix/config/mkmf
    # Fill in mandatory metadata about the VM source version
    sed -i -e 's!\$Date\$!$Date: ${source-date} $!' \
           -e 's!\$Rev\$!$Rev: ${version} $!' \
           -e 's!\$URL\$!$URL: ${source-url} $!' \
           platforms/Cross/vm/sqSCCSVersion.h
  '';

  # Note: --with-vmcfg configure option is broken so copy plugin specs to ./
  preConfigure = ''
    cp build."${flavor}"/pharo.cog.spur/plugins.{ext,int} .
  '';

  # (No special build phase.)

  installPhase = let
    libs = [
      cairo
      libgit2
      libGLU libGL
      freetype
      openssl
      libuuid
      alsa-lib
      xorg.libICE
      xorg.libSM
    ];
  in ''
    # Install in working directory and then copy
    make install-squeak install-plugins prefix=$(pwd)/products

    # Copy binaries & rename from 'squeak' to 'pharo'
    mkdir -p "$out"
    cp products/lib/squeak/5.0-*/squeak "$out/pharo"
    cp -r products/lib/squeak/5.0-*/*.so "$out"
    ln -s "${pharo-share}/lib/"*.sources "$out"

    # Create a shell script to run the VM in the proper environment.
    #
    # These wrapper puts all relevant libraries into the
    # LD_LIBRARY_PATH. This is important because various C code in the VM
    # and Smalltalk code in the image will search for them there.
    mkdir -p "$out/bin"

    # Note: include ELF rpath in LD_LIBRARY_PATH for finding libc.
    libs=$out:$(patchelf --print-rpath "$out/pharo"):${lib.makeLibraryPath libs}

    # Create the script
    cat > "$out/bin/${cmd}" <<EOF
    #!${runtimeShell}
    set -f
    LD_LIBRARY_PATH="\$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$libs" exec $out/pharo "\$@"
    EOF
    chmod +x "$out/bin/${cmd}"
    ln -s ${libgit2}/lib/libgit2.so* "$out/"
  '';

  meta = with lib; {
    description = "Clean and innovative Smalltalk-inspired environment";
    homepage = "https://pharo.org";
    longDescription = ''
      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.

      This package provides the executable VM. You should probably not care
      about this package (which represents a packaging detail) and have a
      look at the pharo-vm-core package instead.

      Please fill bug reports on http://bugs.pharo.org under the 'Ubuntu
      packaging (ppa:pharo/stable)' project.
    '';
    license = licenses.mit;
    maintainers = [ maintainers.lukego ];
    platforms = [ "i686-linux" "x86_64-linux" ];
  };
}
Loading