All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported
Date: Wed, 15 Apr 2020 16:00:58 -0600	[thread overview]
Message-ID: <CADvTj4pmNBNN_O9CbKyR+aYFSNx=kCu-3zmLevS-O5z7KDFe2A@mail.gmail.com> (raw)
In-Reply-To: <CADvTj4qP_7s6rv=TC_wwSb3ZUPtBbcdOGyDhcLokafz37x3NTA@mail.gmail.com>

On Wed, Apr 15, 2020 at 2:22 PM James Hilliard
<james.hilliard1@gmail.com> wrote:
>
> On Wed, Apr 15, 2020 at 2:20 PM James Hilliard
> <james.hilliard1@gmail.com> wrote:
> >
> > On Wed, Apr 15, 2020 at 2:10 PM Thomas Petazzoni
> > <thomas.petazzoni@bootlin.com> wrote:
> > >
> > > Hello Asaf,
> > >
> > > On Tue, 14 Apr 2020 13:26:21 +0300
> > > Asaf Kahlon <asafka7@gmail.com> wrote:
> > >
> > > > The package adds the '-msse2' flag according to the result of the
> > > > pythonic "platform.machine()" statement, which runs on the host
> > > > and doesn't necessarily reflects the existence of this flag on
> > > > the target compiler.
> > > > Hence, we'll set the 'optimzed' variable in setup.py only when
> > >
> > > optimzed -> optimized
> > >
> > > > +define PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> > >
> > > optimized
> > >
> > > > +        $(SED) 's;^\(optimized = *\)\(.*\);\1$(if $(BR2_X86_CPU_HAS_SSE2),True,False);' $(@D)/setup.py
> > > > +endef
> > > > +
> > > > +PYTHON_ARGON2_CFFI_POST_PATCH_HOOKS += PYTHON_ARGON2_CFFI_SET_OPTIMZED_FLAG
> > >
> > > optimized
> > >
> > > But can't we do better here ? Check if the compiler supports the -msse2
> > > flag ? See
> > > https://github.com/pybind/python_example/blob/master/setup.py#L38 for
> > > an example on how to do that.
> > Ah, that looks better, I had submitted
> > https://github.com/hynek/argon2-cffi/pull/59
> > to avoid having to patch setup.py, I'll see if I can get that working.
> Oh, just noticed we'll probably still need both since argon2-cffi
> supports python2.
Nevermind, that comment appears to be totally inaccurate as Python
3.6's CCompiler
does not actually have a has_flag method at all, however we can just include the
function which seems to work. I've updated my pull request with a reworked
version of has_flag which seems to work.
> > >
> > > Thanks!
> > >
> > > Thomas
> > > --
> > > Thomas Petazzoni, CTO, Bootlin
> > > Embedded Linux and Kernel engineering
> > > https://bootlin.com

  reply	other threads:[~2020-04-15 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 10:26 [Buildroot] [PATCH 1/1] package/python-argon2-cffi: use -msse2 only when supported Asaf Kahlon
2020-04-15 20:10 ` Thomas Petazzoni
2020-04-15 20:20   ` James Hilliard
2020-04-15 20:22     ` James Hilliard
2020-04-15 22:00       ` James Hilliard [this message]
2020-04-19 14:00         ` Thomas Petazzoni
2020-04-19 21:36           ` James Hilliard
2020-04-22  6:54 ` James Hilliard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADvTj4pmNBNN_O9CbKyR+aYFSNx=kCu-3zmLevS-O5z7KDFe2A@mail.gmail.com' \
    --to=james.hilliard1@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.