From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH] Allow kmscon to be cross-compiled Date: Mon, 9 Sep 2013 13:43:19 +0200 Message-ID: <20130909114318.GA22197@ulmo> References: <1378722468-21961-1-git-send-email-treding@nvidia.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0103517405==" Return-path: Received: from mail-bk0-f46.google.com (mail-bk0-f46.google.com [209.85.214.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 96722E6B66 for ; Mon, 9 Sep 2013 04:44:13 -0700 (PDT) Received: by mail-bk0-f46.google.com with SMTP id 6so2211838bkj.5 for ; Mon, 09 Sep 2013 04:44:12 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: David Herrmann Cc: "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org --===============0103517405== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 09, 2013 at 12:48:08PM +0200, David Herrmann wrote: > Hi >=20 > On Mon, Sep 9, 2013 at 12:27 PM, Thierry Reding > wrote: > > The genshader and genunifont utilities are run during the build process > > to generate source files. In order for that to work when cross-compiling > > the files need to be built using the native compiler instead of the > > cross-compiler. > > > > Add the AX_PROG_CC_FOR_BUILD m4 macro which defines various *_FOR_BUILD > > variables that are the native equivalents of CC, CFLAGS, LDFLAGS, etc. > > Override CC, CFLAGS and LDFLAGS for genshader and genunifont and their > > object files so that they will be built natively and can be executed > > during the build. >=20 > Thanks a lot! Looks all good, few comments below. I think I will apply > it as is, anyway. New bugfix-release is planned for this week, too. >=20 > > Signed-off-by: Thierry Reding > > --- > > Makefile.am | 16 ++++-- > > configure.ac | 3 +- > > m4/ax_prog_cc_for_build.m4 | 125 +++++++++++++++++++++++++++++++++++++= ++++++++ > > 3 files changed, 139 insertions(+), 5 deletions(-) > > create mode 100644 m4/ax_prog_cc_for_build.m4 > > > > diff --git a/Makefile.am b/Makefile.am > > index 7019290..f1b4435 100644 > > --- a/Makefile.am > > +++ b/Makefile.am > > @@ -445,8 +445,12 @@ EXTRA_DIST +=3D $(SHADERS) > > CLEANFILES +=3D src/static_shaders.c > > genshader_SOURCES =3D src/genshader.c > > > > -src/static_shaders.c: $(SHADERS) genshader$(EXEEXT) > > - $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS) > > +src/static_shaders.c: $(SHADERS) genshader$(BUILD_EXEEXT) > > + $(AM_V_GEN)./genshader$(BUILD_EXEEXT) src/static_shaders.c $(SH= ADERS) > > + > > +genshader$(BUILD_EXEEXT) $(genshader_OBJECTS): CC =3D $(CC_FOR_BUILD) > > +genshader$(BUILD_EXEEXT) $(genshader_OBJECTS): CFLAGS =3D $(CFLAGS_FOR= _BUILD) > > +genshader$(BUILD_EXEEXT): LDFLAGS =3D $(LDFLAGS_FOR_BUILD) >=20 > Just wondering, isn't this going to break if $BUILD_EXEEXT !=3D $EXEEXT > I mean, noinst_PROGRAMS generates build-rules for $EXEEXT, not for > $BUILD_EXEEXT, so a dependency on "genshader$(BUILD_EXEEXT)" won't do > anything if it differs from $EXEEXT. But maybe I am just missing > something and automake creates rules for both? That's a good point. And yes, I think it would break if both extensions differed. On the other hand I have no idea on how to make automake generate rules for $(BUILD_EXEEXT). I don't think it can. Interestingly, I mistakenly used genshader$(EXEEXT) initially, but that causes automake to spew out warnings that these "rules" (which aren't really rules at all) were overriding previous commands for the same target. So while $(BUILD_EXEEXT) is the right extension to use, it also works around a shortcoming in automake. Another shortcoming of automake will cause this to break when doing MinGW->Unix and Unix->MinGW cross- builds... A different approach of this patch was to move genshader and genunifont to a tools subdirectory with a separate Makefile.am and overwrite the CC, CFLAGS and LDFLAGS variables in that directory only, but automake doesn't accept that either because CFLAGS is considered a user variable and therefore can't be overwritten. I think this is as good as it gets for now. I've tried to fix this kind of problem in automake several times but never managed to. Perhaps it's time to move on to something like SCons... Thierry --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iQIcBAEBAgAGBQJSLbRWAAoJEN0jrNd/PrOhJjgP/0LZuNVFvjldG8WQCUee6jGn V2DJTYdty4Caj12fc0R0A+wdhmp+H5nyv3/VoZhB9NTAOXH9u+JIV9H5mVfankMJ 02LSl+yhEnTSDD9Re55R9RojWk8TDJLfemkGiltyut7hDJPKMNAiAnPlSmkQFReq zUYIVQi6iamRYpifIqT/zhVY4NBR5c+2b8Ws+SennG2aw32X8wEWh1ci79H88Lnv 1wObIUWQD/jyDpeECnC3QLcntm3VBWCzTGbSer6j97t12GHC0k5WL3PNhsoxqD4n SXPNuaSrk/lDy38ID68mxLcYGntXQTTQx3D9vyOoxFjbaRm7LxtzMSm7oCkoCEI8 rnFVM894BNp0WRTfhKQMQTuBVAs14zK0mhzPU8VPgSBNUzENBMjtNk2vJNzfJwGW e0uaTueE6LZBanwpB4iutor6zHyrfcTvUcBdGO7WZDjA7QRkJ94mfFDM2fPN+Iko NqjiuNqWV5POWFNSjvk/X9ClMfX8AnmdwUo4F+GYjbznRKhh+qC2jtgCxwjALwDi 7W4rZuaJcwUV7Mq0NSQqzXCwWcjp7F4zu9y/A0jqF6wNkbgO3eql/AjyYQcgCGjv V4EwXe2VrKVAWupedQT3mUy+Eh4Mr1Pdxz+wbBYicMeRccV8EC5NnOU5anf+J84o Gsx0d3avTNOqPm6wnqRu =M+yA -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X-- --===============0103517405== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0103517405==--