Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jun 2014 17:09:01 +0300
From:      Vitaly Magerya <vmagerya@gmail.com>
To:        Sergei G <sergeig.public@gmail.com>, ports@FreeBSD.org
Subject:   Re: Patch for premake 4.4 beta 5 from premake 4
Message-ID:  <53A9867D.2070203@gmail.com>
In-Reply-To: <53A91FD6.9030205@gmail.com>
References:  <53A91FD6.9030205@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
TL;DR: could a brave ports comitter apply an update for
devel/premake4 at [1]? That would be much appreciated.

Redports logs for this update are at [2].

Note that redports for some reason doesn't invoke regression-test
target today; probably a bug on their part.

On 2014-06-24 09:51, Sergei G wrote:
> I had to update Premake 4 port (4.3) to 4.4 beta 5 on FreeBSD
> 10.0-RELEASE #0.
>
> I included patch file with changes applied to Premake 4 port. The
> changes consist of:
>
> 3 regression tests failed (it appears due to at least one missing patch
> file):

The main cause of these regressions is actually a very strange
one (and you're right that those patches are what fixed it in
the past). So, in one of it's routines premake tries to open
'/etc/ld.so.conf'; it does so via Lua function 'io.open'. Now,
FreeBSD doesn't have that file, and in theory 'io.open' should
return 'nil', which should cause premake to skip this file. What
actually happens is that 'io.open' returns some object that is
neither nil, nor a proper file object. Premake thinks that 'io.open'
succeeded, and tries to read from that non-nil, non-file object,
which doesn't work.

Why doesn't 'io.open' return 'nil' here is a mystery to me. Maybe
premake ships with buggy Lua sources. I don't know.

In any case, this problem is fixed in the patch at [1].

> Once I installed premake I observed that it generated Makefile with gcc
> in it, instead of clang. Should switch to clang be applied at premake or
> Box2D project level?

It appears that Premake only supports GCC for its "gmake" target.

It is possible to simply replace "gcc" with "clang" in the premake
sources, and it will mostly work, but:
1) it will not work for projects that use advanced options, since
    clang does not support, and in fact fails on some of the flags
    premake may pass to it ("-ffast-math" for example);
2) makefiles generated on FreeBSD will fail on other platforms
    (not sure if premake promises them to work though).

The long-term solution for premake is to recognize "clang" as a
valid compiler, and provide a set of flags it understands.

The short-term solution for programs that use premake is to either
require GCC from ports, or to manually replace "gcc" with "clang"
before building, patching out incompatible compiler flags, if any.

Note that Box2D v2.3.1 doesn't seem to use any flags that clang
doesn't understand, so it is safe to change "gcc" into "cc", and
"g++" into "c++" in the makefiles that premake generates for it.

[1] http://tx97.net/~magv/diff/premake-4.4.b5.diff
[2] https://redports.org/buildarchive/20140624134401-54287/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53A9867D.2070203>