From 5af8bf173e1f59b6a23d3b0ac4818713c17a09ed Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Wed, 10 Nov 2021 05:37:17 +0000 Subject: [PATCH] added extra/gjs --- extra/gjs/PKGBUILD | 51 ++++++++++++++++ ...ild-Link-with-libatomic-if-necessary.patch | 60 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 extra/gjs/PKGBUILD create mode 100644 extra/gjs/build-Link-with-libatomic-if-necessary.patch diff --git a/extra/gjs/PKGBUILD b/extra/gjs/PKGBUILD new file mode 100644 index 000000000..50468d15f --- /dev/null +++ b/extra/gjs/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: Jan Alexander Steffens (heftig) +# Contributor: Ionut Biru + +# ALARM: Kevin Mihelich +# - patch from debian to detect libatomic usage + +pkgname=gjs +pkgver=1.70.0 +pkgrel=1 +epoch=2 +pkgdesc="Javascript Bindings for GNOME" +url="https://wiki.gnome.org/Projects/Gjs" +arch=(x86_64) +license=(GPL) +depends=(cairo gobject-introspection-runtime js78 dconf readline) +makedepends=(gobject-introspection git meson dbus) +checkdepends=(valgrind xorg-server-xvfb gtk3 gtk4) +provides=(libgjs.so) +_commit=da5d5fe74469c799de80117758d79ad694d1116a # tags/1.70.0^0 +source=("git+https://gitlab.gnome.org/GNOME/gjs.git#commit=$_commit" + build-Link-with-libatomic-if-necessary.patch) +sha256sums=('SKIP' + 'fcfcc02a65b3917fbdf7ded5ee294ff5fc71225ffe720e42ca0257c7cb14eada') + +pkgver() { + cd $pkgname + git describe --tags | sed 's/-/+/g' +} + +prepare() { + cd $pkgname + patch -p1 -i ../build-Link-with-libatomic-if-necessary.patch +} + +build() { + arch-meson $pkgname build \ + --buildtype release \ + -D installed_tests=false \ + -D profiler=disabled + meson compile -C build +} + +check() { + xvfb-run -s '-nolisten local' \ + meson test -C build --print-errorlogs +} + +package() { + depends+=(libreadline.so) + meson install -C build --destdir "$pkgdir" +} diff --git a/extra/gjs/build-Link-with-libatomic-if-necessary.patch b/extra/gjs/build-Link-with-libatomic-if-necessary.patch new file mode 100644 index 000000000..a540ad3d5 --- /dev/null +++ b/extra/gjs/build-Link-with-libatomic-if-necessary.patch @@ -0,0 +1,60 @@ +From: Simon McVittie +Date: Fri, 8 Oct 2021 11:42:49 +0100 +Subject: build: Link with libatomic if necessary + +The implementation of atomic operations in gcc uses atomic opcodes if +supported, but falls back to a library implementation if necessary. +Link that library on architectures where 64-bit atomic operations need it, +such as Debian armel (ARMv5 EABI softfloat), mipsel and powerpc. + +Bug: https://gitlab.gnome.org/GNOME/gjs/-/issues/442 +Bug-Debian: https://bugs.debian.org/995930 +Forwarded: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/686 +Signed-off-by: Simon McVittie +--- + meson.build | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 6ded66c..e230a09 100644 +--- a/meson.build ++++ b/meson.build +@@ -109,6 +109,8 @@ endif + + ### Check for required libraries ############################################### + ++null_dep = dependency('', required : false) ++ + # Note: Notify GNOME release team when adding or updating dependencies + glib_required_version = '>= 2.66.0' + glib = dependency('glib-2.0', version: glib_required_version, +@@ -180,6 +182,20 @@ features.''') + endif + endif + ++if cxx.links(''' ++#include ++ ++int main(void) ++{ ++ std::atomic_int64_t value = ATOMIC_VAR_INIT(0); ++ return value.load(); ++} ++''', name: '64-bit atomics built-in') ++ libatomic = null_dep ++else ++ libatomic = cc.find_library('atomic', required: false) ++endif ++ + build_profiler = sysprof_capture.found() and not get_option('profiler').disabled() + profiler_deps = [sysprof_capture] + if build_profiler and not cxx.has_function('timer_settime') +@@ -458,7 +474,7 @@ module_resource_srcs = gnome.compile_resources('js-resources', + c_name: 'js_resources') + + libgjs_dependencies = [glib, gobject, gthread, gio, gi, ffi, spidermonkey, +- readline] ++ readline, libatomic] + pkg_dependencies = [glib, gobject, gthread, gio, gi, ffi, spidermonkey] + libraries_private = [] +