#20133: Use pkg-config for Sage setup
-------------------------------------+-------------------------------------
       Reporter:  vbraun             |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-7.1
      Component:  build              |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Volker Braun       |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vbraun/use_pkg_config_for_sage_setup|  
a7772cee4683aeb42ab7ecd26792850bcaa794e5
   Dependencies:  #20130             |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by fbissey):

 * status:  needs_review => needs_work


Comment:

 I think there is more to do in `cython.py`. In sage-on-gentoo I added a
 `libdir` in the output of `pyx_preparse` to take into account potential
 `blas/lapack` outside of sage.

 Which means I had also to add it in `cython`, the extra stuff look like
 this
 {{{
 @@ -208,8 +192,8 @@
          '.../sage/ext',
          '.../cysignals'],
          'c',
 -        [], ['-w', '-O2'])
 -        sage: s, libs, inc, lang, f, args = pyx_preparse("# clang c++\n
 #clib foo\n # cinclude bar\n")
 +        [], ['-w', '-O2'],...)
 +        sage: s, libs, inc, lang, f, args, libdirs = pyx_preparse("#
 clang c++\n #clib foo\n # cinclude bar\n")
          sage: lang
          'c++'

 @@ -234,7 +218,7 @@
          '.../sage/ext',
          '.../cysignals']

 -        sage: s, libs, inc, lang, f, args = pyx_preparse("# cargs -O3
 -ggdb\n")
 +        sage: s, libs, inc, lang, f, args, libdirs = pyx_preparse("#
 cargs -O3 -ggdb\n")
          sage: args
          ['-w', '-O2', '-O3', '-ggdb']

 @@ -263,6 +247,7 @@
      s = """\ninclude "cdefs.pxi"\n""" + s
      s = """\ninclude "cysignals/signals.pxi"  # ctrl-c interrupt block
 support\ninclude "stdsage.pxi"\n""" + s
      args, s = parse_keywords('cargs', s)
 +    libdirs = cblas_library_dirs()
      args = ['-w','-O2'] + args

      # Add cysignals directory to includes
 @@ -271,7 +256,7 @@
          if os.path.isdir(cysignals_path):
              inc.append(cysignals_path)

 -    return s, libs, inc, lang, additional_source_files, args
 +    return s, libs, inc, lang, additional_source_files, args, libdirs

  ################################################################
  # If the user attaches a .spyx file and changes it, we have
 @@ -413,7 +398,7 @@

      F = open(filename).read()

 -    F, libs, includes, language, additional_source_files, extra_args =
 pyx_preparse(F)
 +    F, libs, includes, language, additional_source_files, extra_args,
 libdirs = pyx_preparse(F)

      # add the working directory to the includes so custom headers etc.
 work
      includes.append(os.path.split(os.path.splitext(filename)[0])[0])
 @@ -453,19 +438,17 @@

  from sage.env import SAGE_LOCAL

 -extra_link_args =  ['-L' + SAGE_LOCAL + '/lib']
  extra_compile_args = %s

  ext_modules = [Extension('%s', sources=['%s.%s', %s],
                       libraries=%s,
 -                     library_dirs=[SAGE_LOCAL + '/lib/'],
 +                     library_dirs=[SAGE_LOCAL + '/lib/', '%s'],
                       extra_compile_args = extra_compile_args,
 -                     extra_link_args = extra_link_args,
                       language = '%s' )]

  setup(ext_modules = ext_modules,
        include_dirs = %s)
 -    """%(extra_args, name, name, extension, additional_source_files,
 libs, language, includes)
 +    """%(extra_args, name, name, extension, additional_source_files,
 libs, libdirs, language, includes)
      open('%s/setup.py'%build_dir,'w').write(setup)
      cython_include = ' '.join(["-I '%s'"%x for x in includes if
 len(x.strip()) > 0 ])

 }}}
 unless you have that sorted some other way I didn't notice, I would that
 part to be included.

--
Ticket URL: <http://trac.sagemath.org/ticket/20133#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to