Hi,

Could I please get a code review for the fix for:

  7155361 python 2.7 should always build modules pic.
  http://monaco.us.oracle.com/detail.jsf?cr=7155361


Webrev is at:

  http://jurassic.us.oracle.com/~richb/7155361-v1/


x86 Userland workspace (with just python27 built) is at:

  /net/stard.us.oracle.com/tank/ws/UL/7155361/

  Build/publish log is:

  
/net/stard.us.oracle.com/tank/ws/UL/7155361/components/python/python27/publish-trans.txt


SPARC Userland workspace (with just python27 built) is at:

  /net/wonderland.us.oracle.com/builds/richb/7155361/

  Build/publish log is:

  
/net/wonderland.us.oracle.com/builds/richb/7155361/components/python/python27/publish-trans.txt


Tested in two ways.

First a simple Python script was created:

$ cat test_code.py
import os
import re
import sys

if 'CC' in os.environ:
    cc = os.environ['CC']

if 'CFLAGS' in os.environ:
    cflags = os.environ['CFLAGS']
    print >> sys.stderr, "BEFORE: cflags: ", cflags
    # Force PIC compilation. Determine if GNU compiler or otherwise
    # and set the PIC flag(s) accordingly. Defaults to Studio compiler.
    out = os.popen(cc + ' --version 2>/dev/null', 'r')
    out_string = out.read()
    out.close()
    result = re.search(' (\d+\.\d+(\.\d+)*)', out_string)
    kpic_flags = "-fPIC -DPIC" if result else "-KPIC"
    cflags += ' ' + kpic_flags
    print >> sys.stderr, "AFTER: cflags: ", cflags

to test that the code did the right thing for:

1/ The GNU C compiler.
2/ The Studio C compiler
3/ A non-existent C compiler:
4/ CC not set.
5/ CC set but CFLAGS not set

$ CC=/usr/sfw/bin/gcc CFLAGS="-g" python test_code.py
BEFORE: cflags:  -g
AFTER: cflags:  -g -fPIC -DPIC
$

$ CC=/opt/SUNWspro/bin/cc CFLAGS="-g" python test_code.py
BEFORE: cflags:  -g
AFTER: cflags:  -g -KPIC
$

$ CC=/something/that/does/not/exist CFLAGS="-g" python test_code.py
BEFORE: cflags:  -g
AFTER: cflags:  -g -KPIC
$

$ python test_code.py
$

$ CC=/opt/SUNWspro/bin/cc python test_code.py
$


Then by installing the new Python 2.7 package:

  $ sudo pkg set-publisher -p file:///tank/ws/UL/7155361/i386/repo
  $ sudo pkg install pkg://userland/runtime/python-27

and then removing the:

  CFLAGS += $(CC_PIC)

workaround from the Makefiles for the following Userland components:

  .../components/python/pyopenssl/Makefile
  .../components/python/pycurl/Makefile
  .../components/python/pycups/Makefile
  .../components/python/m2crypto/Makefile
  .../components/python/pylxml/Makefile

and making sure that each of those components modules were correctly built
with PIC support.

The build log for each of those components is in the
file called build-trans.txt in the appropriate component
directory under

  /net/stard.us.oracle.com/tank/ws/UL/7156849/

Thanks.

_______________________________________________
userland-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/userland-discuss

Reply via email to