Samuel Thibault, le ven. 20 juil. 2018 09:36:28 +0200, a ecrit:
> Samuel Thibault, le jeu. 19 juil. 2018 10:24:20 +0200, a ecrit:
> > pypy is becoming more and more a dependence for a lot of packages. I
> > have worked on the hurd port, here is the patch I have come up with and
> > submitted to https://bitbucket.org/pypy/pypy/issues/2848/gnu-hurd-port
> 
> Upstream has commited it.
> 
> Could you upload these three patches to Debian so we can get all the
> rdeps of pypy fixed?

Here is the upstream version of the "hurd" patch.

Samuel
# HG changeset patch
# User Armin Rigo <ar...@tunes.org>
# Date 1532071553 -7200
#      Fri Jul 20 09:25:53 2018 +0200
# Node ID 2ca5d2f3a174ec02ebf49f889aee1efe1922d71a
# Parent  587bebd539604208eb416ccdeb05e841db74e0aa
Issue #2848

Patch for GNU Hurd.

diff -r 587bebd53960 -r 2ca5d2f3a174 
pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py  Wed Jul 18 22:47:52 
2018 +0200
+++ b/pypy/module/_multiprocessing/interp_semaphore.py  Fri Jul 20 09:25:53 
2018 +0200
@@ -57,7 +57,7 @@
         TIMESPEC = platform.Struct('struct timespec', [('tv_sec', rffi.TIME_T),
                                                        ('tv_nsec', rffi.LONG)])
         SEM_FAILED = platform.ConstantInteger('SEM_FAILED')
-        SEM_VALUE_MAX = platform.ConstantInteger('SEM_VALUE_MAX')
+        SEM_VALUE_MAX = platform.DefinedConstantInteger('SEM_VALUE_MAX')
         SEM_TIMED_WAIT = platform.Has('sem_timedwait')
         SEM_T_SIZE = platform.SizeOf('sem_t')
 
@@ -70,6 +70,8 @@
     #                rffi.cast(SEM_T, config['SEM_FAILED'])
     SEM_FAILED     = config['SEM_FAILED']
     SEM_VALUE_MAX  = config['SEM_VALUE_MAX']
+    if SEM_VALUE_MAX is None:      # on Hurd
+        SEM_VALUE_MAX = sys.maxint
     SEM_TIMED_WAIT = config['SEM_TIMED_WAIT']
     SEM_T_SIZE = config['SEM_T_SIZE']
     if sys.platform == 'darwin':
diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/jit/backend/detect_cpu.py
--- a/rpython/jit/backend/detect_cpu.py Wed Jul 18 22:47:52 2018 +0200
+++ b/rpython/jit/backend/detect_cpu.py Fri Jul 20 09:25:53 2018 +0200
@@ -57,6 +57,7 @@
             'i486': MODEL_X86,
             'i586': MODEL_X86,
             'i686': MODEL_X86,
+            'i686-AT386': MODEL_X86,  # Hurd
             'i86pc': MODEL_X86,    # Solaris/Intel
             'x86': MODEL_X86,      # Apple
             'Power Macintosh': MODEL_PPC_64,
diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py    Wed Jul 18 22:47:52 2018 +0200
+++ b/rpython/rlib/rposix.py    Fri Jul 20 09:25:53 2018 +0200
@@ -1086,9 +1086,12 @@
         else:
             return bool(c_func(status))
 
-WAIT_MACROS = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+WAIT_MACROS = ['WCOREDUMP', 'WIFSTOPPED',
                'WIFSIGNALED', 'WIFEXITED',
                'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']
+if not sys.platform.startswith('gnu'):
+    WAIT_MACROS.append('WIFCONTINUED')
+
 for name in WAIT_MACROS:
     _make_waitmacro(name)
 
diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py   Wed Jul 18 22:47:52 2018 +0200
+++ b/rpython/translator/platform/__init__.py   Fri Jul 20 09:25:53 2018 +0200
@@ -308,6 +308,13 @@
         host_factory = OpenBSD
     else:
         host_factory = OpenBSD_64
+elif sys.platform.startswith('gnu'):
+    from rpython.translator.platform.hurd import Hurd
+    import platform
+    if platform.architecture()[0] == '32bit':
+        host_factory = Hurd
+    else:
+        host_factory = Hurd_64
 elif os.name == 'nt':
     from rpython.translator.platform.windows import Windows, Windows_x64
     import platform
diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/translator/platform/hurd.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/rpython/translator/platform/hurd.py       Fri Jul 20 09:25:53 2018 +0200
@@ -0,0 +1,42 @@
+"""Support for Hurd."""
+
+import os
+import platform
+import sys
+from rpython.translator.platform.posix import BasePosix
+
+class BaseHurd(BasePosix):
+    name = "hurd"
+
+    link_flags = tuple(
+                 ['-pthread',]
+                 + os.environ.get('LDFLAGS', '').split())
+    extra_libs = ('-lrt',)
+    cflags = tuple(
+             ['-O3', '-pthread', '-fomit-frame-pointer',
+              '-Wall', '-Wno-unused', '-Wno-address']
+             + os.environ.get('CFLAGS', '').split())
+    standalone_only = ()
+    shared_only = ('-fPIC',)
+    so_ext = 'so'
+
+    def _args_for_shared(self, args, **kwds):
+        return ['-shared'] + args
+
+    def _include_dirs_for_libffi(self):
+        return self._pkg_config("libffi", "--cflags-only-I",
+                                ['/usr/include/libffi'],
+                                check_result_dir=True)
+
+    def _library_dirs_for_libffi(self):
+        return self._pkg_config("libffi", "--libs-only-L",
+                                ['/usr/lib/libffi'],
+                                check_result_dir=True)
+
+
+class Hurd(BaseHurd):
+    shared_only = () # it seems that on 32-bit GNU, compiling with -fPIC
+                     # gives assembler that asmgcc is not happy about.
+
+class HurdPIC(BaseHurd):
+    pass

Reply via email to