Unverified Commit 65799e35 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

imager: 4.4-01 -> 4.5-01 (#407584)

parents b7b03f94 12a58dad
Loading
Loading
Loading
Loading
+11 −49
Original line number Diff line number Diff line
diff --git a/admin/Makefile.def b/admin/Makefile.def
index 43ef322..cad3de2 100644
index facc205..0daceaf 100644
--- a/admin/Makefile.def
+++ b/admin/Makefile.def
@@ -306,7 +306,7 @@ endif
@@ -310,7 +310,7 @@ endif
 
 # Apple CLANG flags (identical to GCC)
 ifeq ($(GAG_COMPILER_CKIND),clang)
@@ -11,7 +11,7 @@ index 43ef322..cad3de2 100644
   ifeq ($(RELEASE_MODE),no)
     OPTION_CFLAGS += -Wall
   endif
@@ -356,7 +356,7 @@ endif
@@ -360,7 +360,7 @@ endif
 
 # GFORTRAN flags
 ifeq ($(GAG_COMPILER_FKIND),gfortran)
@@ -21,55 +21,17 @@ index 43ef322..cad3de2 100644
     GLOBAL_FFLAGS += -fsanitize=address -fsanitize=null
     # Can not be used with our memory(ip):
diff --git a/admin/define-system.sh b/admin/define-system.sh
index f68274d..dd1a9be 100644
index 36d4ab9..0233259 100644
--- a/admin/define-system.sh
+++ b/admin/define-system.sh
@@ -279,35 +279,22 @@ EOF
                 else
                     GAG_MACHINE=pc
@@ -287,8 +287,8 @@ EOF
         	fi
-                if which gcc > /dev/null 2>&1; then
-                    DEFAULT_CCOMPILER=gcc
-                fi
-                if which g++ > /dev/null 2>&1; then
-                    DEFAULT_CXXCOMPILER=g++
-                elif which clang++ > /dev/null 2>&1; then
-                    DEFAULT_CXXCOMPILER=clang++
-                fi
-                if which ifort > /dev/null 2>&1; then
-                    DEFAULT_FCOMPILER=ifort
-                elif which gfortran  > /dev/null 2>&1; then
-                    DEFAULT_FCOMPILER=gfortran
-                fi
             elif [ `uname -p` = "arm" ]; then
                 defsys_message "WARNING: experimental ARM support"
                 GAG_MACHINE=arm64
-                if which gcc > /dev/null 2>&1; then
-                    DEFAULT_CCOMPILER=gcc
-                fi
-                if which g++ > /dev/null 2>&1; then
-                    DEFAULT_CXXCOMPILER=g++
-                elif which clang++ > /dev/null 2>&1; then
-                    DEFAULT_CXXCOMPILER=clang++
-                fi
-                if which ifort > /dev/null 2>&1; then
-                    DEFAULT_FCOMPILER=ifort
-                elif which gfortran  > /dev/null 2>&1; then
-                    DEFAULT_FCOMPILER=gfortran
-                fi
+	    fi
+                if which clang > /dev/null 2>&1; then
+                    DEFAULT_CCOMPILER=clang
+            fi
+            if which clang++ > /dev/null 2>&1; then
+                DEFAULT_CXXCOMPILER=clang++
+            elif which g++ > /dev/null 2>&1; then
+                DEFAULT_CXXCOMPILER=g++
+            fi
+            if which ifort > /dev/null 2>&1; then
+                DEFAULT_FCOMPILER=ifort
+            elif which gfortran  > /dev/null 2>&1; then
+                DEFAULT_FCOMPILER=gfortran
             fi ;;
         CYGWIN*)
             if [ `uname -m | grep -c "x86_64"` -ne 0 ]; then
                 fi
                 if which clang++ > /dev/null 2>&1; then
                     DEFAULT_CXXCOMPILER=clang++
+3 −6
Original line number Diff line number Diff line
@@ -26,15 +26,15 @@ let
in

stdenv.mkDerivation (finalAttrs: {
  version = "4.4-01";
  version = "4.5-01";
  pname = "imager";

  src = fetchurl {
    # The recommended download link is on Nextcloud instance that
    # requires to accept some general terms of use. Use a mirror at
    # univ-grenoble-alpes.fr instead.
    url = "https://cloud.univ-grenoble-alpes.fr/s/J6yEqA6yZ8tX9da/download?path=%2F&files=imager-dec24.tar.gz";
    hash = "sha256-Pq92IsGY4heekm5zNGngnp6J6YiCHYAyuMT2RsD1/9o=";
    url = "https://cloud.univ-grenoble-alpes.fr/s/J6yEqA6yZ8tX9da/download?path=%2F&files=imager-may25.tar.gz";
    hash = "sha256-E3JjdVGEQ0I/ogYj0G1OZxfQ3hA+sRgA4LAfHK52Sec=";
  };

  nativeBuildInputs = [
@@ -55,9 +55,6 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  patches = [
    # Update the Python link flag script from Gildas upstream
    # version. This patch will be included in the the IMAGER release.
    ./python-ldflags.patch
    # Use Clang as the default compiler on Darwin.
    ./clang.patch
    # Replace hardcoded cpp with GAG_CPP (see below).
+0 −104
Original line number Diff line number Diff line
diff --git a/admin/python-config-ldflags.py b/admin/python-config-ldflags.py
index 0854698..f397a7c 100644
--- a/admin/python-config-ldflags.py
+++ b/admin/python-config-ldflags.py
@@ -1,38 +1,70 @@
-#!/usr/bin/env python
+# This scripts retrieves the proper options to be used to link against
+# the libpython, in a machine-independant way. It invokes the official
+# script python-config (which thankfully deals with all the details).
 
-# DUPLICATE of "python-config --ldflags", fixed for the library location
+import sys
+newerpython = (sys.version_info[0] == 3 and sys.version_info[1] > 7)
 
-# This utility is known to work with:
-#  python2.6 (system install)   under SL6.4
-#  python2.7 (custom install)   under SL6.4
-#  python3.4 (custom install)   under SL6.4
-#  python2.7 (system install)   under Fedora20
-#  python2.7 (Apple install)    under MacOSX
-#  python2.7 (MacPorts install) under MacOSX
-#  python3.4 (MacPorts install) under MacOSX
+if newerpython:
+  # From now on avoid duplicating python-config, which evolves on its own.
+  # Invoke 'python-config --ldflags --embed'. The embed option (under
+  # Python 3) adds the libpython itself, whose name is highly
+  # unpredictible under the variety of machines and configurations we
+  # support
+  import subprocess
+  output = subprocess.check_output(['python-config', '--ldflags','--embed'])
+  output = output.decode('utf-8')
+  #print(output)
 
-import sys
-import sysconfig
+  args = output.split()
 
-pyver = sysconfig.get_config_var('VERSION')
-getvar = sysconfig.get_config_var
+  output = ''
+  for arg in args:
+    # Discard /usr/lib* path which causes troubles on the link command
+    # line, as it basically overrides all other custom paths coming after
+    # it. No need to put these paths on command line, they are found
+    # implicitly by the linker.
+    if arg not in ['-L/usr/lib','-L/usr/lib32','-L/usr/lib64']:
+      output += arg+' '
+
+  print(output)
 
-libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
-if (hasattr(sys,'abiflags')):
-  libs.append('-lpython' + pyver + sys.abiflags)
 else:
-  libs.append('-lpython' + pyver)
+  # DUPLICATE of "python-config --ldflags", fixed for the library location
+  # This proved to work gracefully up to Python 3.5 (exact limit unclear)
+
+  # This utility is known to work with:
+  #  python2.6 (system install)   under SL6.4
+  #  python2.7 (custom install)   under SL6.4
+  #  python3.4 (custom install)   under SL6.4
+  #  python3.7 (custom install)   under Debian12
+  #  python2.7 (system install)   under Fedora20
+  #  python2.7 (Apple install)    under MacOSX
+  #  python2.7 (MacPorts install) under MacOSX
+  #  python3.4 (MacPorts install) under MacOSX
+
+  import sys
+  import sysconfig
+
+  pyver = sysconfig.get_config_var('VERSION')
+  getvar = sysconfig.get_config_var
+
+  libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+  if (hasattr(sys,'abiflags')):
+    libs.append('-lpython' + pyver + sys.abiflags)
+  else:
+    libs.append('-lpython' + pyver)
 
-# Add the library path, except /usr/lib* which causes troubles
-# on the link command line, as it basically overrides all other
-# custom paths coming after it. No need to put these paths on
-# command line, they are found implicitly by the linker.
-ldpath = getvar('LIBDIR')
-if ldpath not in ['/usr/lib','/usr/lib32','/usr/lib64']:
-  libs.insert(0, '-L' + getvar('LIBDIR'))
+  # Add the library path, except /usr/lib* which causes troubles
+  # on the link command line, as it basically overrides all other
+  # custom paths coming after it. No need to put these paths on
+  # command line, they are found implicitly by the linker.
+  ldpath = getvar('LIBDIR')
+  if ldpath not in ['/usr/lib','/usr/lib32','/usr/lib64']:
+    libs.insert(0, '-L' + getvar('LIBDIR'))
 
-# Framework (specific for Mac)
-if not getvar('PYTHONFRAMEWORK'):
-    libs.extend(getvar('LINKFORSHARED').split())
+  # Framework (specific for Mac)
+  if not getvar('PYTHONFRAMEWORK'):
+      libs.extend(getvar('LINKFORSHARED').split())
 
-print(' '.join(libs))
+  print(' '.join(libs))