flag to tell ports that you are only building for yourself

Anonymous swell.k at gmail.com
Mon Jun 28 03:41:46 UTC 2010

Eitan Adler <lists at eitanadler.com> writes:

> I'd like to add a flag to tell ports that you are building only for
> yourself that and optimizations that typically are not enabled could
> be turned on.

There is already MACHINE_CPU. Depending on CPUTYPE it's set to supported
SIMD instructions. But it doesn't recognize CPUTYPE=native currently.
Until conf/112997 is resolved you can add smth like this to make.conf

  CPUTYPE ?= native
  MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE} - </dev/null 2>&1 \
          | awk '/SSE|MMX/ && !/MATH/ { FS="__"; gsub("_",".",$$2); print tolower($$2) }'

Then you can start adding in your port (ex. for multimedia/mplayer)

  .if ${MACHINE_CPU:Mssse3}
  CONFIGURE_ARGS += --enable-ssse3
  CONFIGURE_ARGS += --disable-ssse3

> The first two that come to mind are -mtune=native and -march=native.


  $ make -V CPUTYPE
  $ make -V _CPUCFLAGS
  $ make -V MACHINE_CPU
  amd64 sse4.1 mmx sse2 ssse3 sse sse3 amd64 sse2 sse mmx

Besides, gcc(1) says

      Generate instructions for the machine type cpu-type.  The choices
      for cpu-type are the same as for -mtune.  Moreover, specifying
      -march=cpu-type implies -mtune=cpu-type.

      A deprecated synonym for -mtune.

So, you don't need -mtune and -mcpu.

> Ports would be able to add more flags as needed. This could allow
> ports to optimize themselves to the architecture they on without
> losing the ability to cross build or have build clusters.

Any case where it would be useful besides -march/-mtune/-mmmx/-msse*?

More information about the freebsd-ports mailing list