From 1d45990efb6ecd5a98b2837a49a9fc6ca9b45eb0 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 21 Sep 2020 00:45:52 +0300 Subject: [PATCH 1/3] spidermonkey_78: init at 78.1.0 * format Co-authored-by: WORLDofPEACE --- .../interpreters/spidermonkey/78.nix | 118 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 119 insertions(+) create mode 100644 pkgs/development/interpreters/spidermonkey/78.nix diff --git a/pkgs/development/interpreters/spidermonkey/78.nix b/pkgs/development/interpreters/spidermonkey/78.nix new file mode 100644 index 000000000000..84897ee84639 --- /dev/null +++ b/pkgs/development/interpreters/spidermonkey/78.nix @@ -0,0 +1,118 @@ +{ stdenv +, fetchurl +, fetchpatch +, autoconf213 +, pkgconfig +, perl +, python3 +, zip +, buildPackages +, which +, readline +, zlib +, icu67 +, cargo +, rustc +, rust-cbindgen +, yasm +, llvmPackages +, nspr +}: + +stdenv.mkDerivation rec { + pname = "spidermonkey"; + version = "78.1.0"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "18k47dl9hbnpqw69csxjar5dhwa7r8k7j9kvcfgmwb1iv6ba601n"; + }; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; # Configure script only understands --includedir + + nativeBuildInputs = [ + autoconf213 + cargo + llvmPackages.llvm # for llvm-objdump + perl + pkgconfig + python3 + rust-cbindgen + rustc + which + yasm # to buid icu? seems weird + zip + ]; + + buildInputs = [ + icu67 + nspr + readline + zlib + ]; + + patches = [ + # https://mail.gnome.org/archives/distributor-list/2020-August/msg00000.html + (fetchpatch { + url = "https://github.com/ptomato/mozjs/commit/b2974f8a6558d2dc4517b49ee313a9900a853285.patch"; + sha256 = "1bl5mbx7gmad6fmpc427263i1ychi2linpg69kxlr2w91r5m6ji3"; + }) + (fetchpatch { + url = "https://github.com/ptomato/mozjs/commit/e5a2eb99f653ae03c67e536df1d55d265a0a1605.patch"; + sha256 = "0xhy63nw2byibmjc41yh6dwpg282nylganrs5aprn9pbqbcpsvif"; + }) + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${buildPackages.python3.interpreter}" + + # We can't build in js/src/, so create a build dir + mkdir obj + cd obj/ + configureScript=../js/src/configure + ''; + + configureFlags = [ + "--with-system-zlib" + "--with-system-nspr" + "--with-system-icu" + "--with-intl-api" + "--enable-readline" + "--enable-shared-js" + "--disable-jemalloc" + # Fedora and Arch disable optimize, but it doesn't seme to be necessary + # It turns on -O3 which some gcc version had a problem with: + # https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e + "--enable-optimize" + "--enable-release" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" + ]; + + configurePlatforms = [ ]; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # Remove unnecessary static lib + preFixup = '' + moveToOutput bin/js60-config "$dev" + rm $out/lib/libjs_static.ajs + ln -s $out/bin/js60 $out/bin/js + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = "https://developer.mozilla.org/en/SpiderMonkey"; + license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license. + maintainers = [ maintainers.abbradar ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 20090f0f299a..ddf2b1495fd8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10391,6 +10391,7 @@ in })); spidermonkey_60 = callPackage ../development/interpreters/spidermonkey/60.nix { }; spidermonkey_68 = callPackage ../development/interpreters/spidermonkey/68.nix { }; + spidermonkey_78 = callPackage ../development/interpreters/spidermonkey/78.nix { }; spidermonkey = spidermonkey_38; ssm-agent = callPackage ../applications/networking/cluster/ssm-agent { }; From 1e80ede78db728b1f5caa2089532bb20138639ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Mon, 28 Sep 2020 15:07:02 +0200 Subject: [PATCH 2/3] cinnamon.cinnamon-common: add patch for new cjs --- pkgs/desktops/cinnamon/cinnamon-common/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/desktops/cinnamon/cinnamon-common/default.nix b/pkgs/desktops/cinnamon/cinnamon-common/default.nix index 35ca865bc1b9..496f0bb3d3f6 100644 --- a/pkgs/desktops/cinnamon/cinnamon-common/default.nix +++ b/pkgs/desktops/cinnamon/cinnamon-common/default.nix @@ -64,6 +64,10 @@ stdenv.mkDerivation rec { url = "https://github.com/linuxmint/cinnamon/commit/ce99760fa15c3de2e095b9a5372eeaca646fbed1.patch"; sha256 = "0p2sbdi5w7sgblqbgisb6f8lcj1syzq5vlk0ilvwaqayxjylg8gz"; }) + (fetchpatch { + url = "https://leigh123linux.fedorapeople.org/pub/patches/new_cjs.patch"; + sha256 = "07biv3vkbn3jzijbdrxcw73p8xz2djbsax014mlkvmryrmys0rg4"; + }) ]; buildInputs = [ From b77e830d9e94bfada1cd1a1c875f6f53719ff0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Mon, 28 Sep 2020 15:06:32 +0200 Subject: [PATCH 3/3] cinnamon.cjs: 4.6.0 -> 4.6.0-gjs1.66.0 --- pkgs/desktops/cinnamon/cjs/default.nix | 83 ++++++++-------- pkgs/desktops/cinnamon/cjs/fix-werror.patch | 39 -------- .../desktops/cinnamon/cjs/spidermonkey_52.nix | 95 ------------------- 3 files changed, 45 insertions(+), 172 deletions(-) delete mode 100644 pkgs/desktops/cinnamon/cjs/fix-werror.patch delete mode 100644 pkgs/desktops/cinnamon/cjs/spidermonkey_52.nix diff --git a/pkgs/desktops/cinnamon/cjs/default.nix b/pkgs/desktops/cinnamon/cjs/default.nix index cdbcfa9683e5..a810bdcc03e1 100644 --- a/pkgs/desktops/cinnamon/cjs/default.nix +++ b/pkgs/desktops/cinnamon/cjs/default.nix @@ -1,6 +1,4 @@ -{ autoconf-archive -, autoreconfHook -, dbus-glib +{ dbus-glib , fetchFromGitHub , gobject-introspection , pkgconfig @@ -17,26 +15,51 @@ , libffi , gtk3 , readline +, spidermonkey_78 +, meson +, sysprof +, dbus +, xvfb_run +, ninja +, makeWrapper +, which +, libxml2 }: -let - - # https://github.com/linuxmint/cjs/issues/80 - spidermonkey_52 = callPackage ./spidermonkey_52.nix {}; - -in - stdenv.mkDerivation rec { pname = "cjs"; - version = "4.6.0"; + version = "4.6.0-gjs-1.66.0"; src = fetchFromGitHub { - owner = "linuxmint"; + owner = "leigh123linux"; repo = pname; - rev = version; - sha256 = "1caa43cplb40dm1bwnwca7z4yafvnrncm96k7mih6kg3m87fxqi5"; + rev = "gjs-1.66.0"; + sha256 = "1pccz7h8mwljziflhn04gmfnbl99pvcj1byz1c6zn947v5gqskj1"; }; + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson # ADDING cmake breaks the build, ignore meson warning + ninja + pkgconfig + makeWrapper + which # for locale detection + libxml2 # for xml-stripblanks + ]; + + buildInputs = [ + gobject-introspection + cairo + readline + spidermonkey_78 + dbus # for dbus-run-session + ]; + + checkInputs = [ + xvfb_run + ]; + propagatedBuildInputs = [ glib @@ -47,25 +70,8 @@ stdenv.mkDerivation rec { xapps ]; - nativeBuildInputs = [ - autoconf-archive - autoreconfHook - wrapGAppsHook - pkgconfig - ]; - - buildInputs = [ - # from .pc - gobject-introspection - libffi - spidermonkey_52 # mozjs-52 - cairo # +cairo-gobject - gtk3 - - # other - - dbus-glib - readline + mesonFlags = [ + "-Dprofiler=disabled" ]; meta = with stdenv.lib; { @@ -77,11 +83,12 @@ stdenv.mkDerivation rec { ''; license = with licenses; [ - gpl2Plus - lgpl2Plus - mit - mpl11 - ]; + gpl2Plus + lgpl2Plus + mit + mpl11 + ]; + platforms = platforms.linux; maintainers = teams.cinnamon.members; }; diff --git a/pkgs/desktops/cinnamon/cjs/fix-werror.patch b/pkgs/desktops/cinnamon/cjs/fix-werror.patch deleted file mode 100644 index 0218eba3b46e..000000000000 --- a/pkgs/desktops/cinnamon/cjs/fix-werror.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1b802175914418f5675047c34f1ab1593dd35b18 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= -Date: Wed, 8 Jan 2020 11:04:27 +0100 -Subject: [PATCH] fix werror - ---- - js/src/moz.build | 2 +- - js/src/shell/moz.build | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/js/src/moz.build b/js/src/moz.build -index 1162cb70c..595ea9842 100644 ---- a/js/src/moz.build -+++ b/js/src/moz.build -@@ -785,7 +785,7 @@ if CONFIG['JS_HAS_CTYPES']: - DEFINES['FFI_BUILDING'] = True - - if CONFIG['GNU_CXX']: -- CXXFLAGS += ['-Wno-shadow', '-Werror=format'] -+ CXXFLAGS += ['-Wno-shadow'] - - # Suppress warnings in third-party code. - if CONFIG['CLANG_CXX']: -diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build -index 72ea8145c..77475b241 100644 ---- a/js/src/shell/moz.build -+++ b/js/src/shell/moz.build -@@ -51,7 +51,7 @@ shellmoduleloader.inputs = [ - ] - - if CONFIG['GNU_CXX']: -- CXXFLAGS += ['-Wno-shadow', '-Werror=format'] -+ CXXFLAGS += ['-Wno-shadow'] - - # This is intended as a temporary workaround to enable VS2015. - if CONFIG['_MSC_VER']: --- -2.17.1 - diff --git a/pkgs/desktops/cinnamon/cjs/spidermonkey_52.nix b/pkgs/desktops/cinnamon/cjs/spidermonkey_52.nix deleted file mode 100644 index 7fb983d6136e..000000000000 --- a/pkgs/desktops/cinnamon/cjs/spidermonkey_52.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, zip, which, readline, icu, zlib, nspr, buildPackages }: - -let - version = "52.9.0"; -in stdenv.mkDerivation { - pname = "spidermonkey"; - inherit version; - - src = fetchurl { - url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; - sha256 = "1mlx34fgh1kaqamrkl5isf0npch3mm6s4lz3jsjb7hakiijhj7f0"; - }; - - outputs = [ "out" "dev" ]; - setOutputFlags = false; # Configure script only understands --includedir - - buildInputs = [ readline icu zlib nspr ]; - nativeBuildInputs = [ autoconf213 pkgconfig perl which buildPackages.python2 zip ]; - - # Apparently this package fails to build correctly with modern compilers, which at least - # on ARMv6 causes polkit testsuite to break with an assertion failure in spidermonkey. - # These flags were stolen from: - # https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/js52 - NIX_CFLAGS_COMPILE = "-fno-delete-null-pointer-checks -fno-strict-aliasing -fno-tree-vrp"; - - patches = [ - # needed to build gnome3.gjs - (fetchpatch { - name = "mozjs52-disable-mozglue.patch"; - url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/mozjs52-disable-mozglue.patch?h=packages/js52&id=4279d2e18d9a44f6375f584911f63d13de7704be"; - sha256 = "18wkss0agdyff107p5lfflk72qiz350xqw2yqc353alkx4fsfpz0"; - }) - (fetchpatch { - url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/no-error.diff?h=packages/js52"; - sha256 = "1vsw6558lxiy0r1mg6y49cgddan1mfqvqlkyv734bgxyg6n3pb9i"; - }) - ./fix-werror.patch - ]; - - configurePlatforms = [ ]; - - preConfigure = '' - export CXXFLAGS="-fpermissive" - export LIBXUL_DIST=$out - export PYTHON="${buildPackages.python2.interpreter}" - configureFlagsArray+=("--includedir=$dev/include") - - cd js/src - - autoconf - ''; - - configureFlags = [ - "--with-nspr-prefix=${nspr}" - "--with-system-zlib" - "--with-system-icu" - "--with-intl-api" - "--enable-readline" - "--enable-shared-js" - ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc" - ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "--host=${stdenv.buildPlatform.config}" - "--target=${stdenv.hostPlatform.config}" - ]; - - makeFlags = [ - "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" - ]; - - depsBuildBuild = [ buildPackages.stdenv.cc ]; - - enableParallelBuilding = true; - - postInstall = '' - moveToOutput bin/js52-config "$dev" - # Nuke a static lib. - rm $out/lib/libjs_static.ajs - ''; - - meta = with stdenv.lib; { - description = "Mozilla's JavaScript engine written in C/C++"; - homepage = "https://developer.mozilla.org/en/SpiderMonkey"; - license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license. - maintainers = [ maintainers.abbradar ]; - platforms = platforms.linux; - - # Commented out so hydra builds the package - # (I know what you're thinking now, but cjs won't be pulling anything from the network - # and modules are allowed to execute commands anyways, so an RCE is basically irrelevant) - # - # knownVulnerabilities = [ - # "The runtime was extracted from Firefox 52, which EOL’d on September 5, 2018." - # ]; - }; -}